using nrpe to monitor jmx

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
rnjie
Posts: 157
Joined: Wed Mar 20, 2019 4:59 pm

using nrpe to monitor jmx

Post 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
User avatar
Box293
Too Basu
Posts: 5126
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia
Contact:

Re: using nrpe to monitor jmx

Post 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.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
rnjie
Posts: 157
Joined: Wed Mar 20, 2019 4:59 pm

Re: using nrpe to monitor jmx

Post 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.
User avatar
Box293
Too Basu
Posts: 5126
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia
Contact:

Re: using nrpe to monitor jmx

Post 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?
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
rnjie
Posts: 157
Joined: Wed Mar 20, 2019 4:59 pm

Re: using nrpe to monitor jmx

Post by rnjie »

i know that because it works with other arguements that do not have special characters
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: using nrpe to monitor jmx

Post 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
Be sure to check out our Knowledgebase for helpful articles and solutions!
rnjie
Posts: 157
Joined: Wed Mar 20, 2019 4:59 pm

Re: using nrpe to monitor jmx

Post by rnjie »

hard coding the command worked
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: using nrpe to monitor jmx

Post by lmiltchev »

Great! Let us know if this is an acceptable "workaround", and if we could close this topic.
Be sure to check out our Knowledgebase for helpful articles and solutions!
rnjie
Posts: 157
Joined: Wed Mar 20, 2019 4:59 pm

Re: using nrpe to monitor jmx

Post by rnjie »

please close the case
Locked