NSCA and long output

Aaron Mills aaron.mills at returnpath.net
Thu May 29 23:35:09 CEST 2008


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
aaron.mills at returnpath.net
 

-------------------------------------------------------------------------
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 at 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





More information about the Users mailing list