老师,我从网上下载的。。。真的没思路啊。。
# check memory script
# Total memory
TOTAL=`free -m | head -2 |tail -1 |gawk '{print $2}'`
# Free memory
FREE=`free -m | head -2 |tail -1 |gawk '{print $4}'`
# use the expression free * 100 / total
FREETMP=`expr $FREE \* 100`
PERCENT=`expr $FREETMP / $TOTAL`
exit 0
chmod +x check_vm
vim services.cfg
define service{
host_name mysql
service_description check_vm
check_command check_nrpe!check_mem!192.168.111.3
max_check_attempts 3
normal_check_interval 2
retry_check_interval 1
check_period 24x7
notification_period 24x7
notification_options w,u,c,r
}
重启服务
service nsgios restart