【问题标题】:munin alert through external scripts fails通过外部脚本的 munin 警报失败
【发布时间】:2019-01-23 17:55:01
【问题描述】:

我被外部脚本的 munin 警报卡住了。我按照这里的指南(http://guide.munin-monitoring.org/en/latest/tutorial/alert.html#alerts-to-or-through-external-scripts),但结果是错误的。

contact.test.command >/etc/munin/scripts/sendsms.py /etc/munin/scripts/sendsms.py

munin-limits 日志显示:

[WARNING] 在命令开头发现 ">"。这应该不再是 必要的,将在执行前从命令中删除。

[WARNING] 无法关闭管道进行接触测试:断管

sendms.py 没有收到来自标准输入的任何信息,这很奇怪。

警报信息在哪里?写命令的正确方法是什么?

【问题讨论】:

    标签: alert munin


    【解决方案1】:

    我正在我的服务器上基于 python 脚本运行警报。要进行设置,请将其放入您的 /etc/munin/munin.conf 在我的情况下,它看起来像:

    contact.test.command | /path/to/my_python_script.py
    

    python 脚本本身可由 munin 执行。在我从 Stdin 读取的脚本中,在

    处指定的文本
    contact.test.text some text and ${var:label} 
    

    使用http://munin-monitoring.org/wiki/MuninAlertVariables指定的一些Munin变量

    【讨论】:

      【解决方案2】:

      您忘记为脚本添加 [管道]。

      可以像这样使用静态消息:

      contact.test.command | /path/to/my_python_script.py "something gone wrong!!!"
      

      或者使用 munin 提供的 [vars]:

      contact.test.command | /path/to/my_python_script.py "${var:group} ${var:host} ${var:graph_category} '${var:graph_title}'"
      

      【讨论】:

        【解决方案3】:

        最好这样调试:

        su - munin --shell=/bin/bash
        /usr/share/munin/munin-limits
        

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 1970-01-01
          • 2018-04-09
          • 2015-10-08
          • 1970-01-01
          • 2014-10-21
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          相关资源
          最近更新 更多