From 55eb45988759ef651d9be6b3c65ce5f8a53ab184 Mon Sep 17 00:00:00 2001 From: Florian Eckert Date: Mon, 16 Sep 2019 14:27:47 +0200 Subject: [PATCH 1/5] collectd: add apcups uci config Signed-off-by: Florian Eckert --- utils/collectd/files/collectd.uci | 5 +++++ utils/collectd/files/usr/share/collectd/plugin/apcups.json | 6 ++++++ 2 files changed, 11 insertions(+) create mode 100644 utils/collectd/files/usr/share/collectd/plugin/apcups.json diff --git a/utils/collectd/files/collectd.uci b/utils/collectd/files/collectd.uci index 73e2c2ab5..fa472c985 100644 --- a/utils/collectd/files/collectd.uci +++ b/utils/collectd/files/collectd.uci @@ -8,6 +8,11 @@ config globals 'globals' # option Interval '30' # option ReadThreads '2' +#config plugin 'apcups' +# option enable '0' +# option Host 'localhost' +# option Port '3551' + #config plugin 'conntrack' # option enable '0' diff --git a/utils/collectd/files/usr/share/collectd/plugin/apcups.json b/utils/collectd/files/usr/share/collectd/plugin/apcups.json new file mode 100644 index 000000000..15a31df9f --- /dev/null +++ b/utils/collectd/files/usr/share/collectd/plugin/apcups.json @@ -0,0 +1,6 @@ +{ + "string": [ + "Host", + "Port" + ] +} From 1205ab461b2f6ec8fcd1eefa8f3d8085a15ee089 Mon Sep 17 00:00:00 2001 From: Florian Eckert Date: Mon, 16 Sep 2019 14:55:17 +0200 Subject: [PATCH 2/5] collectd: add curl uci config Signed-off-by: Florian Eckert --- utils/collectd/files/collectd.init | 33 +++++++++++++++++++ utils/collectd/files/collectd.uci | 7 ++++ .../files/usr/share/collectd/plugin/curl.json | 2 ++ 3 files changed, 42 insertions(+) create mode 100644 utils/collectd/files/usr/share/collectd/plugin/curl.json diff --git a/utils/collectd/files/collectd.init b/utils/collectd/files/collectd.init index a9182380f..a29920015 100644 --- a/utils/collectd/files/collectd.init +++ b/utils/collectd/files/collectd.init @@ -44,6 +44,35 @@ process_exec_sections() { fi } +process_curl() { + printf "\n" >> "$COLLECTD_CONF" + config_foreach process_curl_page curl_page + printf "\n\n" >> "$COLLECTD_CONF" +} + +process_curl_page() { + local cfg="$1" + + local name url + + config_get name "$cfg" name + [ -z "$name" ] && { + $LOG notice "No name option in config $cfg defined" + return 0 + } + + config_get url "$cfg" url + [ -z "$url" ] && { + $LOG notice "No URL option in config $cfg defined" + return 0 + } + + printf "\\t\n" "${name}" >> "$COLLECTD_CONF" + printf "\\t\\tURL \"%s\"\n" "${url}" >> "$COLLECTD_CONF" + printf "\\t\\tMeasureResponseTime true\n" >> "$COLLECTD_CONF" + printf "\\t\n" >> "$COLLECTD_CONF" +} + CONFIG_LIST="" add_list_option() { local value="$1" @@ -139,6 +168,10 @@ process_plugins() { CONFIG_STRING="" process_exec ;; + curl) + CONFIG_STRING="" + process_curl + ;; *) CONFIG_STRING="" process_generic "$cfg" "\\t" "/usr/share/collectd/plugin/$cfg.json" diff --git a/utils/collectd/files/collectd.uci b/utils/collectd/files/collectd.uci index fa472c985..22cade912 100644 --- a/utils/collectd/files/collectd.uci +++ b/utils/collectd/files/collectd.uci @@ -30,6 +30,13 @@ config globals 'globals' # option StoreRates '0' # option DataDir '/tmp' +#config plugin 'curl' +# option enable '0' + +#config curl_page +# option name 'test' +# option url 'http://finance.google.com/finance?q=NYSE%3AAMD%22' + #config plugin 'df' # option enable '0' # list Device '/dev/mtdblock/4' diff --git a/utils/collectd/files/usr/share/collectd/plugin/curl.json b/utils/collectd/files/usr/share/collectd/plugin/curl.json new file mode 100644 index 000000000..2c63c0851 --- /dev/null +++ b/utils/collectd/files/usr/share/collectd/plugin/curl.json @@ -0,0 +1,2 @@ +{ +} From 7d3cbda4afcffc7957badfcc6565f4dd554b4cad Mon Sep 17 00:00:00 2001 From: Florian Eckert Date: Mon, 16 Sep 2019 15:48:02 +0200 Subject: [PATCH 3/5] collectd: add network uci config Signed-off-by: Florian Eckert --- utils/collectd/files/collectd.init | 59 +++++++++++++++++++ utils/collectd/files/collectd.uci | 14 +++++ .../usr/share/collectd/plugin/network.json | 2 + 3 files changed, 75 insertions(+) create mode 100644 utils/collectd/files/usr/share/collectd/plugin/network.json diff --git a/utils/collectd/files/collectd.init b/utils/collectd/files/collectd.init index a29920015..845d33975 100644 --- a/utils/collectd/files/collectd.init +++ b/utils/collectd/files/collectd.init @@ -73,6 +73,61 @@ process_curl_page() { printf "\\t\n" >> "$COLLECTD_CONF" } +process_network() { + local cfg="$1" + + local TimeToLive Forward CacheFlush + + printf "\n" >> "$COLLECTD_CONF" + config_foreach process_network_sections network_listen "listen" + config_foreach process_network_sections network_server "server" + + config_get TimeToLive "$cfg" TimeToLive + [ -z "$TimeToLive" ] || { + printf "\\tTimeToLive %s\n" "${TimeToLive}" >> "$COLLECTD_CONF" + } + + config_get CacheFlush "$cfg" CacheFlush + [ -z "$CacheFlush" ] || { + printf "\\tCacheFlush %s\n" "${CacheFlush}" >> "$COLLECTD_CONF" + } + + config_get_bool Forward "$cfg" Forward + if [ "$value" = "0" ]; then + printf "\\tForward false\n" >> "$COLLECTD_CONF" + else + printf "\\tForward true\n" >> "$COLLECTD_CONF" + fi + + printf "\n\n" >> "$COLLECTD_CONF" +} + +process_network_sections() { + local cfg="$1" + local section="$2" + + local host port output + + config_get host "$cfg" host + [ -z "$host" ] && { + $LOG notice "No host option in config $cfg defined" + return 0 + } + + if [ "$section" = "server" ]; then + output="Server \"$host\"" + else + output="Listen \"$host\"" + fi + + config_get port "$cfg" port + if [ -z "$port" ]; then + printf "\\t%s\n" "${output}" >> "$COLLECTD_CONF" + else + printf "\\t%s \"%s\"\n" "${output}" "${port}" >> "$COLLECTD_CONF" + fi +} + CONFIG_LIST="" add_list_option() { local value="$1" @@ -172,6 +227,10 @@ process_plugins() { CONFIG_STRING="" process_curl ;; + network) + CONFIG_STRING="" + process_network "$cfg" + ;; *) CONFIG_STRING="" process_generic "$cfg" "\\t" "/usr/share/collectd/plugin/$cfg.json" diff --git a/utils/collectd/files/collectd.uci b/utils/collectd/files/collectd.uci index 22cade912..5df40728b 100644 --- a/utils/collectd/files/collectd.uci +++ b/utils/collectd/files/collectd.uci @@ -108,6 +108,20 @@ config globals 'globals' # list VerboseInterface 'br-lan' # list QDisc 'br-lan' +#config plugin 'network' +# option enable '1' +# option TimeToLive '128' +# option Forward '1' +# option CacheFlush '86400' + +#config network_listen +# option host '0.0.0.0' +# option port '25826' + +#config network_server +# option host '1.1.1.1' +# option port '25826' + #config plugin 'nut' # option enable '0' # option UPS 'myupsname' diff --git a/utils/collectd/files/usr/share/collectd/plugin/network.json b/utils/collectd/files/usr/share/collectd/plugin/network.json new file mode 100644 index 000000000..2c63c0851 --- /dev/null +++ b/utils/collectd/files/usr/share/collectd/plugin/network.json @@ -0,0 +1,2 @@ +{ +} From 6141aa2f23ac9991dad15f8490667cb957b7c7e6 Mon Sep 17 00:00:00 2001 From: Florian Eckert Date: Tue, 17 Sep 2019 10:08:01 +0200 Subject: [PATCH 4/5] collectd: add iptables uci config Signed-off-by: Florian Eckert --- utils/collectd/files/collectd.init | 43 +++++++++++++++++++ utils/collectd/files/collectd.uci | 9 ++++ .../usr/share/collectd/plugin/iptables.json | 2 + 3 files changed, 54 insertions(+) create mode 100644 utils/collectd/files/usr/share/collectd/plugin/iptables.json diff --git a/utils/collectd/files/collectd.init b/utils/collectd/files/collectd.init index 845d33975..89715d4c4 100644 --- a/utils/collectd/files/collectd.init +++ b/utils/collectd/files/collectd.init @@ -128,6 +128,45 @@ process_network_sections() { fi } +process_iptables() { + local cfg="$1" + + printf "\n" >> "$COLLECTD_CONF" + config_foreach process_iptables_sections iptables_match + printf "\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="" add_list_option() { local value="$1" @@ -231,6 +270,10 @@ process_plugins() { CONFIG_STRING="" process_network "$cfg" ;; + iptables) + CONFIG_STRING="" + process_iptables + ;; *) CONFIG_STRING="" process_generic "$cfg" "\\t" "/usr/share/collectd/plugin/$cfg.json" diff --git a/utils/collectd/files/collectd.uci b/utils/collectd/files/collectd.uci index 5df40728b..a04cbc31a 100644 --- a/utils/collectd/files/collectd.uci +++ b/utils/collectd/files/collectd.uci @@ -81,6 +81,15 @@ config globals 'globals' # list Interface 'br-lan' # 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' # option enable '0' # list Irq '2' diff --git a/utils/collectd/files/usr/share/collectd/plugin/iptables.json b/utils/collectd/files/usr/share/collectd/plugin/iptables.json new file mode 100644 index 000000000..2c63c0851 --- /dev/null +++ b/utils/collectd/files/usr/share/collectd/plugin/iptables.json @@ -0,0 +1,2 @@ +{ +} From 47bfef3d7a04d46ed85ceac0771e125440ff6f75 Mon Sep 17 00:00:00 2001 From: Florian Eckert Date: Tue, 17 Sep 2019 10:16:39 +0200 Subject: [PATCH 5/5] collectd: bump PKG_PACKAGE version Signed-off-by: Florian Eckert --- utils/collectd/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/collectd/Makefile b/utils/collectd/Makefile index 9d946167c..4216acfca 100644 --- a/utils/collectd/Makefile +++ b/utils/collectd/Makefile @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=collectd PKG_VERSION:=5.9.0 -PKG_RELEASE:=5 +PKG_RELEASE:=6 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 PKG_SOURCE_URL:=https://collectd.org/files/ \