Page 1 of 3

Nagios XI 5R1.0 JMX Not Working

Posted: Wed Oct 07, 2015 4:13 pm
by kvaldez
Hi guys,

I have configured the check_jmx plugin for Nagios XI 5R1.0 and im getting this error on the NagiosXI service configuration -> Test Check Command.
Test_Command.jpg

Code: Select all

OUTPUT: JMX CRITICAL - java not found
This is very weird because on a terminal I get a positive output and everything seems to work fine.
putty.jpg
Im posting the respective pics so anyone can help me.
nagios service detail.jpg
This is the check_jmx script:

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 "$@"
Thanks in advance!

-kvaldez

Re: Nagios XI 5R1.0 JMX Not Working

Posted: Wed Oct 07, 2015 4:17 pm
by hsmith
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?

Re: Nagios XI 5R1.0 JMX Not Working

Posted: Wed Oct 07, 2015 4:32 pm
by kvaldez
I dont get any error on service detail screen.

But when going to Home -> Service Detail Screen on Nagios XI I can see this:
Overview.jpg
-kvaldez

Re: Nagios XI 5R1.0 JMX Not Working

Posted: Thu Oct 08, 2015 11:30 am
by hsmith
Can you try to run the check command from the command line as the 'nagios' user?

Re: Nagios XI 5R1.0 JMX Not Working

Posted: Mon Oct 12, 2015 9:32 am
by kvaldez
Hi,

Thanks for your reply.

From command line this is what I got:
putty.jpg
But what do you mean for run as 'nagios' user?

-kvaldez

Re: Nagios XI 5R1.0 JMX Not Working

Posted: Mon Oct 12, 2015 9:51 am
by hsmith
If you run the command from the command line as root, it sounds like the check is working.

What happens if you switch user to 'nagios' and then run the same check command?

su nagios

Re: Nagios XI 5R1.0 JMX Not Working

Posted: Mon Oct 12, 2015 10:55 am
by kvaldez
Hi,

This is the output from running the command as nagios user:
NagiosUser.jpg
-kvaldez

Re: Nagios XI 5R1.0 JMX Not Working

Posted: Mon Oct 12, 2015 11:06 am
by hsmith
I am not sure if it is going to be this simple, but upon looking at your stuff closer, in the first screenshot you are checking 192.168.0.100... in the command line check, you are checking 192.168.0.99.

Re: Nagios XI 5R1.0 JMX Not Working

Posted: Mon Oct 12, 2015 11:56 am
by kvaldez
Yep, I was trying to connect to different hosts but I always get the same answer, even if the host doesn't exist Im getting the same error:

Code: Select all

OUTPUT: JMX CRITICAL - java not found.
Pic.png
-kvaldez

Re: Nagios XI 5R1.0 JMX Not Working

Posted: Mon Oct 12, 2015 12:10 pm
by hsmith
In your command definition, can you try wrapping the '$ARG' commands in single quotes, or at least the ones that are going to have a space or symbol in them?