stefanprodan / dockprom

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

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add variable to filter by docker-compose projects/stacks

psychowood opened this issue · comments

Hi,
here's my simple use case:

  1. Local docker host
  2. Different docker-compose projects
  3. Filter container stats by compose project name

Basically, I added a variable on top of the dashboard, based on label_values(container_label_com_docker_compose_project) and injected it in every query below, by adding ,container_label_com_docker_compose_project=~"$compose_projects" everywhere except on the top row (CPU/Memory/Storage Load).

It would be nice to have the aggregated stat too (i.e. total memory used by a stack) but my grafana skills are more or less 1 hour old, I need more time :)

image

I could provide a PR for the provisioning file if you believe this could be useful.

I don't find networks metrics dashboard
image

Can you tell me how to prompt it? Thanks

I actually do something very similar with Docker Compose stacks myself this does actually take memory usage into account for the selected stack too.

Here's the configuration pane for the variable.

And the relevant configuration that needs to be added to each of the panels is the section bolded below (Used Memory panel as an example):

sum(container_memory_usage_bytes{image!="",container_label_com_docker_compose_project=~"$stack"})

image

image

I chabge it like u but same errors, no containers show up

image