Add Validation for Metadata in Thresholds

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:

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

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.

Acceptance / Success Criteria

None

Lucidchart Diagrams

Activity

Show:

Chandra Gorantla June 7, 2021 at 7:36 PM

Chandra Gorantla September 17, 2020 at 4:22 PM

Also handle error handling in xml files

Chandra Gorantla September 16, 2020 at 8:47 PM

With NMS-12794 webapp no longer crashes with any string values. But need to add client side error handling for the cases where the values may not be either interpolated or Double.

Chandra Gorantla July 15, 2020 at 1:10 PM

Removing bugfixsla tag as this is not blocking anything. Let me know if you disagree

Alejandro Galue July 7, 2020 at 4:54 PM

Totally agree, which is why I changed the title of the issue.

I've created an enhancement request to add meta-data support for single-DS in the future:

Fixed

Details

Assignee

Reporter

Labels

HB Grooming Date

HB Backlog Status

Components

Sprint

Fix versions

Affects versions

Priority

PagerDuty

Created April 29, 2020 at 1:14 PM
Updated July 6, 2021 at 2:39 PM
Resolved June 8, 2021 at 1:58 PM