InfluxDB - Filtering out results that are above a threshold

Hi guys. I have the following query

`SELECT (last("PoETotal")-last("PoEUsed")) as "PoEFree" FROM "CiscoPoEStatus" WHERE ("agent_host" =~ /^$Switch$/) AND $timeFilter and "PoETotal" > 0 GROUP BY time($__interval), "agent_host", "index" fill(previous)`

Which gives me this nice graph:

But, i would lilke grafana to only show the graph for values that are Bellow 200Watts. How can i do this? I tried to alter the query, but i dont know how.

hello, yes thats a nice graph. What do you want to achieve, to filer out every line with a max value below 200w? or d you want to start at 200w ?
Btw. you can set to each value the physical corect unit.

Currently, i only have a handfull of switches, so this graph is fine. But, eventually, this will grow into monitoring about 200 switches. It is impractical to have all 200 switches on the screen, so i would like the dashboard to only show the switches where the remaining Watt is bellow a certain number. (like 200w or 100w). Because these are the ones we really need to pay attention to.
So, in practice, if the threshold was 200W, the screenshot above would not display any switch, because all of them currently are above 200.

ok interesting, what do you do whith the information, and why is it only interesting below 200 Watts? Is it for your house and do you control every power chord

@yurividal I think you can set your existing query to be a nested query and wrap it in a condition, like SELECT * FROM (<nested query>) WHERE PoEFree < 200. Not sure if that’s the answer but something like it should work IIRC. You may need to add a GROUP BY clause to the outer statement.

@habib1 these are mostly 48 port switches, and we deploy several access points per switch. But, these switches are only capable of 350W (depending on the model), so after a couple APs deployed the switch runs out of poe power. In the noc, we need to know what switches has reached their poe capacity. Since different switch models have different power levels and different APs draw different amount of power, it’s easier to monitor the power remaining on each switch.

@svetb that’s what I am looking for. I tried to nest it, but I’m not sure I’m getting the sintax right

@svetb i managed to solve this! thanks. This is the query that worked:

SELECT LAST("PoEFree") FROM (SELECT (last("PoETotal")-last("PoEUsed")) as "PoEFree" FROM "CiscoPoEStatus" WHERE ("agent_host" =~ /^$Switch$/) AND $timeFilter and "PoETotal" > 0 GROUP BY time($__interval), "agent_host", "index" fill(previous)) WHERE "PoEFree" < 200 GROUP BY time($__interval), "agent_host", "index" fill(previous)
1 Like

ok and what do you do with that information? you cannot unpower one ap?
and why dont you plug in your aps directly? it is very inefficient to distribute power through a network line and you could rescue a lot of trees

we work with events and temporary network installations. So, if one switch in one area has low power remaining (due to many poe APs and Phones connected to it) we simply send out a team to add an extra switch to that location, or move some APs to a different switch.

i see you are a temporary network provider