[icinga-users] notification command configuration
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
| 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$ -
| Info:\n\n$HOSTOUTPUT$\n\n$NOTIFICATIONTYPE$ - Host $HOSTNAME$ is
| $HOSTSTATE$\n\n(Address: $HOSTADDRESS$ Displayname:
| $HOSTDISPLAYNAME$)\n\nNotes: $NOTIFICATIONAUTHOR$
| | /usr/bin/mail -s "$NOTIFICATIONTYPE$ - $HOSTNAME$ is $HOSTSTATE$"
| why not:
| command_line $USER1$/send_email
| with /usr/local/icinga/libexec/send_email:
| if [[ -z "$ICINGA_CONTACTEMAIL" ]]; then
| exit 1
| mutt -s "$ICINGA_NOTIFICATIONTYPE - $ICINGA_HOSTNAME is
| $ICINGA_HOSTSTATE" "$ICINGA_CONTACTEMAIL" <<EOF
| Info: $ICINGA_HOSTOUTPUT
| $ICINGA_NOTIFICATIONTYPE - Host $ICINGA_HOSTNAME is $ICINGA_HOSTSTATE
| Address: $ICINGA_HOSTADDRESS
| Displayname: $ICINGA_HOSTDISPLAYNAME
| Notes: $ICINGA_NOTIFICATIONAUTHOR $ICINGA_NOTIFICATIONCOMMENT
| I've yet to try it, but I was also wondering how to force icinga to send
| a notification so I could test it...?
| 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.
| icinga-users mailing list
| icinga-users at lists.sourceforge.net
More information about the icinga-users