Check_JVM - Check_nrpe Connection Set by Peer

An open discussion forum for obtaining help with Nagios Core. Nagios Core users of all experience levels are welcome here. Subforum have been created for the discussion of Nagios Core and Nagios Plugin development.

NOTE: The SourceForge.net mailing lists have been deprecated in favor of this forum in order to expedite support and provide additional features not available on the old mailing list.

Check_JVM - Check_nrpe Connection Set by Peer

Postby cybergene » Thu Nov 14, 2019 8:47 am

So I was trying out Check_jvm for monitoring Java thread and Heap and I came across this posting:
viewtopic.php?f=7&t=46300&start=30#p238851

I followed the same steps and I managed to pass the initial error
Code: Select all
UNKNOWN Can't connect to the JVM

and Now when I try to run the command similar to what the post says, I get the following error
Code: Select all
./check_nrpe -H localhost -c check_jvm_threads
CHECK_NRPE: Error - Could not connect to ::: Connection reset by peer

check_jvm has chmod 777
sudoers file has been updated

My nrpe.cfg has the following commands:
Code: Select all
allowed_hosts=127.0.0.1,<nagios_server_ip>

# check_jvm
command[check_jvm_threads]=/usr/bin/sudo -u jenkins /usr/local/nagios/libexec/check_jvm -n remoting.jar -p threads -w 195 -c 225

Checking the java processes running :
Code: Select all
ps aux | grep java
ec2-user 10254  0.0  0.0 112712   972 pts/0    S+   13:42   0:00 grep --color=auto java
jenkins  16361  0.0  0.0 113184  1580 ?        Ss   Nov08   0:00 bash -c cd "/home/jenkins" && java  -jar remoting.jar -workDir /home/jenkins
jenkins  16370  0.6  1.8 7797188 291688 ?      Sl   Nov08  53:17 java -jar remoting.jar -workDir /home/jenkins

checking the JVM for Jenkins with the JavaInspector:
Code: Select all
sudo su - jenkins -c "java -jar /usr/local/bin/JvmInspector.jar all"

JVM pid: 16370
  name: remoting.jar -workDir /home/jenkins
  thread count: 27 (peak: 223)
  class count: 5266
  heap memory: max=3659530240|commited=115867648|used=71438600
  non-heap memory: max=-1|commited=61997056|used=58888112
  java version: 1.8.0_232 (Oracle Corporation)
  java home: /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.232.b09-0.el7_7.x86_64/jre
  jvm arguments: []
  class path: remoting.jar


Any help is appreciated!
cybergene
 
Posts: 82
Joined: Wed Aug 10, 2016 7:38 am
Location: Ottawa, Ontario, Canada

Re: Check_JVM - Check_nrpe Connection Set by Peer

Postby benjaminsmith » Thu Nov 14, 2019 3:48 pm

Hello @cybergeen,

Well, it looks like it's close. Have you opened port 5666 for NRPE in the firewall?

1. Run the following on the remote host and post the output.
Code: Select all
./check_nrpe -H 127.0.0.1

2. Do you know if NRPE is installed as a daemon or running under xinetd? The allowed host configuration is different for each type of installation. Post output of the following command. Thanks.
Code: Select all
cat /etc/xinetd.d/nrpe
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.

Be sure to check out our Knowledgebase for helpful articles and solutions!
User avatar
benjaminsmith
 
Posts: 1992
Joined: Wed Aug 22, 2018 4:39 pm
Location: saint paul

Re: Check_JVM - Check_nrpe Connection Set by Peer

Postby cybergene » Wed Nov 20, 2019 1:24 pm

Hi @benjaminsmith

It doesn't seem closed to me.


The command return a good result
Code: Select all
./check_nrpe -H 127.0.0.1
NRPE v3.2.1


And the service is running as as daemon:
Code: Select all
sudo systemctl status nrpe
● nrpe.service - Nagios Remote Plugin Executor
   Loaded: loaded (/usr/lib/systemd/system/nrpe.service; disabled; vendor preset: disabled)
   Active: active (running) since Wed 2019-11-13 20:47:05 UTC; 6 days ago
     Docs: http://www.nagios.org/documentation
  Process: 6252 ExecStopPost=/bin/rm -f /usr/local/nagios/var/nrpe.pid (code=exited, status=0/SUCCESS)
Main PID: 6256 (nrpe)
   CGroup: /system.slice/nrpe.service
           └─6256 /usr/local/nagios/bin/nrpe -c /usr/local/nagios/etc/nrpe.cfg -f


Other commands aon this Linux box are running well, (CPU and Memory..). It is only this command with the check_jvm that doesn't work.
cybergene
 
