Page 3 of 4
Re: NRPE: UNKNOWN Can't connect to the JVM
Posted: Tue Nov 21, 2017 12:27 pm
by pmoradiya
npolovenko wrote:@pmoradiya, Sounds good, keep us updated!
Here are the updates:
Bad News first.
Performed clean uninstall of NRPE v3.2.1 and tried installing v2.x
Got issues with installing 2.x with some ssl errors although openssl and libssl-dev were already installed
The Good News
After clean uninstall of v3.2.1. Performed re-installation of NRPE v3.2.1 in following sequence with added step of uninstalling/re-installing xinetd in between. I am not sure how this worked out to be successful.
Code: Select all
# cd /opt/
# wget https://github.com/NagiosEnterprises/nrpe/releases/download/nrpe-3.2.1/nrpe-3.2.1.tar.gz
# tar xzf nrpe-3.2.1.tar.gz
# cd nrpe-3.2.1
# ./configure
# make all
# make install-groups-users
# make install
# make install-config
# make install-inetd
# make install-init
# systemctl enable nrpe
## Added steps to remove and install xinetd
# apt-get remove xinetd
# apt-get install xinetd
## Update /etc/xinetd.d/nrpe as required
service xinetd restart
service nrpe restart
## Add nagios in sudoers as below
nagios ALL=(ALL) NOPASSWD: /usr/local/nagios/libexec/
Re: NRPE: UNKNOWN Can't connect to the JVM
Posted: Tue Nov 21, 2017 1:50 pm
by npolovenko
@pmoradiya, So the JVM plugin finally started to work?
Re: NRPE: UNKNOWN Can't connect to the JVM
Posted: Wed Nov 22, 2017 3:29 pm
by pmoradiya
npolovenko wrote:@pmoradiya, So the JVM plugin finally started to work?
JVM plugin was always working outside NRPE. Somehow NRPE was not able to work.
But with reinstallation and an odd-addition of removing/installing xinetd in between did the trick. Don't know how.
Thank you all for the great and quick support. Much appreciate it.
Re: NRPE: UNKNOWN Can't connect to the JVM
Posted: Mon Nov 27, 2017 11:06 am
by tmcdonald
Glad to hear it! Are we okay to close this thread?
Re: NRPE: UNKNOWN Can't connect to the JVM
Posted: Tue Nov 28, 2017 9:55 am
by pmoradiya
tmcdonald wrote:Glad to hear it! Are we okay to close this thread?
This could have been closed but the same issue persists in other servers. Above steps somehow fixed the issue on one set of servers but the others still have the same issue.
Will really appreciate your suggestions.
Re: NRPE: UNKNOWN Can't connect to the JVM
Posted: Wed Nov 29, 2017 4:29 pm
by npolovenko
@pmoradiya, Are you able just to run the following command as Nagios user?
/usr/local/nagios/libexec/check_jvm -n org.apache.catalina.startup.Bootstrap -p threads -w 195 -c 225
Can you also run and post the output
ps -ef and
netstat -anp | grep 5666 on the server where you had to reinstall nrpe in order for this plugin to work.
And just to throw in an extra option, I think a remote support session could be beneficial in this kind of scenario. You can email our sales team to set one up at
sales@nagios.com
Re: NRPE: UNKNOWN Can't connect to the JVM
Posted: Thu Nov 30, 2017 1:21 pm
by pmoradiya
npolovenko wrote:@pmoradiya, Are you able just to run the following command as Nagios user?
/usr/local/nagios/libexec/check_jvm -n org.apache.catalina.startup.Bootstrap -p threads -w 195 -c 225
Can you also run and post the output
ps -ef and
netstat -anp | grep 5666 on the server where you had to reinstall nrpe in order for this plugin to work.
And just to throw in an extra option, I think a remote support session could be beneficial in this kind of scenario. You can email our sales team to set one up at
sales@nagios.com
Thanks @npolovenko.
Yes. I am able to run commands on the shell as nagios (and as root) user that works as expected.
Code: Select all
root@client-server:/# /usr/bin/sudo -u tomcat8 /usr/local/nagios/libexec/check_jvm -n org.apache.catalina.startup.Bootstrap -p threads -w 195 -c 225
OK 14 |threads=14;;;
root@client-server:/# su - nagios
$ /usr/bin/sudo -u tomcat8 /usr/local/nagios/libexec/check_jvm -n org.apache.catalina.startup.Bootstrap -p threads -w 195 -c 225
OK 14 |threads=14;;;
I have attached ps -ef and netstat -anp | grep 5666 outputs
Thanks.
Re: NRPE: UNKNOWN Can't connect to the JVM
Posted: Thu Nov 30, 2017 4:17 pm
by npolovenko
@pmoradiya, Ok, so the nrpe is running under Nagios user as well. Please change the command from this:
Code: Select all
command[check_tomcat_threads]=/usr/bin/sudo -u tomcat8 /usr/local/nagios/libexec/check_jvm -n org.apache.catalina.startup.Bootstrap -p threads -w 195 -c 225
To this:
Code: Select all
command[check_tomcat_threads]=/usr/local/nagios/libexec/check_jvm -n org.apache.catalina.startup.Bootstrap -p threads -w 195 -c 225
After that please restart NRPE with
And run the following command from the Nagios Server:
Code: Select all
./check_nrpe -H localhost -c check_tomcat_threads
PS: We also noticed that in nrpe.cfg file you have backslashes on every line. Was that caused by how you copied it over, or do you actually have backslashes in the cfg file? If you do I highly recommend removing them before going over what I posted above.
Re: NRPE: UNKNOWN Can't connect to the JVM
Posted: Fri Dec 01, 2017 10:03 am
by pmoradiya
The cfg file doesn't have backslash on my server. It would have been some format change when i pasted in the txt file here.
Regarding change in command as suggested, returned the following error the command is to be run as tomcat8 user.
Code: Select all
# /usr/local/nagios/libexec/check_nrpe -H localhost -c check_tomcat_threads
UNKNOWN JVM is running with different username, run this script with UID 112
Re: NRPE: UNKNOWN Can't connect to the JVM
Posted: Fri Dec 01, 2017 12:27 pm
by npolovenko
@pmoradiya, As we are running out of options I'd suggest to do what I recommended earlier which is enabling the shell for tomcat 8 user
.
1. Open /etc/passwd file and look for tomcat8 username.
2. Change the ending from /sbin/nologin to /bin/bash
*After that please make sure that you can log in with su - tomcat8.
Then please change the command back to:
Code: Select all
command[check_tomcat_threads]=/usr/bin/sudo -u tomcat8 /usr/local/nagios/libexec/check_jvm -n org.apache.catalina.startup.Bootstrap -p threads -w 195 -c 225
Restart nrpe with: