Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Script to add new monitors in Nagios
# Sets up monitoring for new basic ping monitors in nagios
# Ths script may be called remotely
if [ ! -n "$1" ]
echo "Usage: `basename $0` <servername> <ip address>"
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

This comment has been minimized.

Copy link

@AkhilJalagam AkhilJalagam commented Aug 14, 2018

what if same host exists already?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment