From: acoul Date: Fri, 8 Oct 2010 15:23:33 +0000 (+0000) Subject: net/lsm: add link state monitor package. (thank you Brian J. Murrell) X-Git-Url: http://207.154.207.93/?a=commitdiff_plain;h=9d92247f50e52d66555355889e60f7d99e4e3058;p=packages.git 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 --- diff --git a/net/lsm/Makefile b/net/lsm/Makefile new file mode 100644 index 000000000..1aa3d2d22 --- /dev/null +++ b/net/lsm/Makefile @@ -0,0 +1,59 @@ +# +# Copyright (C) 2006 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=lsm +PKG_VERSION:=0.53 +PKG_RELEASE:=1 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=http://lsm.foobar.fi/download +PKG_MD5SUM:=983911b434a3c649fcefdc99e6ea2f37 + +include $(INCLUDE_DIR)/package.mk + +define Package/lsm + SECTION:=net + CATEGORY:=Network + DEPENDS:=+ssmtp + TITLE:=A link state monitor + URL:=http://lsm.foobar.fi/ +endef + +define Package/lsm/description + lsm is a link state monitor for carrying out actions when a link + transistions from the up to down state or vice versa. +endef + +define Package/lsm/conffiles +/etc/lsm/lsm.conf +endef + +define Build/Prepare + $(call Build/Prepare/Default) + rmdir $(PKG_BUILD_DIR) + mv $(BUILD_DIR)/lsm $(PKG_BUILD_DIR) +endef + +define Build/Compile + echo sed -ie 's/\$$$$(CC)/mipsel-openwrt-linux-uclibc-gcc/g' $(PKG_BUILD_DIR)/Makefile + $(MAKE) -C $(PKG_BUILD_DIR) CC=$(TARGET_CC) +endef + +define Package/lsm/install + $(INSTALL_DIR) $(1)/usr/sbin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/lsm $(1)/usr/sbin/ + $(INSTALL_DIR) $(1)/etc/lsm + $(INSTALL_DIR) $(1)/etc/lsm/script.d + $(INSTALL_DIR) $(1)/etc/init.d + $(INSTALL_DATA) ./files/lsm.conf $(1)/etc/lsm/lsm.conf + $(INSTALL_BIN) ./files/lsm_script $(1)/etc/lsm/script + $(INSTALL_BIN) ./files/lsm.init $(1)/etc/init.d/lsm +endef + +$(eval $(call BuildPackage,lsm)) diff --git a/net/lsm/files/lsm.conf b/net/lsm/files/lsm.conf new file mode 100644 index 000000000..ce54cea6b --- /dev/null +++ b/net/lsm/files/lsm.conf @@ -0,0 +1,42 @@ + +# +# (C) 2009 Mika Ilmaranta +# +# 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 + +# +# Defaults for the connection entries +# +defaults { + name=defaults + checkip=127.0.0.1 + eventscript=/etc/lsm/script + max_packet_loss=15 + 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/lsm/connections.conf + +#EOF diff --git a/net/lsm/files/lsm.init b/net/lsm/files/lsm.init new file mode 100644 index 000000000..e9d316220 --- /dev/null +++ b/net/lsm/files/lsm.init @@ -0,0 +1,12 @@ +#!/bin/sh /etc/rc.common +# Copyright (C) 2006 OpenWrt.org +START=50 + +start() { + lsm /etc/lsm/lsm.conf +} + +stop() { + killall lsm +} + diff --git a/net/lsm/files/lsm_script b/net/lsm/files/lsm_script new file mode 100644 index 000000000..61895b2d6 --- /dev/null +++ b/net/lsm/files/lsm_script @@ -0,0 +1,66 @@ +#!/bin/sh +# +# (C) 2009 Mika Ilmaranta +# +# 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 <