mirror of
git://git.openwrt.org/openwrt/openwrt.git
synced 2025-01-07 07:03:49 +00:00
update the init script and config for the new wprobe
SVN-Revision: 16724
This commit is contained in:
parent
131b2429ef
commit
143d5c0538
@ -5,3 +5,6 @@ config export
|
|||||||
option host ipfix-col
|
option host ipfix-col
|
||||||
option proto tcp
|
option proto tcp
|
||||||
|
|
||||||
|
# enable public wprobe protocol access
|
||||||
|
config export
|
||||||
|
option type wprobe
|
||||||
|
@ -1,24 +1,31 @@
|
|||||||
#!/bin/sh /etc/rc.common
|
#!/bin/sh /etc/rc.common
|
||||||
START=90
|
START=90
|
||||||
EXPORTER=/usr/sbin/wprobe-ipfix
|
EXPORTER=/usr/sbin/wprobe-ipfix
|
||||||
|
UTIL=/sbin/wprobe-util
|
||||||
|
|
||||||
wprobe_ssd() {
|
wprobe_ssd() {
|
||||||
local cfg="$1"; shift
|
|
||||||
local cmd="$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() {
|
stop_wprobe() {
|
||||||
local cfg="$1"
|
local type="$1"
|
||||||
[ -f "/var/run/wprobe-$cfg.pid" ] && wprobe_ssd "$cfg" -K
|
[ -f "/var/run/wprobe-$type.pid" ] && wprobe_ssd -K "$type"
|
||||||
rm -f "/var/run/wprobe-$cfg.pid"
|
rm -f "/var/run/wprobe-$type.pid"
|
||||||
}
|
}
|
||||||
|
|
||||||
config_wprobe() {
|
config_wprobe() {
|
||||||
config_get ifname "$cfg" ifname
|
config_get ifname "$cfg" ifname
|
||||||
config_get interval "$cfg" interval
|
config_get interval "$cfg" interval
|
||||||
[ -n "$interval" ] || interval=100
|
[ -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() {
|
start_ipfix() {
|
||||||
@ -38,13 +45,15 @@ start_ipfix() {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
config_wprobe "$cfg"
|
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() {
|
start_export() {
|
||||||
|
local cfg="$1"
|
||||||
config_get export_type "$cfg" type
|
config_get export_type "$cfg" type
|
||||||
case "$export_type" in
|
case "$export_type" in
|
||||||
ipfix) start_ipfix "$cfg";;
|
ipfix) [ -x "$EXPORTER" ] && start_ipfix "$cfg";;
|
||||||
|
wprobe) start_proxy "$cfg";;
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -59,5 +68,5 @@ stop() {
|
|||||||
start() {
|
start() {
|
||||||
config_load wprobe
|
config_load wprobe
|
||||||
config_foreach config_wprobe interface
|
config_foreach config_wprobe interface
|
||||||
[ -x "$EXPORTER" ] && config_foreach start_export export
|
config_foreach start_export export
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user