Problem with JDBC query monitor operand parameters

Hi,
I’ve created a JdbcQueryMonitor to monitor a database and I would like to use the operand parameter “not equal to” (!=) found here: JDBCQueryMonitor (opennms.com).

I tested the service from OpenNMS console but the operand always act as if it’s “equal to” (=).
Am I missing some settings or anything particular?
I’m using version 30.0.2.
Thank you

Can you share the XML for your service monitor? (redacting any passwords)

Hi,
This is my service definition in etc/poller-configuration.xml

  <service name="MySQL-Replication-Service" interval="30000" user-defined="true" status="on">
     <parameter key="driver" value="com.mysql.jdbc.Driver"/>
     <parameter key="url" value="jdbc:mysql://OPENNMS_JDBC_HOSTNAME:3306/performance_schema?useSSL=false"/>
     <parameter key="user" value="my_user"/>
     <parameter key="password" value="my_password"/>
     <parameter key="query" value="SELECT SERVICE_STATE FROM performance_schema.replication_connection_status"/>
     <parameter key="column" value="SERVICE_STATE"/>
     <parameter key="action" value="compare_string"/>
     <parameter key="operator" value="!="/>
     <parameter key="operand" value="OFF"/>
     <parameter key="message" value="Replication service not running"/>
  </service>
...
<monitor service="MySQL-Replication-Service" class-name="org.opennms.netmgt.poller.monitors.JDBCQueryMonitor"/>

Thank you

Hi,
Do you have any update about this topic?
Thank you

Hi,
did you add mysql-connector-java-5.1.49.jar plugin in /opt/opennms/lib directory??
gives the result of the command
ls /opt/opennms/lib | grep mysql-connector-java-5.1.49.jar
ls -l /opt/opennms/lib/mariadb-java-client-2.5.4.jar

Hi,
The column SERVICE_STATE that I’m querying can have 3 values:

  1. ON
  2. OFF
    3.CONNECTING

I copied the jdbc driver in lib directory and if I change my service to be equal to “ON” it works fine, but I would like to change it and check if that value is not equal to “OFF” because for me the status “CONNECTING” it’s ok and I don’t want the notice to be created in opennms.
For some reason the operand acted like it was “equal”.

Thank you

I think you should change the value of operator

You can see this in Table 3. Using != as operator and operand OFF for your test condition described in

… I would like to change it and check if that value is not equal to “OFF” …

If the behavior is not applied as expected, can you create a bug report at https://issues.opennms.org in the project “OpenNMS (NMS)”. Please add also your version number, the operating system + version you use, and your sample configuration. You can reference the issue here as well, just in case someone else runs into the same problem, we can drive it through the bug report.

1 Like