collectd: add iptables uci config
Signed-off-by: Florian Eckert <fe@dev.tdt.de>
This commit is contained in:
parent
7d3cbda4af
commit
6141aa2f23
|
@ -128,6 +128,45 @@ process_network_sections() {
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
process_iptables() {
|
||||||
|
local cfg="$1"
|
||||||
|
|
||||||
|
printf "<Plugin iptables>\n" >> "$COLLECTD_CONF"
|
||||||
|
config_foreach process_iptables_sections iptables_match
|
||||||
|
printf "</Plugin>\n\n" >> "$COLLECTD_CONF"
|
||||||
|
}
|
||||||
|
|
||||||
|
process_iptables_sections() {
|
||||||
|
local cfg="$1"
|
||||||
|
|
||||||
|
local table chain
|
||||||
|
|
||||||
|
config_get table "$cfg" table
|
||||||
|
[ -z "$table" ] && {
|
||||||
|
$LOG notice "No table option in config $cfg defined"
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
config_get chain "$cfg" chain
|
||||||
|
[ -z "$chain" ] && {
|
||||||
|
$LOG notice "No chain option in config $cfg defined"
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
config_get index "$cfg" index
|
||||||
|
[ -z "$index" ] && {
|
||||||
|
$LOG notice "No index option in config $cfg defined"
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
config_get name "$cfg" name
|
||||||
|
if [ -z "$name" ]; then
|
||||||
|
printf "\\tChain %s %s %s\n" "${table}" "${chain}" "${index}" >> "$COLLECTD_CONF"
|
||||||
|
else
|
||||||
|
printf "\\tChain %s %s %s \"%s\"\n" "${table}" "${chain}" "${index}" "${name}">> "$COLLECTD_CONF"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
CONFIG_LIST=""
|
CONFIG_LIST=""
|
||||||
add_list_option() {
|
add_list_option() {
|
||||||
local value="$1"
|
local value="$1"
|
||||||
|
@ -231,6 +270,10 @@ process_plugins() {
|
||||||
CONFIG_STRING=""
|
CONFIG_STRING=""
|
||||||
process_network "$cfg"
|
process_network "$cfg"
|
||||||
;;
|
;;
|
||||||
|
iptables)
|
||||||
|
CONFIG_STRING=""
|
||||||
|
process_iptables
|
||||||
|
;;
|
||||||
*)
|
*)
|
||||||
CONFIG_STRING=""
|
CONFIG_STRING=""
|
||||||
process_generic "$cfg" "\\t" "/usr/share/collectd/plugin/$cfg.json"
|
process_generic "$cfg" "\\t" "/usr/share/collectd/plugin/$cfg.json"
|
||||||
|
|
|
@ -81,6 +81,15 @@ config globals 'globals'
|
||||||
# list Interface 'br-lan'
|
# list Interface 'br-lan'
|
||||||
# option IgnoreSelected '0'
|
# option IgnoreSelected '0'
|
||||||
|
|
||||||
|
#config plugin 'iptables'
|
||||||
|
# option enable '1'
|
||||||
|
|
||||||
|
#config iptables_match
|
||||||
|
# option table 'nat'
|
||||||
|
# option chain 'zone_wan_postrouting'
|
||||||
|
# option index '1'
|
||||||
|
# option name 'WLAN-Clients traffic'
|
||||||
|
|
||||||
#config plugin 'irq'
|
#config plugin 'irq'
|
||||||
# option enable '0'
|
# option enable '0'
|
||||||
# list Irq '2'
|
# list Irq '2'
|
||||||
|
|
|
@ -0,0 +1,2 @@
|
||||||
|
{
|
||||||
|
}
|
Loading…
Reference in New Issue