- Nagios - Switch Interface Traffic
- How To - Linux Server Performance
- Notes - Building New ESXi Host for iSCSI with Jumbo Frames
- Microsoft Office Version Numbers (XP, 2003, 2007, 2010)
- ESXi Custom Welcome Screen Text
- PHP - Read Data from a CSV file
- PHP - Input Variables from URL
- Fix - WMI Error EventID 10
- Fix - EventID 4007 DNS Server Error
- FIX - CHECK_ESX3.PL Script
Tweak - Nagios Jabber / XMPP Notifications
I wanted to add the feature to send nagios alerts via Jabber, aka XMPP protocol, instant messages. Our office uses the Openfire platform for corporate instant messaging. Some googling found this:
I modified the server connection and user variables to fit my Openfire installation. However after running some simple command line tests, I could not get it to work. The unable to connect errors were easy enough to understand and fix, but then I got an unauthorized error.
ERROR: Authorization failed: error - not-authorized
The link below has information on solution to the error. OK, so now we assume you CAN send a test message via Jabber/XMPP. Let's configure it.
There are two primary scenarios for configuring the Jabber/XMPP notifications.
Scenario 1 - User wants to be contacted for ALL Nagios alerts via Jabber/XMPP.
Define the contact command something like:
# 'notify-by-jabber' command definition
define command{
command_name notify-by-jabber
command_line /usr/local/nagios/bin/notify_via_jabber \
$CONTACTADDRESS1$ "$NOTIFICATIONTYPE$ $HOSTNAME$ \
$SERVICEDESC$ $SERVICESTATE$ $SERVICEOUTPUT$ $LONGDATETIME$"
}
*note - I'm using the backslash for readability only, actually only one line.
Notice how I defined "$CONTACTADDRES1" in the command line. Now check out my Contact definition...
define contact{
contact_name jdoe
use generic-contact
alias John Doe
email jdoe@company.com
address1 jdoe
service_notification_commands +notify-by-jabber
}
This will use the generic contact info for the email method -and- add the jabber contact method. Note the "address1" line I am using for the appropriate jabber_id for the user. Alternatively you could create a contact template called "jabber-contact" using the notify-by-jabber command and then apply both templates to the user contact definition.
Scenario 2 - User only needs specific Nagios service/host alerts via Jabber/XMPP.
Unfortunately this is simple. You would need to define a second contact entirely to assign to the specific host/service. Create a "jdoe-jabber" contact so on your Nagios host/service definition you would have a line like:
contacts jdoe,jdoe-jabber
Maybe with an add-on or future version of Nagios we could define a user/contact method along the lines of:
contacts jdoe:notify-by-jabber,jdoe:notify-by-email
Anyone listening? Feel free to send me a note or comment.
| Attachment | Size |
|---|---|
| jabber-xmpp-notications.txt | 2.45 KB |
- MWalker's blog
- Printer-friendly version
- Login to post comments
-

