version 1.3, 2009/12/17 11:44:47
|
version 1.6, 2010/08/18 10:40:25
|
Line 18 DHCP_TMP_DIR=/tmp/switchgate
|
Line 18 DHCP_TMP_DIR=/tmp/switchgate
|
|
|
# eMail address to send alert messages, if not operating on the |
# eMail address to send alert messages, if not operating on the |
# standard default gateway |
# standard default gateway |
ALERT_EMAIL="adi@ente.limmat.ch" |
ALERT_EMAIL="adi@ente.limmat.ch, hauswartung@dasdreieck.ch" |
|
|
# Host set to ping. A file containing IP addresses, each on a single line. |
# Host set to ping. A file containing IP addresses, each on a single line. |
# Do not include any local hosts, list only hosts located behind your gateways. |
# Do not include any local hosts, list only hosts located behind your gateways. |
Line 28 HOSTSET_FILE="$CONFIG_PATH/hostset"
|
Line 28 HOSTSET_FILE="$CONFIG_PATH/hostset"
|
GATEWAYS_FILE="$CONFIG_PATH/gateways" |
GATEWAYS_FILE="$CONFIG_PATH/gateways" |
|
|
# path to fping |
# path to fping |
PING=/usr/bin/fping |
PING=/usr/sbin/fping |
|
|
# answer of fping to reachable hosts |
# answer of fping to reachable hosts |
ALIVE_ANSWER="is alive" |
ALIVE_ANSWER="is alive" |
Line 353 fi
|
Line 353 fi
|
|
|
# send an eMail if the connection is down or limited |
# send an eMail if the connection is down or limited |
if [ -z "$UP" ]; then |
if [ -z "$UP" ]; then |
EMAIL_BODY="Switchgate on $(hostname -f) reports: No connection!\n\n\nTime:\t\t$(date)\nGateway:\t$CURRENTGW ($CURRENTGW_ID)" |
if [ -z "$NEWGW" ]; then |
EMAIL_SUBJECT="Attention: $(hostname -f) has no connection!" |
EMAIL_BODY="Switchgate on $(hostname -f) reports: No connection!\n\nTime:\t\t$(date)\nGateway:\t$CURRENTGW ($CURRENTGW_ID)" |
echo -e "$EMAIL_BODY" | mail -s "$EMAIL_SUBJECT" "$ALERT_EMAIL" |
EMAIL_SUBJECT="Attention: $(hostname -f) has no connection!" |
if [[ -n "$DEBUG" && "$DEBUG" != "low" ]]; then |
echo -e "$EMAIL_BODY" | mail -s "$EMAIL_SUBJECT" "$ALERT_EMAIL" |
echo "Alert message sent to $ALERT_EMAIL." |
if [[ -n "$DEBUG" && "$DEBUG" != "low" ]]; then |
|
echo "Alert message sent to $ALERT_EMAIL." |
|
fi |
fi |
fi |
elif [ "$CURRENTGW_ID" != 0 ]; then |
elif [ "$CURRENTGW_ID" != 0 ]; then |
EMAIL_BODY="Switchgate on $(hostname -f) reports: Not operating on standard default gateway!\n\n\nTime:\t\t$(date)\nGateway:\t$CURRENTGW ($CURRENTGW_ID)" |
EMAIL_BODY="Switchgate on $(hostname -f) reports: Not operating on standard default gateway!\n\nTime:\t\t$(date)\nGateway:\t$CURRENTGW ($CURRENTGW_ID)" |
EMAIL_SUBJECT="Attention: $(hostname -f) Not operating on standard default gateway!" |
EMAIL_SUBJECT="Attention: $(hostname -f) not operating on standard default gateway!" |
echo -e "$EMAIL_BODY" | mail -s "$EMAIL_SUBJECT" "$ALERT_EMAIL" |
echo -e "$EMAIL_BODY" | mail -s "$EMAIL_SUBJECT" "$ALERT_EMAIL" |
if [[ -n "$DEBUG" && "$DEBUG" != "low" ]]; then |
if [[ -n "$DEBUG" && "$DEBUG" != "low" ]]; then |
echo "Alert message sent to $ALERT_EMAIL." |
echo "Alert message sent to $ALERT_EMAIL." |
Line 370 fi
|
Line 372 fi
|
|
|
if [ "$DEBUG" = "low" ]; then |
if [ "$DEBUG" = "low" ]; then |
echo |
echo |
echo "Default Gateway: $CURRENTGW ($CURRENTGW_ID)" |
echo "Current Default Gateway: $CURRENTGW ($CURRENTGW_ID)" |
echo |
echo |
fi |
fi |
exit 0 |
exit 0 |