=================================================================== RCS file: /cvs/nagios/alert/alert,v retrieving revision 1.3 retrieving revision 1.6 diff -u -r1.3 -r1.6 --- nagios/alert/alert 2010/02/16 17:18:31 1.3 +++ nagios/alert/alert 2010/02/18 19:17:42 1.6 @@ -1,5 +1,5 @@ #!/bin/sh -# $AFresh1: alert,v 1.1 2010/02/16 16:48:01 andrew Exp $ +# $AFresh1: alert,v 1.5 2010/02/17 16:54:14 andrew Exp $ local _type=$1 local _method=$2 local _contact=$3 @@ -13,14 +13,23 @@ fi +local _notification=$NAGIOS_NOTIFICATIONTYPE +if [ X"" != X"$NAGIOS_NOTIFICATIONCOMMENT" ]; then + _notification="$_notification $NAGIOS_NOTIFICATIONCOMMENT" +fi +if [ X"" != X"$NAGIOS_NOTIFICATIONAUTHOR" ]; then + _notification="$_notification ($NAGIOS_NOTIFICATIONAUTHOR)" +fi + ### HOST Descriptions ### local _short_host="$NAGIOS_HOSTNAME" local _long_host="Date/Time: $NAGIOS_LONGDATETIME -$NAGIOS_NOTIFICATIONTYPE $NAGIOS_NOTIFICATIONCOMMENT +$_notification -Host: $NAGIOS_HOSTALIAS [$NAGIOS_HOSTADDRESS] ($NAGIOS_HOSTOUTPUT) +Host: $NAGIOS_HOSTNAME [$NAGIOS_HOSTADDRESS] $NAGIOS_HOSTALIAS State: $NAGIOS_HOSTSTATE (for $NAGIOS_HOSTDURATION) +$NAGIOS_HOSTOUTPUT https://stats.redrivernet.com/CGi-bin/nagios/extinfo.cgi?type=1&host=$NAGIOS_HOSTNAME " @@ -29,11 +38,12 @@ local _short_svc="$NAGIOS_HOSTNAME $NAGIOS_SERVICEDESC" local _long_svc="Date/Time: $NAGIOS_LONGDATETIME -$NAGIOS_NOTIFICATIONTYPE $NAGIOS_NOTIFICATIONCOMMENT +$_notification -Service: $NAGIOS_SERVICEDESC ($NAGIOS_SERVICEOUTPUT) -Host: $NAGIOS_HOSTALIAS ($NAGIOS_HOSTADDRESS) -State: $NAGIOS_HOSTSTATE (for $NAGIOS_HOSTDURATION) +Host: $NAGIOS_HOSTNAME [$NAGIOS_HOSTADDRESS] $NAGIOS_HOSTALIAS +State: $NAGIOS_SERVICESTATE (for $NAGIOS_SERVICEDURATION) +Service: $NAGIOS_SERVICEDESC +$NAGIOS_SERVICEOUTPUT https://stats.redrivernet.com/cgi-bin/nagios/extinfo.cgi?type=2&host=$NAGIOS_HOSTNAME&service=`echo $NAGIOS_SERVICEDESC | sed -e 's/ /+/g'` " @@ -43,6 +53,7 @@ local _state local _short local _long + case $_type in HOST) _state=$NAGIOS_HOSTSTATE @@ -61,10 +72,11 @@ esac if [ X"$NAGIOS_NOTIFICATIONTYPE" == X"ACKNOWLEDGEMENT" ]; then - _state=$NAGIOS_NOTIFICATIONTYPE + _state=ACK fi -_short=$_state: $_short +_short="`echo $_state | cut -c 1-4`: $_short" +_long=`echo "$_long" | awk '{ gsub(/
/,"\n") }1'` case $_method in mail)