Slack Notifications

If your organization uses Slack, you can configure Horizon to send notices to any channel via an incoming webhook. You must configure an incoming webhook in your Slack settings and manually configure some settings in your Horizon instance.

For more information on incoming webhooks in Slack, see the Slack API documentation.

Setup

First, add the following XML to notificationCommands.xml (no customization should be needed):

<command binary="false">
  <name>slack</name>
  <execute>org.opennms.netmgt.notifd.SlackNotificationStrategy</execute>
  <comment>class for sending messages to a Slack team channel for notifications</comment>
  <argument streamed="false">
    <switch>-subject</switch>
  </argument>
  <argument streamed="false">
    <switch>-tm</switch>
  </argument>
</command>

Create slack.properties in your opennms.properties.d directory, and insert the following property:

org.opennms.netmgt.notifd.slack.webhookURL=https://hooks.slack.com/services/AEJ7IIYAI/XOOTH3EOD/c3fc4a662c8e07fe072aeeec

Customize its values as appropriate for your organization.

Horizon loads slack.properties upon restart. After it is loaded, your new slack notification command will be available for use in a destination path.

Additional configuration options

The following table lists optional properties that you may use in slack.properties to customize your Slack notifications:

Parameter Description Default Value Example

org.opennms.netmgt.notifd.slack.channel

Specify a channel or private group other than the one targeted by the webhook.

Webhook default

NetOps

org.opennms.netmgt.notifd.slack.username

The username to associate with the notification posts.

Blank

OpenNMS_Bot

org.opennms.netmgt.notifd.slack.iconEmoji

An emoji sequence to use as the icon for the notification posts.

Blank

:metal:

org.opennms.netmgt.notifd.slack.iconURL

The URL of an image to use as the icon for the notification posts.

Blank

https://example.org/assets/icon.png

org.opennms.netmgt.notifd.slack.useSystemProxy

Should the system-wide proxy settings be used? Configure the system proxy settings via system properties.

true

true