stefanprodan / dockprom

Docker hosts and containers monitoring with Prometheus, Grafana, cAdvisor, NodeExporter and AlertManager
MIT License
6.05k stars 1.73k forks source link

Not getting containers name in Grafana dashboard? #243

Closed genieai-vikas closed 3 years ago

genieai-vikas commented 3 years ago

I am running 12 services(containers) using docker-compose. Using dockprom, I deployed the stack but when I am checking the Grafana dashboard, there is no containers name.

nightah commented 3 years ago

Can you be a little more specific about where you are not seeing the container names?

Which dashboard, what specific graph? Including a screenshot would help.

Regarding your second point you can pull data from all sorts of different places if you're talking about data specific to MongoDB you'll need to add an exporter that can talk to MongoDB and pull out stats that you want to report on, if you're talking basic stats regarding the container as opposed to MongoDB at an application level you can do that out-of-the-box.

Notifications need to be setup per the documentation.

genieai-vikas commented 3 years ago

@nightah Thank you I followed the documentation and was able to fix my issue. I am not able to find any metric which I can use to trigger alerts when the container restarts.

container_last_seen don't have container_label_restartcount. So I can't use the below alert. Also, This is for docker-compose so I can't use kube* metrics. Any help how can I create an alert for container restarts

- alert: Container (Compose) Too Many Restarts
  expr: count by (instance, name) (count_over_time(container_last_seen{name!="", container_label_restartcount!=""}[15m])) - 1 >= 5
  for: 5m
  annotations:
    summary: "Too many restarts ({{ $value }}) for container \"{{ $labels.name }}\""
nightah commented 3 years ago

There is no explicit metric for containers to determine if they are up or down which is why we look at memory usage for said container name in our examples:

https://github.com/stefanprodan/dockprom/blob/e28f1d6b7d64c9e827d7920b8b34d1bbfce734ba/prometheus/alert.rules#L42-L51