I’m using Prometheus (incl. cAdvisor) and Grafana to monitor my server, on which docker containers are running. cAdvisor gives me the data for my docker containers.
I’m trying to monitor the network bandwidth usage
for the selected time (on the top right corner of grafana). It should output a value like 15 GB
(for the selected month) or 500 MB
(for the selected day).
My approach so far:
In Grafana I am using the Stat
UI with Value options > Calculation
of Total
, while using the following query:
sum(rate(container_network_receive_bytes_total{instance=~"$host",name=~"$container",name=~".+"}[1m]))
(FYI: I have a container variable
to filter the values for the selected container. This is why you can find the part ,name=~"$container"
in the query above.)
The problem with the approach above is, that the outputted values do not seem to be right, because if I change the time range to a smaller one, I will get a bigger value. For instance, if I select Last 2 days
the output is 1.19 MB
, while selecting Last 24 hours
gives me 2.38 MB
. Of course, this does not make sense, because yesterday + today
can’t be smaller than just today
.
What do I oversee? How can I achieve it to output correct values?