提醒失败的木偶状态

我可以在傀儡仪表板Web GUI中查看“正在失败”的节点,甚至可以查看哪些策略已经出错。 我也可以看到节点是否不报告。

有什么办法可以把这些失败作为电子邮件提醒吗?

木偶的“标签邮件”报告可能会做你想要的。 有关更多信息,请参阅http://docs.puppetlabs.com/references/0.25.5/report.html#tagmail

工头电子邮件可能是获得此类报告的最佳方式。 你可以在侧面的仪表板上运行它。

我有同样的问题,而不是经过安装福尔曼的努力,我写了一个快速和肮脏的shell / cron脚本curl和grep傀儡仪表板,并通过电子邮件的结果。 认为这可能是有益的发布。 当然可以被砍掉,但目前为我工作。

#!/bin/bash UNRESPURL="http://puppet/nodes/unresponsive" ERRORURL="http://puppet/nodes/failed" [email protected] NUMUNRESPNODES=`curl ${UNRESPURL} 2> /dev/null | grep -Po '(?<=<a href="/nodes/unresponsive">)([^</a>]*)' | grep -v "Unresponsive"` NUMERRORNODES=`curl ${ERRORURL} 2> /dev/null | grep -Po '(?<=<a href="/nodes/failed">)([^</\a>]*)' | grep -v "Failed"` # Check if there are any unresponsive nodes, before emailing if [ ${NUMUNRESPNODES} -gt 0 ]; then # Email an alert echo "There are ${NUMUNRESPNODES} puppet nodes that haven't reported back to the puppetmaster. Please check ${UNRESPURL} for more info." | mail -s "ALERT: ${NUMUNRESPNODES} puppet nodes are unresponsive" ${EMAIL} fi # Check if there are any nodes with errors, before emailing if [ ${NUMERRORNODES} -gt 0 ]; then # Email an alert echo "There are ${NUMERRORNODES} puppet nodes that are reporting errors. Please check ${ERRORURL} for more info." | mail -s "ALERT: ${NUMERRORNODES} puppet nodes are reporting errors" ${EMAIL} fi exit 0 

我们目前在Stack Exchange上做了什么(在这个问题上看到了一些upvotes,所以我想添加一个更新的答案):

我们的监视代理scollector读取/var/lib/puppet/state/last_run_summary.yaml的运行摘要文件。 当转换为结构时,该文件的相关部分如下所示:

 Resources struct { Changed float64 `yaml:"changed"` Failed float64 `yaml:"failed"` FailedToRestart float64 `yaml:"failed_to_restart"` OutOfSync float64 `yaml:"out_of_sync"` Restarted float64 `yaml:"restarted"` Scheduled float64 `yaml:"scheduled"` Skipped float64 `yaml:"skipped"` Total float64 `yaml:"total"` } `yaml:"resources"` 

代理然后发送作为衡量标准的“失败”资源计数)。 然后,我们可以在我们的监控系统bosun中制定一个规则,在失败的时间段内一致地警告是否存在一致的失败资源:

 $t = 2h $notes = This alert will trigger when a host has consistently had failed resources for longer than $t $q = min(q("sum:1h-min:puppet.run.resources{resource=failed,host=*}", "$t", "")) warn = $q 

last_run_summary.yaml获取统计数据的方法应该适用于任何监控系统。

我正在寻找获得日志>级别>错误消息,这也可以创build一个成功的运行err消息。 这是由日志文件生成的,可以在仪表板中看到:

err无法调用刷新:无法重新启动服务[haproxy]:执行'/ sbin / service haproxy restart'返回1: