Nagios XI 5R1.0 JMX Not Working

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
User avatar
kvaldez
Posts: 27
Joined: Tue Aug 18, 2015 4:57 pm
Location: Lima/Peru

Re: Nagios XI 5R1.0 JMX Not Working

Post by kvaldez »

Hi,

This is what I got when putting single quotes to '$ARG3':
Image1.jpg
I've tried the same way with the other ARG but I'm getting the same output.

I think the problem is around here, this is the check_jmx.sh file located in /usr/local/nagios/libexec

Code: Select all

#!/bin/sh
#
# Nagios JMX plugin.
#

JAVA_CMD=`which java`

if [ -z $JAVA_CMD ]
then

  if [ -x $JAVA_HOME/bin/java ]
  then
    JAVA_CMD=$JAVA_HOME/bin/java
  else
    echo JMX CRITICAL - java not found.
    exit 2
  fi

fi

DIR=`dirname $0`
$JAVA_CMD -jar $DIR/check_jmx.jar "$@"
As you can see the error Im getting from the Try Command is there

Code: Select all

JMX CRITICAL - java not found.
-kvaldez
You do not have the required permissions to view the files attached to this post.
User avatar
hsmith
Agent Smith
Posts: 3539
Joined: Thu Jul 30, 2015 11:09 am
Location: 127.0.0.1
Contact:

Re: Nagios XI 5R1.0 JMX Not Working

Post by hsmith »

If you read through the comments here, have you made any of the tweaks listed there? Apparently this plugin has some known issues.
Former Nagios Employee.
me.
User avatar
Box293
Too Basu
Posts: 5126
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia
Contact:

Re: Nagios XI 5R1.0 JMX Not Working

Post by Box293 »

hsmith wrote:First thing to point out here would be that the test check command is VERY buggy. I would not use it, as it has issues with special characters. What is the error on the service detail screen?
I would like to re-iterate what @hsmith has said here. Testing the JMX plugin via the Test Check Command button is going to cause you no end of headaches. You MUST follow this method:
  • Make any changes
    Save and Apply Config
    Schedule Immediate Check of the service to perform a test
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
User avatar
kvaldez
Posts: 27
Joined: Tue Aug 18, 2015 4:57 pm
Location: Lima/Peru

Re: Nagios XI 5R1.0 JMX Not Working

Post by kvaldez »

Hi guys,

Thanks to all for your help. Checking on other servers running nagios I found that the same plugin was running without problems on an older version of Nagios XI.

Not sure but im guessing this issue have something to do with the version.

In order to make the plugin work correctly I'll have to use this older Nagios XI version.

Here are some screenShots.

Newer Version:
Pic1.jpg
Version:
Pic2.jpg
Older Version:
Pic3.jpg
If someone has any comment please let me know. If not I think I'll be ok to close this case.

-kvaldez
You do not have the required permissions to view the files attached to this post.
User avatar
hsmith
Agent Smith
Posts: 3539
Joined: Thu Jul 30, 2015 11:09 am
Location: 127.0.0.1
Contact:

Re: Nagios XI 5R1.0 JMX Not Working

Post by hsmith »

We are going to need screenshots/output from something other than the test screen as you've provided here.
Box293 wrote:
hsmith wrote:First thing to point out here would be that the test check command is VERY buggy. I would not use it, as it has issues with special characters. What is the error on the service detail screen?
I would like to re-iterate what @hsmith has said here. Testing the JMX plugin via the Test Check Command button is going to cause you no end of headaches. You MUST follow this method:
  • Make any changes
    Save and Apply Config
    Schedule Immediate Check of the service to perform a test


I would also like some elaboration on this point:

hsmith wrote:If you read through the comments here, have you made any of the tweaks listed there? Apparently this plugin has some known issues.
Also, have you read through this document?
Former Nagios Employee.
me.
User avatar
kvaldez
Posts: 27
Joined: Tue Aug 18, 2015 4:57 pm
Location: Lima/Peru

Re: Nagios XI 5R1.0 JMX Not Working

Post by kvaldez »

Hi,

This is the screen you're asking on the first point.

Home -> Service Detail
pic.png
Sencond as I said, the same plugin worked on the older nagios version, But when installing the same plugin on the newer one the error comes out.

Third, yes I have read the document https://assets.nagios.com/downloads/nag ... ios-XI.pdf , this guide is what help me installing JMX for nagios Nagios XI 2014R2.7, and its working right now.

-kvaldez
You do not have the required permissions to view the files attached to this post.
User avatar
hsmith
Agent Smith
Posts: 3539
Joined: Thu Jul 30, 2015 11:09 am
Location: 127.0.0.1
Contact:

Re: Nagios XI 5R1.0 JMX Not Working

Post by hsmith »

hsmith wrote:If you read through the comments here, have you made any of the tweaks listed there? Apparently this plugin has some known issues.


Have you made any of the modifications to the plugin listed here? I can't think of anything we changed in XI5 that would have broke this plugin..
Former Nagios Employee.
me.
User avatar
kvaldez
Posts: 27
Joined: Tue Aug 18, 2015 4:57 pm
Location: Lima/Peru

Re: Nagios XI 5R1.0 JMX Not Working

Post by kvaldez »

No I haven't.

It seems very strange to me too. But this is the only different between both enviroments where im running nagios XI.

-kvaldez
User avatar
Box293
Too Basu
Posts: 5126
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia
Contact:

Re: Nagios XI 5R1.0 JMX Not Working

Post by Box293 »

Basically what is happening is the plugin cannot find the java executable when it runs as the nagios user. Its something to do with the nagios user account not getting it's environment loaded or something technical like that.

If I'm correct, the /usr/local/nagios/libexec/check_jmx plugin is defined as:

Code: Select all

#!/bin/sh
#
# Nagios plugin to monitor Java JMX (http://java.sun.com/jmx)attributes.
#
RDIR=`dirname $0`
java -cp $RDIR/jmxquery.jar org.nagios.JMXQuery $@
Try changing java to the specific location of the java executable. First find it:

Code: Select all

which java
Lets assume it is in /usr/bin/java

Then update the plugin as follows:

Code: Select all

#!/bin/sh
#
# Nagios plugin to monitor Java JMX (http://java.sun.com/jmx)attributes.
#
RDIR=`dirname $0`
/usr/bin/java -cp $RDIR/jmxquery.jar org.nagios.JMXQuery $@
Does this help?
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
User avatar
kvaldez
Posts: 27
Joined: Tue Aug 18, 2015 4:57 pm
Location: Lima/Peru

Re: Nagios XI 5R1.0 JMX Not Working

Post by kvaldez »

Hi,

Im really sorry for the delay, I was sick this days.

Anyway I tried what you said but looking at the script I found that first the jmx shell finds where is JAVA installed so then it can pass that value to other variables inside the shell

Code: Select all

#!/bin/sh
#
# Nagios JMX plugin.
#

JAVA_CMD=`which java`
The output of which java in my server is this:

Code: Select all

/usr/java/jdk1.7.0_79/bin/java
So I just need to change this on the script:

Code: Select all

#!/bin/sh
#
# Nagios JMX plugin.
#

JAVA_CMD=/usr/java/jdk1.7.0_79/bin/java
The result:
Result.png
Thanks to all of you guys, you really save me on this one.

PD: Please mark this case as solved

-kvaldez
You do not have the required permissions to view the files attached to this post.
Locked