NRPE: UNKNOWN Can't connect to the JVM

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.
pmoradiya
Posts: 26
Joined: Fri Oct 06, 2017 9:48 am

Re: NRPE: UNKNOWN Can't connect to the JVM

Post 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/
npolovenko
Support Tech
Posts: 3457
Joined: Mon May 15, 2017 5:00 pm

Re: NRPE: UNKNOWN Can't connect to the JVM

Post by npolovenko »

@pmoradiya, So the JVM plugin finally started to work? 8-)
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
pmoradiya
Posts: 26
Joined: Fri Oct 06, 2017 9:48 am

Re: NRPE: UNKNOWN Can't connect to the JVM

Post by pmoradiya »

npolovenko wrote:@pmoradiya, So the JVM plugin finally started to work? 8-)
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.
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: NRPE: UNKNOWN Can't connect to the JVM

Post by tmcdonald »

Glad to hear it! Are we okay to close this thread?
Former Nagios employee
pmoradiya
Posts: 26
Joined: Fri Oct 06, 2017 9:48 am

Re: NRPE: UNKNOWN Can't connect to the JVM

Post 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.
npolovenko
Support Tech
Posts: 3457
Joined: Mon May 15, 2017 5:00 pm

Re: NRPE: UNKNOWN Can't connect to the JVM

Post 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
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
pmoradiya
Posts: 26
Joined: Fri Oct 06, 2017 9:48 am

Re: NRPE: UNKNOWN Can't connect to the JVM

Post 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.
Attachments
ps-ef.rtf
(7.52 KiB) Downloaded 224 times
netstat-ouput.rtf
(561 Bytes) Downloaded 211 times
npolovenko
Support Tech
Posts: 3457
Joined: Mon May 15, 2017 5:00 pm

Re: NRPE: UNKNOWN Can't connect to the JVM

Post 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

Code: Select all

service nrpe restart
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.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
pmoradiya
Posts: 26
Joined: Fri Oct 06, 2017 9:48 am

Re: NRPE: UNKNOWN Can't connect to the JVM

Post 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
npolovenko
Support Tech
Posts: 3457
Joined: Mon May 15, 2017 5:00 pm

Re: NRPE: UNKNOWN Can't connect to the JVM

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

Code: Select all

service nrpe restart
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Locked