#####################################################
command[check_users]=/usr/local/nagios/libexec/check_users -w 10 -c 15
command[check_load]=/usr/local/nagios/libexec/check_load -w 15,12,10 -c 25,20,18
command[check_disk]=/usr/local/nagios/libexec/check_disk -x /ytxt/patch -x /ytxt/maintain -w 10% -c 5%
command[check_procs]=/usr/local/nagios/libexec/check_procs -w 280 -c 350
command[check_swap]=/usr/local/nagios/libexec/check_swap -w 8% -c 4%
command[check_vmio]=/usr/local/nagios/libexec/check_vmio.sh -p PROCESS_QUEUE -w 10 -c 15
EOF
else
echo 'The Nagios-plugins Install Fail!'
exit
fi
}
main(){
for i in $PACKAGE1 $PACKAGE2 $PACKAGE3 $PACKAGE4
do
rpm -q $i >/dev/null 2>&1
if (($? != 0));then
echo "PLE chack $i package"
exit
else
echo 'The base package have installed!'
fi
done
download
nagios-plugins
install-nrpe
add-command
sed -i 's/allowed_hosts=127.0.0.1/allowed_hosts=127.0.0.1,192.168.10.163/g' /usr/local/nagios/etc/nrpe.cfg
echo '/usr/local/nagios/bin/nrpe -c /usr/local/nagios/etc/nrpe.cfg -d' >> /etc/rc.d/rc.local
rm -rf /etc/xinetd.d/nrpe
#restart xinetd
/usr/local/nagios/bin/nrpe -c /usr/local/nagios/etc/nrpe.cfg -d
sleep 5
netstat -natuple | grep 5666 >/dev/null 2>&1
if (($? != 0));then
echo
echo
echo
echo '#########################################################'
echo '#Install Fail Please Check The Server And install again!#'
echo '#########################################################'
else
echo
echo
echo '###########################################'
echo '# INSTALL SUCCESS #'
echo '###########################################'
fi
}
if grep nagios /etc/passwd
then
main
else
echo 'you must add the nagios user!'
exit 0
f