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

TopReportPlugin fails on FreeBSD

    Details

    • Type: Bug
    • Status: Resolved (View Workflow)
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 14.0.2
    • Fix Version/s: 14.0.3
    • Component/s: Command-Line Tools
    • Security Level: Default (Default Security Scheme)
    • Labels:
      None

      Description

      2014-12-13 16:46:20,918 DEBUG [main] org.opennms.systemreport.SystemReportResourceLocator - Failed to run '/usr/bin/top -h'
      org.apache.commons.exec.ExecuteException: Process exited with an error: 1 (Exit value: 1)
              at org.apache.commons.exec.DefaultExecutor.executeInternal(DefaultExecutor.java:402)
              at org.apache.commons.exec.DefaultExecutor.execute(DefaultExecutor.java:164)
              at org.opennms.systemreport.SystemReportResourceLocator.slurpOutput(SystemReportResourceLocator.java:110)
              at org.opennms.systemreport.system.TopReportPlugin.getEntries(TopReportPlugin.java:66)
              at org.opennms.systemreport.system.ReportPluginTestCase.setUp(ReportPluginTestCase.java:73)
      ...
      2014-12-13 16:46:20,924 DEBUG [main] org.opennms.systemreport.system.TopReportPlugin - top -h output: null
      ...
      Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 13.681 sec <<< FAILURE! - in org.opennms.systemreport.system.ThreadReportPluginTest
      testThreadReportPlugin(org.opennms.systemreport.system.ThreadReportPluginTest)  Time elapsed: 11.013 sec  <<< ERROR!
      java.lang.NullPointerException: null
              at org.opennms.systemreport.system.TopReportPlugin.getEntries(TopReportPlugin.java:69)
      

      On FreeBSD, running "top -h" will return the usage, but more importantly here, it will return an exit code of 1 which is why DefaultExecutor throws an ExecutionException.

      So to fix part of the problem in org.opennms.systemreport.SystemReportResourceLocator.slurpOutput, we need to add the following which will cause it to ignore all exit values.

              if (ignoreExitCode) {
                  executor.setExitValues(null);
              }
      

      Then we also need an update to TopReportPlugin to run it correctly for FreeBSD.

        Attachments

          Activity

            People

            • Assignee:
              ranger Benjamin Reed
              Reporter:
              ronald.roskens@biworldwide.com Ron Roskens
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: