Script to add new monitors in Nagios
#!/bin/bash | |
# newpingmonitor.sh | |
# Sets up monitoring for new basic ping monitors in nagios | |
# Ths script may be called remotely | |
E_BADARGS=65 | |
if [ ! -n "$1" ] | |
then | |
echo "Usage: `basename $0` <servername> <ip address>" | |
exit $E_BADARGS | |
fi | |
echo "define host{ | |
use generic-host | |
host_name ${1} | |
alias ${1} | |
address ${2} | |
}" >> /etc/nagios3/conf.d/$1.cfg | |
echo "> Successfully created Nagios monitor." | |
echo "> Restarting Nagios daemon..." | |
service nagios3 restart |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This comment has been minimized.
what if same host exists already?