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

Remove some series from query in influx

我有疑问:

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)

它 returns 全部找到系列 - 这太多了。

我想减少值为 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)

influx 只是忽略我(空结果)。

如何从结果中过滤掉慢序列?谢谢

遗憾的是,无法在查询正文中引用 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