Page 1 of 1
UNKNOWN JVM is running with different username, run this scr
Posted: Thu May 18, 2017 11:21 am
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
Re: UNKNOWN JVM is running with different username, run this
Posted: Thu May 18, 2017 1:24 pm
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
Then you would have to change the owner of the script using that username found from the above command using this example.
Try that and see if it fixes the issue.
Re: UNKNOWN JVM is running with different username, run this
Posted: Mon May 22, 2017 7:17 am
by anish
Hi ,
I tried above one. I got same error.
tomcat

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
Re: UNKNOWN JVM is running with different username, run this
Posted: Mon May 22, 2017 9:05 am
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.
Re: UNKNOWN JVM is running with different username, run this
Posted: Mon May 22, 2017 10:20 am
by anish
Hi,
I cannot run from nagios server ( Remote server)
Can you help me.
Re: UNKNOWN JVM is running with different username, run this
Posted: Mon May 22, 2017 11:56 am
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