diff --git a/utils/collectd/Makefile b/utils/collectd/Makefile index 232225e45..6e621b7b8 100644 --- a/utils/collectd/Makefile +++ b/utils/collectd/Makefile @@ -8,13 +8,13 @@ include $(TOPDIR)/rules.mk PKG_NAME:=collectd -PKG_VERSION:=5.8.1 -PKG_RELEASE:=6 +PKG_VERSION:=5.9.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:=e796fda27ce06377f491ad91aa286962a68c2b54076aa77a29673d53204453da +PKG_HASH:=7b220f8898a061f6e7f29a8c16697d1a198277f813da69474a67911097c0626b PKG_FIXUP:=autoreconf PKG_REMOVE_FILES:=aclocal.m4 libltdl/aclocal.m4 @@ -26,6 +26,7 @@ PKG_USE_MIPS16:=0 COLLECTD_PLUGINS_DISABLED:= \ amqp \ + ampq1 \ apple_sensors \ aquaero \ barometer \ @@ -43,6 +44,7 @@ COLLECTD_PLUGINS_DISABLED:= \ genericjmx \ gmond \ gps \ + gpu_nvidia \ grpc \ hddtemp \ hugepages \ @@ -75,6 +77,7 @@ COLLECTD_PLUGINS_DISABLED:= \ oracle \ ovs_events \ ovs_stats \ + pcie_errors \ perl \ pf \ pinba \ @@ -103,6 +106,8 @@ COLLECTD_PLUGINS_DISABLED:= \ write_redis \ write_riemann \ write_sensu \ + write_stackdriver \ + write_syslog \ write_tsdb \ xencpu \ xmms \ @@ -399,7 +404,7 @@ $(eval $(call BuildPlugin,openvpn,OpenVPN traffic/compression input,openvpn,)) $(eval $(call BuildPlugin,ping,ping status input,ping,+PACKAGE_collectd-mod-ping:liboping)) $(eval $(call BuildPlugin,postgresql,PostgreSQL status input,postgresql,+PACKAGE_collectd-mod-postgresql:libpq)) $(eval $(call BuildPlugin,powerdns,PowerDNS server status input,powerdns,)) -$(eval $(call BuildPlugin,processes,process status input,processes,)) +$(eval $(call BuildPlugin,processes,process status input,processes,+PACKAGE_collectd-mod-processes:libmnl)) $(eval $(call BuildPlugin,protocols,network protocols input,protocols,)) $(eval $(call BuildPlugin,rrdtool,RRDtool output,rrdtool,+PACKAGE_collectd-mod-rrdtool:librrd1)) $(eval $(call BuildPlugin,sensors,lm_sensors input,sensors,+PACKAGE_collectd-mod-sensors:libsensors)) diff --git a/utils/collectd/patches/000-01-backport-upstream-remove-sensors-version-limit.patch b/utils/collectd/patches/000-01-backport-upstream-remove-sensors-version-limit.patch deleted file mode 100644 index af2c3ee43..000000000 --- a/utils/collectd/patches/000-01-backport-upstream-remove-sensors-version-limit.patch +++ /dev/null @@ -1,84 +0,0 @@ -From d5a3c020d33cc33ee8049f54c7b4dffcd123bf83 Mon Sep 17 00:00:00 2001 -From: Pavel Rochnyack -Date: Mon, 3 Dec 2018 18:34:14 +0700 -Subject: [PATCH] sensors: Removed checks for upper limit of - SENSORS_API_VERSION - -That makes no more sense after lm-sensors got new maintainers. - -Closes: #3006 ---- - src/sensors.c | 17 ++++++----------- - 1 file changed, 6 insertions(+), 11 deletions(-) - -diff --git a/src/sensors.c b/src/sensors.c -index f4ecda5e49..33982e061a 100644 ---- a/src/sensors.c -+++ b/src/sensors.c -@@ -149,7 +149,7 @@ typedef struct featurelist { - static char *conffile = SENSORS_CONF_PATH; - /* #endif SENSORS_API_VERSION < 0x400 */ - --#elif (SENSORS_API_VERSION >= 0x400) && (SENSORS_API_VERSION < 0x500) -+#elif (SENSORS_API_VERSION >= 0x400) - typedef struct featurelist { - const sensors_chip_name *chip; - const sensors_feature *feature; -@@ -159,11 +159,6 @@ typedef struct featurelist { - - static char *conffile = NULL; - static _Bool use_labels = 0; --/* #endif (SENSORS_API_VERSION >= 0x400) && (SENSORS_API_VERSION < 0x500) */ -- --#else /* if SENSORS_API_VERSION >= 0x500 */ --#error "This version of libsensors is not supported yet. Please report this " \ -- "as bug." - #endif - - static featurelist_t *first_feature = NULL; -@@ -223,7 +218,7 @@ static int sensors_config(const char *key, const char *value) { - if (IS_TRUE(value)) - ignorelist_set_invert(sensor_list, 0); - } --#if (SENSORS_API_VERSION >= 0x400) && (SENSORS_API_VERSION < 0x500) -+#if (SENSORS_API_VERSION >= 0x400) - else if (strcasecmp(key, "UseLabels") == 0) { - use_labels = IS_TRUE(value) ? 1 : 0; - } -@@ -353,7 +348,7 @@ static int sensors_load_conf(void) { - } /* while sensors_get_detected_chips */ - /* #endif SENSORS_API_VERSION < 0x400 */ - --#elif (SENSORS_API_VERSION >= 0x400) && (SENSORS_API_VERSION < 0x500) -+#elif (SENSORS_API_VERSION >= 0x400) - chip_num = 0; - while ((chip = sensors_get_detected_chips(NULL, &chip_num)) != NULL) { - const sensors_feature *feature; -@@ -410,7 +405,7 @@ static int sensors_load_conf(void) { - } /* while (subfeature) */ - } /* while (feature) */ - } /* while (chip) */ --#endif /* (SENSORS_API_VERSION >= 0x400) && (SENSORS_API_VERSION < 0x500) */ -+#endif /* (SENSORS_API_VERSION >= 0x400) */ - - if (first_feature == NULL) { - sensors_cleanup(); -@@ -485,7 +480,7 @@ static int sensors_read(void) { - } /* for fl = first_feature .. NULL */ - /* #endif SENSORS_API_VERSION < 0x400 */ - --#elif (SENSORS_API_VERSION >= 0x400) && (SENSORS_API_VERSION < 0x500) -+#elif (SENSORS_API_VERSION >= 0x400) - for (featurelist_t *fl = first_feature; fl != NULL; fl = fl->next) { - double value; - int status; -@@ -528,7 +523,7 @@ static int sensors_read(void) { - - sensors_submit(plugin_instance, type, type_instance, value); - } /* for fl = first_feature .. NULL */ --#endif /* (SENSORS_API_VERSION >= 0x400) && (SENSORS_API_VERSION < 0x500) */ -+#endif /* (SENSORS_API_VERSION >= 0x400) */ - - return 0; - } /* int sensors_read */ - diff --git a/utils/collectd/patches/050-backport-modbus-little-endian.patch b/utils/collectd/patches/050-backport-modbus-little-endian.patch deleted file mode 100644 index 26a589d6d..000000000 --- a/utils/collectd/patches/050-backport-modbus-little-endian.patch +++ /dev/null @@ -1,179 +0,0 @@ -From 6028f89df95b12219d735b277863f83e9f5ee9e9 Mon Sep 17 00:00:00 2001 -From: PJ Bostley -Date: Sat, 20 Jan 2018 16:39:36 -0700 -Subject: [PATCH 1/2] Adding support for CDAB endian 32-bit modbus polls - ---- - src/modbus.c | 61 +++++++++++++++++++++++++++++++++++++++++++++++++++++++----- - 1 file changed, 56 insertions(+), 5 deletions(-) - -diff --git a/src/modbus.c b/src/modbus.c -index 31f0c2da81..daa3c028f5 100644 ---- a/src/modbus.c -+++ b/src/modbus.c -@@ -76,9 +76,13 @@ - enum mb_register_type_e /* {{{ */ - { REG_TYPE_INT16, - REG_TYPE_INT32, -+ REG_TYPE_INT32_CDAB, - REG_TYPE_UINT16, - REG_TYPE_UINT32, -- REG_TYPE_FLOAT }; /* }}} */ -+ REG_TYPE_UINT32_CDAB, -+ REG_TYPE_FLOAT, -+ REG_TYPE_FLOAT_CDAB }; /* }}} */ -+ - enum mb_mreg_type_e /* {{{ */ - { MREG_HOLDING, - MREG_INPUT }; /* }}} */ -@@ -425,7 +429,9 @@ static int mb_read_data(mb_host_t *host, mb_slave_t *slave, /* {{{ */ - - if ((ds->ds[0].type != DS_TYPE_GAUGE) && - (data->register_type != REG_TYPE_INT32) && -- (data->register_type != REG_TYPE_UINT32)) { -+ (data->register_type != REG_TYPE_INT32_CDAB) && -+ (data->register_type != REG_TYPE_UINT32) && -+ (data->register_type != REG_TYPE_UINT32_CDAB)) { - NOTICE( - "Modbus plugin: The data source of type \"%s\" is %s, not gauge. " - "This will most likely result in problems, because the register type " -@@ -434,8 +440,11 @@ static int mb_read_data(mb_host_t *host, mb_slave_t *slave, /* {{{ */ - } - - if ((data->register_type == REG_TYPE_INT32) || -+ (data->register_type == REG_TYPE_INT32_CDAB) || - (data->register_type == REG_TYPE_UINT32) || -- (data->register_type == REG_TYPE_FLOAT)) -+ (data->register_type == REG_TYPE_UINT32_CDAB) || -+ (data->register_type == REG_TYPE_FLOAT) || -+ (data->register_type == REG_TYPE_FLOAT_CDAB)) - values_num = 2; - else - values_num = 1; -@@ -496,8 +505,8 @@ static int mb_read_data(mb_host_t *host, mb_slave_t *slave, /* {{{ */ - } - if (status != values_num) { - ERROR("Modbus plugin: modbus read function (%s/%s) failed. " -- " status = %i, values_num = %i. Giving up.", -- host->host, host->node, status, values_num); -+ " status = %i, start_addr = %i, values_num = %i. Giving up.", -+ host->host, host->node, status, data->register_base, values_num); - #if LEGACY_LIBMODBUS - modbus_close(&host->connection); - #else -@@ -521,6 +530,17 @@ static int mb_read_data(mb_host_t *host, mb_slave_t *slave, /* {{{ */ - "Returned float value is %g", - (double)float_value); - -+ CAST_TO_VALUE_T(ds, vt, float_value); -+ mb_submit(host, slave, data, vt); -+ } else if (data->register_type == REG_TYPE_FLOAT_CDAB) { -+ float float_value; -+ value_t vt; -+ -+ float_value = mb_register_to_float(values[1], values[0]); -+ DEBUG("Modbus plugin: mb_read_data: " -+ "Returned float value is %g", -+ (double)float_value); -+ - CAST_TO_VALUE_T(ds, vt, float_value); - mb_submit(host, slave, data, vt); - } else if (data->register_type == REG_TYPE_INT32) { -@@ -535,6 +555,20 @@ static int mb_read_data(mb_host_t *host, mb_slave_t *slave, /* {{{ */ - "Returned int32 value is %" PRIi32, - v.i32); - -+ CAST_TO_VALUE_T(ds, vt, v.i32); -+ mb_submit(host, slave, data, vt); -+ } else if (data->register_type == REG_TYPE_INT32_CDAB) { -+ union { -+ uint32_t u32; -+ int32_t i32; -+ } v; -+ value_t vt; -+ -+ v.u32 = (((uint32_t)values[1]) << 16) | ((uint32_t)values[0]); -+ DEBUG("Modbus plugin: mb_read_data: " -+ "Returned int32 value is %" PRIi32, -+ v.i32); -+ - CAST_TO_VALUE_T(ds, vt, v.i32); - mb_submit(host, slave, data, vt); - } else if (data->register_type == REG_TYPE_INT16) { -@@ -561,6 +595,17 @@ static int mb_read_data(mb_host_t *host, mb_slave_t *slave, /* {{{ */ - "Returned uint32 value is %" PRIu32, - v32); - -+ CAST_TO_VALUE_T(ds, vt, v32); -+ mb_submit(host, slave, data, vt); -+ } else if (data->register_type == REG_TYPE_UINT32_CDAB) { -+ uint32_t v32; -+ value_t vt; -+ -+ v32 = (((uint32_t)values[1]) << 16) | ((uint32_t)values[0]); -+ DEBUG("Modbus plugin: mb_read_data: " -+ "Returned uint32 value is %" PRIu32, -+ v32); -+ - CAST_TO_VALUE_T(ds, vt, v32); - mb_submit(host, slave, data, vt); - } else /* if (data->register_type == REG_TYPE_UINT16) */ -@@ -702,12 +747,18 @@ static int mb_config_add_data(oconfig_item_t *ci) /* {{{ */ - data.register_type = REG_TYPE_INT16; - else if (strcasecmp("Int32", tmp) == 0) - data.register_type = REG_TYPE_INT32; -+ else if (strcasecmp("Int32LE", tmp) == 0) -+ data.register_type = REG_TYPE_INT32_CDAB; - else if (strcasecmp("Uint16", tmp) == 0) - data.register_type = REG_TYPE_UINT16; - else if (strcasecmp("Uint32", tmp) == 0) - data.register_type = REG_TYPE_UINT32; -+ else if (strcasecmp("Uint32LE", tmp) == 0) -+ data.register_type = REG_TYPE_UINT32_CDAB; - else if (strcasecmp("Float", tmp) == 0) - data.register_type = REG_TYPE_FLOAT; -+ else if (strcasecmp("FloatLE", tmp) == 0) -+ data.register_type = REG_TYPE_FLOAT_CDAB; - else { - ERROR("Modbus plugin: The register type \"%s\" is unknown.", tmp); - status = -1; - -From 67afd2685892e69ababb489f48b9033ab5908f4d Mon Sep 17 00:00:00 2001 -From: PJ Bostley -Date: Tue, 23 Jan 2018 15:33:23 -0700 -Subject: [PATCH 2/2] Adding documentation for the Modbus little endian modes - where 32 bit values have thier registers swapped - ---- - src/collectd.conf.pod | 18 +++++++++++++----- - 1 file changed, 13 insertions(+), 5 deletions(-) - -diff --git a/src/collectd.conf.pod b/src/collectd.conf.pod -index dfd785a2c8..e9715126e6 100644 ---- a/src/collectd.conf.pod -+++ b/src/collectd.conf.pod -@@ -4139,11 +4139,19 @@ Configures the base register to read from the device. If the option - B has been set to B or B, this and the next - register will be read (the register number is increased by one). - --=item B B|B|B|B|B -- --Specifies what kind of data is returned by the device. If the type is B, --B or B, two 16Ebit registers will be read and the data is --combined into one value. Defaults to B. -+=item B B|B|B|B|B|B|B|B -+ -+Specifies what kind of data is returned by the device. This defaults to -+B. If the type is B, B, B, B, -+B or B, two 16Ebit registers at B -+and B will be read and the data is combined into one -+32Evalue. For B, B and B the most significant -+16Ebits are in the register at B and the least -+significant 16Ebits are in the register at B. -+For B, B, or B, the high and low order -+registers are swapped with the most significant 16Ebits in -+the B and the least significant 16Ebits in -+B. - - =item B B|B - diff --git a/utils/collectd/patches/051-Add-scale-and-shift-to-modbus-plugin.patch b/utils/collectd/patches/051-Add-scale-and-shift-to-modbus-plugin.patch deleted file mode 100644 index f95df9d56..000000000 --- a/utils/collectd/patches/051-Add-scale-and-shift-to-modbus-plugin.patch +++ /dev/null @@ -1,81 +0,0 @@ -From eeabc41e703f39cae0ad7eb8a596045a5a2f25b4 Mon Sep 17 00:00:00 2001 -From: cekstam -Date: Tue, 27 Mar 2018 13:15:28 +0200 -Subject: [PATCH 1/3] Add scale and shift to modbus plugin - -Adding a Scale and Shift parameter to the modbus plugin in order to correct amplifed data ---- - src/collectd.conf.pod | 10 ++++++++++ - src/modbus.c | 18 ++++++++++++++---- - 2 files changed, 24 insertions(+), 4 deletions(-) - ---- a/src/collectd.conf.pod -+++ b/src/collectd.conf.pod -@@ -4169,6 +4169,16 @@ supported. - Sets the type instance to use when dispatching the value to I. If - unset, an empty string (no type instance) is used. - -+=item B I -+ -+The values taken from collectd are multiplied by I. The field is optional -+and the default is B<1.0>. -+ -+=item B I -+ -+I is added to values from collectd after they have been multiplied by -+B value. The field is optional and the default value is B<0.0>. -+ - =back - - =item EB IE blocks ---- a/src/modbus.c -+++ b/src/modbus.c -@@ -105,6 +105,8 @@ struct mb_data_s /* {{{ */ - mb_mreg_type_t modbus_register_type; - char type[DATA_MAX_NAME_LEN]; - char instance[DATA_MAX_NAME_LEN]; -+ double scale; -+ double shift; - - mb_data_t *next; - }; /* }}} */ -@@ -395,13 +397,13 @@ static int mb_init_connection(mb_host_t - #define CAST_TO_VALUE_T(ds, vt, raw) \ - do { \ - if ((ds)->ds[0].type == DS_TYPE_COUNTER) \ -- (vt).counter = (counter_t)(raw); \ -+ (vt).counter = (((counter_t)(raw) * ds[0].scale) + ds[0].shift); \ - else if ((ds)->ds[0].type == DS_TYPE_GAUGE) \ -- (vt).gauge = (gauge_t)(raw); \ -+ (vt).gauge = (((gauge_t)(raw) * ds[0].scale) + ds[0].shift); \ - else if ((ds)->ds[0].type == DS_TYPE_DERIVE) \ -- (vt).derive = (derive_t)(raw); \ -+ (vt).derive = (((derive_t)(raw) * ds[0].scale) + ds[0].shift); \ - else /* if (ds->ds[0].type == DS_TYPE_ABSOLUTE) */ \ -- (vt).absolute = (absolute_t)(raw); \ -+ (vt).absolute = (((absolute_t)(raw) * ds[0].scale) + ds[0].shift); \ - } while (0) - - static int mb_read_data(mb_host_t *host, mb_slave_t *slave, /* {{{ */ -@@ -723,6 +725,8 @@ static int mb_config_add_data(oconfig_it - data.name = NULL; - data.register_type = REG_TYPE_UINT16; - data.next = NULL; -+ data.scale = 1; -+ data.shift = 0; - - status = cf_util_get_string(ci, &data.name); - if (status != 0) -@@ -736,6 +740,12 @@ static int mb_config_add_data(oconfig_it - else if (strcasecmp("Instance", child->key) == 0) - status = cf_util_get_string_buffer(child, data.instance, - sizeof(data.instance)); -+ else if (strcasecmp("Scale", child->key) == 0) -+ status = cf_util_get_string_buffer(child, data.scale, -+ sizeof(data.scale)); -+ else if (strcasecmp("Shift", child->key) == 0) -+ status = cf_util_get_string_buffer(child, data.shift, -+ sizeof(data.shift)); - else if (strcasecmp("RegisterBase", child->key) == 0) - status = cf_util_get_int(child, &data.register_base); - else if (strcasecmp("RegisterType", child->key) == 0) { diff --git a/utils/collectd/patches/052-correcting-all-the-wrongs.patch b/utils/collectd/patches/052-correcting-all-the-wrongs.patch deleted file mode 100644 index b56fe3d9a..000000000 --- a/utils/collectd/patches/052-correcting-all-the-wrongs.patch +++ /dev/null @@ -1,120 +0,0 @@ -From e596496f5c783f4bba85c4d559502c98e4050465 Mon Sep 17 00:00:00 2001 -From: cekstam -Date: Tue, 27 Mar 2018 14:11:52 +0200 -Subject: [PATCH 2/3] correcting all the wrongs - -, data->scale, data->shift ---- - src/modbus.c | 32 +++++++++++++++----------------- - 1 file changed, 15 insertions(+), 17 deletions(-) - ---- a/src/modbus.c -+++ b/src/modbus.c -@@ -394,16 +394,16 @@ static int mb_init_connection(mb_host_t - } /* }}} int mb_init_connection */ - #endif /* !LEGACY_LIBMODBUS */ - --#define CAST_TO_VALUE_T(ds, vt, raw) \ -+#define CAST_TO_VALUE_T(ds, vt, raw, scale, shift) \ - do { \ - if ((ds)->ds[0].type == DS_TYPE_COUNTER) \ -- (vt).counter = (((counter_t)(raw) * ds[0].scale) + ds[0].shift); \ -+ (vt).counter = (((counter_t)(raw) * scale) + shift); \ - else if ((ds)->ds[0].type == DS_TYPE_GAUGE) \ -- (vt).gauge = (((gauge_t)(raw) * ds[0].scale) + ds[0].shift); \ -+ (vt).gauge = (((gauge_t)(raw) * scale) + shift); \ - else if ((ds)->ds[0].type == DS_TYPE_DERIVE) \ -- (vt).derive = (((derive_t)(raw) * ds[0].scale) + ds[0].shift); \ -+ (vt).derive = (((derive_t)(raw) * scale) + shift); \ - else /* if (ds->ds[0].type == DS_TYPE_ABSOLUTE) */ \ -- (vt).absolute = (((absolute_t)(raw) * ds[0].scale) + ds[0].shift); \ -+ (vt).absolute = (((absolute_t)(raw) * scale) + shift); \ - } while (0) - - static int mb_read_data(mb_host_t *host, mb_slave_t *slave, /* {{{ */ -@@ -532,7 +532,7 @@ static int mb_read_data(mb_host_t *host, - "Returned float value is %g", - (double)float_value); - -- CAST_TO_VALUE_T(ds, vt, float_value); -+ CAST_TO_VALUE_T(ds, vt, float_value, data->scale, data->shift); - mb_submit(host, slave, data, vt); - } else if (data->register_type == REG_TYPE_FLOAT_CDAB) { - float float_value; -@@ -543,7 +543,7 @@ static int mb_read_data(mb_host_t *host, - "Returned float value is %g", - (double)float_value); - -- CAST_TO_VALUE_T(ds, vt, float_value); -+ CAST_TO_VALUE_T(ds, vt, float_value, data->scale, data->shift); - mb_submit(host, slave, data, vt); - } else if (data->register_type == REG_TYPE_INT32) { - union { -@@ -557,7 +557,7 @@ static int mb_read_data(mb_host_t *host, - "Returned int32 value is %" PRIi32, - v.i32); - -- CAST_TO_VALUE_T(ds, vt, v.i32); -+ CAST_TO_VALUE_T(ds, vt, v.i32, data->scale, data->shift); - mb_submit(host, slave, data, vt); - } else if (data->register_type == REG_TYPE_INT32_CDAB) { - union { -@@ -571,7 +571,7 @@ static int mb_read_data(mb_host_t *host, - "Returned int32 value is %" PRIi32, - v.i32); - -- CAST_TO_VALUE_T(ds, vt, v.i32); -+ CAST_TO_VALUE_T(ds, vt, v.i32, data->scale, data->shift); - mb_submit(host, slave, data, vt); - } else if (data->register_type == REG_TYPE_INT16) { - union { -@@ -586,7 +586,7 @@ static int mb_read_data(mb_host_t *host, - "Returned int16 value is %" PRIi16, - v.i16); - -- CAST_TO_VALUE_T(ds, vt, v.i16); -+ CAST_TO_VALUE_T(ds, vt, v.i16, data->scale, data->shift); - mb_submit(host, slave, data, vt); - } else if (data->register_type == REG_TYPE_UINT32) { - uint32_t v32; -@@ -597,7 +597,7 @@ static int mb_read_data(mb_host_t *host, - "Returned uint32 value is %" PRIu32, - v32); - -- CAST_TO_VALUE_T(ds, vt, v32); -+ CAST_TO_VALUE_T(ds, vt, v32, data->scale, data->shift); - mb_submit(host, slave, data, vt); - } else if (data->register_type == REG_TYPE_UINT32_CDAB) { - uint32_t v32; -@@ -608,7 +608,7 @@ static int mb_read_data(mb_host_t *host, - "Returned uint32 value is %" PRIu32, - v32); - -- CAST_TO_VALUE_T(ds, vt, v32); -+ CAST_TO_VALUE_T(ds, vt, v32, data->scale, data->shift); - mb_submit(host, slave, data, vt); - } else /* if (data->register_type == REG_TYPE_UINT16) */ - { -@@ -618,7 +618,7 @@ static int mb_read_data(mb_host_t *host, - "Returned uint16 value is %" PRIu16, - values[0]); - -- CAST_TO_VALUE_T(ds, vt, values[0]); -+ CAST_TO_VALUE_T(ds, vt, values[0], data->scale, data->shift); - mb_submit(host, slave, data, vt); - } - -@@ -741,11 +741,9 @@ static int mb_config_add_data(oconfig_it - status = cf_util_get_string_buffer(child, data.instance, - sizeof(data.instance)); - else if (strcasecmp("Scale", child->key) == 0) -- status = cf_util_get_string_buffer(child, data.scale, -- sizeof(data.scale)); -+ status = cf_util_get_double(child, &data.scale); - else if (strcasecmp("Shift", child->key) == 0) -- status = cf_util_get_string_buffer(child, data.shift, -- sizeof(data.shift)); -+ status = cf_util_get_double(child, &data.shift); - else if (strcasecmp("RegisterBase", child->key) == 0) - status = cf_util_get_int(child, &data.register_base); - else if (strcasecmp("RegisterType", child->key) == 0) { diff --git a/utils/collectd/patches/053-Add-support-for-RS485-to-modbus-plugin.patch b/utils/collectd/patches/053-Add-support-for-RS485-to-modbus-plugin.patch deleted file mode 100644 index 752689ed2..000000000 --- a/utils/collectd/patches/053-Add-support-for-RS485-to-modbus-plugin.patch +++ /dev/null @@ -1,114 +0,0 @@ -From a00ab52931a587cf29c53a945e9295b4d7fe41ba Mon Sep 17 00:00:00 2001 -From: Daniel Golle -Date: Thu, 28 Mar 2019 01:52:04 +0100 -Subject: [PATCH] Add support for RS485 to modbus plugin - -Allow setting up RS485 mode for Modbus-RTU ---- - src/collectd.conf.pod | 6 +++++ - src/modbus.c | 55 +++++++++++++++++++++++++++++++++++++++---- - 2 files changed, 57 insertions(+), 4 deletions(-) - ---- a/src/collectd.conf.pod -+++ b/src/collectd.conf.pod -@@ -4234,6 +4234,12 @@ For Modbus/RTU, specifies the path to th - For Modbus/RTU, specifies the baud rate of the serial device. - Note, connections currently support only 8/N/1. - -+=item B I -+ -+For Modbus/RTU, specifies the type of the serial device. -+RS232, RS422 and RS485 are supported. Defaults to RS232. -+Available only on Linux systems with libmodbus>=2.9.4. -+ - =item B I - - Sets the interval (in seconds) in which the values will be collected from this ---- a/src/modbus.c -+++ b/src/modbus.c -@@ -95,6 +95,12 @@ enum mb_conntype_e /* {{{ */ - MBCONN_RTU }; /* }}} */ - typedef enum mb_conntype_e mb_conntype_t; - -+enum mb_uarttype_e /* {{{ */ -+{ UARTTYPE_RS232, -+ UARTTYPE_RS422, -+ UARTTYPE_RS485 }; /* }}} */ -+typedef enum mb_uarttype_e mb_uarttype_t; -+ - struct mb_data_s; - typedef struct mb_data_s mb_data_t; - struct mb_data_s /* {{{ */ -@@ -124,8 +130,9 @@ struct mb_host_s /* {{{ */ - char host[DATA_MAX_NAME_LEN]; - char node[NI_MAXHOST]; /* TCP hostname or RTU serial device */ - /* char service[NI_MAXSERV]; */ -- int port; /* for Modbus/TCP */ -- int baudrate; /* for Modbus/RTU */ -+ int port; /* for Modbus/TCP */ -+ int baudrate; /* for Modbus/RTU */ -+ mb_uarttype_t uarttype; /* UART type for Modbus/RTU */ - mb_conntype_t conntype; - cdtime_t interval; - -@@ -390,6 +397,22 @@ static int mb_init_connection(mb_host_t - return status; - } - -+#if defined(linux) && LIBMODBUS_VERSION_CHECK(2, 9, 4) -+ switch (host->uarttype) { -+ case UARTTYPE_RS485: -+ if (modbus_rtu_set_serial_mode(host->connection, MODBUS_RTU_RS485)) -+ DEBUG("Modbus plugin: Setting RS485 mode failed."); -+ break; -+ case UARTTYPE_RS422: -+ /* libmodbus doesn't say anything about full-duplex symmetric RS422 UART */ -+ break; -+ case UARTTYPE_RS232: -+ break; -+ default: -+ DEBUG("Modbus plugin: Invalid UART type!."); -+ } -+#endif /* defined(linux) && LIBMODBUS_VERSION_CHECK(2, 9, 4) */ -+ - return 0; - } /* }}} int mb_init_connection */ - #endif /* !LEGACY_LIBMODBUS */ -@@ -951,11 +974,35 @@ static int mb_config_add_host(oconfig_it - status = -1; - } else if (strcasecmp("Device", child->key) == 0) { - status = cf_util_get_string_buffer(child, host->node, sizeof(host->node)); -- if (status == 0) -+ if (status == 0) { - host->conntype = MBCONN_RTU; -+ host->uarttype = UARTTYPE_RS232; -+ } - } else if (strcasecmp("Baudrate", child->key) == 0) - status = cf_util_get_int(child, &host->baudrate); -- else if (strcasecmp("Interval", child->key) == 0) -+ else if (strcasecmp("UARTType", child->key) == 0) { -+#if defined(linux) && !LEGACY_LIBMODBUS && LIBMODBUS_VERSION_CHECK(2, 9, 4) -+ char buffer[NI_MAXHOST]; -+ status = cf_util_get_string_buffer(child, buffer, sizeof(buffer)); -+ if (status != 0) -+ break; -+ if (strncmp(buffer, "RS485", 6) == 0) -+ host->uarttype = UARTTYPE_RS485; -+ else if (strncmp(buffer, "RS422", 6) == 0) -+ host->uarttype = UARTTYPE_RS422; -+ else if (strncmp(buffer, "RS232", 6) == 0) -+ host->uarttype = UARTTYPE_RS232; -+ else { -+ ERROR("Modbus plugin: The UARTType \"%s\" is unknown.", buffer); -+ status = -1; -+ break; -+ } -+#else -+ ERROR("Modbus plugin: Option `UARTType' not supported. Please " -+ "upgrade libmodbus to at least 2.9.4"); -+ return -1; -+#endif -+ } else if (strcasecmp("Interval", child->key) == 0) - status = cf_util_get_cdtime(child, &host->interval); - else if (strcasecmp("Slave", child->key) == 0) - /* Don't set status: Gracefully continue if a slave fails. */ diff --git a/utils/collectd/patches/100-rrdtool-add-rrasingle-option.patch b/utils/collectd/patches/100-rrdtool-add-rrasingle-option.patch index 2820e0755..9fb749b24 100644 --- a/utils/collectd/patches/100-rrdtool-add-rrasingle-option.patch +++ b/utils/collectd/patches/100-rrdtool-add-rrasingle-option.patch @@ -17,7 +17,7 @@ /* consolidation_functions = */ NULL, /* consolidation_functions_num = */ 0, -@@ -949,6 +952,12 @@ static int rrd_config(const char *key, c +@@ -944,6 +947,12 @@ static int rrd_config(const char *key, c /* compar = */ rrd_compare_numeric); free(value_copy); @@ -30,8 +30,8 @@ } else if (strcasecmp("XFF", key) == 0) { double tmp = atof(value); if ((tmp < 0.0) || (tmp >= 1.0)) { ---- a/src/utils_rrdcreate.c -+++ b/src/utils_rrdcreate.c +--- a/src/utils/rrdcreate/rrdcreate.c ++++ b/src/utils/rrdcreate/rrdcreate.c @@ -180,6 +180,9 @@ static int rra_get(char ***ret, const va rts_num = rra_timespans_num; } @@ -42,8 +42,8 @@ rra_max = rts_num * rra_types_num; assert(rra_max > 0); ---- a/src/utils_rrdcreate.h -+++ b/src/utils_rrdcreate.h +--- a/src/utils/rrdcreate/rrdcreate.h ++++ b/src/utils/rrdcreate/rrdcreate.h @@ -40,6 +40,8 @@ struct rrdcreate_config_s { int *timespans; size_t timespans_num; diff --git a/utils/collectd/patches/300-delay-first-read-cycle.patch b/utils/collectd/patches/300-delay-first-read-cycle.patch index 3d878d750..6c6d1b116 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 -@@ -1099,7 +1099,7 @@ static int plugin_insert_read(read_func_ +@@ -1085,7 +1085,7 @@ static int plugin_insert_read(read_func_ int status; llentry_t *le; diff --git a/utils/collectd/patches/400-fix-olsrd-get-all.patch b/utils/collectd/patches/400-fix-olsrd-get-all.patch index d12295ad4..d46a57af5 100644 --- a/utils/collectd/patches/400-fix-olsrd-get-all.patch +++ b/utils/collectd/patches/400-fix-olsrd-get-all.patch @@ -1,6 +1,6 @@ --- a/src/olsrd.c +++ b/src/olsrd.c -@@ -585,7 +585,7 @@ static int olsrd_read(void) /* {{{ */ +@@ -582,7 +582,7 @@ static int olsrd_read(void) /* {{{ */ if (fh == NULL) return -1; diff --git a/utils/collectd/patches/600-fix-libmodbus-detection.patch b/utils/collectd/patches/600-fix-libmodbus-detection.patch index 80e4720ac..7b22b6a89 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 -@@ -3327,9 +3327,9 @@ if test "x$with_libmodbus" = "xyes"; the +@@ -3399,9 +3399,9 @@ if test "x$with_libmodbus" = "xyes"; the SAVE_CPPFLAGS="$CPPFLAGS" CPPFLAGS="$CPPFLAGS $with_libmodbus_cflags" @@ -33,8 +33,8 @@ Reversed patch to be applied: --- a/src/modbus.c +++ b/src/modbus.c @@ -26,7 +26,7 @@ - #include "configfile.h" #include "plugin.h" + #include "utils/common/common.h" -#include +#include diff --git a/utils/collectd/patches/700-disable-sys-capability-check.patch b/utils/collectd/patches/700-disable-sys-capability-check.patch index 95920681a..c5126731e 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 -@@ -526,11 +526,7 @@ if test "x$ac_system" = "xLinux"; then +@@ -531,11 +531,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 360c41751..ff0269b83 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 -@@ -710,6 +710,11 @@ AC_CACHE_CHECK([whether clock_boottime a +@@ -721,6 +721,11 @@ AC_CACHE_CHECK([whether clock_boottime a ] ) @@ -12,7 +12,7 @@ # # Checks for typedefs, structures, and compiler characteristics. -@@ -6127,6 +6132,7 @@ plugin_ipc="no" +@@ -6392,6 +6397,7 @@ plugin_ipc="no" plugin_ipmi="no" plugin_ipvs="no" plugin_irq="no" @@ -20,15 +20,15 @@ plugin_load="no" plugin_log_logstash="no" 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]) -+AC_PLUGIN([iwinfo], [$with_iwinfo], [Common iwinfo wireless statistics]) - 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]) -@@ -6899,6 +6906,7 @@ AC_MSG_RESULT([ libyajl . . . . . . . +@@ -6826,6 +6832,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]) ++AC_PLUGIN([iwinfo], [$with_iwinfo], [Common iwinfo wireless statistics]) + 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 . . . . . . . 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]) -@@ -6957,6 +6965,7 @@ AC_MSG_RESULT([ ipmi . . . . . . . . +@@ -7253,6 +7261,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 -@@ -137,6 +137,7 @@ +@@ -138,6 +138,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 -@@ -721,6 +722,12 @@ +@@ -767,6 +768,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 -@@ -3521,6 +3521,27 @@ and all other interrupts are collected. +@@ -3803,6 +3803,27 @@ and all other interrupts are collected. =back @@ -119,9 +119,9 @@ + **/ + +#include "collectd.h" -+#include "common.h" +#include "plugin.h" -+#include "utils_ignorelist.h" ++#include "utils/common/common.h" ++#include "utils/ignorelist/ignorelist.h" + +#include +#include @@ -252,17 +252,17 @@ +} --- a/src/types.db +++ b/src/types.db -@@ -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 +@@ -240,6 +240,7 @@ voltage_threshold value:GAUGE:U:U, + spam_check value:GAUGE:0:U + spam_score value:GAUGE:U:U + spl value:GAUGE:U:U +stations value:GAUGE:0:256 - - # - # Legacy types + swap value:GAUGE:0:1099511627776 + swap_io value:DERIVE:0:U + tcp_connections value:GAUGE:0:4294967295 --- a/Makefile.am +++ b/Makefile.am -@@ -997,6 +997,14 @@ irq_la_LDFLAGS = $(PLUGIN_LDFLAGS) +@@ -1149,6 +1149,14 @@ irq_la_LDFLAGS = $(PLUGIN_LDFLAGS) irq_la_LIBADD = libignorelist.la endif diff --git a/utils/collectd/patches/920-fix-ping-droprate.patch b/utils/collectd/patches/920-fix-ping-droprate.patch index e32947dc9..6b1e9a0d4 100644 --- a/utils/collectd/patches/920-fix-ping-droprate.patch +++ b/utils/collectd/patches/920-fix-ping-droprate.patch @@ -1,6 +1,6 @@ --- a/src/ping.c +++ b/src/ping.c -@@ -633,7 +633,7 @@ static int ping_read(void) /* {{{ */ +@@ -648,7 +648,7 @@ static int ping_read(void) /* {{{ */ ((double)(pkg_recv * (pkg_recv - 1)))); /* Calculate drop rate. */ diff --git a/utils/collectd/patches/930-fix-lua-callback-registration.patch b/utils/collectd/patches/930-fix-lua-callback-registration.patch deleted file mode 100644 index bffe656e0..000000000 --- a/utils/collectd/patches/930-fix-lua-callback-registration.patch +++ /dev/null @@ -1,42 +0,0 @@ ---- a/src/lua.c -+++ b/src/lua.c -@@ -281,9 +281,6 @@ static int lua_cb_register_read(lua_Stat - - luaL_checktype(L, 1, LUA_TFUNCTION); - -- char function_name[DATA_MAX_NAME_LEN]; -- snprintf(function_name, sizeof(function_name), "lua/%s", lua_tostring(L, 1)); -- - int callback_id = clua_store_callback(L, 1); - if (callback_id < 0) - return luaL_error(L, "%s", "Storing callback function failed"); -@@ -298,6 +295,9 @@ static int lua_cb_register_read(lua_Stat - if (cb == NULL) - return luaL_error(L, "%s", "calloc failed"); - -+ char function_name[DATA_MAX_NAME_LEN]; -+ snprintf(function_name, sizeof(function_name), "lua/%p", thread); -+ - cb->lua_state = thread; - cb->callback_id = callback_id; - cb->lua_function_name = strdup(function_name); -@@ -325,9 +325,6 @@ static int lua_cb_register_write(lua_Sta - - luaL_checktype(L, 1, LUA_TFUNCTION); - -- char function_name[DATA_MAX_NAME_LEN] = ""; -- snprintf(function_name, sizeof(function_name), "lua/%s", lua_tostring(L, 1)); -- - int callback_id = clua_store_callback(L, 1); - if (callback_id < 0) - return luaL_error(L, "%s", "Storing callback function failed"); -@@ -342,6 +339,9 @@ static int lua_cb_register_write(lua_Sta - if (cb == NULL) - return luaL_error(L, "%s", "calloc failed"); - -+ char function_name[DATA_MAX_NAME_LEN] = ""; -+ snprintf(function_name, sizeof(function_name), "lua/%p", thread); -+ - cb->lua_state = thread; - cb->callback_id = callback_id; - cb->lua_function_name = strdup(function_name);