English
Nagios *OFFICIAL* integration for SMS notification PDF Print E-mail

This article illustrates how to link your Foxbox G20 to an external Nagios server

To configure the architecture you just have to follow the steps in this guide.
The bigger part of the implementation takes place on the server side, and there are two different procedures related to the FoxBox version in use.

 

Initial Setup

SMS/MMS FoxBox G20 Unit (newer version):

  1. We installed a SIM card into the SMS/MMS FoxBox G20 by following the included documentation;
  2. The SMS/MMS FoxBox G20 was installed on our network at the IP address 192.168.0.98;
  3. An easy verification on the connection to device in possible by browsing to 192.168.0.98, using the
    given default credentials.

SMS FoxBox Unit (older version):

  1. We installed a SIM card into the SMS FoxBox by following the included documentation;
  2. The SMS FoxBox was installed on our network at the IP address 192.168.1.98;
  3. An easy verification on the connection to device in possible by browsing to 192.168.1.98, using the
    given default credentials.

Monitoring Server:

  1. Nagios 3.0.6 was compiled and installed on the monitoring server
  2. Version 1.4.13 of the Nagios-plugins were installed on the monitoring server.
  3. A custom script was installed and titled 'sendSMS.sh'

sendSMS.sh Script

We created a script named 'sendSMS.sh' and placed it in /usr/local/nagios/libexec/ directory. 

You can find the scripts here:

Attention: we suggest to not to simply copy&paste the contents (expecially under Windows) to avoid unwanted encoding troubles.

Monitoring Configuration

We modified our Nagios configuration files to include new notification scripts:

# 'notify-host-by-foxbox' command definition
define command{
command_name notify-host-by-foxbox
command_line /usr/local/nagios/libexec/sendSMS.sh Nagios $CONTACTPAGER$ "Host Alert:
$HOSTNAME$\nHost State: $HOSTSTATE$\nDate/Time: $LONGDATETIME$"
}

# 'notify-service-by-foxbox' command definition
define command{
command_name notify-service-by-foxbox
command_line /usr/local/nagios/libexec/sendSMS.sh Nagios $CONTACTPAGER$ "Service Alert:
$HOSTALIAS$/$SERVICEDESC$\nService State: $SERVICESTATE$\nDate/Time: $LONGDATETIME$"
}

Attention: SMS messages in this script will be sent out to the contacts pager number.

We then added a new contact and contact group using the new notification script and having a valid
phone number:

define contact{
contact_name test-contact
use generic-contact
alias tester
email yourname@domain
host_notification_commands notify-host-by-foxbox
service_notification_commands notify-service-by-foxbox
pager 12453683421
}

define contactgroup{
contactgroup_name test-group
alias test-group
members test-contact
}

Now we need to make sure we have host and service setup for notifications with this user, this is normally one broadly using templates, let us define a generic template that hosts and services should use:

define host{
name generic-host
notifications_enabled 1
event_handler_enabled 1
flap_detection_enabled 1
failure_prediction_enabled 1
process_perf_data 1
retain_status_information 1
retain_nonstatus_information 1
notification_period 24x7
register 0
max_check_attempts 3
check_interval 5
retry_interval 1
check_command check-host-alive
contact_groups test-group
notification_interval 0
notification_options d,u,r,f,s
register 0; a template definition
}
define service{
name generic-service
active_checks_enabled 1
passive_checks_enabled 1
parallelize_check 1
obsess_over_service 1
check_freshness 0
notifications_enabled 1
event_handler_enabled 1
flap_detection_enabled 1
failure_prediction_enabled 1
process_perf_data 1
retain_status_information 1
retain_nonstatus_information 1
is_volatile 0
check_period 24x7
max_check_attempts 3
normal_check_interval 5
retry_check_interval 2
notification_options w,u,c,r,f,s
notification_interval 0
notification_period 24x7
contact_groups test-group
register 0; a template definition
}

Note: After creating or editing the templates you will need to make sure that hosts/services are using them.
Both hosts and service use the directive 'use <name of template>' inside the brackets of the object definition.

After saving our configuration files, we verified our configuration files and started Nagios:

/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
/etc/init.d/nagios restart

Once Nagios was restarted and external commands were enabled, we can force a notification to be sent by clicking on a host/service to open extended information page, then by selecting 'Send custom host notification', and on the next screen selecting 'forced' then 'commit'.


Additional Notes

 
 
< Prev   Next >

buy foxbox
buy on FoxBox eShop



For further info contact us by mail This e-mail address is being protected from spam bots, you need JavaScript enabled to view it providing us the FoxBox model you need and your company details.

KDEV di Davide Cantaluppi, P.IVA 02984320131

http://www.kdev.it