Skip to main content

slack logoAs Slack is becoming our main place of work it made sense integrating our monitoring systems into it.

Focusing on Nagios & openNMS below is a guide to push openNMS notification to a Slack channel using XMPP.

First step is to enable XMPP on Slack Team. This can be done from https://your_team.slack.com/admin/settings on Permissions tab / Gateways.

Second step is to enable the xmpp on the user with which openNMS will connect to Slack’s XMPP server. We created a new user (NOC) as we plan to use it for further integrations. This can be done from https://your_team.slack.com/account/settings on Gateways / Gateways configuration.

The required settings to connect to the XMPP server are displayed there for each user. Once this is activated, the Slack part is done.

On openNMS we have to configure it to user the XMPP server to push notifications.

This is done through $OPENNMS_HOME/etc/xmpp-configuration.properties

################################################################################
# This file is the configuration for the the XMPPNotificationStrategy class.
# It is used to specify the parameters required to make an XMPP (Jabber)
# connection on behalf of OpenNMS.
################################################################################
 
# The hostname to connect to
# For google talk, set to talk.google.com
xmpp.server = your_team.xmpp.slack.com
 
# The service name to use; if unset, it will use the value of xmpp.server
# For google talk, set to gmail.com
xmpp.servicename = your_team.xmpp.slack.com
 
# The port to connect to; defaults to 5222 if unset
xmpp.port = 5222
 
# Whether to enable TLS encryption; defaults to false if unset
xmpp.TLSEnabled = true
 
# Whether to enable SASL authentication; defaults to true if unset
#xmpp.SASLEnabled = true
 
# Whether to allow self-signed certificates; defaults to false if unset
xmpp.selfSignedCertificateEnabled = false
 
# The java XMPP libraries store certificates in a trust store.  It defines
# the password used to protect the trust store; defaults to changeit if unset
#xmpp.truststorePassword = changeit
 
# Enable debugging; extremely high-volume, you probably should not turn
# this on
xmpp.debuggerEnabled = false
 
# The username to connect as; just the username, no @host
xmpp.user   = slack_username
 
# The user's password
xmpp.pass   = password_provided_by_slack

After this file is configured and saved, openNMS must be restarted.

Next step is to configure a user with an XMPP address. We created a user “slack” who has alerts@conference.your_team.xmpp.slack.com as an emailopennms logo address. The “alerts” identifies the channel on which the notifications will be sent. The “conference” indicates that the notification will go to a channel and not a user. If a single user was to be notified then the xmpp address would be user@your_team.xmpp.slack.com.

Last step is to go to “Configure Notifications” and assign the desired notifications to the newly created user.

From now on, all new alerts configured on the notifications will come to your Slack channel! Enjoy!