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

Add Validation for Metadata in Thresholds

    XMLWordPrintable

Details

    • Bug
    • Status: Resolved (View Workflow)
    • Critical
    • Resolution: Fixed
    • 26.0.0
    • 29.0.0
    • Thresholding
    • Security Level: Default (Default Security Scheme)
    • Horizon 2021 - May 26 - June 9
    • Backlog

    Description

      In theory, the functionality is present in terms of processing thresholds, as you can see here:

      https://github.com/OpenNMS/opennms/pull/2713/files

      Unfortunately, validations on thresholds.xml prevents the usage of this feature.

      Here are the two major problems:

      1) You cannot use the meta-data format on the value when defining thresholds through the WebUI, as it silently ignores the content as it expects a number:

      https://github.com/OpenNMS/opennms/blob/opennms-26.0.0-1/opennms-webapp/src/main/java/org/opennms/web/controller/admin/thresholds/ThresholdController.java#L604

      Based on the above code, you'll see an error like the following on web.log:

      2020-04-29 09:02:35,084 WARN  [qtp2106500011-401] o.o.w.c.a.t.ThresholdController: Failed to parse value ('${requisition:tcpErrors|10}') as a number.
      

      2) You cannot manually set the value with meta-data format directly on threhsolds.xml because the XSD validation fails.

      <threshold description="Trigger an alert if one or more incoming packets on the whole node were not received due to an error for one measurement interval" type="high" ds-type="node" value="${requisition:tcpErrors|10}" rearm="0.0" trigger="1" filterOperator="OR" ds-name="tcpInErrors"/>
      
      [opennms@opennms bin]$ ./config-tester thresholds.xml
      ...
      Internal Exception: org.xml.sax.SAXParseException; lineNumber: 3; columnNumber: 292; cvc-datatype-valid.1.2.1: '${requisition:tcpErrors|10}' is not a valid value for 'double'.]
      

      Another side effect of this is because `config-tester` fails if there is meta-data content on `threhsolds.xml` OpenNMS won't start.

      In conclusion, you cannot use the meta-data feature with thresholds until the code is changed to properly handle the case when the value is not a Java Double.

      Attachments

        Issue Links

          Activity

            People

              cgorantla Chandra Gorantla
              agalue Alejandro Galue
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Git Integration

                  Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.