Hi. I’ve created a dashboard for my HPE server’s iLO data which I receive by querying its SNMP OIDs using Telegraf as my data-collector and Influxdb as my data-source.
Previously, I’ve set an alert for power-meter so that if the server’s power consumption in the last 24 hours or the past 1 hour had more than 50 percent growth or fall, I’d get a notification; and I set that alert condition using percent_diff() function as you can see in the below picture.
It works completely fine, but the issue here is that I want to remove this alert condition and instead, implement it through a query on the data-source and have it displayed as a time-series which shows the percentage of rise and fall of the data in the past 24 hours for each data-point; but I haven’t been able to do that yet, since that percent difference function isn’t available on the query panel.
I’d appreciate it if you could help me with the possible queries.
If you write your query as you describe (let’s call it “B”), and display it on the same graph, then does it appear as you wish? If not, what does it look like?
SELECT last("powermeter_current_reading") - last("powermeter_current_reading") AS "Difference" FROM "ilo_snmp_esxi" WHERE $timeFilter GROUP BY time($__interval) fill(null)
In the query above, I can get the power.Now by using last() function, but my problem is that I don’t know how to select the power.Now-1h.
Hi @marjan.mesgarani My query example was calculating the difference between two values (actual & setpoint) taken at the same timestamp. Looking back at your desired calculation, it’s a bit tougher because it involves the timestamp from 1 hour ago. I did a brief search on this and while it may be possible in InfluxQL, upgrading your InfluxDB to 2.0 (or higher) and using Flux will make this a very straightforward query. See more here.