UNKNOWN JVM is running with different username, run this scr

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
anish
Posts: 161
Joined: Tue Jul 19, 2016 5:29 am

UNKNOWN JVM is running with different username, run this scr

Post by anish »

Hi ,

I am executing check_jvm.sh plugin in our tomcat server as root user. But it throw below error,

"UNKNOWN JVM is running with different username, run this script with UID 1011"

I couldnot get the output.

Please do the needful.

Thanks,
Nagarajan.M
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

Re: UNKNOWN JVM is running with different username, run this

Post by tgriep »

You can search the /etc/passwd file on that server for the UID to see what username it is expecting.
Run this as root to get the username

Code: Select all

grep 1011 /etc/passwd
Then you would have to change the owner of the script using that username found from the above command using this example.

Code: Select all

chown username check_jvm.sh
Try that and see if it fixes the issue.
Be sure to check out our Knowledgebase for helpful articles and solutions!
anish
Posts: 161
Joined: Tue Jul 19, 2016 5:29 am

Re: UNKNOWN JVM is running with different username, run this

Post by anish »

Hi ,
I tried above one. I got same error.

tomcat:x:1011:301::/home/tomcat:/bin/bash
-rwxrwxrwx 1 tomcat nagios 6580 May 18 16:03 check_jvm.sh

[root@sesklshrddev01 plugins]# ./check_jvm.sh -n Tomcat_BioHazardDev -p heap -w 80 -c 90
UNKNOWN JVM is running with different username, run this script with UID 1011
Please help me
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

Re: UNKNOWN JVM is running with different username, run this

Post by tgriep »

One thing I found in the documentation for the plugin, you need to use sudo to run it as the tomcat user which will make it match the service running as the tomcat user as well.
You would have to edit the command defined in nagios like the example below which will run the plugin as the tomcat user.

Code: Select all

/usr/bin/sudo -u tomcat /usr/local/nagios/libexec/check_jvm.sh -n Tomcat_BioHazardDev -p heap -w 80 -c 90
Try that and if you have any questions, let us know.
Be sure to check out our Knowledgebase for helpful articles and solutions!
anish
Posts: 161
Joined: Tue Jul 19, 2016 5:29 am

Re: UNKNOWN JVM is running with different username, run this

Post by anish »

Hi,

I cannot run from nagios server ( Remote server)

Can you help me.
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

Re: UNKNOWN JVM is running with different username, run this

Post by tgriep »

If you are 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

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.

Code: Select all

command[tomcat_heap]=/usr/bin/sudo -u tomcat /usr/local/nagios/libexec/check_jvm.sh -n Tomcat_BioHazardDev -p heap -w 80 -c 90
Then restart the NRPE Agent and see if this fixes the issue for you.

Take a look at the README file for that plugin at this link.
https://fidanov.net/c0d3/nagios-plugins ... tor/README
Be sure to check out our Knowledgebase for helpful articles and solutions!
Locked