[icinga-users] notification command configuration

John Sellens jsellens at syonex.com
Wed Feb 6 15:14:02 CET 2013

A year or so ago I came to the same conclusion (I happen to be a Nagios
user, but the problem is the same).

I wrote a tool that I called "genoa" for "GEneric NOtification
Author/Arranger/Artist" which lets you set up templates for what you want
your messages to look like, and does environment variable substitution.
The templates are searched for based on host, service, etc.

So, just as you propose, the notification command line looks like
    command_line genoa -s
to send mail, or
    command_line genoa -p
to send pages.

I also wrote a notification tool I called "tellitto" which is meant for
use if you have multiple ways to send pager notifications, and which
"genoa -p" will use.

I'll invite you to have a look
and would welcome any feedback.

As for forcing Icinga (or whatever) to send a notification, just unplug
something :-)  Or, if that's not an option, you could add a check that is
bound to fail e.g. check for a TCP port that you know is closed.

Hope this is helpful - cheers!


On Wed, Feb 06, 2013 at 02:55:28PM +0100, Simon Oosthoek wrote:
| Hi all
| I'm wondering why notification comand_line's are so complicated (i.e. 
| long and hard to read).
| Most if not all relevant macro's are available as environment variables, 
| according to the documentation 
| http://docs.icinga.org/latest/en/macrolist.html
| Wouldn't it be much easier to define a script to handle the sending of a 
| notification (doesn't matter what type)? The script could then take the 
| information from ICINGA_* variables and if one isn't exported, request 
| it from the commandline.
| Then the script can use all that to produce an e-mail or sms or whatever.
| e.g. instead of:
| command_line    /usr/bin/printf "%b" "$SHORTDATETIME$ - 
| $HOSTSTATE$\n\n(Address: $HOSTADDRESS$ Displayname: 
| $NOTIFICATIONCOMMENT$\n$HOSTNOTESURL$\n\nUrl:\nhttp://ICINGAHOST/icinga/cgi-bin/extinfo.cgi?type=1&host=$HOSTNAME$\n\n" 
| | /usr/bin/mail -s "$NOTIFICATIONTYPE$ - $HOSTNAME$ is $HOSTSTATE$" 
| why not:
| command_line	$USER1$/send_email
| with /usr/local/icinga/libexec/send_email:
| #!/bin/bash
| if [[ -z "$ICINGA_CONTACTEMAIL" ]]; then
|          exit 1
| fi
| Url: 
| http://ICINGAHOST/icinga/cgi-bin/extinfo.cgi?type=1&host=$ICINGA_HOSTNAME"
| I've yet to try it, but I was also wondering how to force icinga to send 
| a notification so I could test it...?
| /Simon
| ------------------------------------------------------------------------------
| Free Next-Gen Firewall Hardware Offer
| Buy your Sophos next-gen firewall before the end March 2013 
| and get the hardware for free! Learn more.
| http://p.sf.net/sfu/sophos-d2d-feb
| _______________________________________________
| icinga-users mailing list
| icinga-users at lists.sourceforge.net
| https://lists.sourceforge.net/lists/listinfo/icinga-users

More information about the icinga-users mailing list