diff options
author | Felix Fietkau <nbd@openwrt.org> | 2009-07-07 00:38:42 +0000 |
---|---|---|
committer | Felix Fietkau <nbd@openwrt.org> | 2009-07-07 00:38:42 +0000 |
commit | 0dc232c50acdef3def660d8599d72aeb22cb6560 (patch) | |
tree | f1cc062efa7448ace1fb9b7285868d9788f9050f /package/wprobe | |
parent | 8cc0545531ed4fd969c6baedf4ae04de25000f9e (diff) | |
download | master-187ad058-0dc232c50acdef3def660d8599d72aeb22cb6560.tar.gz master-187ad058-0dc232c50acdef3def660d8599d72aeb22cb6560.tar.bz2 master-187ad058-0dc232c50acdef3def660d8599d72aeb22cb6560.zip |
update the init script and config for the new wprobe
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@16724 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'package/wprobe')
-rw-r--r-- | package/wprobe/files/wprobe.config | 3 | ||||
-rwxr-xr-x | package/wprobe/files/wprobe.init | 27 |
2 files changed, 21 insertions, 9 deletions
diff --git a/package/wprobe/files/wprobe.config b/package/wprobe/files/wprobe.config index 8494bccb57..63518ef6e4 100644 --- a/package/wprobe/files/wprobe.config +++ b/package/wprobe/files/wprobe.config @@ -5,3 +5,6 @@ config export option host ipfix-col option proto tcp +# enable public wprobe protocol access +config export + option type wprobe diff --git a/package/wprobe/files/wprobe.init b/package/wprobe/files/wprobe.init index cf0b162181..11a5bf6e14 100755 --- a/package/wprobe/files/wprobe.init +++ b/package/wprobe/files/wprobe.init @@ -1,24 +1,31 @@ #!/bin/sh /etc/rc.common START=90 EXPORTER=/usr/sbin/wprobe-ipfix +UTIL=/sbin/wprobe-util wprobe_ssd() { - local cfg="$1"; shift local cmd="$1"; shift - start-stop-daemon "$cmd" -p "/var/run/wprobe-$cfg.pid" -b -x "$EXPORTER" -m -- "$@" + local type="$1"; shift + local app="$1"; shift + start-stop-daemon "$cmd" -p "/var/run/wprobe-$type.pid" -b ${app:+-x "$app"} -m -- "$@" } stop_wprobe() { - local cfg="$1" - [ -f "/var/run/wprobe-$cfg.pid" ] && wprobe_ssd "$cfg" -K - rm -f "/var/run/wprobe-$cfg.pid" + local type="$1" + [ -f "/var/run/wprobe-$type.pid" ] && wprobe_ssd -K "$type" + rm -f "/var/run/wprobe-$type.pid" } config_wprobe() { config_get ifname "$cfg" ifname config_get interval "$cfg" interval [ -n "$interval" ] || interval=100 - wprobe-info "$ifname" -c -i "$interval" + $UTIL "$ifname" -i "$interval" 2>/dev/null >/dev/null +} + +start_proxy() { + config_get port "$cfg" port + wprobe_ssd -S proxy "$UTIL" -P -p "${port:-19770}" } start_ipfix() { @@ -38,13 +45,15 @@ start_ipfix() { return } config_wprobe "$cfg" - wprobe_ssd "$cfg" -S "$proto" -i "$ifname" -c "$host" -p "${port:-4739}" + wprobe_ssd -S "export-$cfg" "$EXPORTER" "$proto" -i "$ifname" -c "$host" -p "${port:-4739}" } start_export() { + local cfg="$1" config_get export_type "$cfg" type case "$export_type" in - ipfix) start_ipfix "$cfg";; + ipfix) [ -x "$EXPORTER" ] && start_ipfix "$cfg";; + wprobe) start_proxy "$cfg";; esac } @@ -59,5 +68,5 @@ stop() { start() { config_load wprobe config_foreach config_wprobe interface - [ -x "$EXPORTER" ] && config_foreach start_export export + config_foreach start_export export } |