Page 1 of 1

NRPE: Unable to read output

Posted: Wed Apr 01, 2015 1:45 am
by larp
I have download the check_zfs.pl from the exchange site, and get a "NRPE: Unable to read output" when I use it, it runs well without nrpe both as root and as the nagios user.
this is the output that I get, I also showed the output from "check_swap.pl" which works fine.
This is the output from the client:
root@W96248:global # id
uid=0(root) gid=0(root)
root@W96248:global # ls -l check_zfs.pl
-rwxr-xr-x 1 nagios bin 18390 Mar 31 15:15 check_zfs.pl
root@W96248:global # ./check_nrpe -H 127.0.0.1
NRPE v2.14
root@W96248:global # ./check_nrpe -H 127.0.0.1 -t 30 -c check_zfs -a '-p'
NRPE: Unable to read output
root@W96248:global # ./check_zfs.pl -p
OK: ZFS on W96248 - No zfs failures detected
root@W96248:global # ./check_nrpe -H 127.0.0.1 -t 30 -c check_swap -a '-w 30% -c 20% -m swap'
OK: Available swap (85.0%) > warning threshold (30.0%)|available=57729836kB free=49087576kB allocated=8169424kB reserved=472836kB used=8642260kB
root@W96248:global # su - nagios
Oracle Corporation SunOS 5.10 Generic Patch January 2005
-bash-3.2$ cd /opt/nagios/libexec
-bash-3.2$ ./check_zfs.pl -p
OK: ZFS on W96248 - No zfs failures detected
-bash-3.2$ id
uid=346(nagios) gid=139(nagios)
-bash-3.2$ ./check_nrpe -H 127.0.0.1 -t 30 -c check_zfs -a '-p'
NRPE: Unable to read output
-bash-3.2$

Re: NRPE: Unable to read output

Posted: Wed Apr 01, 2015 9:02 am
by jdalrymple
Hi larp,

I found this promising little bit of documentation: http://tech.ebusinessjuncture.com/2009/ ... n-solaris/

The output you're getting is usually indicative of the actual binary/script that runs under NRPE being unexecutable or the nagios/nrpe user being unable to find it, so that guy is likely on to something. Take a look and let us know if that helps.

Re: NRPE: Unable to read output

Posted: Wed Apr 01, 2015 9:20 am
by larp
Hi

Check that, I can run other perl script e.g. check_mem.pl without any issues, this is the only script that gives that error.

Best
Lars

Re: NRPE: Unable to read output

Posted: Wed Apr 01, 2015 9:54 am
by jdalrymple
This "feels" like an selinux issue, although it is most definitely not. NRPE isn't running chrooted is it? That may be the issue. I'm guessing the deep-underlying problem isn't so much the check_zfs.pl script as it is the ability for the nagios user to call the zfs binary (no doubt part of that script) from the NRPE created env.

Maybe make sure all the paths are absolute in the script, and also absolute path in your nrpe.cfg?

Re: NRPE: Unable to read output

Posted: Tue Apr 07, 2015 4:22 am
by larp
Hi

Nice hint I found that the script could only run in /opt/nagios/libexec, until I change the lib line to

use lib "/opt/nagios/libexec";

Thank you for your help.

Best
Lars

Re: NRPE: Unable to read output

Posted: Tue Apr 07, 2015 9:12 am
by tmcdonald
I'll be closing this thread now, but feel free to open another if you need anything in the future!