I am trying to gather some stats from my JVM, here: a tomcat process.
I've been trying for ages to get my head around a problem but did not succeed, thus I'm seeking for your help.
I think I have read almost each and every topic regarding this issue, yet the issue is still not sorted out.
I startet with the script "check_jstat.sh" from here: https://exchange.nagios.org/directory/P ... at/details
I think I've included all mandatory changes to the script (e.g. call "jstat" using sudo) and provisioned access to the script in /etc/sudoers.
I have also set up
Code: Select all
Defaults:nagios !requiretty
wheres the manual call of the script (as NRPE-user 'nagios') returns the expected result:
Code: Select all
nagios@MYMACHINE[~]> sudo /usr/lib/nagios/plugins/check_jstat.sh -p 1314 -w 90 -c 95
OK:jstat process 1314 alive, | 1314_heap=1991275520B;3865470566;4080218931;0;4294967296 1314_heap_ratio=46%;90;95;0;100 1314_perm=573860864B;1481637888;1563951104;0;1646264320 1314_perm_ratio=34%;90;95;0;100
Code: Select all
cat /usr/lib/nagios/plugins/check_test.sh
#!/bin/bash
sudo jstat -gc 1314 | tail -1 | sed -e 's/[ ][ ]*/ /g' > ~/check_test.log 2>&1
exit 5
Code: Select all
nagios@MYMACHINE[~]> sudo /usr/lib/nagios/plugins/check_test.sh
root@MYMACHINE[/usr/lib/nagios/plugins]> cat ~root/check_test.log
38912,0 39424,0 23936,3 0,0 1318912,0 672096,7 1664512,0 1338755,6 646840,0 560757,3 88288,0 71962,9 29418 2113,383 110 110,260 2223,643
Code: Select all
command[check_test]=sudo /usr/lib/nagios/plugins/check_test.sh
Code: Select all
nagios@nagios[/usr/local/nagios/libexec]> ./check_nrpe -H p083.persis.de -c check_test
The debug log show:
Code: Select all
Feb 4 15:44:53 p083 nrpe[16032]: Connection from x.x.x.x port 12960
Feb 4 15:44:53 p083 nrpe[16032]: Host address is in allowed_hosts
Feb 4 15:44:53 p083 nrpe[16032]: Host x.x.x.x is asking for command 'check_test' to be run...
Feb 4 15:44:53 p083 nrpe[16032]: Running command: sudo /usr/lib/nagios/plugins/check_test.sh
Feb 4 15:44:53 p083 nrpe[16032]: Command completed with return code 3 and output:
Feb 4 15:44:53 p083 nrpe[16032]: Return Code: 3, Output: NRPE: Unable to read output
Feb 4 15:44:53 p083 nrpe[16032]: Connection from x.x.x.x closed.
What am I doing wrong?
Any help is greaty appreciated!
Best regards,
Dennis