Hello,
I am new to linux and nagios, hoping that someone will be able to provide some assistance with a problem I am having.
I have a basic nagios configuration set up on a test network, only monitoring a handful of services on 2 computers and 1 switch.
I am running a Ubuntu 11.04 Virtual Machine as the nagios server.
The problem I am having is with sending SMS alerts.
I have not done anything with email alerts yet, as the network that I will be using nagios on does not have an internet connection.
I have a Nokia Mobile phone handset connected to the Host machine via USB cable for sending the SMS alerts.
I am able to send SMS messages directly from the terminal by using the following command:
/usr/bin/gsmsendsms -d /dev/ttyACM0 +61400111222 "the text of the sms goes here"
That works fine every time, however I am unable to send SMS alerts from nagios.
I have defined a contact in the contacts_nagios2.cfg file as below:
define contact{
name generic-contact ; The nameof this contact template
service_notification_period 24x7 ; service notificationscan be sent anytime
host_notification_period 24x7 ; host notificationscan be sent anytime
service_notification_options w,u,c,r,f,s ; sendnotifications for all service states, flapping events, and scheduleddowntime events
host_notification_options d,u,r,f,s ; sendnotifications for all host states, flapping events, and scheduleddowntime events
service_notification_commands notify-service-by-sms ; sendservice notifications via SMS
host_notification_commands notify-host-by-sms ; send host notifications via SMS
register 0 ; DONT REGISTER THISDEFINITION - ITS NOT A REAL CONTACT, JUST A TEMPLATE!
}
define contact{
contact_name contact1
alias Mr Jones
service_notification_period 24x7
host_notification_period 24x7
service_notification_options w,u,c,r
host_notification_options d,u,r
service_notification_commands notify-service-by-sms
host_notification_commands notify-host-by-sms
pager +61400111222
}
define contact{
contact_name myname
use generic-contact
alias Mr Jones
pager +61400111222
}
define contactgroup{
contactgroup_name admins
alias Nagios Administrators
members contact1
}
I have defined the command for sending SMS alerts in the commands.cfg file as below:
define command{
command_name notify-service-by-sms
command_line /usr/bin/gsmsendsms -d /dev/ttyACM0 $CONTACTPAGER$ "Nagios - $NOTIFICATIONTYPE$ : $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ ($OUTPUT$)"
}
define command{
command_name notify-host-by-sms
command_line /usr/bin/gsmsendsms -d /dev/ttyACM0 $CONTACTPAGER$ "Nagios - $NOTIFICATIONTYPE$ : Host $HOSTALIAS$ is $HOSTSTATE$ ($OUTPUT$)"
}
I have also tried changing the command to the following, just in case any of variables were wrong
define command{
command_name notify-host-by-sms
command_line /usr/bin/gsmsendsms -d /dev/ttyACM0 +61400111222 "Nagios - This is a test nagios Alert SMS"
}
When I restart nagios, I intentionally have a few services and one of the machines I am monitoring turned off
I then look in the nagios web interface and click on any of the critical services. When i click on view notifications for this service, I see the following, which seems to indicate that the command has been run, but no SMS has been sent.
[list] Host Service Type Time Contact Notification Command Information
aws29 04.JSI Task Host CRITICAL 2011-08-30 12:25:09 contact1 notify-service-by-sms CRITICAL: JSI Task Host: stopped (critical)[/list:u]
if anyone can suggest where I might be going wrong, it would be very much appreciated.
As stated earlier, I am new to both linux and nagios, so my apologies if this all just looks like a horrible mess.