All pastes #2072899 Raw Edit

Something

public shellscript v1 · immutable
#2072899 ·published 2011-05-31 18:35 UTC
rendered paste body
#!/bin/bash# the filename for the fifo is passed on the command line.# could just be defined in here, and not /etc/nagios/resource.cfg# the fifo is currently only used by this script and the eggdrop glueFIFO=$1HOST=$NAGIOS_HOSTNAMEADDR=$NAGIOS_HOSTADDRESSTYPE=$NAGIOS_NOTIFICATIONTYPEif [ "$TYPE" == 'ACKNOWLEDGEMENT' ]; then    TYPE='ACK'elif echo $TYPE | grep FLAPPING; then    TYPE='FLAP'fiif [ "$NAGIOS_SERVICECHECKCOMMAND" != '' ]; then    # service-level alert    STATE=$NAGIOS_SERVICESTATE    SERVICE="$NAGIOS_SERVICEDESC"    OUTPUT="$NAGIOS_SERVICEOUTPUT"    SERVICE_INFO="$SERVICE: $OUTPUT"else    # host-level alert    STATE="$NAGIOS_HOSTSTATE"fiprintf "%-4.4s %-7.7s %-23.23s %-18.18s" $STATE $TYPE $HOST "[$ADDR]" > $FIFOif [ "$SERVICE_INFO" != '' ]; then    echo "  $SERVICE_INFO" > $FIFOfiif [ "$NAGIOS_NOTIFICATIONCOMMENT" != '' ]; then    echo "  $NAGIOS_NOTIFICATIONAUTHORNAME: $NAGIOS_NOTIFICATIONCOMMENT" > $FIFOfi