自定义Nagios NRPE脚本EXIT退出值和nagios状态都应关系:
状态
EXIT退出值
输出
例子
OK
0
echo “OK - it’s ok.”
echo “OK - it’s ok.” exit 0
WARNING
1
echo “WARNING - it’s warning.”
echo “WARNING - it’s warning.” exit 1
CRITICAL
2
echo “CRITICAL - it’s critical.”
echo “CRITICAL - it’s critical.” exit 2
UNKNOWN
3
echo “UNKNOWN - it’s unknown.”
echo “UNKNOWN - it’s unknown.” exit 3
错误的例子: shell脚本中echo和退出值: echo “OK - it’s ok.” exit 1 此时,Nagios会显示: 这条服务对应的状态是”WARNING“,但是输出的信息是”OK - it’s ok.”