Error in check_jvm script

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
Poulami
Posts: 6
Joined: Tue May 23, 2017 5:07 am

Error in check_jvm script

Post by Poulami »

Hi Team,

I am facing an issue while running the check_jvm script .
Whenever I run the script from nagios user, it shows below error message :
'UNKNOWN JVM is running with different username, run this script with UID 2000'

However, If I run this script from app user then it works fine.

EUID of nagios user = 2003
EUID of app user = 2000

How will I be able to run this script successfully from nagios user?
Note : Tomcat is running from app user.

Regards,
Poulami
dwhitfield
Former Nagios Staff
Posts: 4583
Joined: Wed Sep 21, 2016 10:29 am
Location: NoLo, Minneapolis, MN
Contact:

Re: Error in check_jvm script

Post by dwhitfield »

I assume https://exchange.nagios.org//directory/ ... vm/details is what you are using? The instructions make it clear
it must be started with
the same USERid as the target JVM
Also, I found this bit useful in the readme (https://fidanov.net/c0d3/nagios-plugins ... tor/README):
Usually the plugin is locally installed on monitored system and executed through NRPE.
The NRPE documentation can be high-level at points, but it will be useful if you are not familiar with NRPE: https://assets.nagios.com/downloads/nag ... e/NRPE.pdf

If you do not like the current state of Java checking, I would suggest letting your requirements known at https://github.com/nagios-plugins/nagio ... issues/279
Poulami
Posts: 6
Joined: Tue May 23, 2017 5:07 am

Re: Error in check_jvm script

Post by Poulami »

I am pretty sure the script will work when this will be running through the user which is responsible for running tomcat.

Now in case of NRPE, i have configured nagios user in nrpe.cfg.

Code: Select all

nrpe_user=nagios
So if I run the script through NRPE will it work?
User avatar
tgriep
Madmin
Posts: 9177
Joined: Thu Oct 30, 2014 9:02 am

Re: Error in check_jvm script

Post by tgriep »

When using the NRPE agent to run the check on the remote system, you would have to edit the /etc/sudoers file on the remote server and add the following entry. Adjust the command name if needed.

Code: Select all

nagios    ALL=(ALL) NOPASSWD: /usr/local/nagios/libexec/check_jvm.sh
Then the command that is defined in the nrpe.cfg file would look like the example below. Replace <username> with the account that is associated with UID of 2000.

Code: Select all

command[check_jvm_nrpe]=/usr/bin/sudo -u <username> /usr/local/nagios/libexec/check_jvm.sh -n what ever options you need
Then restart the NRPE Agent and see if this fixes the issue for you.
Be sure to check out our Knowledgebase for helpful articles and solutions!
Locked