I’ve got Nagios 3.0.2 working on Ubuntu 8.04 & the email alerting part is working fine.
I’ve decided to add SmS functionality, so installed Gammu & have got this working. If I run :-
/usr/bin/printf “This is a test” | /usr/bin/gammu --sendsms TEXT 1234567890
from the terminal (replace 1234567890 with a correct number) I can send TxT messages fine.
I added these lines to the COMMANDS.CFG
‘notify-host-by-sms’ command definition
define command{
command_name notify-host-by-sms
command_line /usr/bin/printf “***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\nHost: $HOSTNAME$\nState: $HOSTSTATE$\nAddress: $HOSTADDRESS$\nInfo: $HOSTOUTPUT$\n\nDate/Time: $LONGDATETIME$\n” | /usr/bin/gammu --sendsms TEXT $CONTACTPAGER$
}
‘notify-service-by-sms’ command definition
define command{
command_name notify-service-by-sms
command_line /usr/bin/printf “***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\n\nService: $SERVICEDESC$\nHost: $HOSTALIAS$\nAddress: $HOSTADDRESS$\nState: $SERVICESTATE$\n\nDate/Time: $LONGDATETIME$\n\nAdditional Info:\n\n$SERVICEOUTPUT$” | /usr/bin/gammu --sendsms TEXT $CONTACTPAGER$
}
& this line to the CONTACTS.CFG
define contact{
contact_name Lien
alias Lien
service_notification_period 24x7
host_notification_period 24x7
service_notification_options w,u,c,r,f,s
host_notification_options d,u,r,f,s
service_notification_commands notify-host-by-sms
host_notification_commands notify-service-by-sms
email @****
pager 1234567890
}
I get the email alerts fine & if I look in the NAGIOS.LOG file it has tried to run the SmS command
[1214991948] SERVICE NOTIFICATION: Lien;Server;Drive Space C;WARNING;notify-host-by-sms;c:\ - total: 5.82 Gb - used: 5.13 Gb (88%) - free 0.69 Gb (12%)
But I get no text message. I’ve enabled loggin on Gammu & there is nothing in the log, so I’m wondering if its something to do with Nagios & the way i’ve set it up. Can anyone point me in the right direction of where I should be looking next.