Page 1 of 1

“Long service output” in Nagios gets chomped for some reason

Posted: Wed Jan 22, 2014 8:40 am
by littlesandra88
Hello all =)

According to this page[1] the limit of $LONGSERVICEOUTPUT$ is 4kB, but in my case, it stops showing the rest of the output after 970 bytes of output (26 lines), where there multiple newlines no long lines. I use NRPE 2.14 and Nagios 3.5.1.

[1]: http://nagios.sourceforge.net/docs/3_0/pluginapi.html

Question

Any idea what is wrong?

My Nagios plugin

Code: Select all

#!/usr/gnu/bin/sh

ZPOOL="/sbin/zpool"

if ! [ -x $ZPOOL ]; then
    echo "CRITICAL: $ZPOOL not found or not executable."
    exit 3
fi

for DEVICE in $($ZPOOL list -H -o name); do

    HEALTH="$($ZPOOL list -H -o health $DEVICE)"

    case "$HEALTH" in
        ONLINE)
            T="OK: $DEVICE ONLINE. "
            ;;
        DEGRADED)
            T="ERROR: $DEVICE DEGRADED"
            ;;
        FAULTED)
            T="ERROR: $DEVICE FAULTED"
            ;;
        OFFLINE)
            T="ERROR: $DEVICE OFFLINE"
            ;;
        REMOVED)
            T="ERROR: $DEVICE REMOVED"
            ;;
        UNAVAIL)
            T="ERROR: $DEVICE UNAVAIL"
            ;;
        FAULTED)
            T="ERROR: $DEVICE FAULTED"
            ;;
        *)
            T="CRITICAL: $HEALTH is an unknown zpool state for $DEVICE."
            ;;
    esac

    M+="$T"
    S+="$($ZPOOL status $DEVICE)"
done

echo "$M"
echo "$S"

if grep -q CRITICAL <<< "$M"; then
    exit 3
elif grep -qE 'DEGRADED|FAULTED|OFFLINE|REMOVED|UNAVAIL|FAULTED' <<< "$M"; then
    exit 2
elif grep -q ONLINE <<< "$M"; then
    exit 0
fi

Re: “Long service output” in Nagios gets chomped for some re

Posted: Wed Jan 22, 2014 5:27 pm
by slansing
What is the output if you manually execute that plugin check from the nagios CLI?

Re: “Long service output” in Nagios gets chomped for some re

Posted: Thu Jan 23, 2014 9:18 am
by littlesandra88
If I run it from the Nagios monitor host:

Code: Select all

[root@nagios ~]# /usr/lib64/nagios/plugins/check_nrpe -H nas -c check_zfs_zpool
OK: rpool ONLINE. OK: tank3 ONLINE. 
  pool: rpool
 state: ONLINE
  scan: resilvered 33.4G in 0h11m with 0 errors on Thu Jan 16 14:44:21 2014
config:

	NAME        STATE     READ WRITE CKSUM
	rpool       ONLINE       0     0     0
	  mirror-0  ONLINE       0     0     0
	    c4d0s0  ONLINE       0     0     0
	    c5d0s0  ONLINE       0     0     0

errors: No known data errors  pool: tank3
 state: ONLINE
  scan: none requested
config:

	NAME                       STATE     READ WRITE CKSUM
	tank3                      ONLINE       0     0     0
	  raidz2-0                 ONLINE       0     0     0
	    c3t5000C5004F306B02d0  ONLINE       0     0     0
	    c3t5000C5004F2B9E40d0  ONLINE       0     0     0
	    c3t5000C5004F2BB2A3d0  ONLINE       0     0     0
	    c3t5000C5004F2F8A6Cd0  ONLINE       0     0     0
	    c3t5000C5004F2F83C9d0  ONLINE       0     0     0
	    c3t5000C5004F2F978Bd0  ONLINE       0     0     0
	  raidz2-1                 ONLINE       0     0     0
	    c3t5000C5004F3009C3d0  ONLI
[root@nagios ~]# 
I get the same result if I do it on the locally on the nas host:

Code: Select all

root@nas:~# /usr/local/nagios/libexec/check_nrpe -H localhost -c check_zfs_zpool
OK: rpool ONLINE. OK: tank3 ONLINE. 
  pool: rpool
 state: ONLINE
  scan: resilvered 33.4G in 0h11m with 0 errors on Thu Jan 16 14:44:21 2014
config:

        NAME        STATE     READ WRITE CKSUM
        rpool       ONLINE       0     0     0
          mirror-0  ONLINE       0     0     0
            c4d0s0  ONLINE       0     0     0
            c5d0s0  ONLINE       0     0     0

errors: No known data errors  pool: tank3
 state: ONLINE
  scan: none requested
config:

        NAME                       STATE     READ WRITE CKSUM
        tank3                      ONLINE       0     0     0
          raidz2-0                 ONLINE       0     0     0
            c3t5000C5004F306B02d0  ONLINE       0     0     0
            c3t5000C5004F2B9E40d0  ONLINE       0     0     0
            c3t5000C5004F2BB2A3d0  ONLINE       0     0     0
            c3t5000C5004F2F8A6Cd0  ONLINE       0     0     0
            c3t5000C5004F2F83C9d0  ONLINE       0     0     0
            c3t5000C5004F2F978Bd0  ONLINE       0     0     0
          raidz2-1                 ONLINE       0     0     0
            c3t5000C5004F3009C3d0  ONLI
root@nas:~# 

Re: “Long service output” in Nagios gets chomped for some re

Posted: Fri Jan 24, 2014 8:27 am
by littlesandra88
I have opened this thread, as it looks like a bug in NRPE.

http://support.nagios.com/forum/viewtop ... 34&t=25221

Re: “Long service output” in Nagios gets chomped for some re

Posted: Fri Jan 24, 2014 1:45 pm
by slansing
Sounds good, we will continue over there. It might actually be an issue with the plugin, we just fixed check_disk so that it now has a flag for longoutput.