collectd: upgrade package collectd to version 5.8.0

This patch upgrades the collectd package from 5.7.2 to 5.8.2.
All openwrt patches got either updated or deleted in case they
are already included into upstream collectd.
The new collectd 5.8.0 package compiles and got tested on current
lede trunk with latest luci on an PCengines APU. All default plugins
(enabled via Openwrt  Makefile) - so also iwinfo - are running fine
with the new version.

Signed-off-by: Thomas Huehn <thomas@net.t-labs.tu-berlin.de>

Amended with the following changes:

* preserve git file history by avoiding unnecessary patch renames
* mark new plugins introduced with 5.8 branch as disabled

Compile tested all plugins with ipq806x

Signed-off-by: Hannu Nyman <hannu.nyman@iki.fi>
This commit is contained in:
Thomas Huehn 2017-11-30 19:52:34 +01:00 committed by Hannu Nyman
parent f7450805b4
commit 55e530747f
8 changed files with 73 additions and 228 deletions

View File

@ -8,13 +8,13 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=collectd
PKG_VERSION:=5.7.2
PKG_RELEASE:=2
PKG_VERSION:=5.8.0
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:=9d20a0221569a8d6b80bbc52b86e5e84965f5bafdbf5dfc3790e0fed0763e592
PKG_HASH:=b06ff476bbf05533cb97ae6749262cc3c76c9969f032bd8496690084ddeb15c9
PKG_FIXUP:=autoreconf
PKG_REMOVE_FILES:=aclocal.m4 libltdl/aclocal.m4
@ -36,6 +36,7 @@ COLLECTD_PLUGINS_DISABLED:= \
curl_json \
curl_xml \
dbi \
dpdkevents \
dpdkstat \
drbd \
ethstat \
@ -46,6 +47,7 @@ COLLECTD_PLUGINS_DISABLED:= \
grpc \
hddtemp \
hugepages \
intel_pmu \
intel_rdt \
ipc \
ipmi \
@ -57,6 +59,7 @@ COLLECTD_PLUGINS_DISABLED:= \
lpar \
madwifi \
mbmon \
mcelog \
md \
memcachec \
memcached \
@ -73,6 +76,8 @@ COLLECTD_PLUGINS_DISABLED:= \
openldap \
openvz \
oracle \
ovs_events \
ovs_stats \
perl \
pf \
pinba \
@ -83,8 +88,10 @@ COLLECTD_PLUGINS_DISABLED:= \
serial \
sigrok \
smart \
snmp_agent \
statsd \
swap \
synproxy \
tape \
tokyotyrant \
turbostat \

View File

@ -1,6 +1,6 @@
--- a/src/rrdtool.c
+++ b/src/rrdtool.c
@@ -61,6 +61,7 @@ typedef struct rrd_queue_s rrd_queue_t;
@@ -60,6 +60,7 @@ typedef struct rrd_queue_s rrd_queue_t;
static const char *config_keys[] = {
"CacheTimeout", "CacheFlush", "CreateFilesAsync", "DataDir",
"StepSize", "HeartBeat", "RRARows", "RRATimespan",
@ -8,7 +8,7 @@
"XFF", "WritesPerSecond", "RandomTimeout"};
static int config_keys_num = STATIC_ARRAY_SIZE(config_keys);
@@ -78,6 +79,8 @@ static rrdcreate_config_t rrdcreate_conf
@@ -77,6 +78,8 @@ static rrdcreate_config_t rrdcreate_conf
/* timespans = */ NULL,
/* timespans_num = */ 0,
@ -17,7 +17,7 @@
/* consolidation_functions = */ NULL,
/* consolidation_functions_num = */ 0,
@@ -971,6 +974,12 @@ static int rrd_config(const char *key, c
@@ -950,6 +953,12 @@ static int rrd_config(const char *key, c
/* compar = */ rrd_compare_numeric);
free(value_copy);

View File

@ -1,6 +1,6 @@
--- a/src/daemon/plugin.c
+++ b/src/daemon/plugin.c
@@ -1108,7 +1108,7 @@ static int plugin_insert_read(read_func_
@@ -1099,7 +1099,7 @@ static int plugin_insert_read(read_func_
int status;
llentry_t *le;

View File

@ -2,7 +2,7 @@
+++ b/src/olsrd.c
@@ -585,7 +585,7 @@ static int olsrd_read(void) /* {{{ */
if (fh == NULL)
return (-1);
return -1;
- fputs("\r\n", fh);
+ fputs("/all \r\n", fh);

View File

@ -1,169 +0,0 @@
From af01dd6fa3eb458e2fbb272703b0cae37ea54a9b Mon Sep 17 00:00:00 2001
From: Marcin Jurkowski <marcin1j@gmail.com>
Date: Tue, 11 Jul 2017 15:00:25 +0200
Subject: [PATCH] uptime plugin: don't cache boot time and simplify Linux code
Caching boottime on startup yields incorrect uptime values if system
date changes after the daemon is started.
This is almost certain to happen on embedded systems without RTC, where
clock is set from NTP server at some point after boot process.
On Linux, we can retrieve uptime directly by either reading /proc/uptime
(it's sufficient to read a few bytes) or calling sysinfo() function.
Use the latter since it's the most efficient way in speed, memory
requirements and code simplicity terms.
---
src/uptime.c | 71 ++++++++++++++++--------------------------------------------
1 file changed, 19 insertions(+), 52 deletions(-)
--- a/src/uptime.c
+++ b/src/uptime.c
@@ -25,8 +25,7 @@
#include "plugin.h"
#if KERNEL_LINUX
-#define STAT_FILE "/proc/stat"
-/* Using /proc filesystem to retrieve the boot time, Linux only. */
+#include <sys/sysinfo.h>
/* #endif KERNEL_LINUX */
#elif HAVE_LIBKSTAT
@@ -53,8 +52,6 @@
/*
* Global variables
*/
-/* boottime always used, no OS distinction */
-static time_t boottime;
#if HAVE_LIBKSTAT
extern kstat_ctl_t *kc;
@@ -72,8 +69,6 @@ static void uptime_submit(gauge_t value)
plugin_dispatch_values(&vl);
}
-static int uptime_init(void) /* {{{ */
-{
/*
* On most unix systems the uptime is calculated by looking at the boot
* time (stored in unix time, since epoch) and the current one. We are
@@ -84,48 +79,21 @@ static int uptime_init(void) /* {{{ */
* the boot time, the plugin is unregistered and there is no chance to
* try again later. Nevertheless, this is very unlikely to happen.
*/
-
+static time_t uptime_get_sys(void) { /* {{{ */
+ time_t result;
#if KERNEL_LINUX
- unsigned long starttime;
- char buffer[1024];
- int ret;
- FILE *fh;
-
- ret = 0;
-
- fh = fopen(STAT_FILE, "r");
+ struct sysinfo info;
+ int status;
- if (fh == NULL) {
+ status = sysinfo(&info);
+ if (status != 0) {
char errbuf[1024];
- ERROR("uptime plugin: Cannot open " STAT_FILE ": %s",
+ ERROR("uptime plugin: Error calling sysinfo: %s",
sstrerror(errno, errbuf, sizeof(errbuf)));
return (-1);
}
- while (fgets(buffer, 1024, fh) != NULL) {
- /* look for the btime string and read the value */
- ret = sscanf(buffer, "btime %lu", &starttime);
- /* avoid further loops if btime has been found and read
- * correctly (hopefully) */
- if (ret == 1)
- break;
- }
-
- fclose(fh);
-
- /* loop done, check if no value has been found/read */
- if (ret != 1) {
- ERROR("uptime plugin: No value read from " STAT_FILE "");
- return (-1);
- }
-
- boottime = (time_t)starttime;
-
- if (boottime == 0) {
- ERROR("uptime plugin: btime read from " STAT_FILE ", "
- "but `boottime' is zero!");
- return (-1);
- }
+ result = (time_t)info.uptime;
/* #endif KERNEL_LINUX */
#elif HAVE_LIBKSTAT
@@ -159,13 +127,13 @@ static int uptime_init(void) /* {{{ */
return (-1);
}
- boottime = (time_t)knp->value.ui32;
-
- if (boottime == 0) {
+ if (knp->value.ui32 == 0) {
ERROR("uptime plugin: kstat_data_lookup returned success, "
"but `boottime' is zero!");
return (-1);
}
+
+ result = time(NULL) - (time_t)knp->value.ui32;
/* #endif HAVE_LIBKSTAT */
#elif HAVE_SYS_SYSCTL_H
@@ -186,13 +154,13 @@ static int uptime_init(void) /* {{{ */
return (-1);
}
- boottime = boottv.tv_sec;
-
- if (boottime == 0) {
+ if (boottv.tv_sec == 0) {
ERROR("uptime plugin: sysctl(3) returned success, "
"but `boottime' is zero!");
return (-1);
}
+
+ result = time(NULL) - boottv.tv_sec;
/* #endif HAVE_SYS_SYSCTL_H */
#elif HAVE_PERFSTAT
@@ -212,18 +180,18 @@ static int uptime_init(void) /* {{{ */
if (hertz <= 0)
hertz = HZ;
- boottime = time(NULL) - cputotal.lbolt / hertz;
+ result = cputotal.lbolt / hertz;
#endif /* HAVE_PERFSTAT */
- return (0);
-} /* }}} int uptime_init */
+ return result;
+} /* }}} int uptime_get_sys */
static int uptime_read(void) {
gauge_t uptime;
time_t elapsed;
/* calculate the amount of time elapsed since boot, AKA uptime */
- elapsed = time(NULL) - boottime;
+ elapsed = uptime_get_sys();
uptime = (gauge_t)elapsed;
@@ -233,6 +201,5 @@ static int uptime_read(void) {
}
void module_register(void) {
- plugin_register_init("uptime", uptime_init);
plugin_register_read("uptime", uptime_read);
} /* void module_register */

View File

@ -18,15 +18,18 @@ Reversed patch to be applied:
--- a/configure.ac
+++ b/configure.ac
@@ -3278,7 +3278,7 @@ then
SAVE_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS $with_libmodbus_cflags"
@@ -3327,9 +3327,9 @@ if test "x$with_libmodbus" = "xyes"; the
SAVE_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS $with_libmodbus_cflags"
- AC_CHECK_HEADERS(modbus.h, [], [with_libmodbus="no (modbus.h not found)"])
+ AC_CHECK_HEADERS(modbus/modbus.h, [], [with_libmodbus="no (modbus/modbus.h not found)"])
- AC_CHECK_HEADERS([modbus.h],
+ AC_CHECK_HEADERS([modbus/modbus.h],
[with_libmodbus="yes"],
- [with_libmodbus="no (modbus.h not found)"]
+ [with_libmodbus="no (modbus/modbus.h not found)"]
)
CPPFLAGS="$SAVE_CPPFLAGS"
fi
CPPFLAGS="$SAVE_CPPFLAGS"
--- a/src/modbus.c
+++ b/src/modbus.c
@@ -26,7 +26,7 @@

View File

@ -1,14 +1,15 @@
--- a/configure.ac
+++ b/configure.ac
@@ -830,10 +830,7 @@ fi
have_cpuid_h="no"
AC_CHECK_HEADERS(cpuid.h, [have_cpuid_h="yes"])
@@ -526,11 +526,7 @@ if test "x$ac_system" = "xLinux"; then
[have_cpuid_h="no (cpuid.h not found)"]
)
-have_capability="yes"
-AC_CHECK_HEADERS(sys/capability.h,
- [have_capability="yes"],
- [have_capability="no (<sys/capability.h> not found)"])
+have_capability="no"
if test "x$have_capability" = "xyes"; then
AC_CHECK_LIB(cap, cap_get_proc,
[have_capability="yes"],
- AC_CHECK_HEADERS([sys/capability.h],
- [have_capability="yes"],
- [have_capability="no (<sys/capability.h> not found)"]
- )
-
+ have_capability="no"
if test "x$have_capability" = "xyes"; then
AC_CHECK_LIB([cap], [cap_get_proc],
[have_capability="yes"],

View File

@ -1,24 +1,26 @@
--- a/configure.ac
+++ b/configure.ac
@@ -804,6 +804,9 @@ AC_CACHE_CHECK([whether clock_boottime a
[c_cv_have_clock_boottime_monotonic="no"]))
@@ -710,6 +710,11 @@ AC_CACHE_CHECK([whether clock_boottime a
]
)
+# For the iwinfo plugin
+AC_CHECK_LIB(iwinfo, iwinfo_backend, [with_iwinfo="yes"], [with_iwinfo="no (libiwinfo not found)"], [])
+
# For the turbostat plugin
have_asm_msrindex_h="no"
AC_CHECK_HEADERS(asm/msr-index.h, [have_asm_msrindex_h="yes"])
@@ -6035,6 +6038,7 @@ plugin_interface="no"
+AC_CHECK_LIB([iwinfo], [iwinfo_backend],
+ [with_iwinfo="yes"],
+ [with_iwinfo="no (libiwinfo not found)"]
+)
#
# Checks for typedefs, structures, and compiler characteristics.
@@ -6127,6 +6132,7 @@ plugin_ipc="no"
plugin_ipmi="no"
plugin_ipvs="no"
plugin_irq="no"
+plugin_iwinfo="no"
plugin_load="no"
plugin_log_logstash="no"
plugin_memory="no"
@@ -6505,6 +6509,7 @@ AC_PLUGIN([ipmi], [$plugi
plugin_mcelog="no"
@@ -6538,6 +6544,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])
@ -26,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])
@@ -6886,6 +6891,7 @@ AC_MSG_RESULT([ libyajl . . . . . . .
@@ -6899,6 +6906,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])
@ -34,7 +36,7 @@
AC_MSG_RESULT()
AC_MSG_RESULT([ Features:])
AC_MSG_RESULT([ daemon mode . . . . . $enable_daemon])
@@ -6942,6 +6948,7 @@ AC_MSG_RESULT([ ipmi . . . . . . . .
@@ -6957,6 +6965,7 @@ AC_MSG_RESULT([ ipmi . . . . . . . .
AC_MSG_RESULT([ iptables . . . . . . $enable_iptables])
AC_MSG_RESULT([ ipvs . . . . . . . . $enable_ipvs])
AC_MSG_RESULT([ irq . . . . . . . . . $enable_irq])
@ -44,7 +46,7 @@
AC_MSG_RESULT([ logfile . . . . . . . $enable_logfile])
--- a/src/collectd.conf.in
+++ b/src/collectd.conf.in
@@ -135,6 +135,7 @@
@@ -137,6 +137,7 @@
#@BUILD_PLUGIN_IPTABLES_TRUE@LoadPlugin iptables
#@BUILD_PLUGIN_IPVS_TRUE@LoadPlugin ipvs
#@BUILD_PLUGIN_IRQ_TRUE@LoadPlugin irq
@ -52,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
@@ -649,6 +650,12 @@
@@ -720,6 +721,12 @@
# IgnoreSelected true
#</Plugin>
@ -67,7 +69,7 @@
# JVMArg "-Djava.class.path=@prefix@/share/collectd/java/collectd-api.jar"
--- a/src/collectd.conf.pod
+++ b/src/collectd.conf.pod
@@ -3143,6 +3143,27 @@ and all other interrupts are collected.
@@ -3503,6 +3503,27 @@ and all other interrupts are collected.
=back
@ -248,25 +250,9 @@
+ plugin_register_config("iwinfo", iwinfo_config, config_keys, config_keys_num);
+ plugin_register_read("iwinfo", iwinfo_read);
+}
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -568,6 +568,13 @@ irq_la_SOURCES = irq.c
irq_la_LDFLAGS = $(PLUGIN_LDFLAGS)
endif
+if BUILD_PLUGIN_IWINFO
+pkglib_LTLIBRARIES += iwinfo.la
+iwinfo_la_SOURCES = iwinfo.c
+iwinfo_la_LDFLAGS = -module -avoid-version
+iwinfo_la_LIBADD = -liwinfo
+endif
+
if BUILD_PLUGIN_JAVA
pkglib_LTLIBRARIES += java.la
java_la_SOURCES = java.c
--- a/src/types.db
+++ b/src/types.db
@@ -260,6 +260,7 @@ voltage_threshold value:GAUGE:U:U,
@@ -269,6 +269,7 @@ voltage_threshold value:GAUGE:U:U,
vs_memory value:GAUGE:0:9223372036854775807
vs_processes value:GAUGE:0:65535
vs_threads value:GAUGE:0:65535
@ -274,3 +260,20 @@
#
# Legacy types
--- a/Makefile.am
+++ b/Makefile.am
@@ -983,6 +983,14 @@ irq_la_LDFLAGS = $(PLUGIN_LDFLAGS)
irq_la_LIBADD = libignorelist.la
endif
+if BUILD_PLUGIN_IWINFO
+pkglib_LTLIBRARIES += iwinfo.la
+iwinfo_la_SOURCES = src/iwinfo.c
+#iwinfo_la_LDFLAGS = -module -avoid-version
+iwinfo_la_LDFLAGS = $(PLUGIN_LDFLAGS)
+iwinfo_la_LIBADD = -liwinfo libignorelist.la
+endif
+
if BUILD_PLUGIN_JAVA
pkglib_LTLIBRARIES += java.la
java_la_SOURCES = src/java.c