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

Nagios XI 5R1.0 JMX Not Working

Post 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
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 »

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?
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 »

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
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 »

Can you try to run the check command from the command line as the 'nagios' user?
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,

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
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 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
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 output from running the command as nagios user:
NagiosUser.jpg
-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 »

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.
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 »

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
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 »

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?
Former Nagios Employee.
me.
Locked