Page 1 of 1

using nrpe to monitor jmx

Posted: Mon Feb 10, 2020 1:05 pm
by rnjie
i am currently trying to monitor jmx using nrpe and it works on my jmx server but doesnt work on the remote nagios server, this only happens when the command has a special character in, please see successful command ran on jx server and unsuccessful command on remote nagios xi server

jmx server: lxatmsd1 libexec]$ ./check_jmx -U service:jmx:rmi:///jndi/rmi://lxatmsd1:9077/jmxrmi -O com.bea:ServerRuntime=tmsServer1,Name=TMS'!'TMSJMSServer1@IE_TO_TMS_QUEUE,Type=JMSDestinationRuntime,JMSServerRuntime=TMSJMSServer1 -A ConsumersTotalCount -K used -I ConsumersTotalCount -J used -vvvv -w 5 -c 10

JMX WARNING - ConsumersTotalCount.used=16 | ConsumersTotalCount.used=1616

nagiosxiserver: ./check_nrpe -H lxatmsd1 -c -n check_jmx -a '-U service:jmx:rmi:///jndi/rmi://lxatmsd1:9077/jmxrmi -O com.bea:ServerRuntime=tmsServer1,Name=TMS\!TMSJMSServer1@IE_T O_TMS_QUEUE,Type=JMSDestinationRuntime,JMSServerRuntime=TMSJMSServer1 -A ConsumersTotalCount -K used -I ConsumersTotalCount -J used -vvvv -w 5 -c 10'

CHECK_NRPE: Receive header underflow - only 0 bytes received (4 expected)


i have tried other options like putting double quotes or a slash infront of the special characters but it still dosent work, please your help will be appriciated

Re: using nrpe to monitor jmx

Posted: Mon Feb 10, 2020 7:40 pm
by Box293
You could try defining the commands in your nrpe.cfg file on your jmx server so that you don't have to send all the arguments across.

It does mean you will need to define all your commands on the jmx server but it may be simpler this way.

Re: using nrpe to monitor jmx

Posted: Thu Feb 13, 2020 1:45 pm
by rnjie
i already defined the command in nrpe.cfg,
i just have issues with the output when it involves special characters as shown in the above example.

Re: using nrpe to monitor jmx

Posted: Thu Feb 13, 2020 4:53 pm
by Box293
How do you know it's an output issue? Could NRPE be having issues with executing the received arguments? How have you tested to rule this out?

Re: using nrpe to monitor jmx

Posted: Fri Feb 14, 2020 9:38 am
by rnjie
i know that because it works with other arguements that do not have special characters

Re: using nrpe to monitor jmx

Posted: Fri Feb 14, 2020 12:05 pm
by lmiltchev
i already defined the command in nrpe.cfg,
i just have issues with the output when it involves special characters as shown in the above example.
Can you show us how the "check_jmx" command is defined in the nrpe.cfg on the remote machine? I don't see any special characters in the output... The output of the check is this (see below), correct?
JMX WARNING - ConsumersTotalCount.used=16 | ConsumersTotalCount.used=1616
Note: I believe @Box293 suggested that you could "hardcode" the arguments in your "check_jmx" command in the nrpe.cfg file, so that you won't have to pass them to check_nrpe.

For example, you could have something like this (on the client):

Code: Select all

command[check_jmx]=/path/to/check_jmx -U service:jmx:rmi:///jndi/rmi://lxatmsd1:9077/jmxrmi -O com.bea:ServerRuntime=tmsServer1,Name=TMS'!'TMSJMSServer1@IE_TO_TMS_QUEUE,Type=JMSDestinationRuntime,JMSServerRuntime=TMSJMSServer1 -A ConsumersTotalCount -K used -I ConsumersTotalCount -J used -vvvv -w 5 -c 10
and could run the following command on the Nagios XI server to test it:

Code: Select all

./check_nrpe -H lxatmsd1 -c -n check_jmx

Re: using nrpe to monitor jmx

Posted: Fri Feb 14, 2020 3:18 pm
by rnjie
hard coding the command worked

Re: using nrpe to monitor jmx

Posted: Fri Feb 14, 2020 3:34 pm
by lmiltchev
Great! Let us know if this is an acceptable "workaround", and if we could close this topic.

Re: using nrpe to monitor jmx

Posted: Mon Feb 17, 2020 10:20 am
by rnjie
please close the case