Hi I am currently collecting SNMP information from a power monitor which is giving me current power usage in KW for our datacenter - what i am looking for is a way to combine this information in to a usage per day.
My current query in Grafana is
SELECT last(“INPUT KW”) FROM “snmp” WHERE (“agent_host” = ‘xx.x.x.xx’) AND $timeFilter GROUP BY time(15s)
my question is how do i combine the collected information in to a bar graph that would show the past x number of days total usage - i have tried (although briefly to edit the query by using “sum” and group by 1day etc but the query provides no data - this leads me to believe i may need to do something on the DB side to be able to visualise the information.
Hi I am currently collecting SNMP information from a power monitor which is
giving me current power usage in KW for our datacenter - what i am looking
for is a way to combine this information in to a usage per day.
My current query in Grafana is
SELECT last(“INPUT KW”) FROM “snmp” WHERE (“agent_host” = ‘xx.x.x.xx’) AND
$timeFilter GROUP BY time(15s)
Is last() what you really want? Might mean() not be more meaningful?
my question is how do i combine the collected information in to a bar graph
that would show the past x number of days total usage
Try something like:
SELECT sum(kW) from (SELECT last(“INPUT KW”) as kW FROM “snmp” WHERE
(“agent_host” = ‘xx.x.x.xx’) AND $timeFilter GROUP BY time(15s)) group by time
(1d)
Hi, the query ive pasted is a query based on showing me the last point of data received so i can see a movement of power usage throughout a day as servers ramp up/down and crac units cool more etc.
You are right in that “last” isn’t the metric i would be after when collecting a days total -
ive just tried
SELECT sum(kW) from (SELECT last(INPUTKW) as kW FROM snmp WHERE
(agent_host = “10.4.8.19”) AND $timeFilter GROUP BY time(15s)) group by time(1d)
and the result brings in no data points. - there has got to be something somewhere not quite right but i cant put my finger on it
Hi, the query ive pasted is a query based on showing me the last point of
data received so i can see a movement of power usage throughout a day as
servers ramp up/down and crac units cool more etc. You are right in that
“last” isn’t the metric i would be after when collecting a days total -
ive just tried
SELECT sum(kW) from (SELECT last(INPUTKW) as kW FROM snmp WHERE
(agent_host = “10.4.8.19”) AND $timeFilter GROUP BY time(15s)) group by
time(1d)
and the result brings in no data points. - there has got to be something
somewhere not quite right but i cant put my finger on it
Have you tried the query directly in Influx (rather than Grafana)?
I often find doing a query in the Influx client gives me an insight into what
needs to go into Grafana.
I would start with:
SELECT last(INPUTKW) as kW FROM snmp WHERE (agent_host = “10.4.8.19”) AND
now()-4h GROUP BY time(15s)
Make sure you get a table of results, and that the column is headed “kW”.
Then repeat that with the outer select on it:
SELECT sum(kW) from (SELECT last(INPUTKW) as kW FROM snmp WHERE
(agent_host = “10.4.8.19”) AND time>now()-4h GROUP BY time(15s)) group by
time(1d)
I’d expect a single result for this.
Expand the inner time range:
SELECT sum(kW) from (SELECT last(INPUTKW) as kW FROM snmp WHERE
(agent_host = “10.4.8.19”) AND time>now()-48h GROUP BY time(15s)) group by
time(1d)
That should give two or three data points, I think.