Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

According to this page 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.15 and Nagios 3.5.1.

Question

Any idea what is wrong?

My Nagios plugin

#!/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
share|improve this question

1 Answer 1

up vote 3 down vote accepted

Nagios itself can handle 4k of output from plugins, but NRPE is limited to 1k by default.

You can up this limit in the source and recompile, if you want to. It's defined as MAX_PACKETBUFFER_LENGTH in include/common.h:

include/common.h:#define MAX_PACKETBUFFER_LENGTH    1024

You'll probably have to modify check_nrpe as well, to match the new size. These changes are documented in this old forum discussion, too.

Alternatively, you might be interested in this patch from Opsview that adds similar functionality.

See "The Protocol" section of this random blog for details.

share|improve this answer
    
If I do that then I get CHECK_NRPE: Received 0 bytes from daemon. Check the remote server logs for error messages. –  Sandra Feb 1 at 12:01
    
Feb 1 13:00:50 nas nrpe[3185]: [ID 261363 daemon.error] Error: Request packet had invalid CRC32. Feb 1 13:00:50 nas nrpe[3185]: [ID 900267 daemon.error] Client request was invalid, bailing out... –  Sandra Feb 1 at 12:02
    
I'm guessing this is you? ;-) support.nagios.com/forum/viewtopic.php?f=34&t=25221 –  Keith Feb 2 at 6:13

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.