Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Multiple WHERE in InfluxDB don't return result

I'm using telegraf to push snmp data into my InfluxDB and visualize it through Grafana.

Now I ran into a weird problem (most likely just a missunderstanding on my side...)

Given the following series:

snmp,agent_host=10.20.30.40,host=grafana-dev,hostname=1OG,ifIndex=3,ifName=ath0
snmp,agent_host=10.20.30.40,host=grafana-dev,hostname=1OG,ifIndex=3,ifName=ath1

I currently use the following query in grafana to get the data (which works fine):

SELECT 
non_negative_derivative(mean("ifInOctets"), 1s) *8 AS "In", 
non_negative_derivative(mean("ifOutOctets"), 1s) *8 AS "Out" 
FROM "snmp" 
WHERE "host" = 'grafana-dev' 
AND "hostname" =~ /^1OG$/ 
AND time > now() - 6h 
GROUP BY time(10s), "hostname", "ifName" fill(null)&epoch=ms

I now need to only select the data for a single interface (ifName):

SELECT 
non_negative_derivative(mean("ifInOctets"), 1s) *8 AS "In", 
non_negative_derivative(mean("ifOutOctets"), 1s) *8 AS "Out" 
FROM "snmp" 
WHERE "host" = 'grafana-dev' 
AND "hostname" =~ /^1OG$/ 
AND "ifName"= 'ath0'
AND time > now() - 6h 
GROUP BY time(10s), "hostname", "ifName" fill(null)&epoch=ms

But this does not return any results although there should be plenty.

I'd really appreciate any hint what the issue is...

Cheers

like image 757
deveth0 Avatar asked Nov 08 '22 02:11

deveth0


1 Answers

Note to myself: always double check the available series.

The series posted above are old series where no new data is added by telegraf and therefor no results are returned. The correct (current) series are named:

snmp,agent_host=10.20.0.11,host=grafana-dev,hostname=1OG,ifDescr=ath0,ifIndex=6
snmp,agent_host=10.20.0.11,host=grafana-dev,hostname=1OG,ifDescr=ath1,ifIndex=5

and work fine. Sorry for bothering :)

like image 148
deveth0 Avatar answered Nov 15 '22 11:11

deveth0