Search code examples
slackopennms

OpenNMS sending multiple notification for the same event


I have referred the following url to integrate OpenNMS with Slack.

# Drop this file in your OPENNMS_HOME/etc/opennms.properties.d directory

org.opennms.netmgt.notifd.slack.webhookURL=https://hooks.slack.com/services/T00000000/B00000000/XXXXXXXXXXXXXXXXXXXXXXXX
org.opennms.netmgt.notifd.slack.username=UlfBot
org.opennms.netmgt.notifd.slack.iconURL=https://avatars2.githubusercontent.com/u/7483547
org.opennms.netmgt.notifd.slack.channel=#AwesomeOps

# Then add this to OPENNMS_HOME/etc/notificationCommands.xml, and restart OpenNMS

    <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>

Source: https://gist.github.com/jeffgdotorg/83a3888c9b0b9275d35e02b79a054ff9

However, although it integrated the OpenNMS instance correctly, I receive 3 notifications on Slack for the same event on OpenNMS.

I am not sure what is causing this.


Solution

  • This issue is because you have multiple role selected in "Configure Destination Paths"

    • Solution 1:

    Have only one role in Destination path for slack. Home-> Admin -> Configure Notifications -> Destination Paths - > Modify destination for slack. Select only one role in Initial target and finish.

    Solution 1 screenshot

    • Solution 2:

    Even if you have multiple role in Initial targets, you can off the notification for other role and keep on for one role. Please see the attached image for it.

    Solution 2 screenshot

    Hope this resolves the issue of multiple notification.

    -Kushal