从涌入的查询中删除一些系列

时间:2016-03-29 12:57:31

标签: influxdb grafana

我有疑问:

SELECT non_negative_derivative(max("value"), 10s)
                   FROM "interface_rx" 
                   WHERE "host" =~ /host.+/
                             AND "instance" =~ /eth.+/ 
                             AND "type" = 'if_octets' 
                             AND $timeFilter
                   GROUP BY time(5m), "instance"
                   fill(null)

它返回所有找到的系列 - 这太过分了。

我想减少值为non_negative_derivative(max(“value”),10s)>的序列。 100。

如果我这样做:

SELECT non_negative_derivative(max("value"), 10s) 
      as irx 
      FROM "interface_rx" 
      WHERE "host" =~ /host.+/ 
            AND "instance" =~ /eth.+/ 
            AND "type" = 'if_octets'
            AND $timeFilter 
            AND irx > 100
     GROUP BY time(5m), "instance" 
     fill(null)
潮流只是忽略了我(空洞的结果)。

如何从结果中过滤掉慢速系列?感谢。

1 个答案:

答案 0 :(得分:2)

很遗憾,没有办法在查询正文中引用irx

要获得结果,您需要发出两个查询:

SELECT non_negative_derivative(max("value"), 10s) AS irx
               INTO tmp
               FROM "interface_rx" 
               WHERE "host" =~ /host.+/
                         AND "instance" =~ /eth.+/ 
                         AND "type" = 'if_octets' 
                         AND $timeFilter
               GROUP BY time(5m), "instance"
               fill(null)

SELECT irx FROM tmp WHERE irx > 100 GROUP BY instance