URL: Nagstamon
Price: $0
Version: 0.8.2
Platform: Windows, Linux
#!/bin/sh
# This function call the clickatell through HTTP instead of Email to SMS
# Print the help and exit.
dumphelp(){
echo "send_sms"
exit
}
# Check if number of parameter is 1. If not, print the help and exit.
if [ $# -ne 2 ]; then
dumphelp
fi
NAGIOSHOME=/usr/local/nagios
NAGIOSLOG=$NAGIOSHOME/var
SMSLOG=$NAGIOSLOG/sms.log
USER="XXXXXXX"
PASSWORD="XXXXXXX"
API_ID="XXXXXXXX"
PHONE=$1
MSG=$2
# As calling through HTTP instead of email to SMS, need to replace all space with +
MSG1=`echo $2 | sed "s/ /+/g"`
# Get the current log time
LOGTIME=`date "+%Y%m%d %H:%M:%S.%N"`
echo "$LOGTIME [To: $PHONE] [Msg: $MSG1]" >> $SMSLOG
wget -q -O /tmp/sms.html "http://api.clickatell.com/http/sendmsg?user=$USER&password=$PASSWORD&api_id=$API_ID&to=$PHONE&text=$MSG1"
# 'notify-host-by-sms' command definition
define command{
command_name notify-host-by-sms
command_line $USER1$/send_sms $CONTACTPAGER$ "$NOTIFICATIONTYPE$ $HOSTALIAS$ $HOSTSTATE$ [$HOSTOUTPUT$]"
}
# 'notify-service-by-sms' command definition
define command{
command_name notify-service-by-sms
command_line $USER1$/send_sms $CONTACTPAGER$ "$NOTIFICATIONTYPE$ $SERVICEDESC$ $HOSTALIAS$ $SERVICESTATE$ [$SERVICEOUTPUT$]"
}
define contact{
name generic-sms-contact ; The name of this contact template
service_notification_period 24x7 ; service notifications can be sent anytime
host_notification_period 24x7 ; host notifications can be sent anytime
service_notification_options w,u,c,r,f,s ; send notifications for all service states, flapping events, and scheduled downtime events
host_notification_options d,u,r,f,s ; send notifications for all host states, flapping events, and scheduled downtime events
service_notification_commands notify-service-by-sms ; send service notifications via sms
host_notification_commands notify-host-by-sms ; send host notifications via sms
register 0 ; DONT REGISTER THIS DEFINITION - ITS NOT A REAL CONTACT, JUST A TEMPLATE!
}
# Define the person to receive the SMS
define contact{
contact_name SMS.XXX
use generic-sms-contact
alias System Admin
email AAA@bbb.ccc.com
pager 1234567890
}
# Define the SMS contact group
define contactgroup{
contactgroup_name SMS_ABCDE
alias Server Application Admin
members SMS.XXX
}
> tar xvfz nconf-1.2.5-0.tgz
> cp nconf /var/www
> Go to http://localhost/nconf and follow the steps
> sudo vigr
# Add the user www-data to group nagios
nagios:x:1002:nagios,www-data
> sudo chmod g+w -R nagios
> sudo chown www-data:nagios /var/www/nconf
> restart apache
> sudo adduser nagios
> sudo adduser nagiosadmin
> tar xvfz nagios-3.1.2.tar.gz
> cd nagios-3.1.2
> ./configure --with-nagios-user=nagios --with-nagios-group=nagios
> make all
> make fullinstall
> htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin
> /etc/init.d/apache2 reload
> sudo ln -s /etc/init.d/nagios /etc/rcS.d/S99nagios
> ./configure
> make
> sudo make install
> sudo chown nagios:nagios /usr/local/nagios -R