Monitoring graphite未获取数据时发送nagios警报
我正在使用graphite收集一些指标,但有时没有数据进入其中(可能是因为服务器已关闭,或者没有网络连接)。我希望nagios在此类事件中向我发送警报。如何做到这一点?您可以使用nagios插件中的check_file_age脚本来检查您正在收集数据的每个系统的单个已知感兴趣数据点Monitoring graphite未获取数据时发送nagios警报,monitoring,nagios,graphite,Monitoring,Nagios,Graphite,我正在使用graphite收集一些指标,但有时没有数据进入其中(可能是因为服务器已关闭,或者没有网络连接)。我希望nagios在此类事件中向我发送警报。如何做到这一点?您可以使用nagios插件中的check_file_age脚本来检查您正在收集数据的每个系统的单个已知感兴趣数据点 check_file_age -w 600 -c 1800 /opt/graphite/storage/whisper/servers/$(uname -f)/cpu/idl.wsp 如果某个指标在5分钟内丢失,则
check_file_age -w 600 -c 1800 /opt/graphite/storage/whisper/servers/$(uname -f)/cpu/idl.wsp
如果某个指标在5分钟内丢失,则会提醒您
否则
您可以在所有点上运行find命令,并报告n小时内未更新的任何点
#!/bin/bash
OLD_GRAPHS=$(find /opt/graphite/storage/whisper -mmin +120 -type f | wc -l)
if [[ OLD_GRAPHS -gt 0 ]];then
echo "Found ${OLD_GRAPHS} graph(s) without an update in 120 minutes"
exit 1
fi
echo "All graphs are up to date"
exit 0
我认为这个解决方案应该行得通,但我遇到了一个问题。。当我手动运行该命令时,它会工作。但是Nagios给出了一些错误。这是我在日志中得到的-Embedded Perl ran/usr/lib/nagios/plugins/check_file_age:return code=2,plugin output=file_age CRITICAL:file not found--w\n