Posts: 82
Joined: Wed Aug 10, 2016 7:38 am
Location: Ottawa, Ontario, Canada

Re: Check_JVM - Check_nrpe Connection Set by Peer

Postby benjaminsmith » Wed Nov 20, 2019 4:49 pm

Hello @cybergene,

Ok. Let's try and get this worked out. Are you able to run the plugin locally on the remote host? Log in as the nagios user, and run the check command.
Code: Select all
su - nagios
/usr/bin/sudo -u jenkins /usr/local/nagios/libexec/check_jvm -n remoting.jar -p threads -w 195 -c 225

What are the permissions on the plugin?
Code: Select all
ls -l /usr/local/nagios/libexec/check_jvm

Can you post your sudoers file for us to review? Thanks.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.

Be sure to check out our Knowledgebase for helpful articles and solutions!
User avatar
benjaminsmith
 
Posts: 1992
Joined: Wed Aug 22, 2018 4:39 pm
Location: saint paul

Re: Check_JVM - Check_nrpe Connection Set by Peer

Postby cybergene » Mon Nov 25, 2019 8:35 am

Hello @benjaminsmith,
Sorry for the late reply but I was busy at work, here are the results of the commands you asked for:

Log in as the nagios user, and run the check command
Code: Select all
[nagios@ip-xx-xxx-x-xx libexec]$ /usr/bin/sudo -u jenkins /usr/local/nagios/libexec/check_jvm -n remoting.jar -p threads -w 195 -c 225
UNKNOWN Can't connect to the JVM:


Permission for the check_jvm plugin

Code: Select all
[nagios@ip-xx-xxx-x-xx libexec]$ ls -l /usr/local/nagios/libexec/check_jvm
-rwxrwxrwx. 1 nagios nagios 5981 Nov 13 19:58 /usr/local/nagios/libexec/check_jvm
cybergene
 
Posts: 82
Joined: Wed Aug 10, 2016 7:38 am
Location: Ottawa, Ontario, Canada

Re: Check_JVM - Check_nrpe Connection Set by Peer

Postby tgriep » Mon Nov 25, 2019 4:09 pm

You are trying to run the plugin as the jenkins user so there has to be some permission changes/

Edit the /etc/sudoers file and make sure the following entry it there.

Code: Select all
jenkins ALL=(ALL) NOPASSWD: /usr/local/nagios/libexec/check_jvm


Another thing, the permissions of the plugin is set, the folder may be restricting the jenkins user.
Try editing the /etc/groups file and add the jenkins user to the nagios group and see if that works.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.

Be sure to check out our Knowledgebase for helpful articles and solutions!
User avatar
tgriep
Madmin
 
Posts: 8429
Joined: Thu Oct 30, 2014 9:02 am

Re: Check_JVM - Check_nrpe Connection Set by Peer

Postby cybergene » Tue Nov 26, 2019 12:52 pm

I already have added that to the sudoers file and it still not working.

I tried changing the owner of the libexec/ to Jenkins user and it still can't connect to JVM

Code: Select all
$ sudo chown jenkins:jenkins libexec/
$ /usr/bin/sudo -u jenkins /usr/local/nagios/libexec/check_jvm -n remoting.jar -p threads -w 195 -c 225
UNKNOWN Can't connect to the JVM:


is there something specific about this plugin? Do you suggest any other plugin to monitor JVM ? A plugin that you know it works?
cybergene
 
Posts: 82
Joined: Wed Aug 10, 2016 7:38 am
Location: Ottawa, Ontario, Canada

Re: Check_JVM - Check_nrpe Connection Set by Peer

Postby tgriep » Tue Nov 26, 2019 1:39 pm

Open up the plugin and see is it is using any applications to gather the data it requires.
Make sure the applications have the full path to them as the jenkins user may have a different default path set.

Also, the jenkins user has to have permissions to run those applications as well.
You would have to add that to the sudoers file.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.

Be sure to check out our Knowledgebase for helpful articles and solutions!
User avatar
tgriep
Madmin
 
Posts: 8429
Joined: Thu Oct 30, 2014 9:02 am

Re: Check_JVM - Check_nrpe Connection Set by Peer

Postby cybergene » Tue Dec 10, 2019 1:12 pm

It did not work for me- same error, anyways you can close this for now. It is not a high priority now. If I have more questions I'll let you know.

Thank you!
cybergene
 
Posts: 82
Joined: Wed Aug 10, 2016 7:38 am
Location: Ottawa, Ontario, Canada


Return to Nagios Core

Who is online

Users browsing this forum: Google [Bot], neilpmurray and 23 guests