SSLCertMonitor server-name parameter results in NPE

Description

Using a service configuration like this seems to be broken in 25.0.0, it worked in 23.0.4

<service name="SSL-Cert-HTTPS" interval="7200000" user-defined="false" status="on"> <parameter key="retry" value="2"/> <parameter key="timeout" value="3000"/> <parameter key="port" value="443"/> <parameter key="days" value="30"/> <parameter key="server-name" value="${nodelabel}"/> </service>

This results in the following NPE during parameter substitution:

2019-10-09 10:37:38,771 ERROR [Poller-Thread-3-of-30] o.o.n.p.p.PollableServiceConfig: Unexpected exception while polling PollableService[location=Default, interface=PollableInterface [PollableNode [1]:a.b.c.d], svcName=SSL-Cert-HTTPS]. Marking service as DOWN java.lang.NullPointerException: null at java.util.regex.Matcher.getTextLength(Matcher.java:1283) ~[?:1.8.0_222] at java.util.regex.Matcher.reset(Matcher.java:309) ~[?:1.8.0_222] at java.util.regex.Matcher.<init>(Matcher.java:229) ~[?:1.8.0_222] at java.util.regex.Pattern.matcher(Pattern.java:1093) ~[?:1.8.0_222] at org.opennms.netmgt.poller.monitors.support.ParameterSubstitutingMonitor.parseString(ParameterSubstitutingMonitor.java:162) ~[org.opennms.features.poller.monitors.core-25.0.0.jar:?] at org.opennms.netmgt.poller.monitors.support.ParameterSubstitutingMonitor.lambda$getSubstitutedParameters$1(ParameterSubstitutingMonitor.java:113) ~[org.opennms.features.poller.monitors.core-25.0.0.jar:?] at java.util.HashMap.forEach(HashMap.java:1289) ~[?:1.8.0_222] at org.opennms.netmgt.poller.monitors.support.ParameterSubstitutingMonitor.getSubstitutedParameters(ParameterSubstitutingMonitor.java:110) ~[org.opennms.features.poller.monitors.core-25.0.0.jar:?] at org.opennms.netmgt.poller.monitors.support.ParameterSubstitutingMonitor.getRuntimeAttributes(ParameterSubstitutingMonitor.java:105) ~[org.opennms.features.poller.monitors.core-25.0.0.jar:?] at org.opennms.netmgt.poller.client.rpc.PollerRequestBuilderImpl.execute(PollerRequestBuilderImpl.java:177) ~[org.opennms.features.poller.client-rpc-25.0.0.jar:?] at org.opennms.netmgt.poller.pollables.PollableServiceConfig.poll(PollableServiceConfig.java:135) [opennms-services-25.0.0.jar:?] at org.opennms.netmgt.poller.pollables.PollableService.poll(PollableService.java:190) [opennms-services-25.0.0.jar:?] at org.opennms.netmgt.poller.pollables.PollableElement.poll(PollableElement.java:309) [opennms-services-25.0.0.jar:?] at org.opennms.netmgt.poller.pollables.PollableContainer$5.run(PollableContainer.java:319) [opennms-services-25.0.0.jar:?] at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:1.8.0_222] at org.opennms.netmgt.poller.pollables.PollableElement.withTreeLock(PollableElement.java:240) [opennms-services-25.0.0.jar:?] at org.opennms.netmgt.poller.pollables.PollableElement.withTreeLock(PollableElement.java:227) [opennms-services-25.0.0.jar:?] at org.opennms.netmgt.poller.pollables.PollableContainer.poll(PollableContainer.java:326) [opennms-services-25.0.0.jar:?] at org.opennms.netmgt.poller.pollables.PollableInterface.poll(PollableInterface.java:228) [opennms-services-25.0.0.jar:?] at org.opennms.netmgt.poller.pollables.PollableContainer$5.run(PollableContainer.java:319) [opennms-services-25.0.0.jar:?] at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:1.8.0_222] at org.opennms.netmgt.poller.pollables.PollableElement.withTreeLock(PollableElement.java:240) [opennms-services-25.0.0.jar:?] at org.opennms.netmgt.poller.pollables.PollableElement.withTreeLock(PollableElement.java:227) [opennms-services-25.0.0.jar:?] at org.opennms.netmgt.poller.pollables.PollableContainer.poll(PollableContainer.java:326) [opennms-services-25.0.0.jar:?] at org.opennms.netmgt.poller.pollables.PollableNode$3.run(PollableNode.java:288) [opennms-services-25.0.0.jar:?] at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:1.8.0_222] at org.opennms.netmgt.poller.pollables.PollableElement.withTreeLock(PollableElement.java:240) [opennms-services-25.0.0.jar:?] at org.opennms.netmgt.poller.pollables.PollableElement.withTreeLock(PollableElement.java:227) [opennms-services-25.0.0.jar:?] at org.opennms.netmgt.poller.pollables.PollableNode.doPoll(PollableNode.java:291) [opennms-services-25.0.0.jar:?] at org.opennms.netmgt.poller.pollables.PollableElement.doPoll(PollableElement.java:184) [opennms-services-25.0.0.jar:?] at org.opennms.netmgt.poller.pollables.PollableService.doPoll(PollableService.java:214) [opennms-services-25.0.0.jar:?] at org.opennms.netmgt.poller.pollables.PollableService$PollRunner.run(PollableService.java:60) [opennms-services-25.0.0.jar:?] at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:1.8.0_222] at org.opennms.netmgt.poller.pollables.PollableElement.withTreeLock(PollableElement.java:276) [opennms-services-25.0.0.jar:?] at org.opennms.netmgt.poller.pollables.PollableElement.withTreeLock(PollableElement.java:259) [opennms-services-25.0.0.jar:?] at org.opennms.netmgt.poller.pollables.PollableService.doRun(PollableService.java:404) [opennms-services-25.0.0.jar:?] at org.opennms.netmgt.poller.pollables.PollableService.run(PollableService.java:379) [opennms-services-25.0.0.jar:?] at org.opennms.netmgt.scheduler.Schedule.run(Schedule.java:142) [org.opennms.core.daemon-25.0.0.jar:?] at org.opennms.netmgt.scheduler.Schedule$ScheduleEntry.run(Schedule.java:86) [org.opennms.core.daemon-25.0.0.jar:?] at org.opennms.netmgt.scheduler.LegacyScheduler$1.run(LegacyScheduler.java:179) [org.opennms.core.daemon-25.0.0.jar:?] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_222] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_222] at org.opennms.core.concurrent.LogPreservingThreadFactory$3.run(LogPreservingThreadFactory.java:124) [opennms-util-25.0.0.jar:?] at java.lang.Thread.run(Thread.java:748) [?:1.8.0_222]

