Simple status of docker container states

Grafana Version: 9.0.5
OS: Linux docker-desktop 5.10.104

  • What are you trying to achieve?
    Display states of my docker containers (created,dead,exited,paused,removing,restarting) in one “status history” visualization using docker_state_exporter, grafana and prometheus.

  • How are you trying to achieve it?
    Created a panel “status history” with the metric below

container_state_status{name=~“prowlarr|sonarr|radarr|jackett|bazarr|tautulli|varken|influxdb|docker-exporter|cadvisor|docker-state-exporter|requestrr|grafana|overseerr|autobrr|container-exporter|node-exporter|unpackerr|prometheus”,status=“running”}

options: legend ={name}, min step=25, format=time series

Set color scheme to "from tresholds (by vaule) and added two thresholds. 1 = green and 0 = red.

Now I have this nice dashboard https://i.imgur.com/C37wmME.png. If I stop a container, jackett for example, it is visible in the dashboard with red.

How do I proceed with visualizing restarts in the same “status history” panel/graph? If I add another metric like below it will list all containers again (https://i.imgur.com/Q5IR1Pd.png). I only want one list of the containers and different colors for each state. Running = green. Not running = red. Restarts = yellow and so on.

container_state_status{name=~“prowlarr|sonarr|radarr|jackett|bazarr|tautulli|varken|influxdb|docker-exporter|cadvisor|docker-state-exporter|requestrr|grafana|overseerr|autobrr|container-exporter|node-exporter|unpackerr|prometheus”,status=“restarting”}

I am not sure how to proceed or if it is even possible to include restarts (or more states like dead etc) in the same “status history”? container_state_status will only return 0 or 1 for each status like below.

container_state_status{…,name=“jackett”,status=“running”} 1
container_state_status{…,name=“jackett”,status=“restarting”} 0

  • Did you receive any errors in the Grafana UI or in related logs? If so, please tell us exactly what they were.
    No.

  • Did you follow any online instructions? If so, what is the URL?
    No.