Uploaded image for project: 'OpenNMS'
  1. OpenNMS
  2. NMS-5399

varbind based notification filtering doesn't support regular expression



    • Enhancement
    • Status: Closed (View Workflow)
    • Minor
    • Resolution: Fixed
    • 1.10.3
    • 1.11.2, 1.10.9
    • Security Level: Default (Default Security Scheme)
    • None


      Hi guys,

      According to http://www.opennms.org/wiki/Configuring_notifications:

      When an event is received, a few evaluations are performed:

      • Are notifications turned on (the "status" attribute on the "notifd-configuration" element in notifd-configuration.xml)? If not, the event is discarded and a notification is not performed.
      • Does the UEI in the event match a UEI configured in an enabled notification and does the rule in the notification match the event (see Rule Matching below)? If not, the event is discarded and notification is not performed. Note: the special UEI string "MATCH-ANY-UEI" can be used to match all event UEIs (the rule still needs to match, as well).
      • If the notification has a <varbind> configured with a name and value, it is used for a case sensitive match against the beginning an event parameter of the same name.

      If the above evaluations pass, one or more notifications are sent. If the "match-all" attribute on the "notifd-configuration" element is set to "true", every matching notification will be executed by walking its destination path, otherwise only the first matching notification will be executed.

      The fact that <varbind> matching is only done against the beginning of an event parameter is a limitation that could probably easily be overcome:

      If I'm not mistaken, this match is done in file opennms\opennms-services\src\main\java\org\opennms\netmgt\config\NotifdConfigManager.java, method matchNotificationParameters.

      There is the following test:

      if (parmName.equals(notfName) && parmContent.startsWith(notfValue))

      { parmmatch = true; }

      As parmContent and nofValue are regular java Strings, this could easily be replaced by:

      if (parmName.equals(notfName) && parmContent.matches(notfValue)) { parmmatch = true; }

      What do you think?

      Is this enough information for you to patch onms quickly, or would it be quicker if I provided you with a proper git-like patch?






            seth Seth Leger
            stcyr Cyrille Bollu
            0 Vote for this issue
            2 Start watching this issue