summaryrefslogtreecommitdiffstats
path: root/package/wprobe/files
diff options
context:
space:
mode:
authornbd <nbd@3c298f89-4303-0410-b956-a3cf2f4a3e73>2009-06-10 14:37:36 +0000
committernbd <nbd@3c298f89-4303-0410-b956-a3cf2f4a3e73>2009-06-10 14:37:36 +0000
commitdfe42a2505e655ee80e862c72a78a15802a76a71 (patch)
treef249aaeb346f0b0991059630e2096f0f56e2838f /package/wprobe/files
parentff31d59270d5a87e71af95d19240d271b426f942 (diff)
wprobe: move measurement task to the kernel, add some configurability (work in progress)
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@16402 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'package/wprobe/files')
-rw-r--r--package/wprobe/files/wprobe.config7
-rwxr-xr-xpackage/wprobe/files/wprobe.init23
2 files changed, 27 insertions, 3 deletions
diff --git a/package/wprobe/files/wprobe.config b/package/wprobe/files/wprobe.config
new file mode 100644
index 000000000..8494bccb5
--- /dev/null
+++ b/package/wprobe/files/wprobe.config
@@ -0,0 +1,7 @@
+config export
+ # uncomment this line to enable ipfix export:
+ # option type ipfix
+ option ifname ath0
+ option host ipfix-col
+ option proto tcp
+
diff --git a/package/wprobe/files/wprobe.init b/package/wprobe/files/wprobe.init
index 3c62a0306..cf0b16218 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
}