As it turns out, getting long output working was a little easier than I
anticipated. The UI turns "\n" into "<BR>". So I'm able to bundle the
long output into the standard plugin output. All I had to do in the end
was pass $LONGSERVICEOUTPUT$ with $SERVICEOUTPUT$ like this:

define command{
        command_name    submit_check_result
        command_line
/usr/local/nagios/libexec/eventhandlers/submit_check_result $HOSTNAME$
'$SERVICEDESC$' $SERVICESTATE$ '$SERVICEOUTPUT$' '$LONGSERVICEOUTPUT$'
        }



Then I copied submit_check_result script from the Distributed Monitoring
Doc that's on the web, and modified it accordingly:

...snip...

case "$3" in
            OK)
                        return_code=0
                                ;;
        WARNING)
                    return_code=1
                ;;
        CRITICAL)
                    return_code=2
                ;;
        UNKNOWN)
                    return_code=-1
                ;;
esac


if [[ $5 ]]
then
        LONGOUT="$4\n$5"
else
        LONGOUT=$4
fi

printf "%s\t%s\t%s\t%s\n" "$1" "$2" "$return_code" "$LONGOUT" |
/usr/local/nagios/bin/send_nsca -H myhost.com -c
/usr/local/nagios/etc/send_nsca.cfg

...snip...


Just don't ask me how to turn this back into $LONGSERVICEOUTPUT$ once
it's on the master Nagios server.


Aaron Mills
Systems Administrator
Return Path, Inc.
http://www.returnpath.net
[EMAIL PROTECTED]
 

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Nagios-users mailing list
Nagios-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting 
any issue. 
::: Messages without supporting info will risk being sent to /dev/null

Reply via email to