stefanprodan / dockprom

Docker hosts and containers monitoring with Prometheus, Grafana, cAdvisor, NodeExporter and AlertManager

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Not getting containers name in Grafana dashboard?

genieai-vikas opened this issue · comments

commented

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.

  • How to get the container's name in the Grafana dashboard?
  • Also I am not sure this stack is able to pull data containers like mongoDB. How do I know? One of my container restarted multiple times but I am not getting any notification

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.

commented

@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 }}\""

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:

- name: containers
rules:
- alert: jenkins_down
expr: absent(container_memory_usage_bytes{name="jenkins"})
for: 30s
labels:
severity: critical
annotations:
summary: "Jenkins down"
description: "Jenkins container is down for more than 30 seconds."