OpenNMS Admin Guide HostResourceSwRunMonitor service-name not exact match string

Description

Hello, I was using the Admin Guide reference of HostResourceSwRunMonitor

http://docs.opennms.org/opennms/releases/18.0.1/guide-admin/guide-admin.html#_hostresourceswrunmonitor

The guide says that the service-name parameter is "The name of the process to be monitored. This parameter’s value is case-sensitive and is evaluated as an exact match."

However, the code at https://github.com/vishwaabhinav/OpenNMS/blob/master/opennms-services/src/main/java/org/opennms/netmgt/poller/monitors/HostResourceSwRunMonitor.java shows this value is interpreted as a regular expression.

private boolean match(String expectedText, String currentText) {
268 if (expectedText.startsWith("~")) {
269 return currentText.matches(expectedText.replaceFirst("~", ""));
270 }
271 return currentText.equalsIgnoreCase(expectedText);
272 }

matches expects a regex

Thanks,
Tim

Acceptance / Success Criteria

None

Lucidchart Diagrams

Activity

Show:

Mark Mahacek August 17, 2021 at 5:15 PM

Mark Mahacek July 28, 2021 at 6:31 PM

Technically the field is an exact match unless the name starts with a `~`, then it is a regex.  Regardless, the docs are not correct on that fact.

Fixed

Details

Assignee

Reporter

Doc Backlog Status

Doc Backlog Grooming Date

Sprint

Affects versions

Priority

PagerDuty

Created December 22, 2016 at 7:01 AM
Updated August 17, 2021 at 7:27 PM
Resolved August 17, 2021 at 7:27 PM