Hi all
My goal is monitoring the cumulative bandwidth used on my network and track the total usage in GB/TB per month from each network port, e. g. [1].

I’m tying with Grafana / InfluxDB / Cacti + Plugin [2] and or Collectd.

From both cacti and collectd, I can’t generate the expected value. I have tried the queries with:

For example, from cacti I have the network port with the values below on period of: From 2017-05-25 18:00 TO 2017-05-31 11:51

What I’m trying replicate on Grafana is the Total In value which in this example the value is: 1.68TB

Doing it on Grafana using the query:

SELECT mean(“value”) AS “traffic_in” FROM “interface.traffic” WHERE “host” = ‘MyHost’ AND “namecache” =~ /Traffic - 1/0/15/ AND “type” = ‘traffic_in’ AND $timeFilter GROUP BY time($__interval) fill(none)

And on dash / Axes tab using bits unit, it got the value: 33.905Tb every period, even the last 5 minutes:

The use of the derivative function in this case was just a test. I had used the derivative function multiplying by 8 to convert the bit/sec to bytes/sec.

As I said before, my goal is make something like that [1] and every month restart the value sum of the cumulative bandwidth traffic.

I missed following up here - it sounds like the non-negative derivative grouped by month should work. There is no need to multiply by 8 - just choose the correct unit in Grafana.

Just to clarify; I’m try the same kind of thing (grafana from influxdb being fed by collectd), and am trying to get a value for the last rolling 30 day/7day/24hour/1h periods (I presume this is what is meant by the above, and there is no way of grouping by calendar month/week etc).

To do this I have queries that look like this feeding a singlestat:

SELECT non_negative_derivative(mean(“value”), 30d) FROM “interface_rx” WHERE (“host” = ‘x’ AND “instance” = ‘y’ AND “type” = ‘if_octets’) AND time >= now() - 35d GROUP BY time(1h) fill(previous)

The thinking here is that I’m going to get the last value for the derivative, which would be the difference between the mean of the values in the past hour, vs the mean of the values in an hour 30 days ago. ‘now() - 35d’ is to ensure that I have at least 30 days of data.

I notice however that the final result is very sensitive to the value after the subtraction sign, in a way that I don’t really expect. I could see some slight variation due to the hours being calculated over a different window but not - say - a 10% variation in the final value.

Thank you for the link however I do not see your actual query. I too am having a problem with the y-axis showing Gbps when the total sum of the interfaces should be Mbps. I cannot seem to get the correct total. I have 16 cable modem downstream channels which I can graph, but when I try to total them with this:

SELECT non_negative_derivative(sum(“ifHCInOctets”), 1s) FROM “cmts” WHERE (“hostname” =~ /^CMTS/ and “ifAlias” =~ /^FiberNode/ and “ifType”=‘205’ or “hostname” =~ /^CMTS/ and “ifAlias” =~ /^FiberNode/ and “ifType”=‘278’) AND $timeFilter GROUP BY time(5m) fill(ll)

The total is incorrect. Any help would be greatly appreciated.