net/lsm: add link state monitor package. (thank you Brian J. Murrell)
git-svn-id: svn://svn.openwrt.org/openwrt/packages@23326 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
66
net/lsm/files/lsm_script
Normal file
66
net/lsm/files/lsm_script
Normal file
@ -0,0 +1,66 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# (C) 2009 Mika Ilmaranta <ilmis at nullnet.fi>
|
||||
#
|
||||
# License: GPLv2
|
||||
#
|
||||
|
||||
#
|
||||
# default event handling script
|
||||
#
|
||||
|
||||
DATE=$(/bin/date)
|
||||
|
||||
STATE=${1}
|
||||
NAME=${2}
|
||||
CHECKIP=${3}
|
||||
DEVICE=${4}
|
||||
WARN_EMAIL=${5}
|
||||
REPLIED=${6}
|
||||
WAITING=${7}
|
||||
TIMEOUT=${8}
|
||||
REPLY_LATE=${9}
|
||||
CONS_RCVD=${10}
|
||||
CONS_WAIT=${11}
|
||||
CONS_MISS=${12}
|
||||
AVG_RTT=${13}
|
||||
|
||||
cat <<EOM | mail -s "LSM: ${NAME} ${STATE}, IP ${CHECKIP}" ${WARN_EMAIL}
|
||||
|
||||
Hi,
|
||||
|
||||
Your connection ${NAME} has changed it's state to ${STATE} at ${DATE}.
|
||||
|
||||
Following parameters were passed:
|
||||
newstate = ${STATE}
|
||||
name = ${NAME}
|
||||
checkip = ${CHECKIP}
|
||||
device = ${DEVICE}
|
||||
warn_email = ${WARN_EMAIL}
|
||||
|
||||
Packet statuses:
|
||||
replied = ${REPLIED} packets replied
|
||||
waiting = ${WAITING} packets waiting for reply
|
||||
timeout = ${TIMEOUT} packets that have timeout (= packet loss)
|
||||
reply_late = ${REPLY_LATE} packets that received a reply after timeout
|
||||
cons_rcvd = ${CONS_RCVD} consecutively received replies in sequence
|
||||
cons_wait = ${CONS_WAIT} consecutive packets waiting for reply
|
||||
cons_miss = ${CONS_MISS} consecutive packets that have timed out
|
||||
avg_rtt = ${AVG_RTT} average rtt [usec], calculated from received packets
|
||||
|
||||
BR,
|
||||
Your LSM installation
|
||||
|
||||
EOM
|
||||
|
||||
cd /etc/lsm/script.d/
|
||||
for script in $(ls); do
|
||||
if [ ! -x $script ]; then
|
||||
continue
|
||||
fi
|
||||
./$script "$@"
|
||||
done
|
||||
|
||||
exit 0;
|
||||
|
||||
#EOF
|
Reference in New Issue
Block a user