I’m using telegraf on PFSense to collect stats, I want to know what the “current” bandwidth use is. I can do this over time by using the derivative function, for example, something like this;
SELECT derivative(mean(“bytes_recv”), 10s) FROM “pfsense”.“autogen”.“net” WHERE time > :dashboardTime: AND time < :upperDashboardTime: AND “interface”=‘re0’ GROUP BY time(:interval:) FILL(null)
What I’d like is the last number that returns - so the “current” situation.
Hello @doowle,
You’ll want to use a nested subquery.
Something like:
SELECT last("myderivative") FROM (SELECT derivative(mean(“bytes_recv”), 10s) AS "myderivative" FROM “pfsense”.“autogen”.“net” ) WHERE time > :dashboardTime: AND time < :upperDashboardTime: AND “interface”=‘re0’ GROUP BY time(:interval:) FILL(null)
SELECT LAST("myderivative") FROM (SELECT derivative(mean("bytes_recv"), 10s) AS "myderivative" FROM "net" WHERE ("interface" = 'pppoe0') AND $timeFilter GROUP BY time($__interval) fill(null))