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.
runzelpunzel
Posts: 16 Joined: Thu Jul 05, 2018 2:14 am
Post
by runzelpunzel » Fri Feb 28, 2020 1:46 am
This is so bizarre
It is indeed! That's why I'm kinda lost and seeking for your help
Code: Select all
ls -l /usr/lib/nagios/plugins/check_test.sh
-rwxr-xr-x 1 root root 199 Feb 21 08:19 /usr/lib/nagios/plugins/check_test.sh
Looks okay to me!?
PS: I will be AFK in the following week, so any further test / comment will be written after March, 9th.
scottwilkerson
DevOps Engineer
Posts: 19396 Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:
Post
by scottwilkerson » Fri Feb 28, 2020 8:32 am
I wonder if the problem is you need to add the full path to
jstat in the script
When NRPE runs you don't get the full environment for the nagios user, and this could be causing it to fail.
runzelpunzel
Posts: 16 Joined: Thu Jul 05, 2018 2:14 am
Post
by runzelpunzel » Mon Mar 09, 2020 3:11 am
It's the default
/usr/bin/jstat .
Even when I run a
/usr/bin/sudo /usr/bin/jstat -gc 16652 , whereas 16652 is the PID of my java process, I get a proper result.
However, when I run configure
Code: Select all
command[check_sudo_test4]=/usr/bin/sudo /usr/bin/jstat -gc 16652
in
/etc/nagios/nrpe.cfg and call
check_sudo_test4 via NRPE from the nagios server, i get an "
NRPE: Unable to read output "
scottwilkerson
DevOps Engineer
Posts: 19396 Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:
Post
by scottwilkerson » Mon Mar 09, 2020 7:08 am
What is the output you get when you run it directly?
runzelpunzel
Posts: 16 Joined: Thu Jul 05, 2018 2:14 am
Post
by runzelpunzel » Mon Mar 09, 2020 8:09 am
the regular output from jstat, eg.
Code: Select all
S0C S1C S0U S1U EC EU OC OU MC MU CCSC CCSU YGC YGCT FGC FGCT GCT
45056.0 45568.0 0.0 24537.4 1306112.0 914401.5 1668096.0 1393081.2 574832.0 506528.5 79048.0 65307.1 2629 226.672 17 12.857 239.529
Looking into that, "unable to read output" might well be a vaild answer (as we've a multi-line-output, etc.).
This is a very basic testing-script, as the previous tests that were writing to a file an parse the output from jstat didn't work either.
runzelpunzel
Posts: 16 Joined: Thu Jul 05, 2018 2:14 am
Post
by runzelpunzel » Tue Mar 10, 2020 3:44 am
No, it really runs just one time:
Code: Select all
nagios@<MYMACHINE>[~]> /usr/bin/sudo /usr/bin/jstat -gc 16652
S0C S1C S0U S1U EC EU OC OU MC MU CCSC CCSU YGC YGCT FGC FGCT GCT
24064,0 38400,0 23785,2 0,0 1090560,0 323405,2 1622016,0 1587494,2 578800,0 509547,1 79432,0 65639,8 3436 288,142 18 13,699 301,841
nagios@<MYMACHINE>[~]>
scottwilkerson
DevOps Engineer
Posts: 19396 Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:
Post
by scottwilkerson » Tue Mar 10, 2020 3:13 pm
Curious, what output do you get when you run
Code: Select all
/usr/bin/sudo /usr/bin/jstat -gc 16652 2> /dev/null
echo $?
runzelpunzel
Posts: 16 Joined: Thu Jul 05, 2018 2:14 am
Post
by runzelpunzel » Wed Mar 11, 2020 9:55 am
"0", as you would expect.
Code: Select all
nagios@<MYMACHINE>[~]> /usr/bin/sudo /usr/bin/jstat -gc 16652 2> /dev/null
S0C S1C S0U S1U EC EU OC OU MC MU CCSC CCSU YGC YGCT FGC FGCT GCT
17408,0 9216,0 0,0 9188,3 446976,0 325530,5 1664000,0 1205941,3 585968,0 515763,0 80200,0 66246,9 5507 437,466 25 20,204 457,670
nagios@<MYMACHINE>[~]> echo $?
0