当石墨没有获得数据时发送nagios警报



我正在使用石墨收集一些指标,但有时没有数据传入(可能是因为服务器坏了,或者没有网络连接)。我希望nagios在发生此类事件时向我发送警报。我该怎么做?

您可以使用nagios-plugins中的check_file_age脚本来检查您正在从中收集数据的每个系统的单个已知感兴趣的数据点。

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

最新更新