aboutsummaryrefslogtreecommitdiffstats
path: root/package/wprobe/files/wprobe.init
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2009-06-10 14:37:36 +0000
committerFelix Fietkau <nbd@openwrt.org>2009-06-10 14:37:36 +0000
commitf87baeb3e0096a43d4647f549078c53bec68543f (patch)
tree0c6d0fe3f556165e3ae85ad7867257eac0b24c8f /package/wprobe/files/wprobe.init
parentcc12508ee32a954ae1296563194ede69a3063309 (diff)
downloadupstream-f87baeb3e0096a43d4647f549078c53bec68543f.tar.gz
upstream-f87baeb3e0096a43d4647f549078c53bec68543f.tar.bz2
upstream-f87baeb3e0096a43d4647f549078c53bec68543f.zip
wprobe: move measurement task to the kernel, add some configurability (work in progress)
SVN-Revision: 16402
Diffstat (limited to 'package/wprobe/files/wprobe.init')
-rwxr-xr-xpackage/wprobe/files/wprobe.init23
1 files changed, 20 insertions, 3 deletions
diff --git a/package/wprobe/files/wprobe.init b/package/wprobe/files/wprobe.init
index 3c62a03066..cf0b162181 100755
--- a/package/wprobe/files/wprobe.init
+++ b/package/wprobe/files/wprobe.init
@@ -1,10 +1,11 @@
#!/bin/sh /etc/rc.common
START=90
+EXPORTER=/usr/sbin/wprobe-ipfix
wprobe_ssd() {
local cfg="$1"; shift
local cmd="$1"; shift
- start-stop-daemon "$cmd" -p "/var/run/wprobe-$cfg.pid" -b -x /sbin/wprobe-export -m -- "$@"
+ start-stop-daemon "$cmd" -p "/var/run/wprobe-$cfg.pid" -b -x "$EXPORTER" -m -- "$@"
}
stop_wprobe() {
@@ -13,7 +14,14 @@ stop_wprobe() {
rm -f "/var/run/wprobe-$cfg.pid"
}
-start_wprobe() {
+config_wprobe() {
+ config_get ifname "$cfg" ifname
+ config_get interval "$cfg" interval
+ [ -n "$interval" ] || interval=100
+ wprobe-info "$ifname" -c -i "$interval"
+}
+
+start_ipfix() {
local cfg="$1"
config_get ifname "$cfg" interface
config_get host "$cfg" host
@@ -29,9 +37,17 @@ start_wprobe() {
echo "wprobe-export: missing host or interface name in config $cfg"
return
}
+ config_wprobe "$cfg"
wprobe_ssd "$cfg" -S "$proto" -i "$ifname" -c "$host" -p "${port:-4739}"
}
+start_export() {
+ config_get export_type "$cfg" type
+ case "$export_type" in
+ ipfix) start_ipfix "$cfg";;
+ esac
+}
+
stop() {
for f in /var/run/wprobe-*.pid; do
CFG="${f%%.pid}"
@@ -42,5 +58,6 @@ stop() {
start() {
config_load wprobe
- config_foreach start_wprobe wprobe
+ config_foreach config_wprobe interface
+ [ -x "$EXPORTER" ] && config_foreach start_export export
}