InfluxDB: Get the last point of interface state

Hello,
I’m lost with the query optins / refresh timing configuration and I need your advice.
I would like to create a dashboard with panels using the Flow plugin to create dynamic network status diagrams. Telegraf polls routers via SNMP every 10 seconds to get the Up(1)/Down(2) interface status. Furthermore, Telegraf stores the query results in InfluxDBv2. Grafana must perform a query and take a single (last) point in the series. Depending on the value of this point (1 or 2), the plugin changes the color of the link on the diagram to green (for 1) or red (for 2).
In the Influx, I can clearly see the right values ​​inserted every 10 seconds.
In Grafana, the query is as follows:
FROM snmp WHERE agent_host::tag = RTR01 AND ifName::tag = 1/1/c8/1 SELECT field (ifOperStatus) ORDER BY TIME descending LIMIT 1 FORMAT AS Time series ALIAS woo
to only take the last point in the series.
Query options configuration:
Max data points: 1
Min interval: No limit
Interval: 15s
Relative time: 15s
Time shift: now-20s and now-5s
My logic:
The points in the influxdb are added every 10s.
In Grafana, I set the interval to 15s so that one evry-10s-point in the series falls within the interval. The refresh rate is 15s. To avoid the SNMP response delay causing no points in the last 15s before refresh (now-15s), I shift the refresh interval to 5s (from now-20s to now-5s).
In “Inspect:Data”, I actually only see one value each time, but it’s either the correct value received (1 or 2) or empty.
Alternatively: with the value, empty, with the value, empty, with the value, empty, etc.
2025-09-19 13:05:30 1
2025-09-19 13:05:45 : empty
2025-09-19 13:06:00 1
2025-09-19 13:06:15 : empty
2025-09-19 13:06:30 1
2025-09-19 13:06:45 : empty
etc.
Why they are empty?
How do I configure the query to always have the latest value in the series regardless of the refresh time configuration (which can be changed by user)?
And one follow-up question.
It’s possible that 1-2 SNMP responses weren’t received (if there’s an interface flapping). It seems practical to me to take not just one last point, but (for example) 5 last points and consider that the interface is Up only if 3 of these 5 points have the value 1 (Up). How can this behavior be achieved? Through a query? Through a transformation?
Thanks in advance for your help!
WBR,
Victor

  • Grafana : v12.1.1_16903967602 linux amd64

  • Influxdb2 : v2.7.12-1 linux amd64

  • Flow plugin for Grafana : v1.18.5