我安装了最新的 sensu-core,并使用综合包安装了 sensu-plugin gem。
Sensu 启动并运行没有问题,但我遇到了处理程序的主要问题。我已经设置了来自社区插件的标准 ruby mailer.rb 以及 pagerduty 处理程序。
当我将处理程序添加到我知道在日志中失败的检查中时,我看到:
{\"id\":\"a1e807d2-425f-4891-b291-ed5bda5b6105\",\"client\":{\"name\":\"mfp\",\"address\":\"25.147.26.157\",\"subscriptions\":[\"test\"],\"version\":\"0.20.0\",\"timestamp\":1437673191},\"check\":{\"command\":\"/etc/sensu/plugins/check-disk.sh -d /dev/md1 -w 80 -c 90\",\"interval\":10,\"handlers\":[\"default\",\"pagerduty\",\"mailer\"],\"occurrences\":3,\"subscribers\":[\"test\"],\"name\":\"disk\",\"issued\":1437673279,\"executed\":1437673201,\"duration\":0.01,\"output\":\"CRITICAL - /dev/md1 space used=94% | '/dev/md1 usage'=94%;80;90;\\n\",\"status\":2,\"history\":[\"2\",\"2\",\"2\",\"2\",\"2\",\"2\",\"2\",\"2\",\"2\",\"2\",\"2\",\"2\",\"2\",\"2\",\"2\",\"2\",\"2\",\"2\",\"2\",\"2\",\"2\"],\"total_state_change\":0},\"occurrences\":513,\"action\":\"create\"}"]}
{"timestamp":"2015-07-23T12:41:20.873279-0500","level":"info","message":"handler output","handler":{"type":"pipe","command":"/etc/sensu/handlers/pagerduty.rb","api_key":"2e24c101ef754ff6add39aaaffa846c9","name":"pagerduty"},"output":["only handling every 180 occurrences: ws/disk\n"]}
{"timestamp":"2015-07-23T12:41:20.873561-0500","level":"info","message":"handler output","handler":{"type":"pipe","command":"/etc/sensu/handlers/pagerduty.rb","api_key":"2e24c101ef754ff6add39aaaffa846c9","name":"pagerduty"},"output":["only handling every 180 occurrences: wwv/disk\n"]}
{"timestamp":"2015-07-23T12:41:21.055407-0500","level":"info","message":"handler output","handler":{"type":"pipe","command":"/etc/sensu/handlers/pagerduty.rb","api_key":"2e24c101ef754ff6add39aaaffa846c9","name":"pagerduty"},"output":["only handling every 180 occurrences: mfp/disk\n"]}
所以看起来处理程序正在触发,但被 sensu-handler.rb gem 过滤,而不是创建电子邮件或 pagerduty 事件。
这是违规行
only handling every 180 occurrences
有谁知道问题是什么?这是一个错误吗?我需要覆盖一些东西吗?对于这个特定的检查(check_disk),我有大量的感觉,所以它应该被触发到 pagerduty 和邮件程序。
我在尝试集成松弛处理程序时遇到了同样的问题。您必须在处理程序配置文件中添加刷新参数。例如 :
本教程中找到的解决方案:http: //www.whiteboardcoder.com/2014/11/getting-sensu-to-talk-to-hipchat.html
这是 sensu-plugin 中的错误,不一定是错误,而是缺少文档。问题出在 config.json 中,你需要为 API 块指定主机声明,sensu-plugin 需要这个,否则你会遇到这些过滤问题。