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
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
#Forgive the linewrapping below if any, also note that I have commented out lines that also don’t work when swapped in
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$" }
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$" }
#The all important notify-by-gnokii script
Gnokii Plugin script
© Horst venzke
v 0.1 - 17.01.2004
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 firstname.lastname@example.org -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.