Hi all,
I’ve recently set up Nagios2.0b4 and all is going well except I can’t get gnokii 0.67 to send sms messages to me which is kinda critical as I’ve got 55 servers to manage and a life to lead away from checking email. I’ve tried several approaches including the one listed in the FAQ at
http://www.nagios.org/faqs/viewfaq.php?faq_id=220
If you’ll forgive me for posting swathes of config, I hope somebody will be gracious enough to look over it for me. I’ve lost nearly 2 weeks trying to get it up and maybe fresh eyes will help. Incidentally, email notifications work fine.
Obviously not the real contact details
define contact{
contact_name adam
alias Adam
service_notification_period 24x7
host_notification_period 24x7
service_notification_options w,u,c,r
host_notification_options d,r
service_notification_commands notify-by-email,notify-by-gnokii
host_notification_commands host-notify-by-email,host-notify-by-gnokii
email [email protected]
pager 01234567890
}
#Forgive the linewrapping below if any, also note that I have commented out lines that also don’t work when swapped in
define command{
command_name notify-by-gnokii
command_line /bin/echo “Nagios Service Alert: $SERVICEDESC$ on $HOSTALIAS$ $HOSTADDRESS$ is $SERVICESTATE$; $SERVICEOUTPUT; $LONGDATETIME$” | /usr/local/bin/gnokii --sendsms $CONTACTPAGER$
command_line /usr/local/nagios/etc/notify-by-gnokii $CONTACTPAGER$ "Nagios Service Alert: $SERVICEDESC$ on $HOSTALIAS$ $HOSTADDRESS$ is $SERVICESTATE$; $SERVICEOUTPUT$; $LONGDATETIME$"
}
define command{
command_name host-notify-by-gnokii
command_line /bin/echo “Nagios Host Alert: $HOSTNAME$ $HOSTADDRESS$ is $HOSTSTATE$; $HOSTOUTPUT$; $LONGDATETIME$” | /usr/local/bin/gnokii --sendsms $CONTACTPAGER$
command_line /usr/local/nagios/etc/notify-by-gnokii $CONTACTPAGER$ "Nagios Host Alert: $HOSTALIAS$ $HOSTADDRESS$ is $HOSTSTATE$; $HOSTOUPUT$; $LONGDATETIME$"
}
#Test check
define service{
use generic-service
host_name xxx
service_description HTTP
is_volatile 0
check_period 24x7
max_check_attempts 3
normal_check_interval 5
retry_check_interval 1
contact_groups test
notification_interval 960
notification_period 24x7
notification_options w,u,c,r
check_command check_http
}
#The all important notify-by-gnokii script
#!/bin/sh
Gnokii Plugin script
© Horst venzke
v 0.1 - 17.01.2004
mess=$2
number=$1
echo $mess | gnokii --sendsms $number
This script is /usr/local/nagios/etc/notify-by-gnokii, is executable and is owned by nagios:nagios. As a test, I added in a
mail [email protected] -s gnokii < /dev/null
line into the notify-by-gnokii script and I don’t get that mail so the script isn’t getting run properly.
Making a test script which is the same but resolves the variables within the file and is executed on the command line by user nagios works fine. I have also seen the variables resolve in the config file, though they no longer appear since I moved the config out to separate files.
I can see the script entries in my logs, running a
Here is a log snippet:
Obviously the service check and the machine in question are written into the various groups and check commands correctly, as I said, email notifications work, I just thought it better to omit config that is easily implied.
If anyone is able to advise I would be very grateful and post further config if necesssary.
Thanks,
Adam