InfluxDB 1.7.9 : query returns empty result depending on time range

Dear colleagues:
I am using Telegraf to poll (SNMP plugin) network devices and put the information in InfluxDB (version 1.7.9)

One network device has been turned off since quite a long time. In this case, Telegraf has been polling the device and since no answer comes back, I suspect no data is being stored in InfluxDB.

The following two queries ask InfluxDB to return the data regarding that network device.
The first query is in a timerange that starts in a date in which I know the device was working, whereas the second query has a timerange that starts 2 days later, when the device died.

Please kindly notice that I ask InfluxDB to fill with value “1” those days with no data.

The first query returns data even for the days in which the device was not operational (expected, since I asked to fill with “1”) whereas the second query comes back empty.

SELECT count(“snmpEngineTime.0”) FROM “system” WHERE “snmpEngineTime.0”>10 AND “hostname”=‘SW-AR-PL-ZRT-027’ AND time>now() -75d AND time < now()-70d GROUP BY time(24h) fill(1)

name: system
time count

2024-03-27T00:00:00Z 27
2024-03-28T00:00:00Z 95
2024-03-29T00:00:00Z 1
2024-03-30T00:00:00Z 1
2024-03-31T00:00:00Z 1
2024-04-01T00:00:00Z 1

SELECT count(“snmpEngineTime.0”) FROM “system” WHERE “snmpEngineTime.0”>10 AND “hostname”=‘SW-AR-PL-ZRT-027’ AND time>now() -73d AND time < now()-70d GROUP BY time(24h) fill(1)

It seems to be that if there is no data in the entire timerange, then the result is empty.

¿ is this a normal and/or expected behavior for the answer to my query?
Hints will be greatly appreciated

Best regards

that’s normal behavior and a pretty common “issue”.

Let’s put it like this, a series can be filled only if it exists, and that depends on the time range you filter.

The best approach would be to store the data even if the device is not responding (conceptually IsOnline 0 or 1).
This gives you a complete series in all cases, with the drawback of having more and possibly garbage data (let’s say a device is scrapped but not removed from monitoring), but it all comes down to the process itself.

If you set up something like a ping you can reduce the number of data points keeping one very X interval and every status change using the dedup processor

Hello Giovanni:
Thanks a lot for your hints.

Then my question is how I force Telegraf´s SNMP Plugin to store something regardless of whether there was or not an answer. I will dig a bit more in the Telegraf forums.

Best regards

1 Like