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

Uncaught exception in HostResourceSwRunMonitor when handling empty strings

    XMLWordPrintable

    Details

      Description

      If the HostResourceSwRunMonitor is configured with an alternative "service-name-oid" parameter that points to e.g. hrSwRunParameters (.1.3.6.1.2.1.25.4.2.1.5) and it comes across any processes with zero-length parameter strings, the monitor will fail to catch an IndexOutOfBoundsException coming from the antlr StringUtils class. Here is an illustrative exception stack trace from poller.log (see https://mynms.opennms.com/Ticket/Display.html?id=2207):

      2013-05-06 10:26:51,186 DEBUG [PollerScheduler-30 Pool-fiber3] HostResourceSwRunMonitor: HostResourceSwRunMonitor: Unexpected exception during SNMP poll of interface 192.168.200.23
      java.lang.StringIndexOutOfBoundsException: String index out of range: -1
      at java.lang.String.substring(String.java:1937)
      at antlr.StringUtils.stripFrontBack(StringUtils.java:83)
      at org.opennms.netmgt.poller.monitors.HostResourceSwRunMonitor.stripExtraQuotes(HostResourceSwRunMonitor.java:300)
      at org.opennms.netmgt.poller.monitors.HostResourceSwRunMonitor.poll(HostResourceSwRunMonitor.java:247)
      at org.opennms.netmgt.poller.pollables.LatencyStoringServiceMonitorAdaptor.poll(LatencyStoringServiceMonitorAdaptor.java:104)
      at org.opennms.netmgt.poller.pollables.PollableServiceConfig.poll(PollableServiceConfig.java:109)
      at org.opennms.netmgt.poller.pollables.PollableService.poll(PollableService.java:178)
      at org.opennms.netmgt.poller.pollables.PollableElement.poll(PollableElement.java:292)
      at org.opennms.netmgt.poller.pollables.PollableContainer$5.run(PollableContainer.java:305

      And the corresponding service and monitor definition, slightly sanitized:

      <service name="AFEED00-TOMCAT" interval="300000"
      user-defined="false" status="on">
      <parameter key="retry" value="1"/>
      <parameter key="timeout" value="3000"/>
      <parameter key="service-name" value="-Djava.util.logging.config.file=/usr/local/example/apache-t"/>
      <parameter key="service-name-oid" value=".1.3.6.1.2.1.25.4.2.1.5"/>
      </service>

      <monitor service="AFEED00-TOMCAT" class-name="org.opennms.netmgt.poller.monitors.HostResourceSwRunMonitor"/>

        Attachments

          Activity

            People

            • Assignee:
              agalue Alejandro Galue
              Reporter:
              jeffg Jeff Gehlbach
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: