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

ClassCastException when using complex threshold expressions.

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 1.9.92
    • Fix Version/s: 1.9.93
    • Component/s: Thresholding
    • Security Level: Default (Default Security Scheme)
    • Labels:

      Description

      I have a situation that needs trigger a threshold when the value is equal to certain numbers. This is not the standard use case of thresholds but in this particular situation will be very useful.

      I need to track JUNIPER-MIB::jnxOperatingState. Operating state is defined as on of the following by the MIB:

      1 - unknown
      2 - running
      3 - ready
      4 - reset
      5 - runningAtFullSpeed
      6 - down
      7 - standby

      The threshold should be triggered when the value is running(2), ready(3) ot standby (7), so here is the threshold definition:

      <group name="juniper-status" rrdRepository = "/opt/opennms/share/rrd/snmp/">
      <expression type="high" expression="jnxOperatingState == 2.0 || jnxOperatingState == 3.0 || jnxOperatingState == 7.0 ? 1.0 : 0.0"
      ds-type="jnxContentsContainerIndex" ds-label="jnxContentsType" value="1" rearm="0" trigger="1"
      triggeredUEI="org.opennms/thresholds/juniper/powerStatusFailure"
      rearmedUEI="org.opennms/thresholds/juniper/powerStatusNormal">
      <resource-filter field="jnxContentsType">^jnxPower$</resource-filter>
      </expression>
      </group>

      We use Apache JEXL to parse and evaluate the expressions, the above expression is correct according with:
      http://commons.apache.org/jexl/reference/syntax.html#Operators

      The problem is that ExpressionConfigWrapper will throw a ClassCastException because JEXL return a Long and that class will try to convert the value returned into Double.

        Attachments

          Activity

            People

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

              Dates

              • Created:
                Updated:
                Resolved: