From 1920eb60fee785b748d602d924ce19d47cd6d0cd Mon Sep 17 00:00:00 2001 From: Florian Eckert Date: Wed, 3 Jul 2019 10:08:44 +0200 Subject: [PATCH 01/16] collectd: move jshn.sh include to remove warning Redmine-patch-id: 3680 If I build an image with the imagebuilder I get the following output during image building: ../root-x86/etc/init.d/collectd: line 4: /usr/share/libubox/jshn.sh: No such file or directory To remove this messsage move include to the needed postion, so that the message does not occur during image building on the host system anymore. Signed-off-by: Florian Eckert (cherry-picked, modified to match 19.07) Signed-off-by: Hannu Nyman --- utils/collectd/files/collectd.init | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/utils/collectd/files/collectd.init b/utils/collectd/files/collectd.init index a0029267a..7b9c4623e 100644 --- a/utils/collectd/files/collectd.init +++ b/utils/collectd/files/collectd.init @@ -1,8 +1,6 @@ #!/bin/sh /etc/rc.common # Copyright (C) 2006-2016 OpenWrt.org -. "/usr/share/libubox/jshn.sh" - START=80 STOP=10 @@ -62,6 +60,7 @@ process_generic() { local config="" + . /usr/share/libubox/jshn.sh json_init json_load_file "$json" From c4083af7b725600555a175914b49196b3f8a8ad9 Mon Sep 17 00:00:00 2001 From: Florian Eckert Date: Fri, 8 Feb 2019 14:52:23 +0100 Subject: [PATCH 02/16] collectd: enable threshold plugin The only action the Threshold plugin takes itself is to generate and dispatch a notification. Other plugins can register to receive notifications and perform appropriate further actions. Signed-off-by: Florian Eckert (cherry-picked for 19.07, line numbers adjusted) Signed-off-by: Hannu Nyman --- utils/collectd/Makefile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/utils/collectd/Makefile b/utils/collectd/Makefile index 3bf51d8dd..dbb56dc98 100644 --- a/utils/collectd/Makefile +++ b/utils/collectd/Makefile @@ -177,6 +177,7 @@ COLLECTD_PLUGINS_SELECTED:= \ teamspeak2 \ ted \ thermal \ + threshold \ unixsock \ uptime \ users \ @@ -419,6 +420,7 @@ $(eval $(call BuildPlugin,teamspeak2,TeamSpeak2 input,teamspeak2,)) $(eval $(call BuildPlugin,ted,The Energy Detective input,ted,)) $(eval $(call BuildPlugin,tcpconns,TCP connection tracking input,tcpconns,)) $(eval $(call BuildPlugin,thermal,system temperatures input,thermal,)) +$(eval $(call BuildPlugin,threshold,Notifications and thresholds,threshold,)) $(eval $(call BuildPlugin,unixsock,unix socket output,unixsock,)) $(eval $(call BuildPlugin,uptime,uptime status input,uptime,)) $(eval $(call BuildPlugin,users,user logged in status input,users,)) From 2bd0a56f0998962c7bc86456cb896fc7524321e5 Mon Sep 17 00:00:00 2001 From: Yousong Zhou Date: Fri, 9 Aug 2019 03:10:08 +0000 Subject: [PATCH 03/16] collectd: log stderr output Collectd without log type plugin loaded will write log lines to stderr. Signed-off-by: Yousong Zhou (cherry-picked for 19.07) Signed-off-by: Hannu Nyman --- utils/collectd/files/collectd.init | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/utils/collectd/files/collectd.init b/utils/collectd/files/collectd.init index 7b9c4623e..71993f601 100644 --- a/utils/collectd/files/collectd.init +++ b/utils/collectd/files/collectd.init @@ -199,16 +199,14 @@ process_config() { } start_service() { + process_config + procd_open_instance procd_set_param command /usr/sbin/collectd procd_append_param command -C "$COLLECTD_CONF" - procd_append_param command -f # don't daemonize, procd will handle that for us + procd_append_param command -f # don't daemonize procd_set_param nice "$NICEPRIO" - - process_config - - # set auto respawn behavior + procd_set_param stderr 1 procd_set_param respawn procd_close_instance } - From 4d54186f17a6df43945e405091f2ee904593718a Mon Sep 17 00:00:00 2001 From: Yousong Zhou Date: Fri, 9 Aug 2019 13:08:39 +0000 Subject: [PATCH 04/16] collectd: use uname to get default Hostname Signed-off-by: Yousong Zhou (cherry-picked for 19.07) Signed-off-by: Hannu Nyman --- utils/collectd/files/collectd.init | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/collectd/files/collectd.init b/utils/collectd/files/collectd.init index 71993f601..a9182380f 100644 --- a/utils/collectd/files/collectd.init +++ b/utils/collectd/files/collectd.init @@ -189,7 +189,7 @@ process_config() { config_get ReadThreads globals ReadThreads 2 printf "ReadThreads \"%s\"\n" "$ReadThreads" >> "$COLLECTD_CONF" - config_get Hostname globals Hostname "$(hostname)" + config_get Hostname globals Hostname "$(uname -n)" printf "Hostname \"%s\"\n" "$Hostname" >> "$COLLECTD_CONF" printf "\n" >> "$COLLECTD_CONF" From 0f9ae62e2c871ec23a5e35c41b137592a0d0d4a6 Mon Sep 17 00:00:00 2001 From: Florian Eckert Date: Fri, 13 Sep 2019 12:50:15 +0200 Subject: [PATCH 05/16] collectd: add new cpu config values Signed-off-by: Florian Eckert (cherry-picked for 19.07) Signed-off-by: Hannu Nyman --- utils/collectd/files/usr/share/collectd/plugin/cpu.json | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/utils/collectd/files/usr/share/collectd/plugin/cpu.json b/utils/collectd/files/usr/share/collectd/plugin/cpu.json index 2c63c0851..ef28a43e8 100644 --- a/utils/collectd/files/usr/share/collectd/plugin/cpu.json +++ b/utils/collectd/files/usr/share/collectd/plugin/cpu.json @@ -1,2 +1,7 @@ { + "bool": [ + "ValuesPercentage", + "ReportByCpu", + "ReportByState" + ] } From eb67983518f9c276224eb37ed3c245ad4acc8697 Mon Sep 17 00:00:00 2001 From: Florian Eckert Date: Fri, 13 Sep 2019 12:50:26 +0200 Subject: [PATCH 06/16] collectd: add new memory config values Signed-off-by: Florian Eckert (cherry-picked for 19.07) Signed-off-by: Hannu Nyman --- utils/collectd/files/usr/share/collectd/plugin/memory.json | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/utils/collectd/files/usr/share/collectd/plugin/memory.json b/utils/collectd/files/usr/share/collectd/plugin/memory.json index 2c63c0851..fc43e2fe9 100644 --- a/utils/collectd/files/usr/share/collectd/plugin/memory.json +++ b/utils/collectd/files/usr/share/collectd/plugin/memory.json @@ -1,2 +1,6 @@ { + "bool": [ + "ValuesPercentage", + "ValuesAbsolute" + ] } From 53e546854ab0f3ea55e2614d290e1111eea0b4f2 Mon Sep 17 00:00:00 2001 From: Florian Eckert Date: Mon, 16 Sep 2019 14:27:47 +0200 Subject: [PATCH 07/16] collectd: add apcups uci config Signed-off-by: Florian Eckert (cherry-picked for 19.07) Signed-off-by: Hannu Nyman --- 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 df7d418c97bd532eca7a9b4e6324a648520c3e0b Mon Sep 17 00:00:00 2001 From: Florian Eckert Date: Mon, 16 Sep 2019 14:55:17 +0200 Subject: [PATCH 08/16] collectd: add curl uci config Signed-off-by: Florian Eckert (cherry-picked for 19.07) Signed-off-by: Hannu Nyman --- 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 6884430d49766341644ede566cedd3582a122f55 Mon Sep 17 00:00:00 2001 From: Florian Eckert Date: Mon, 16 Sep 2019 15:48:02 +0200 Subject: [PATCH 09/16] collectd: add network uci config Signed-off-by: Florian Eckert (cherry-picked for 19.07) Signed-off-by: Hannu Nyman --- 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 5dd077e951727ae80b20c78ed7aa0bbece46f71a Mon Sep 17 00:00:00 2001 From: Florian Eckert Date: Tue, 17 Sep 2019 10:08:01 +0200 Subject: [PATCH 10/16] collectd: add iptables uci config Signed-off-by: Florian Eckert (cherry-picked for 19.07) Signed-off-by: Hannu Nyman --- 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 ac29330c5b78f75a6a07788fa2f6bda35c60d652 Mon Sep 17 00:00:00 2001 From: Florian Eckert Date: Fri, 20 Sep 2019 15:21:36 +0200 Subject: [PATCH 11/16] collectd: add logfile plugin definitions Signed-off-by: Florian Eckert (cherry-picked for 19.07) Signed-off-by: Hannu Nyman --- .../files/usr/share/collectd/plugin/logfile.json | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 utils/collectd/files/usr/share/collectd/plugin/logfile.json diff --git a/utils/collectd/files/usr/share/collectd/plugin/logfile.json b/utils/collectd/files/usr/share/collectd/plugin/logfile.json new file mode 100644 index 000000000..fd1608497 --- /dev/null +++ b/utils/collectd/files/usr/share/collectd/plugin/logfile.json @@ -0,0 +1,9 @@ +{ + "string": [ + "LogLevel", + "File" + ], + "bool": [ + "Timestamp" + ] +} From e7ed36702053b78ec2affe99e03d600456c899f0 Mon Sep 17 00:00:00 2001 From: Florian Eckert Date: Fri, 20 Sep 2019 15:46:53 +0200 Subject: [PATCH 12/16] collectd: add reload and service trigger Signed-off-by: Florian Eckert (cherry-picked for 19.07) Signed-off-by: Hannu Nyman --- utils/collectd/files/collectd.init | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/utils/collectd/files/collectd.init b/utils/collectd/files/collectd.init index 89715d4c4..89af365c2 100644 --- a/utils/collectd/files/collectd.init +++ b/utils/collectd/files/collectd.init @@ -333,6 +333,11 @@ process_config() { config_foreach process_plugins plugin } +service_triggers() +{ + procd_add_reload_trigger "collectd" +} + start_service() { process_config @@ -345,3 +350,7 @@ start_service() { procd_set_param respawn procd_close_instance } + +reload_service() { + restart "$@" +} From bbf35c736009e62b270ecdd00ad1e13659b3900f Mon Sep 17 00:00:00 2001 From: Florian Eckert Date: Fri, 20 Sep 2019 16:12:26 +0200 Subject: [PATCH 13/16] collectd: bump PKG_PACKAGE version Signed-off-by: Florian Eckert (cherry-picked for 19.07) Signed-off-by: Hannu Nyman --- utils/collectd/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/collectd/Makefile b/utils/collectd/Makefile index dbb56dc98..a954281d6 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:=4 +PKG_RELEASE:=7 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 PKG_SOURCE_URL:=https://collectd.org/files/ \ From a681b766e820fbbbe058fb4bb9c70ec16d4f3906 Mon Sep 17 00:00:00 2001 From: Hannu Nyman Date: Wed, 9 Oct 2019 20:56:21 +0300 Subject: [PATCH 14/16] collectd: update to 5.9.2 Update collectd to 5.9.2 Mainly bug fixes: https://github.com/collectd/collectd/blob/dfb9dd09fe3a6864c8cf85eb92e826c289e6d6d2/ChangeLog Signed-off-by: Hannu Nyman (cherry-picked for 19.07) Signed-off-by: Hannu Nyman --- utils/collectd/Makefile | 6 +++--- .../patches/300-delay-first-read-cycle.patch | 2 +- .../patches/600-fix-libmodbus-detection.patch | 2 +- .../patches/700-disable-sys-capability-check.patch | 2 +- utils/collectd/patches/900-add-iwinfo-plugin.patch | 14 +++++++------- 5 files changed, 13 insertions(+), 13 deletions(-) diff --git a/utils/collectd/Makefile b/utils/collectd/Makefile index a954281d6..b7c321b6b 100644 --- a/utils/collectd/Makefile +++ b/utils/collectd/Makefile @@ -8,13 +8,13 @@ include $(TOPDIR)/rules.mk PKG_NAME:=collectd -PKG_VERSION:=5.9.0 -PKG_RELEASE:=7 +PKG_VERSION:=5.9.2 +PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 PKG_SOURCE_URL:=https://collectd.org/files/ \ https://github.com/collectd/collectd/releases/download/collectd-$(PKG_VERSION) -PKG_HASH:=7b220f8898a061f6e7f29a8c16697d1a198277f813da69474a67911097c0626b +PKG_HASH:=917c483608b9b38438b121737b510c3d68f335c091bc286aa6ebcc0c8e372a09 PKG_FIXUP:=autoreconf PKG_REMOVE_FILES:=aclocal.m4 libltdl/aclocal.m4 diff --git a/utils/collectd/patches/300-delay-first-read-cycle.patch b/utils/collectd/patches/300-delay-first-read-cycle.patch index 6c6d1b116..2554ba830 100644 --- a/utils/collectd/patches/300-delay-first-read-cycle.patch +++ b/utils/collectd/patches/300-delay-first-read-cycle.patch @@ -1,6 +1,6 @@ --- a/src/daemon/plugin.c +++ b/src/daemon/plugin.c -@@ -1085,7 +1085,7 @@ static int plugin_insert_read(read_func_ +@@ -1087,7 +1087,7 @@ static int plugin_insert_read(read_func_ int status; llentry_t *le; diff --git a/utils/collectd/patches/600-fix-libmodbus-detection.patch b/utils/collectd/patches/600-fix-libmodbus-detection.patch index 7b22b6a89..8c5d17225 100644 --- a/utils/collectd/patches/600-fix-libmodbus-detection.patch +++ b/utils/collectd/patches/600-fix-libmodbus-detection.patch @@ -18,7 +18,7 @@ Reversed patch to be applied: --- a/configure.ac +++ b/configure.ac -@@ -3399,9 +3399,9 @@ if test "x$with_libmodbus" = "xyes"; the +@@ -3393,9 +3393,9 @@ if test "x$with_libmodbus" = "xyes"; the SAVE_CPPFLAGS="$CPPFLAGS" CPPFLAGS="$CPPFLAGS $with_libmodbus_cflags" diff --git a/utils/collectd/patches/700-disable-sys-capability-check.patch b/utils/collectd/patches/700-disable-sys-capability-check.patch index c5126731e..8b3068707 100644 --- a/utils/collectd/patches/700-disable-sys-capability-check.patch +++ b/utils/collectd/patches/700-disable-sys-capability-check.patch @@ -1,6 +1,6 @@ --- a/configure.ac +++ b/configure.ac -@@ -531,11 +531,7 @@ if test "x$ac_system" = "xLinux"; then +@@ -532,11 +532,7 @@ if test "x$ac_system" = "xLinux"; then [have_cpuid_h="no (cpuid.h not found)"] ) diff --git a/utils/collectd/patches/900-add-iwinfo-plugin.patch b/utils/collectd/patches/900-add-iwinfo-plugin.patch index ff0269b83..e10528df8 100644 --- a/utils/collectd/patches/900-add-iwinfo-plugin.patch +++ b/utils/collectd/patches/900-add-iwinfo-plugin.patch @@ -1,6 +1,6 @@ --- a/configure.ac +++ b/configure.ac -@@ -721,6 +721,11 @@ AC_CACHE_CHECK([whether clock_boottime a +@@ -712,6 +712,11 @@ AC_CACHE_CHECK([whether clock_boottime a ] ) @@ -12,7 +12,7 @@ # # Checks for typedefs, structures, and compiler characteristics. -@@ -6392,6 +6397,7 @@ plugin_ipc="no" +@@ -6394,6 +6399,7 @@ plugin_ipc="no" plugin_ipmi="no" plugin_ipvs="no" plugin_irq="no" @@ -20,7 +20,7 @@ plugin_load="no" plugin_log_logstash="no" plugin_mcelog="no" -@@ -6826,6 +6832,7 @@ AC_PLUGIN([ipmi], [$plugi +@@ -6828,6 +6834,7 @@ AC_PLUGIN([ipmi], [$plugi AC_PLUGIN([iptables], [$with_libiptc], [IPTables rule counters]) AC_PLUGIN([ipvs], [$plugin_ipvs], [IPVS connection statistics]) AC_PLUGIN([irq], [$plugin_irq], [IRQ statistics]) @@ -28,7 +28,7 @@ AC_PLUGIN([java], [$with_java], [Embed the Java Virtual Machine]) AC_PLUGIN([load], [$plugin_load], [System load]) AC_PLUGIN([log_logstash], [$plugin_log_logstash], [Logstash json_event compatible logging]) -@@ -7193,6 +7200,7 @@ AC_MSG_RESULT([ libyajl . . . . . . . +@@ -7197,6 +7204,7 @@ AC_MSG_RESULT([ libyajl . . . . . . . AC_MSG_RESULT([ oracle . . . . . . . $with_oracle]) AC_MSG_RESULT([ protobuf-c . . . . . $have_protoc_c]) AC_MSG_RESULT([ protoc 3 . . . . . . $have_protoc3]) @@ -36,7 +36,7 @@ AC_MSG_RESULT() AC_MSG_RESULT([ Features:]) AC_MSG_RESULT([ daemon mode . . . . . $enable_daemon]) -@@ -7253,6 +7261,7 @@ AC_MSG_RESULT([ ipmi . . . . . . . . +@@ -7257,6 +7265,7 @@ AC_MSG_RESULT([ ipmi . . . . . . . . AC_MSG_RESULT([ iptables . . . . . . $enable_iptables]) AC_MSG_RESULT([ ipvs . . . . . . . . $enable_ipvs]) AC_MSG_RESULT([ irq . . . . . . . . . $enable_irq]) @@ -252,7 +252,7 @@ +} --- a/src/types.db +++ b/src/types.db -@@ -240,6 +240,7 @@ voltage_threshold value:GAUGE:U:U, +@@ -240,6 +240,7 @@ snr value:GAUGE:0:U spam_check value:GAUGE:0:U spam_score value:GAUGE:U:U spl value:GAUGE:U:U @@ -262,7 +262,7 @@ tcp_connections value:GAUGE:0:4294967295 --- a/Makefile.am +++ b/Makefile.am -@@ -1149,6 +1149,14 @@ irq_la_LDFLAGS = $(PLUGIN_LDFLAGS) +@@ -1150,6 +1150,14 @@ irq_la_LDFLAGS = $(PLUGIN_LDFLAGS) irq_la_LIBADD = libignorelist.la endif From e33b3f8caba3aa08d80c8585e2a397c3efa54e4b Mon Sep 17 00:00:00 2001 From: Hannu Nyman Date: Sun, 3 Nov 2019 17:48:11 +0200 Subject: [PATCH 15/16] collectd: adjust reaction to ntp time at boot time Adjust the reaction to a polling interval timestamp that references to a past time. Past timestamps can happen when ntpd adjusts router's time after network connectivity is obtained after boot. Collectd shows warnings for each plugin as it tries to enter new values with the same timestamp as the previous one. This patch adjusts the next polling time to be now+2 seconds for the main loop and for the plugin-specific read loops. That avoids the warnings, but does not overreact in case there are shorter polling intervals or the time gets adjusted for other reasons. Additionally some debug statements are aded, but they are visible only when --enable-debug configure option is used in Makefile. Signed-off-by: Hannu Nyman (cherry-picked for 19.07) Signed-off-by: Hannu Nyman --- utils/collectd/Makefile | 2 +- ...-reaction-to-ntp-time-change-at-boot.patch | 61 +++++++++++++++++++ 2 files changed, 62 insertions(+), 1 deletion(-) create mode 100644 utils/collectd/patches/320-reaction-to-ntp-time-change-at-boot.patch diff --git a/utils/collectd/Makefile b/utils/collectd/Makefile index b7c321b6b..605e44d22 100644 --- a/utils/collectd/Makefile +++ b/utils/collectd/Makefile @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=collectd PKG_VERSION:=5.9.2 -PKG_RELEASE:=1 +PKG_RELEASE:=2 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 PKG_SOURCE_URL:=https://collectd.org/files/ \ diff --git a/utils/collectd/patches/320-reaction-to-ntp-time-change-at-boot.patch b/utils/collectd/patches/320-reaction-to-ntp-time-change-at-boot.patch new file mode 100644 index 000000000..6440a139d --- /dev/null +++ b/utils/collectd/patches/320-reaction-to-ntp-time-change-at-boot.patch @@ -0,0 +1,61 @@ +Adjust the reaction to a polling interval timestamp that references +to a past time. + +Past timestamps can happen when ntpd adjusts router's time after network +connectivity is obtained after boot. Collectd shows warnings for each plugin +as it tries to enter new values with the same timestamp as the previous one. + +This patch adjusts the next polling time to be now+2 seconds for the main +loop and for the plugin-specific read loops. That avoids the warnings, but +does not overreact in case there are shorter polling intervals or the time +gets adjusted for other reasons. + +Additionally some debug statements are added, but they are visible only +when --enable-debug configure option is used in Makefile. + + +--- a/src/daemon/collectd.c ++++ b/src/daemon/collectd.c +@@ -274,20 +274,23 @@ static int do_loop(void) { + update_kstat(); + #endif + ++ DEBUG("do_loop before plugin_read_all: now = %.3f", CDTIME_T_TO_DOUBLE(cdtime())); + /* Issue all plugins */ + plugin_read_all(); + + cdtime_t now = cdtime(); ++ DEBUG("do_loop after plugin_read_all: now = %.3f, wait_until= %.3f", CDTIME_T_TO_DOUBLE(now), CDTIME_T_TO_DOUBLE(wait_until)); + if (now >= wait_until) { +- WARNING("Not sleeping because the next interval is " ++ WARNING("Sleeping only 2s because the next interval is " + "%.3f seconds in the past!", + CDTIME_T_TO_DOUBLE(now - wait_until)); +- wait_until = now + interval; +- continue; ++ wait_until = now + DOUBLE_TO_CDTIME_T(2); ++ DEBUG("do_loop: wait_until adjusted to now+2 = %.3f", CDTIME_T_TO_DOUBLE(wait_until)); + } + + struct timespec ts_wait = CDTIME_T_TO_TIMESPEC(wait_until - now); + wait_until = wait_until + interval; ++ DEBUG("do_loop ends: wait_until set to %.3f", CDTIME_T_TO_DOUBLE(wait_until)); + + while ((loop == 0) && (nanosleep(&ts_wait, &ts_wait) != 0)) { + if (errno != EINTR) { +--- a/src/daemon/plugin.c ++++ a/src/daemon/plugin.c +@@ -578,10 +578,11 @@ + + /* Check, if `rf_next_read' is in the past. */ + if (rf->rf_next_read < now) { +- /* `rf_next_read' is in the past. Insert `now' ++ /* `rf_next_read' is in the past. Insert `now'+2s + * so this value doesn't trail off into the + * past too much. */ +- rf->rf_next_read = now; ++ rf->rf_next_read = now + DOUBLE_TO_CDTIME_T(2); ++ DEBUG("plugin_read_thread: Next read is in the past. Adjusted to now+2s"); + } + + DEBUG("plugin_read_thread: Next read of the `%s' plugin at %.3f.", From a9b5f06578cc0115019b8727e1c36e004261db14 Mon Sep 17 00:00:00 2001 From: Hannu Nyman Date: Sat, 30 Nov 2019 19:19:10 +0200 Subject: [PATCH 16/16] collectd: update to 5.10.0 Update collectd to 5.10.0 * leave new plugins as disabled for now (procevent, sysevent) * refresh patches. Remove unenecessary version fix Signed-off-by: Hannu Nyman (cherry-picked for 19.07. PKG_RELEASE=2 as cpufreq was already backported) Signed-off-by: Hannu Nyman --- utils/collectd/Makefile | 6 ++++-- .../patches/300-delay-first-read-cycle.patch | 2 +- ...0-reaction-to-ntp-time-change-at-boot.patch | 4 ++-- .../patches/600-fix-libmodbus-detection.patch | 2 +- .../patches/900-add-iwinfo-plugin.patch | 18 +++++++++--------- 5 files changed, 17 insertions(+), 15 deletions(-) diff --git a/utils/collectd/Makefile b/utils/collectd/Makefile index 605e44d22..74fa9c42a 100644 --- a/utils/collectd/Makefile +++ b/utils/collectd/Makefile @@ -8,13 +8,13 @@ include $(TOPDIR)/rules.mk PKG_NAME:=collectd -PKG_VERSION:=5.9.2 +PKG_VERSION:=5.10.0 PKG_RELEASE:=2 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 PKG_SOURCE_URL:=https://collectd.org/files/ \ https://github.com/collectd/collectd/releases/download/collectd-$(PKG_VERSION) -PKG_HASH:=917c483608b9b38438b121737b510c3d68f335c091bc286aa6ebcc0c8e372a09 +PKG_HASH:=a03359f563023e744c2dc743008a00a848f4cd506e072621d86b6d8313c0375b PKG_FIXUP:=autoreconf PKG_REMOVE_FILES:=aclocal.m4 libltdl/aclocal.m4 @@ -82,6 +82,7 @@ COLLECTD_PLUGINS_DISABLED:= \ perl \ pf \ pinba \ + procevent \ python \ redis \ rrdcached \ @@ -92,6 +93,7 @@ COLLECTD_PLUGINS_DISABLED:= \ statsd \ swap \ synproxy \ + sysevent \ tape \ tokyotyrant \ turbostat \ diff --git a/utils/collectd/patches/300-delay-first-read-cycle.patch b/utils/collectd/patches/300-delay-first-read-cycle.patch index 2554ba830..d4eb82666 100644 --- a/utils/collectd/patches/300-delay-first-read-cycle.patch +++ b/utils/collectd/patches/300-delay-first-read-cycle.patch @@ -1,6 +1,6 @@ --- a/src/daemon/plugin.c +++ b/src/daemon/plugin.c -@@ -1087,7 +1087,7 @@ static int plugin_insert_read(read_func_ +@@ -1092,7 +1092,7 @@ static int plugin_insert_read(read_func_ int status; llentry_t *le; diff --git a/utils/collectd/patches/320-reaction-to-ntp-time-change-at-boot.patch b/utils/collectd/patches/320-reaction-to-ntp-time-change-at-boot.patch index 6440a139d..9b0d0338c 100644 --- a/utils/collectd/patches/320-reaction-to-ntp-time-change-at-boot.patch +++ b/utils/collectd/patches/320-reaction-to-ntp-time-change-at-boot.patch @@ -44,8 +44,8 @@ when --enable-debug configure option is used in Makefile. while ((loop == 0) && (nanosleep(&ts_wait, &ts_wait) != 0)) { if (errno != EINTR) { --- a/src/daemon/plugin.c -+++ a/src/daemon/plugin.c -@@ -578,10 +578,11 @@ ++++ b/src/daemon/plugin.c +@@ -585,10 +585,11 @@ static void *plugin_read_thread(void __a /* Check, if `rf_next_read' is in the past. */ if (rf->rf_next_read < now) { diff --git a/utils/collectd/patches/600-fix-libmodbus-detection.patch b/utils/collectd/patches/600-fix-libmodbus-detection.patch index 8c5d17225..464605762 100644 --- a/utils/collectd/patches/600-fix-libmodbus-detection.patch +++ b/utils/collectd/patches/600-fix-libmodbus-detection.patch @@ -18,7 +18,7 @@ Reversed patch to be applied: --- a/configure.ac +++ b/configure.ac -@@ -3393,9 +3393,9 @@ if test "x$with_libmodbus" = "xyes"; the +@@ -3389,9 +3389,9 @@ if test "x$with_libmodbus" = "xyes"; the SAVE_CPPFLAGS="$CPPFLAGS" CPPFLAGS="$CPPFLAGS $with_libmodbus_cflags" diff --git a/utils/collectd/patches/900-add-iwinfo-plugin.patch b/utils/collectd/patches/900-add-iwinfo-plugin.patch index e10528df8..318cfb78b 100644 --- a/utils/collectd/patches/900-add-iwinfo-plugin.patch +++ b/utils/collectd/patches/900-add-iwinfo-plugin.patch @@ -12,7 +12,7 @@ # # Checks for typedefs, structures, and compiler characteristics. -@@ -6394,6 +6399,7 @@ plugin_ipc="no" +@@ -6397,6 +6402,7 @@ plugin_ipc="no" plugin_ipmi="no" plugin_ipvs="no" plugin_irq="no" @@ -20,7 +20,7 @@ plugin_load="no" plugin_log_logstash="no" plugin_mcelog="no" -@@ -6828,6 +6834,7 @@ AC_PLUGIN([ipmi], [$plugi +@@ -6841,6 +6847,7 @@ AC_PLUGIN([ipmi], [$plugi AC_PLUGIN([iptables], [$with_libiptc], [IPTables rule counters]) AC_PLUGIN([ipvs], [$plugin_ipvs], [IPVS connection statistics]) AC_PLUGIN([irq], [$plugin_irq], [IRQ statistics]) @@ -28,7 +28,7 @@ AC_PLUGIN([java], [$with_java], [Embed the Java Virtual Machine]) AC_PLUGIN([load], [$plugin_load], [System load]) AC_PLUGIN([log_logstash], [$plugin_log_logstash], [Logstash json_event compatible logging]) -@@ -7197,6 +7204,7 @@ AC_MSG_RESULT([ libyajl . . . . . . . +@@ -7212,6 +7219,7 @@ AC_MSG_RESULT([ libyajl . . . . . . . AC_MSG_RESULT([ oracle . . . . . . . $with_oracle]) AC_MSG_RESULT([ protobuf-c . . . . . $have_protoc_c]) AC_MSG_RESULT([ protoc 3 . . . . . . $have_protoc3]) @@ -36,7 +36,7 @@ AC_MSG_RESULT() AC_MSG_RESULT([ Features:]) AC_MSG_RESULT([ daemon mode . . . . . $enable_daemon]) -@@ -7257,6 +7265,7 @@ AC_MSG_RESULT([ ipmi . . . . . . . . +@@ -7274,6 +7282,7 @@ AC_MSG_RESULT([ ipmi . . . . . . . . AC_MSG_RESULT([ iptables . . . . . . $enable_iptables]) AC_MSG_RESULT([ ipvs . . . . . . . . $enable_ipvs]) AC_MSG_RESULT([ irq . . . . . . . . . $enable_irq]) @@ -46,7 +46,7 @@ AC_MSG_RESULT([ logfile . . . . . . . $enable_logfile]) --- a/src/collectd.conf.in +++ b/src/collectd.conf.in -@@ -138,6 +138,7 @@ +@@ -140,6 +140,7 @@ #@BUILD_PLUGIN_IPTABLES_TRUE@LoadPlugin iptables #@BUILD_PLUGIN_IPVS_TRUE@LoadPlugin ipvs #@BUILD_PLUGIN_IRQ_TRUE@LoadPlugin irq @@ -54,7 +54,7 @@ #@BUILD_PLUGIN_JAVA_TRUE@LoadPlugin java @BUILD_PLUGIN_LOAD_TRUE@@BUILD_PLUGIN_LOAD_TRUE@LoadPlugin load #@BUILD_PLUGIN_LPAR_TRUE@LoadPlugin lpar -@@ -767,6 +768,12 @@ +@@ -775,6 +776,12 @@ # IgnoreSelected true # @@ -69,7 +69,7 @@ # JVMArg "-Djava.class.path=@prefix@/share/collectd/java/collectd-api.jar" --- a/src/collectd.conf.pod +++ b/src/collectd.conf.pod -@@ -3803,6 +3803,27 @@ and all other interrupts are collected. +@@ -3873,6 +3873,27 @@ and all other interrupts are collected. =back @@ -259,10 +259,10 @@ +stations value:GAUGE:0:256 swap value:GAUGE:0:1099511627776 swap_io value:DERIVE:0:U - tcp_connections value:GAUGE:0:4294967295 + sysevent value:GAUGE:0:1 --- a/Makefile.am +++ b/Makefile.am -@@ -1150,6 +1150,14 @@ irq_la_LDFLAGS = $(PLUGIN_LDFLAGS) +@@ -1165,6 +1165,14 @@ irq_la_LDFLAGS = $(PLUGIN_LDFLAGS) irq_la_LIBADD = libignorelist.la endif