- Nagios Network Monitoring
- General Information and TidBits
- Installation Tips & Tricks
- Addons, Plugins, Tweaks & Customizations
- Checking Drupal Status with Nagios and WebInject
- AddOn - NRPE / NSClient
- AddOn - Nagios Event Log aka NagEventLog
- Addon - Nagios Passive Checks with NSCA
- Nagios Custom Object Variables
- Nagios Event Handler - Restart Remote Service
- Nagios Event Handler - Restarting a Local Service
- Plugin: check_dns_secondary - Checking NS Servers
- Plugin: check_http_requisites - Page Size, Files, and Loadtime
- Plugin: check_mem - Linux Memory Usage
- Plugin: check_sql - Check MSSQL and MYSQL servers
- Plugin: check_svn - Check Subversion
- Tweak - Nagios Jabber / XMPP Notifications
- Tweak - Nagios SMS Messaging
- Tweak - check_file_age to check_file_modified
- Tweak: Using NagiosGraph's SHOW.CGI
- Tweak: check_sql - Allow decimal values
- Common Errors & Fixes
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 or register to post comments
-


Comments
a Nagios XMPP gateway
You might be interested in the Nagios XMPP gateway I've just released, Molniya. It adds a number of features over the fire-and-forget example code I've seen; you can request status reports, acknowledge problems, etc. It doesn't quite solve your Scenario 2 problem, but it does allow you to receive notifications via XMPP if you're online, and via email if you're not.