我正在使用 telegraf 将 snmp 数据推送到我的 InfluxDB 并通过 Grafana 将其可视化。
现在我遇到了一个奇怪的问题(很可能只是我的误解......)
鉴于以下系列:
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
我目前在 grafana 中使用以下查询来获取数据(效果很好):
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
我现在只需要为单个接口(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
但这不会返回任何结果,尽管应该有很多。
我真的很感激任何提示问题是什么......
干杯
最佳答案
提醒自己:总是仔细检查可用的系列。
上面发布的系列是旧系列,telegraf 没有添加新数据,因此没有返回结果。正确的(当前)系列被命名为:
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
并且工作正常。
抱歉打扰了:)
关于influxdb - InfluxDB 中的多个 WHERE 不返回结果,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41853288/