| version 1.1, 2010/02/16 16:48:01 |
version 1.3, 2010/02/16 17:18:31 |
|
|
| #!/bin/sh |
#!/bin/sh |
| # $AFresh1$ |
# $AFresh1: alert,v 1.1 2010/02/16 16:48:01 andrew Exp $ |
| local _type=$1 |
local _type=$1 |
| local _method=$2 |
local _method=$2 |
| local _contact=$3 |
local _contact=$3 |
|
|
| fi |
fi |
| |
|
| |
|
| |
|
| ### HOST Descriptions ### |
### HOST Descriptions ### |
| |
|
| local _short_host="$NAGIOS_HOSTSTATE: $NAGIOS_HOSTNAME" |
local _short_host="$NAGIOS_HOSTNAME" |
| local _long_host="Date/Time: $NAGIOS_LONGDATETIME |
local _long_host="Date/Time: $NAGIOS_LONGDATETIME |
| Notification Type: $NAGIOS_NOTIFICATIONTYPE |
$NAGIOS_NOTIFICATIONTYPE $NAGIOS_NOTIFICATIONCOMMENT |
| |
|
| Host: $NAGIOS_HOSTALIAS ($NAGIOS_HOSTADDRESS) |
Host: $NAGIOS_HOSTALIAS [$NAGIOS_HOSTADDRESS] ($NAGIOS_HOSTOUTPUT) |
| State: $NAGIOS_HOSTSTATE (for $NAGIOS_HOSTDURATION) |
State: $NAGIOS_HOSTSTATE (for $NAGIOS_HOSTDURATION) |
| |
|
| https://stats.redrivernet.com/CGi-bin/nagios/extinfo.cgi?type=1&host=$NAGIOS_HOSTNAME |
https://stats.redrivernet.com/CGi-bin/nagios/extinfo.cgi?type=1&host=$NAGIOS_HOSTNAME |
|
|
| |
|
| ### SERVICE Descriptions ### |
### SERVICE Descriptions ### |
| |
|
| local _short_svc="$NAGIOS_SERVICESTATE: $NAGIOS_HOSTNAME $NAGIOS_SERVICEDESC ($NAGIOS_SERVICEOUTPUT)" |
local _short_svc="$NAGIOS_HOSTNAME $NAGIOS_SERVICEDESC" |
| local _long_svc="Date/Time: $NAGIOS_LONGDATETIME |
local _long_svc="Date/Time: $NAGIOS_LONGDATETIME |
| Notification Type: $NAGIOS_NOTIFICATIONTYPE |
$NAGIOS_NOTIFICATIONTYPE $NAGIOS_NOTIFICATIONCOMMENT |
| |
|
| Service: $NAGIOS_SERVICEDESC |
Service: $NAGIOS_SERVICEDESC ($NAGIOS_SERVICEOUTPUT) |
| Host: $NAGIOS_HOSTALIAS ($NAGIOS_HOSTADDRESS) |
Host: $NAGIOS_HOSTALIAS ($NAGIOS_HOSTADDRESS) |
| State: $NAGIOS_SERVICESTATE (for $NAGIOS_SERVICEDURATION) |
State: $NAGIOS_HOSTSTATE (for $NAGIOS_HOSTDURATION) |
| |
|
| https://stats.redrivernet.com/cgi-bin/nagios/extinfo.cgi?type=2&host=$NAGIOS_HOSTNAME&service=`echo $NAGIOS_SERVICEDESC | sed -e 's/ /+/g'` |
https://stats.redrivernet.com/cgi-bin/nagios/extinfo.cgi?type=2&host=$NAGIOS_HOSTNAME&service=`echo $NAGIOS_SERVICEDESC | sed -e 's/ /+/g'` |
| " |
" |
| |
|
| ### Actions ### |
### Actions ### |
| |
|
| local _additional_vars=NOTIFICATIONCOMMENT |
local _state |
| local _short |
local _short |
| local _long |
local _long |
| case $_type in |
case $_type in |
| HOST) |
HOST) |
| |
_state=$NAGIOS_HOSTSTATE |
| _short=$_short_host |
_short=$_short_host |
| _long=$_long_host |
_long=$_long_host |
| _additional_vars="$_additional_vars HOSTOUTPUT HOSTACKCOMMENT" |
|
| ;; |
;; |
| SERVICE) |
SERVICE) |
| |
_state=$NAGIOS_SERVICESTATE |
| _short=$_short_svc |
_short=$_short_svc |
| _long=$_long_svc |
_long=$_long_svc |
| _additional_vars="$_additional_vars SERVICEOUTPUT SERVICEACKCOMMENT" |
|
| ;; |
;; |
| *) |
*) |
| echo "Unknown type $_type" |
echo "Unknown type $_type" |
|
|
| ;; |
;; |
| esac |
esac |
| |
|
| local _add |
if [ X"$NAGIOS_NOTIFICATIONTYPE" == X"ACKNOWLEDGEMENT" ]; then |
| local _a |
_state=$NAGIOS_NOTIFICATIONTYPE |
| for _a in $_additional_vars; do |
|
| local _val |
|
| eval _val=\${NAGIOS_${_a}} |
|
| if [ X"" != X"$_val" ]; then |
|
| _add="$_add\n$_val" |
|
| fi |
|
| done |
|
| |
|
| if [ X"" != X"$_add" ]; then |
|
| _long="$_long\nAdditional Info: $_add" |
|
| fi |
fi |
| |
|
| |
_short=$_state: $_short |
| |
|
| case $_method in |
case $_method in |
| mail) |
mail) |