Environment

RHEL 7

Acceptance / Success Criteria

None

Attachments

3
  • 17 Jun 2020, 07:40 PM
  • 04 Jun 2020, 05:22 PM
  • 04 Jun 2020, 05:22 PM

is duplicated by

Lucidchart Diagrams

Activity

Show:

Patrick Schweizer June 18, 2020 at 7:03 PM

, I looked into the log and it seems that the Poller can't connect to 127.0.0.1.

The relevant code should be this here:

https://github.com/OpenNMS/opennms/blob/release-26.x/features/poller/monitors/core/src/main/java/org/opennms/netmgt/poller/monitors/SSLCertMonitor.java#L262

I assume the Exception is thrown here:

https://github.com/OpenNMS/opennms/blob/release-26.x/features/poller/monitors/core/src/main/java/org/opennms/netmgt/poller/monitors/SSLCertMonitor.java#L191

To me it doesn't look like a related problem to this ticket. I would like to leave this ticket closed. If needed let's open a new ticket.

 

 

Marcel Fuhrmann June 17, 2020 at 7:40 PM

I've attached a DEBUG poller log.

Marcel Fuhrmann June 4, 2020 at 7:54 PM


I've configured the monitor in 26.1.1 like this:

<service name="SSL-Cert-Validity" interval="7200000" user-defined="false" status="on"> <parameter key="retry" value="5"/> <parameter key="timeout" value="3000"/> <parameter key="port" value="443"/> <parameter key="days" value="30"/> <parameter key="server-name" value="${nodeLabel}"/> </service>

The node has a loopback interface with the* SSL-Cert-Validity* service assigned. As you can see in the screenshots I get an connection exception.

Patrick Schweizer June 4, 2020 at 12:25 AM

Patrick Schweizer Is that error message handled as eventReason? So the nodeLostService event will contain the information?

, the error message is logged as a warning at the same place as we had before the NullpointerException. Let me know if that helps or if we need to change more?

Marcel Fuhrmann June 3, 2020 at 5:52 AM
Edited

Oh man.. I also run into that issue. And it was just the capital L... But the error message is a good improvement. Thanks!

Is that error message handled as eventReason? So the nodeLostService event will contain the information?

Fixed

Details

Assignee

Reporter

Labels

Sprint

Affects versions

Priority

PagerDuty

Created October 9, 2019 at 11:40 AM
Updated June 18, 2020 at 7:03 PM
Resolved May 18, 2020 at 9:39 PM

Flag notifications