Numeric Pager

Marc Powell marc at ena.com
Sat Jan 14 18:27:21 CET 2006


Please always reply on list so that others may benefit from your
experience.


> -----Original Message-----
> From: Carl Davis [mailto:lists at tswireless.net]
> Sent: Saturday, January 14, 2006 7:07 AM
> To: Marc Powell
> Subject: RE: [Nagios-users] Numeric Pager
> 
> That faq section seems more geared towards alpla-numeric pages.  I was
> hoping someone wrote some extra scripts that would take a
notification,
> use the IP address only and use perhaps a 1, 2, or 3 to indicate the
> state of the device.

It would be straightforward to do --

define command{
	command_name	service-notify-by-pager
	command_line	$USER1$/notify-by-pager $HOSTADDRESS$
$SERVICESTATE$
	}

/usr/local/nagios/libexec/notify-by-pager --

#!/bin/sh

        # Arguments:
        #  $1 = host_address (IP address of host that the service is
        #       associated with)
        #  $2 = state_string (A string representing the status of
        #       the given service - "OK", "WARNING", "CRITICAL"
        #       or "UNKNOWN")

        # Convert the state string to the corresponding return code
        return_code=3

        case "$2" in
             OK)
              return_code=0
             ;;
             WARNING)
               return_code=1
             ;;
             CRITICAL)
               return_code=2
             ;;
             UNKNOWN)
               return_code=3
             ;;
        esac

        # send the service check info into the pager program
	  # pseudocode here as I don't know what program you would use

        send_page $1 $return_code <pager number>

--
Marc



-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_idv37&alloc_id865&op=click
_______________________________________________
Nagios-users mailing list
Nagios-users at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting any issue. 
::: Messages without supporting info will risk being sent to /dev/null





More information about the Users mailing list