foolsm: Add package foolsm

Signed-off-by: Brian J. Murrell <brian@interlinx.bc.ca>
(cherry picked from commit 5cff94399d)
This commit is contained in:
Brian J. Murrell
2017-12-13 07:48:01 -05:00
parent df8b221e00
commit 1bdddaefcd
7 changed files with 209 additions and 0 deletions
+13
View File
@@ -0,0 +1,13 @@
connection {
name=Provider1
checkip=1.1.1.1
device=pppoe-wan
ttl=2
}
connection {
name=Provider2
checkip=2.2.2.2
device=eth0.2
ttl=1
}
+43
View File
@@ -0,0 +1,43 @@
#
# (C) 2009 Mika Ilmaranta <ilmis at nullnet.fi>
#
# License: GPLv2
#
#
# Debug level: 0 .. 8 are normal, 9 gives lots of stuff and 100 doesn't
# bother to detach
#
#debug=10
#debug=9
debug=8
# reopen_on_enodev=1
#
# Defaults for the connection entries
#
defaults {
name=defaults
checkip=127.0.0.1
eventscript=/etc/foolsm/script
notifyscript=
max_packet_loss=20
max_successive_pkts_lost=7
min_packet_loss=5
min_successive_pkts_rcvd=10
interval_ms=2000
timeout_ms=2000
warn_email=root
check_arp=0
sourceip=
# if using ping probes for monitoring only then defaults should
# not define a default device for packets to autodiscover their path
# to destination
# device=eth0
# use system default ttl
ttl=0
}
include /etc/foolsm/connections.conf
#EOF
+19
View File
@@ -0,0 +1,19 @@
#!/bin/sh /etc/rc.common
# Copyright (C) 2010-2011 OpenWrt.org
START=45
SERVICE_USE_PID=1
SERVICE_PID_FILE=/var/run/foolsm.pid
start() {
service_start /usr/sbin/foolsm -c /etc/foolsm/foolsm.conf -p $SERVICE_PID_FILE
}
stop() {
service_stop /usr/sbin/foolsm
}
reload() {
service_reload /usr/sbin/foolsm
}
+57
View File
@@ -0,0 +1,57 @@
#!/bin/sh
#
# (C) 2009 Mika Ilmaranta <ilmis@nullnet.fi>
# (C) 2009 Tom Eastep <teastep@shorewall.net>
#
# License: GPLv2
#
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 | ssmtp ${WARN_EMAIL}
Subject: "LSM: ${NAME} ${STATE}, DEV ${DEVICE}"
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 counters:
replied = ${REPLIED} packets replied
waiting = ${WAITING} packets waiting for reply
timeout = ${TIMEOUT} packets that have timed out (= 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, notice that waiting and timed out packets have rtt = 0 when calculating this
Your LSM Daemon
EOM
exit 0
#EOF