How to run a perl script instead of sending emails?

Stuart Browne stuart.browne at ausregistry.com.au
Mon Jan 25 00:21:55 CET 2010



> -----Original Message-----
> From: Mr Gabriel [mailto:gabriel at impactteachers.com]
> Sent: Monday, 25 January 2010 09:49
> To: nagios-users at lists.sourceforge.net
> Subject: [Nagios-users] How to run a perl script instead of sending
> emails?
> 
> Dear All,
> 
> I have a perl script that connects to my asterisk instance, and calls
> who ever is on shift to log in, and take care of whatever broke. I
> would
> like to initiate this script whenever there is a critical alert that
> has
> gone off more than once - how can I best achieve this?
> 
> I would like these to run instead of an email when out of hours, and
> when a critical alert has been left unattended to for some time

What a cool idea..

Fairly simple.

Use service escalation to change the contact for 2nd notification onward, and set the contact's notification 'command' to be the perl routine to poke asterisk.

define serviceescalation{
	host_name			nt-3
	service_description	Processor Load
	first_notification	2
	last_notification		2
	notification_interval	30
	contacts			+thephone
	escalation_options	c
	}

define contact{
	contact_name                    jdoe
	alias                           John Doe
	host_notifications_enabled	1
	service_notifications_enabled	1
	service_notification_period     24x7
	host_notification_period        24x7
	service_notification_options    c,u
	host_notification_options       d,u,r
	service_notification_commands   notify-by-phone
	host_notification_commands      host-notify-by-phone
	email					jdoe at localhost.localdomain
	pager					555-5555 at pagergateway.localhost.localdomain
	address1				xxxxx.xyyy at icq.com
	address2				555-555-5555
	}

define command{
        command_name    notify-by-phone
        command_line	/usr/local/bin/service-phone.pl
	}
define command{
        command_name    host-notify-by-phone
        command_line	/usr/local/bin/host-phone.pl
	}

Examples pulled from the documentation., modified slightly.

Stuart

------------------------------------------------------------------------------
Throughout its 18-year history, RSA Conference consistently attracts the
world's best and brightest in the field, creating opportunities for Conference
attendees to learn about information security's most important issues through
interactions with peers, luminaries and emerging and established companies.
http://p.sf.net/sfu/rsaconf-dev2dev
_______________________________________________
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