I want to monitor the bandwidth usage on some links. I use Telegraf / InfluxDB / Grafana for it and it’s working perfectly fine for the actual data collected on the servers. The query I use (in Grafana) is:
SELECT non_negative_derivative(mean("bytes_recv"), 10s) FROM "net" WHERE ("host" =~ /^$hostname$/ AND "interface" =~ /^$interface$/) AND $timeFilter GROUP BY time($__interval) fill(null)
Since the data is very spiky, I also want to monitor the smoothed out average bandwidth usage. Unfortunately, everything I tried doesn’t work. Grafana-GUI gives me:
SELECT moving_average(non_negative_derivative(mean("bytes_recv"), 10s), 10) FROM "net" WHERE ("host" =~ /^$hostname$/ AND "interface" =~ /^$interface$/) AND $timeFilter GROUP BY time($__interval) fill(null)
Trying myself with Subqueries (like the following) doesn’t work either:
SELECT moving_average("rate", 40) FROM (SELECT non_negative_derivative(mean("bytes_recv"), 10s) AS "rate" FROM "net" WHERE ("host" =~ /^$hostname$/ AND "interface" =~ /^$interface$/) AND time > now() - 12h GROUP BY time(1m) fill(null) ) WHERE time > now() - 12h GROUP BY time(1m)
I tried lots of different queries as well but I seem to be missing something general here - and hint and comments on what I’m doing wrong is more than welcome!