nagios监控服务脚本

#!/bin/bash
STATE_OK=0
STATE_WARNING=1
STATE_CRITICAL=2
STATE_UNKNOWN=3
STATE_NUM=$(ps aux|grep mysqld|grep -v grep >/dev/null)
if [ $? -ne 0 ]
then
        echo "mysql services is down "
        exit $STATE_CRITICAL
else
        echo "mysql services is running "
        exit $STATE_OK
fi
 

你可能感兴趣的:(nagios,监控服务脚本)