0

当 Cisco 路由器的接口吞吐量超过某个值时,我正在尝试生成警报。请看一下我的代码。

我正在使用电报收集数据。我的测量“监控使用情况”包含多个字段键和值。如何将它们分开并警告它们?我是否正确使用“衍生”节点?它是我应该在“衍生”节点中使用的字段键吗?

有没有办法记录每个节点的输出以帮助排除故障?在我的情况下,我如何看到由“alert”节点计算的“bytes_recv_per_sec”值?

“日志”节点究竟做了什么?日志文件在哪里?我在“/var/log/kapacitor/kapacitor.log”中没有看到太多有价值的信息

我试过用不同的参数方法玩不同的节点,但没有多大成功。谢谢你的帮助。

dbrp "telegraf"."autogen"

stream
    |from()
        .measurement('monitor usage')
        .where(lambda: "agent_host" == '10.92.192.15')
    |window()
      .period(1m)
      .every(1m)
    |httpOut('dump')
    |stats(1m)
    |httpOut('stats')
    |derivative('Envision_Po1.891_ifHCInOctets')
        .unit(1s).nonNegative()
        .as('bytes_recv_per_sec')
    |alert()
        .warn(lambda: "bytes_recv_per_sec" > 40.0)
        .crit(lambda: "bytes_recv_per_sec" > 80.0)
         // post to logfile
        .log('/tmp/alerts.log')

在这个阶段,我想查看“/tmp/alerts.log”以在达到警报阈值时生成一些警报消息。最终我想发送一封警报电子邮件。

根据要求,这里是关于“监视器使用”测量的数据库信息

> show series from "monitor usage";
key
---
monitor\ usage,agent_host=10.85.1.5,host=dzhao-trex,sw_name=it-na-wan-pro-01-11p.int.pason.com
monitor\ usage,agent_host=10.85.1.6,host=dzhao-trex,sw_name=it-na-wan-pro-02-11p.int.pason.com
monitor\ usage,agent_host=10.92.192.15,host=dzhao-trex,rtr_name=irt01-00rm255r2r1.int.pason.com
monitor\ usage,agent_host=10.92.192.17,host=dzhao-trex,sw_name=wsw01-00rm255r2r1.pason.com
monitor\ usage,agent_host=172.19.254.200,host=dzhao-trex,sw_name=ssw01-04rm120r7.int.pason.com
monitor\ usage,agent_host=192.168.195.1,host=dzhao-trex,sw_name=wrt01-06.int.pason.com

> show field keys from "monitor usage";
name: monitor usage
fieldKey                           fieldType
--------                           ---------
Envision_Po1.891_ifHCInOctets      integer
Envision_Po1.891_ifHCOutOctets     integer
Gi0/0/0_ifHCInOctets               integer
Gi0/0/0_ifHCOutOctets              integer
GigabitEthernet0/0/0_ifHCInOctets  integer
GigabitEthernet0/0/0_ifHCOutOctets integer
GigabitEthernet0/0/2_ifHCInOctets  integer
GigabitEthernet0/0/2_ifHCOutOctets integer
HE_Po1.892_ifHCInOctets            integer
HE_Po1.892_ifHCOutOctets           integer
Po1003_ifHCInOctets                integer
Po1003_ifHCOutOctets               integer
Rogers_Po1.894_ifHCInOctets        integer
Rogers_Po1.894_ifHCOutOctets       integer
Shaw_Po1.893_ifHCInOctets          integer
Shaw_Po1.893_ifHCOutOctets         integer
Te2/5/6_ifHCInOctets               integer
Te2/5/6_ifHCOutOctets              integer
Tunnel100_ifHCInOctets             integer
Tunnel100_ifHCOutOctets            integer
Tunnel1_ifHCInOctets               integer
Tunnel1_ifHCOutOctets              integer
Tunnel2_ifHCInOctets               integer
Tunnel2_ifHCOutOctets              integer
YYCIX_Gi0/0/1_ifHCInOctets         integer
YYCIX_Gi0/0/1_ifHCOutOctets        integer

> show tag keys from "monitor usage";
name: monitor usage
tagKey
------
agent_host
host
rtr_name
sw_name
4

0 回答 0