collectd.git
7 years agonfs plugin: Changes after review
usev6 [Mon, 18 Sep 2017 18:50:18 +0000 (20:50 +0200)]
nfs plugin: Changes after review

* Avoid negated config options (s/IgnoreV/ReportV/)
* Use _Bool instead of int
* Handle multiple occurences of config option correctly

7 years agonfs: Add config options to ignore versions
usev6 [Fri, 15 Sep 2017 21:05:14 +0000 (23:05 +0200)]
nfs: Add config options to ignore versions

7 years agoREADME: NFSv4 is supported nowadays
usev6 [Fri, 15 Sep 2017 21:02:19 +0000 (23:02 +0200)]
README: NFSv4 is supported nowadays

(implemented with commit 64446a66fe)

7 years agoMerge remote-tracking branch 'github/pr/2258'
Florian Forster [Wed, 30 Aug 2017 11:34:28 +0000 (13:34 +0200)]
Merge remote-tracking branch 'github/pr/2258'

7 years agolibcollectdclient: Guard gcrypt code with preprocessor conditionals.
Florian Forster [Wed, 30 Aug 2017 09:16:54 +0000 (11:16 +0200)]
libcollectdclient: Guard gcrypt code with preprocessor conditionals.

7 years agolibcollectdclient: Include <stdlib.h> and <string.h>.
Florian Forster [Wed, 30 Aug 2017 09:14:50 +0000 (11:14 +0200)]
libcollectdclient: Include <stdlib.h> and <string.h>.

For free(3) and memmove(3) respectively.

7 years agocollectd.spec: add new intel_pmu plugin
Ruben Kerkhof [Fri, 18 Aug 2017 11:00:36 +0000 (13:00 +0200)]
collectd.spec: add new intel_pmu plugin

7 years agoconfigure.ac: fix indentation
Ruben Kerkhof [Fri, 18 Aug 2017 10:53:52 +0000 (12:53 +0200)]
configure.ac: fix indentation

7 years agoMerge pull request #2405 from cpaelzer/fix-dpdk-pkg-config-if-not-available
Ruben Kerkhof [Fri, 18 Aug 2017 10:51:54 +0000 (12:51 +0200)]
Merge pull request #2405 from cpaelzer/fix-dpdk-pkg-config-if-not-available

configure.ac: dpdk: tolerate no pkg-config

7 years agoconfigure.ac: follow the 2 space indent style
Christian Ehrhardt [Fri, 18 Aug 2017 10:50:22 +0000 (12:50 +0200)]
configure.ac: follow the 2 space indent style

The rest of configure.ac indents not to the context, but by 2 spaces.
Follow that rule to stay in style.

Signed-off-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
7 years agoconfigure.ac: fix indent
Christian Ehrhardt [Fri, 18 Aug 2017 10:46:17 +0000 (12:46 +0200)]
configure.ac: fix indent

Fix tab indents to be space based as they should, but keep the
effective indent at the level of the context it belongs to in
PKG_CHECK_MODULES.

Signed-off-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
7 years agoconfigure.ac: dpdk: tolerate no pkg-config
root [Thu, 17 Aug 2017 14:18:02 +0000 (14:18 +0000)]
configure.ac: dpdk: tolerate no pkg-config

Since pull request #2400 pkg-config works great for dpdk, but not if
there is no pkg-config around at all.
To fix that the PKG_CHECK_MODULES macro needs to define a valid fourth
argument, otherwise it will error out.

This closes 2404

Signed-off-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
7 years agoMerge pull request #2400 from cpaelzer/fix-dpdk-multiarch-pkg-config
Ruben Kerkhof [Thu, 17 Aug 2017 13:09:56 +0000 (15:09 +0200)]
Merge pull request #2400 from cpaelzer/fix-dpdk-multiarch-pkg-config

configure.ac: dpdk: use pkg-config

7 years agoconfigure.ac: dpdk: append DPDK_CFLAGS to LIBDPDK_CPPFLAGS
Christian Ehrhardt [Thu, 17 Aug 2017 13:01:27 +0000 (15:01 +0200)]
configure.ac: dpdk: append DPDK_CFLAGS to LIBDPDK_CPPFLAGS

In some way it is bad naming in pkg-config - it is always some sort of
conflated ldflags + libs and cppflags + cxxflags + cflags.
Due to that to work correctly we append DPDK_CFLAGS (if defined by
pkg-config) to LIBDPDK_CPPFLAGS as well.
This intentionally does not add those CFLAGS specified by a user to
allow full override and fully separated CLFAGS/CPPFLAGS if needed.

Signed-off-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
7 years agoconfigure.ac: dpdk: introduce LIBDPDK_CFLAGS
Christian Ehrhardt [Thu, 17 Aug 2017 11:34:12 +0000 (13:34 +0200)]
configure.ac: dpdk: introduce LIBDPDK_CFLAGS

This restores the former behavior of LIBDPDK_CPPFLAGS and now
correctly carries CFLAGS read from pkg-config in its own variable.

Signed-off-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
7 years agoconfigure.ac: dpdk: use pkg-config
Christian Ehrhardt [Wed, 16 Aug 2017 12:31:48 +0000 (14:31 +0200)]
configure.ac: dpdk: use pkg-config

To detect cflags and libs use the sometimes provided pkg-config for
libdpdk. That avoids build errors on systems where special flags are
needed and provided by dpdk via pkg-config, but not yet considered by
the collectd build system.

This closes #2399

Signed-off-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
7 years agoMerge pull request #2378 from cramertj/grpc-meta
Florian Forster [Thu, 27 Jul 2017 10:58:11 +0000 (12:58 +0200)]
Merge pull request #2378 from cramertj/grpc-meta

Add metadata support to GRPC plugin

7 years agoMerge pull request #2380 from maryamtahhan/feat_mcelog_bugfixes
Florian Forster [Wed, 26 Jul 2017 20:15:13 +0000 (22:15 +0200)]
Merge pull request #2380 from maryamtahhan/feat_mcelog_bugfixes

mcelog: fix compilation error caused by migration to snprintf().

7 years agoGRPC metadata review cleanup
Taylor Cramer [Wed, 26 Jul 2017 17:25:02 +0000 (10:25 -0700)]
GRPC metadata review cleanup

7 years agomcelog: fix compilation error caused by migration to snprintf().
Korynkevych, RomanX [Tue, 25 Jul 2017 09:30:59 +0000 (10:30 +0100)]
mcelog: fix compilation error caused by migration to snprintf().

Change-Id: I625254fa60efbb94580ed2eb69d7c7bf7027a6eb
Signed-off-by: Korynkevych, RomanX <romanx.korynkevych@intel.com>
7 years agoAdd metadata support to GRPC plugin
Taylor Cramer [Mon, 24 Jul 2017 17:36:27 +0000 (10:36 -0700)]
Add metadata support to GRPC plugin

7 years agoMerge pull request #2246 from maryamtahhan/feat_mcelog_notification_bugfixes
Florian Forster [Mon, 24 Jul 2017 13:37:45 +0000 (15:37 +0200)]
Merge pull request #2246 from maryamtahhan/feat_mcelog_notification_bugfixes

Feat mcelog notification bugfixes

7 years agomcelog: updates based on review comments
Korynkevych, RomanX [Fri, 21 Jul 2017 13:42:46 +0000 (14:42 +0100)]
mcelog: updates based on review comments

* modified code to use return without parenthesis
* fixed logic that parses config options

Change-Id: I2c5c5f42f8395306622dee8cdf4f94b46e3e3570
Signed-off-by: Korynkevych, RomanX <romanx.korynkevych@intel.com>
7 years agoMerge pull request #2349 from rpv-tomsk/fix-register-complex-read
Florian Forster [Mon, 24 Jul 2017 07:31:05 +0000 (09:31 +0200)]
Merge pull request #2349 from rpv-tomsk/fix-register-complex-read

Free `userdata` if plugin_register_complex_read() has failed.

7 years agoopenldap: Fixed possible dereference of NULL pointer
Pavel Rochnyack [Mon, 24 Jul 2017 07:05:16 +0000 (14:05 +0700)]
openldap: Fixed possible dereference of NULL pointer

If `plugin_register_complex_read()` has failed, then `cldap_free` is called which set pointer to NULL.
That pointer is accessed by `cldap_shutdown()` callback later.

7 years agoChange error message when read callback name is duplicated while registering it.
Pavel Rochnyack [Thu, 6 Jul 2017 19:07:43 +0000 (02:07 +0700)]
Change error message when read callback name is duplicated while registering it.

The message `Check for duplicate "LoadPlugin" lines` is obsolete, as there is a special check in `plugin_load()` for this case.

7 years agoFree `userdata` if plugin_register_complex_read() has failed.
Pavel Rochnyack [Thu, 6 Jul 2017 18:48:21 +0000 (01:48 +0700)]
Free `userdata` if plugin_register_complex_read() has failed.

7 years agoMerge pull request #2374 from maryamtahhan/feat_intel_pmu_bugfixes
Florian Forster [Thu, 20 Jul 2017 19:53:04 +0000 (21:53 +0200)]
Merge pull request #2374 from maryamtahhan/feat_intel_pmu_bugfixes

intel_pmu: fix compilation error caused by migration to snprintf().

7 years agointel_pmu: fix compilation error caused by migration to snprintf().
Korynkevych, RomanX [Thu, 20 Jul 2017 13:09:36 +0000 (14:09 +0100)]
intel_pmu: fix compilation error caused by migration to snprintf().

Change-Id: I4e461cd11aa03ca588649ca86892c23c9f38fc54
Signed-off-by: Korynkevych, RomanX <romanx.korynkevych@intel.com>
7 years agoMerge branch 'collectd-5.7'
Florian Forster [Thu, 20 Jul 2017 07:12:14 +0000 (09:12 +0200)]
Merge branch 'collectd-5.7'

Conflicts:
src/rrdtool.c

7 years agoMerge branch 'collectd-5.6' into collectd-5.7
Florian Forster [Thu, 20 Jul 2017 07:11:09 +0000 (09:11 +0200)]
Merge branch 'collectd-5.6' into collectd-5.7

Conflicts:
src/rrdtool.c

7 years agoMerge pull request #2232 from rpv-tomsk/processes
Florian Forster [Thu, 20 Jul 2017 06:14:17 +0000 (08:14 +0200)]
Merge pull request #2232 from rpv-tomsk/processes

processes: Show real disk IO in addition to process IO (Linux only)

7 years agorrdtool plugin: Changes after review
Pavel Rochnyack [Wed, 19 Jul 2017 12:28:15 +0000 (19:28 +0700)]
rrdtool plugin: Changes after review

* Handle "CacheFlush" as a double
* Updated documentation spelling

7 years agorrdtool plugin: Respect RandomTimeout while calling CacheFlush handler
Pavel Rochnyack [Mon, 17 Jul 2017 05:26:16 +0000 (12:26 +0700)]
rrdtool plugin: Respect RandomTimeout while calling CacheFlush handler

The CacheFlush implementation does not respect RandomTimeout value.
All cache values, whose flush is deferred by RandomTimeout variance,
will be flushed. That can cause a partial or full cache flush,
depending on the value of RandomTimeout.

7 years agorrdtool plugin: Configuration check moved to init callback
Pavel Rochnyack [Mon, 17 Jul 2017 04:26:04 +0000 (11:26 +0700)]
rrdtool plugin: Configuration check moved to init callback

The "RandomTimeout" option value check moved from rrd_get_random_variation()
to rrd_init(). This will save few CPU cycles.

7 years agorrdtool plugin: Remove excessive complain
Pavel Rochnyack [Mon, 17 Jul 2017 04:15:52 +0000 (11:15 +0700)]
rrdtool plugin: Remove excessive complain

The plugin complains `Adjusting "RandomTimeout" to 0.000 seconds.` even
if no 'CacheTimeout' was set.

7 years agorrdtool plugin: Raise interval of random_variation to match documentation
Pavel Rochnyack [Mon, 17 Jul 2017 04:13:53 +0000 (11:13 +0700)]
rrdtool plugin: Raise interval of random_variation to match documentation

Documentation states what the actual timeout for each value is chosen randomly
between <CacheTimeout>-<RandomTimeout> and <CacheTimeout>+<RandomTimeout>.

The implementation did not match this.

7 years agorrdtool plugin: Fix flushing
Pavel Rochnyack [Sun, 16 Jul 2017 15:56:05 +0000 (22:56 +0700)]
rrdtool plugin: Fix flushing

* Value from wrong option was passed to rrd_cache_flush()
* Variable cache_flush_timeout was used as cdtime_t type time while value was set as simple seconds
* Added info message about CacheFlush ajusting
* Documentation updated

7 years agoMerge remote-tracking branch 'github/pr/2276'
Florian Forster [Wed, 19 Jul 2017 05:54:49 +0000 (07:54 +0200)]
Merge remote-tracking branch 'github/pr/2276'

7 years agoMerge pull request #2366 from axibase/ssnprintf-fix
Ruben Kerkhof [Mon, 17 Jul 2017 20:54:28 +0000 (22:54 +0200)]
Merge pull request #2366 from axibase/ssnprintf-fix

Fix build: left ssnprintf in test

7 years agoFix left ssnprintf in test
rmakulov [Mon, 17 Jul 2017 09:12:45 +0000 (12:12 +0300)]
Fix left ssnprintf in test

7 years agointel_rdt plugin: fix style
Ruben Kerkhof [Sun, 16 Jul 2017 20:38:57 +0000 (22:38 +0200)]
intel_rdt plugin: fix style

7 years agonut plugin: remove trailing whitespace
Ruben Kerkhof [Sun, 16 Jul 2017 20:37:31 +0000 (22:37 +0200)]
nut plugin: remove trailing whitespace

7 years agoMerge branch 'ssnprintf-cleanup'
Ruben Kerkhof [Sun, 16 Jul 2017 20:33:21 +0000 (22:33 +0200)]
Merge branch 'ssnprintf-cleanup'

Conflicts:
src/dpdkevents.c
src/utils_dpdk.c
src/write_mongodb.c

7 years agoRun clang-format after removing ssnprintf
Ruben Kerkhof [Sun, 16 Jul 2017 20:24:54 +0000 (22:24 +0200)]
Run clang-format after removing ssnprintf

Changing ssnprintf to snprintf changed the indentation.

7 years agoMerge pull request #2354 from rpv-tomsk/issue-2344-nut-rework
Ruben Kerkhof [Sat, 15 Jul 2017 13:55:52 +0000 (15:55 +0200)]
Merge pull request #2354 from rpv-tomsk/issue-2344-nut-rework

nut plugin: Multi-threaded ups polling with connect timeout.

7 years agoMerge branch 'master' into feat_mcelog_notification_bugfixes
Roman Korynkevych [Fri, 14 Jul 2017 14:26:44 +0000 (17:26 +0300)]
Merge branch 'master' into feat_mcelog_notification_bugfixes

7 years agomcelog: updates based on github review
Tahhan, Maryam [Thu, 6 Jul 2017 14:04:50 +0000 (15:04 +0100)]
mcelog: updates based on github review

* Reduces complex level of indentation in conditional blocks
* Uses #defines for corrected and uncorrected strings for notifications
* Fixes memory leaks
* clang was run on the mcelog.c

Change-Id: Ia4c08debc129e2fc9327922299a68304b101d09f
Signed-off-by: Tahhan, Maryam <maryam.tahhan@intel.com>
7 years agoMerge pull request #2362 from rpv-tomsk/issue-2338
Ruben Kerkhof [Thu, 13 Jul 2017 15:29:22 +0000 (17:29 +0200)]
Merge pull request #2362 from rpv-tomsk/issue-2338

snmp_agent: Fixes and improvements

7 years agosnmp_agent: Documented 'PluginInstance' option
Pavel Rochnyack [Thu, 13 Jul 2017 12:45:53 +0000 (19:45 +0700)]
snmp_agent: Documented 'PluginInstance' option

7 years agosnmp_agent: Changed plugin initialization
Pavel Rochnyack [Thu, 13 Jul 2017 11:51:31 +0000 (18:51 +0700)]
snmp_agent: Changed plugin initialization

* Do not start working thread if plugin not configured.
  That allows to avoid useless CPU consumption by polling loop.

* Do not register 'write' / 'missing' callbacks if there was no <Table> configured.
  These callbacks do not do anything in this case.

* Registration of 'shutdown' callback delayed to 'init' phase.

7 years agosnmp_agent: Fix null pointer dereference
Pavel Rochnyack [Thu, 13 Jul 2017 07:34:27 +0000 (14:34 +0700)]
snmp_agent: Fix null pointer dereference

As `table` field in `data_definition_t` is just backreference,
then `snmp_agent_free_data()` should not alter parent structure.

So, table columns unregistering and freeing has moved to new
`snmp_agent_free_table_columns()` function.

That also fixes null pointer dereference.

Closes: #2338.

7 years agosnmp_agent: Added a check for llist_create() result
Pavel Rochnyack [Wed, 12 Jul 2017 14:26:13 +0000 (21:26 +0700)]
snmp_agent: Added a check for llist_create() result

Also appropriate `llist_destroy()` calls added.

7 years agosnmp_agent: Avoid race conditions between thread start and locks initialization.
Pavel Rochnyack [Wed, 12 Jul 2017 14:06:22 +0000 (21:06 +0700)]
snmp_agent: Avoid race conditions between thread start and locks initialization.

Lock initialization should be done before starting pthread which uses them.

7 years agoMerge branch 'collectd-5.7'
Ruben Kerkhof [Wed, 12 Jul 2017 16:59:07 +0000 (18:59 +0200)]
Merge branch 'collectd-5.7'

Conflicts:
contrib/systemd.collectd.service

7 years agoMerge branch 'collectd-5.6' into collectd-5.7
Ruben Kerkhof [Wed, 12 Jul 2017 16:58:18 +0000 (18:58 +0200)]
Merge branch 'collectd-5.6' into collectd-5.7

7 years agocollectd.service: remove NoNewPrivileges setting
Ruben Kerkhof [Wed, 12 Jul 2017 16:54:49 +0000 (18:54 +0200)]
collectd.service: remove NoNewPrivileges setting

There are various issues with it in combination with SELinux.
See https://marc.info/?l=selinux&m=149971836431361&w=2 for some
background.

7 years agoMerge pull request #2357 from rpv-tomsk/issue-2305
Ruben Kerkhof [Wed, 12 Jul 2017 15:44:34 +0000 (17:44 +0200)]
Merge pull request #2357 from rpv-tomsk/issue-2305

Fixed failed compilation on AIX

7 years agonut plugin: Multi-threaded ups polling with connect timeout.
Pavel Rochnyack [Mon, 10 Jul 2017 06:24:08 +0000 (13:24 +0700)]
nut plugin: Multi-threaded ups polling with connect timeout.

Changes:

* Implemented use of 'plugin_register_complex_read', so querying will be multi-threaded;
* Added 'ConnectTimeout' option, implemented with use of 'upscli_tryconnect()' added in nut-2.6.2;
* The `upscli_cleanup()` should be called only at Collectd shutdown, excessive calls was removed;
* Added `upscli_init()` call if `ForceSSL` enabled.
* Added a check for duplicated values in `UPS` option.

Closes: #2344

7 years agoFixed failed compilation on AIX
Pavel Rochnyack [Tue, 11 Jul 2017 04:08:56 +0000 (11:08 +0700)]
Fixed failed compilation on AIX

Caused by typo in 2761915bed8c6caea41018be3e675aa712cc0b0a / #1842.

Closes: #2305

7 years agowrite_mongodb: fix a couple of build warnings
Ruben Kerkhof [Sat, 8 Jul 2017 10:12:33 +0000 (12:12 +0200)]
write_mongodb: fix a couple of build warnings

  CC       src/write_mongodb_la-write_mongodb.lo
src/write_mongodb.c:96:21: warning: comparison of integers of different signs: 'int' and 'const size_t' (aka 'const unsigned long') [-Wsign-compare]
  for (int i = 0; i < ds->ds_num; i++) {
                  ~ ^ ~~~~~~~~~~
src/write_mongodb.c:121:21: warning: comparison of integers of different signs: 'int' and 'const size_t' (aka 'const unsigned long') [-Wsign-compare]
  for (int i = 0; i < ds->ds_num; i++) {
                  ~ ^ ~~~~~~~~~~
src/write_mongodb.c:134:21: warning: comparison of integers of different signs: 'int' and 'const size_t' (aka 'const unsigned long') [-Wsign-compare]
  for (int i = 0; i < ds->ds_num; i++) {
                  ~ ^ ~~~~~~~~~~
3 warnings generated.

7 years agochrony plugin: small cleanup
Ruben Kerkhof [Sat, 8 Jul 2017 09:52:42 +0000 (11:52 +0200)]
chrony plugin: small cleanup

7 years agochrony plugin: fix 2 build warnings
Ruben Kerkhof [Sat, 8 Jul 2017 09:50:23 +0000 (11:50 +0200)]
chrony plugin: fix 2 build warnings

  CC       src/chrony.lo
src/chrony.c:355:30: warning: comparison of integers of different signs: 'int' and 'size_t' (aka 'unsigned long') [-Wsign-compare]
    if (!isalnum(c) || j + 1 >= p_buf_size)
                       ~~~~~ ^  ~~~~~~~~~~
src/chrony.c:359:9: warning: comparison of integers of different signs: 'int' and 'size_t' (aka 'unsigned long') [-Wsign-compare]
  if (j < p_buf_size)
      ~ ^ ~~~~~~~~~~

7 years agoMerge pull request #2351 from rpv-tomsk/apcups-defaults
Ruben Kerkhof [Sat, 8 Jul 2017 08:58:26 +0000 (10:58 +0200)]
Merge pull request #2351 from rpv-tomsk/apcups-defaults

apcups: allow to use plugin without explicit configuration

7 years agoapcups: allow to use plugin without explicit configuration
Pavel Rochnyack [Fri, 7 Jul 2017 17:56:23 +0000 (00:56 +0700)]
apcups: allow to use plugin without explicit configuration
Previously the apcups plugin could not be used without defining
an explicit configuration.

While the apcups plugin did provide a localhost fallback, it
did not however provide a 3551 port fallback in practice,
eventhough a constant for that purpose was already present.

Thanks to Pascal de Bruijn for report.

Closes: #2347

7 years agoMerge branch 'collectd-5.7'
Ruben Kerkhof [Fri, 7 Jul 2017 16:43:39 +0000 (18:43 +0200)]
Merge branch 'collectd-5.7'

Fixes #2328
Conflicts:
src/curl_json.c
src/curl_xml.c

7 years agoMerge branch 'collectd-5.6' into collectd-5.7
Ruben Kerkhof [Fri, 7 Jul 2017 16:40:55 +0000 (18:40 +0200)]
Merge branch 'collectd-5.6' into collectd-5.7

7 years agosnmp_agent: fix format specifiers
Ruben Kerkhof [Fri, 7 Jul 2017 14:00:48 +0000 (16:00 +0200)]
snmp_agent: fix format specifiers

make  all-am
make[1]: Entering directory '/home/ruben/src/collectd'
  CC       src/snmp_agent_la-snmp_agent.lo
In file included from ./src/daemon/common.h:33:0,
                 from src/snmp_agent.c:31:
src/snmp_agent.c: In function ‘snmp_agent_dump_data’:
src/snmp_agent.c:42:21: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘size_t {aka long unsigned int}’ [-Wformat=]
 #define PLUGIN_NAME "snmp_agent"
                     ^
./src/daemon/plugin.h:400:42: note: in definition of macro ‘DEBUG’
 #define DEBUG(...) plugin_log(LOG_DEBUG, __VA_ARGS__)
                                          ^~~~~~~~~~~
src/snmp_agent.c:192:13: note: in expansion of macro ‘PLUGIN_NAME’
       DEBUG(PLUGIN_NAME ":   OID[%d]: %s", i, oid_str);
             ^~~~~~~~~~~
src/snmp_agent.c:192:35: note: format string is defined here
       DEBUG(PLUGIN_NAME ":   OID[%d]: %s", i, oid_str);
                                  ~^
                                  %ld
  CCLD     snmp_agent.la

7 years agoMerge pull request #2348 from maryamtahhan/feat_dpdkevents_fixes
Ruben Kerkhof [Thu, 6 Jul 2017 16:54:45 +0000 (18:54 +0200)]
Merge pull request #2348 from maryamtahhan/feat_dpdkevents_fixes

Feat dpdkevents fixes

7 years agodpdk plugins: bug fixes and improvements
Przemyslaw Szczerbik [Fri, 7 Apr 2017 12:48:39 +0000 (13:48 +0100)]
dpdk plugins: bug fixes and improvements

- Do not return error in configuration callback, which will cause
  collectd to be stopped. Instead, report error in init callback, which
  will unload incorrectly configured plugin.
- Remove redundant ProcessType configuration option, which was always set to
  "secondary"
- Use functions from cf_util_get family for parsing config file
- In case of parsing errors perform plugin cleanup
- Correctly remove previously created shared memory object if user specified
  "SharedMemObj" option with different value than default
- Prevent segmentation fault in dpdk_shm_cleanup
- Change 'send_updated' and 'notify' variable types to _Bool

Change-Id: Id7dfc7f25d2cebf332d47bcd5afaaebf577945d6
Signed-off-by: Przemyslaw Szczerbik <przemyslawx.szczerbik@intel.com>
7 years agodpdkevents: initialization fixes
Krzysztof Matczak [Wed, 5 Apr 2017 15:57:25 +0000 (16:57 +0100)]
dpdkevents: initialization fixes

This patch removes impact of keep_alive init failure on
link_status processing. Also changed default behaviour in configless
mode, where no <Plugin/> stanza is defined. Now both keep_alive
and link_status are enabled by default. On the other hand if
<Plugin/> stanza is present, both features are disabled by default
and user is responsible for specifying which one is active or not.

Change-Id: I03f7ab88e89404e03532677d00a966ddb80d1552
Signed-off-by: Krzysztof Matczak <krzysztofx.matczak@intel.com>
7 years agodpdkevents: detect primary DPDK application (re)start
Przemyslaw Szczerbik [Tue, 28 Mar 2017 08:53:32 +0000 (09:53 +0100)]
dpdkevents: detect primary DPDK application (re)start

Current implementation attempts to open KA SHM only once during init callback.
If at the time primary DPDK application is not running shm_open will fail, which
will result in dpdkevents plugin being unloaded. Move KA SHM open logic to read
callback to allow plugin to attach to primary DPDK application later without a
need to restart collectd. Moreover, it will allow to determine if primary DPDK
application was killed and plugin should stop dispatching KA statistics.

Additionally modify dpdk_event_keep_alive_shm_open function to detect restart of
primary DPDK application. When primary DPDK application (with KA support) is
restarted it unlinks existing shared memory object and creates a new one. It's
necessary for the plugin to create a new SHM mapping in order to prevent reading
statistics from stale SHM block.

Change-Id: I7fc0047ba117db771ada58a40cbe0b2bddd00112
Signed-off-by: Przemyslaw Szczerbik <przemyslawx.szczerbik@intel.com>
7 years agomcelog: set n.meta to NULL after meta data is cleared.
Korynkevych, RomanX [Tue, 20 Jun 2017 15:02:29 +0000 (16:02 +0100)]
mcelog: set n.meta to NULL after meta data is cleared.

mcelog plugin got stuck after corrected and uncorrected memory errors injection.
This is caused due to pointing n.meta to unknown place in memory as n.meta
was not set to NULL after meta data has been cleared.

Change-Id: I81bdbeb43a9858f0071e1798e4d7a15423832a35
Signed-off-by: Korynkevych, RomanX <romanx.korynkevych@intel.com>
7 years agomcelog: make options mutually exclusive
Tahhan, Maryam [Mon, 29 May 2017 13:04:39 +0000 (14:04 +0100)]
mcelog: make options mutually exclusive

Make the logfile and socket options mutually exclusive as the collection
requirements for the 2 are different and the memory errors from the
socket overlap with the logfile. Set the default to memory errors until
the logfile changes are merged.

Change-Id: If1eef9d37f1ffe404cf679df4dca9ae3c92ab9ea
Signed-off-by: Tahhan, Maryam <maryam.tahhan@intel.com>
7 years agomcelog: notification persist option
Tahhan, Maryam [Mon, 27 Feb 2017 13:33:31 +0000 (13:33 +0000)]
mcelog: notification persist option

Implement notification persist option and separate out memory block from the
rest of the configuration.

Change-Id: I48d946bb381d3cfc61fee91a31f3865802389eef
Signed-off-by: Tahhan, Maryam <maryam.tahhan@intel.com>
7 years agomcelog: code review fix
Tahhan, Maryam [Tue, 23 May 2017 10:02:01 +0000 (11:02 +0100)]
mcelog: code review fix

Get rid of verbose mcelog_get_dimm() function and use llist_search() instead.

Change-Id: Iccc5c083cf254b82c74f6f77df4a0659ba14282c
Signed-off-by: Tahhan, Maryam <maryam.tahhan@intel.com>
7 years agoprocesses: Show real disk IO in addition to process IO (Linux only)
Pavel Rochnyack [Wed, 29 Mar 2017 15:31:43 +0000 (21:31 +0600)]
processes: Show real disk IO in addition to process IO (Linux only)

Before this patch, Collectd reports /proc/PID/io fields 'io_rchar/io_wchar' as
'ps_disk_octets' type and 'io_syscr/io_syscw' as 'ps_disk_ops' type.
The names of these types do not match values they represent.

New, correct mapping implemented:

 io_rchar/io_wchar      -> io_octets   (was ps_disk_octets, not used anymore)
 io_syscr/io_syscw      -> io_ops      (was ps_disk_ops, not used anymore)
 read_bytes/write_bytes -> disk_octets (new data collected)

 Closes: #1990

7 years agolibcollectdclient: Include "config.h" unconditionally.
Florian Forster [Tue, 4 Jul 2017 21:36:24 +0000 (23:36 +0200)]
libcollectdclient: Include "config.h" unconditionally.

7 years agoMerge pull request #2341 from rpv-tomsk/issue-2328
Ruben Kerkhof [Tue, 4 Jul 2017 15:27:03 +0000 (17:27 +0200)]
Merge pull request #2341 from rpv-tomsk/issue-2328

curl plugins: Use configured URL for all poll cycles

7 years agocurl plugins: Use configured URL for all poll cycles
Pavel Rochnyack [Tue, 4 Jul 2017 10:31:46 +0000 (17:31 +0700)]
curl plugins: Use configured URL for all poll cycles

After redirect received, Collectd send subsequent requests to new location.
That is wrong - Collectd should use configured URL for all poll cycles, regardless of the responses received previously.

Problem was caused by libcurl issue 1631. To avoid that we set request url in each poll cycle.

Closes: #2328

7 years agowrite_mongodb: fix build warning
Ruben Kerkhof [Sun, 2 Jul 2017 20:12:18 +0000 (22:12 +0200)]
write_mongodb: fix build warning

  CC       src/write_mongodb_la-write_mongodb.lo
src/write_mongodb.c: In function ‘wm_config’:
src/write_mongodb.c:371:55: warning: ‘%s’ directive output may be truncated writing up to 127 bytes into a region of size 114 [-Wformat-truncation=]
     snprintf(cb_name, sizeof(cb_name), "write_mongodb/%s", node->name);
                                                       ^~
src/write_mongodb.c:371:5: note: ‘snprintf’ output between 15 and 142 bytes into a destination of size 128
     snprintf(cb_name, sizeof(cb_name), "write_mongodb/%s", node->name);
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

7 years agowrite_redis: fix build warning
Ruben Kerkhof [Sun, 2 Jul 2017 20:07:59 +0000 (22:07 +0200)]
write_redis: fix build warning

src/write_redis.c: In function ‘wr_config’:
src/write_redis.c:222:53: warning: ‘%s’ directive output may be truncated writing up to 127 bytes into a region of size 116 [-Wformat-truncation=]
     snprintf(cb_name, sizeof(cb_name), "write_redis/%s", node->name);
                                                     ^~
src/write_redis.c:222:5: note: ‘snprintf’ output between 13 and 140 bytes into a destination of size 128
     snprintf(cb_name, sizeof(cb_name), "write_redis/%s", node->name);
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

7 years agolibcollectdclient: increase error buffer
Ruben Kerkhof [Sun, 2 Jul 2017 19:52:14 +0000 (21:52 +0200)]
libcollectdclient: increase error buffer

make[1]: Entering directory '/home/ruben/src/collectd'
  CC       src/libcollectdclient/libcollectdclient_la-client.lo
src/libcollectdclient/client.c: In function ‘lcc_getval’:
src/libcollectdclient/client.c:621:23: warning: ‘%s’ directive output may be truncated writing up to 1023 bytes into a region of size 1010 [-Wformat-truncation=]
     LCC_SET_ERRSTR(c, "Server error: %s", res.message);
                       ^                   ~
src/libcollectdclient/client.c:94:48: note: in definition of macro ‘LCC_SET_ERRSTR’
     snprintf((c)->errbuf, sizeof((c)->errbuf), __VA_ARGS__);                   \
                                                ^~~~~~~~~~~
src/libcollectdclient/client.c:94:5: note: ‘snprintf’ output between 15 and 1038 bytes into a destination of size 1024
     snprintf((c)->errbuf, sizeof((c)->errbuf), __VA_ARGS__);                   \
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/libcollectdclient/client.c:621:5: note: in expansion of macro ‘LCC_SET_ERRSTR’
     LCC_SET_ERRSTR(c, "Server error: %s", res.message);
     ^~~~~~~~~~~~~~
src/libcollectdclient/client.c: In function ‘lcc_putval’:
src/libcollectdclient/client.c:754:23: warning: ‘%s’ directive output may be truncated writing up to 1023 bytes into a region of size 1010 [-Wformat-truncation=]
     LCC_SET_ERRSTR(c, "Server error: %s", res.message);
                       ^                   ~
src/libcollectdclient/client.c:94:48: note: in definition of macro ‘LCC_SET_ERRSTR’
     snprintf((c)->errbuf, sizeof((c)->errbuf), __VA_ARGS__);                   \
                                                ^~~~~~~~~~~
src/libcollectdclient/client.c:94:5: note: ‘snprintf’ output between 15 and 1038 bytes into a destination of size 1024
     snprintf((c)->errbuf, sizeof((c)->errbuf), __VA_ARGS__);                   \
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/libcollectdclient/client.c:754:5: note: in expansion of macro ‘LCC_SET_ERRSTR’
     LCC_SET_ERRSTR(c, "Server error: %s", res.message);
     ^~~~~~~~~~~~~~
src/libcollectdclient/client.c: In function ‘lcc_flush’:
src/libcollectdclient/client.c:802:23: warning: ‘%s’ directive output may be truncated writing up to 1023 bytes into a region of size 1010 [-Wformat-truncation=]
     LCC_SET_ERRSTR(c, "Server error: %s", res.message);
                       ^                   ~
src/libcollectdclient/client.c:94:48: note: in definition of macro ‘LCC_SET_ERRSTR’
     snprintf((c)->errbuf, sizeof((c)->errbuf), __VA_ARGS__);                   \
                                                ^~~~~~~~~~~
src/libcollectdclient/client.c:94:5: note: ‘snprintf’ output between 15 and 1038 bytes into a destination of size 1024
     snprintf((c)->errbuf, sizeof((c)->errbuf), __VA_ARGS__);                   \
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/libcollectdclient/client.c:802:5: note: in expansion of macro ‘LCC_SET_ERRSTR’
     LCC_SET_ERRSTR(c, "Server error: %s", res.message);
     ^~~~~~~~~~~~~~
src/libcollectdclient/client.c: In function ‘lcc_listval’:
src/libcollectdclient/client.c:834:23: warning: ‘%s’ directive output may be truncated writing up to 1023 bytes into a region of size 1010 [-Wformat-truncation=]
     LCC_SET_ERRSTR(c, "Server error: %s", res.message);
                       ^                   ~
src/libcollectdclient/client.c:94:48: note: in definition of macro ‘LCC_SET_ERRSTR’
     snprintf((c)->errbuf, sizeof((c)->errbuf), __VA_ARGS__);                   \
                                                ^~~~~~~~~~~
src/libcollectdclient/client.c:94:5: note: ‘snprintf’ output between 15 and 1038 bytes into a destination of size 1024
     snprintf((c)->errbuf, sizeof((c)->errbuf), __VA_ARGS__);                   \
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/libcollectdclient/client.c:834:5: note: in expansion of macro ‘LCC_SET_ERRSTR’
     LCC_SET_ERRSTR(c, "Server error: %s", res.message);
     ^~~~~~~~~~~~~~

Fixes #2200

7 years agolibcollectclient: snprintf already NUL-terminates
Ruben Kerkhof [Sun, 2 Jul 2017 19:50:48 +0000 (21:50 +0200)]
libcollectclient: snprintf already NUL-terminates

7 years agoprocesses plugin: fix build warning
Ruben Kerkhof [Sun, 2 Jul 2017 19:48:50 +0000 (21:48 +0200)]
processes plugin: fix build warning

  CC       src/processes.lo
src/processes.c: In function ‘ps_read’:
src/processes.c:823:58: warning: ‘%s’ directive output may be truncated writing up to 255 bytes into a region of size between 32 and 51 [-Wformat-truncation=]
     snprintf(filename, sizeof(filename), "/proc/%li/task/%s/status", ps->id,
                                                          ^~
src/processes.c:823:5: note: ‘snprintf’ output between 21 and 295 bytes into a destination of size 64
     snprintf(filename, sizeof(filename), "/proc/%li/task/%s/status", ps->id,
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
               tpid);
               ~~~~~

In practice the buffer is more than large enough, since all we substitute are process ids, but gcc can't know that.

7 years agoTreewide: replace ssnprintf with snprintf
Ruben Kerkhof [Sun, 2 Jul 2017 19:17:30 +0000 (21:17 +0200)]
Treewide: replace ssnprintf with snprintf

ssnprintf supposedly was a safer version of snprintf, but they both
always NUL-terminate the buffer.

After this change GCC >= 7 will start warning when snprintf silenty
truncates, which is good since I want to see when that happens.

7 years agoMerge branch 'collectd-5.7'
Ruben Kerkhof [Sun, 2 Jul 2017 18:52:18 +0000 (20:52 +0200)]
Merge branch 'collectd-5.7'

7 years agotcpconns plugin: fix build on FreeBSD current
Ruben Kerkhof [Sun, 2 Jul 2017 18:34:59 +0000 (20:34 +0200)]
tcpconns plugin: fix build on FreeBSD current

FreeBSD commit https://github.com/freebsd/freebsd/commit/3a5c9aaf2b2ea107bcaf0ba28b706238d92bdbbd
hides inpcb and tcpcb from userland.

Patch taken from FreeBSD ports tree, thanks glebius@.

7 years agowrite_mongodb: use ssnprintf_alloc to create dsn
Ruben Kerkhof [Sun, 2 Jul 2017 17:38:12 +0000 (19:38 +0200)]
write_mongodb: use ssnprintf_alloc to create dsn

7 years agowrite_mongodb: fix potential NULL dereference
Ruben Kerkhof [Sun, 2 Jul 2017 17:22:20 +0000 (19:22 +0200)]
write_mongodb: fix potential NULL dereference

scan-build: Using '/usr/bin/clang-4.0' for static analysis
make  all-am
make[1]: Entering directory '/home/ruben/src/collectd'
  CC       src/write_mongodb_la-write_mongodb.lo
src/write_mongodb.c:173:41: warning: Null pointer passed as an argument to a 'nonnull' parameter
                 strlen(node->passwd) + strlen(node->host) + 5 +
                                        ^~~~~~~~~~~~~~~~~~
src/write_mongodb.c:199:42: warning: Null pointer passed as an argument to a 'nonnull' parameter
    uri_length = strlen(format_string) + strlen(node->host) + 5 + 1;
                                         ^~~~~~~~~~~~~~~~~~
2 warnings generated.
  CCLD     write_mongodb.la

7 years agowrite_mongodb.c: clang-format
Ruben Kerkhof [Sun, 2 Jul 2017 17:16:55 +0000 (19:16 +0200)]
write_mongodb.c: clang-format

7 years agoOnly build libplugin_mock.la during make check
Ruben Kerkhof [Sun, 2 Jul 2017 13:44:39 +0000 (15:44 +0200)]
Only build libplugin_mock.la during make check

7 years agoMerge pull request #2315 from mcorbin/feat/riemann-microseconds-resolution
Ruben Kerkhof [Sun, 2 Jul 2017 12:38:36 +0000 (14:38 +0200)]
Merge pull request #2315 from mcorbin/feat/riemann-microseconds-resolution

Add micro-seconds resolution in write_riemann

7 years agoMerge pull request #2301 from rpv-tomsk/fix-apcups
Ruben Kerkhof [Sun, 2 Jul 2017 11:34:05 +0000 (13:34 +0200)]
Merge pull request #2301 from rpv-tomsk/fix-apcups

apcups: Fix reconnect implementation

7 years agoipvs plugin: remove custom kernel source support
Ruben Kerkhof [Sat, 1 Jul 2017 13:43:42 +0000 (15:43 +0200)]
ipvs plugin: remove custom kernel source support

Linux has shipped ipvs.h in its uapi for ages now.

7 years agoconfigure.ac: minor cleanup
Ruben Kerkhof [Sat, 1 Jul 2017 13:27:21 +0000 (15:27 +0200)]
configure.ac: minor cleanup

7 years agoconfigure.ac: remove some whitespace
Ruben Kerkhof [Sat, 1 Jul 2017 13:18:08 +0000 (15:18 +0200)]
configure.ac: remove some whitespace

7 years agosnmp_agent plugin: fix a few build warnings
Ruben Kerkhof [Sat, 1 Jul 2017 13:09:40 +0000 (15:09 +0200)]
snmp_agent plugin: fix a few build warnings

```
CC       src/snmp_agent_la-snmp_agent.lo
src/snmp_agent.c:166:25: warning: comparison of integers of different signs: 'int' and 'size_t' (aka 'unsigned long') [-Wsign-compare]
      for (int i = 0; i < dd->oids_len; i++) {
                      ~ ^ ~~~~~~~~~~~~
src/snmp_agent.c:190:23: warning: comparison of integers of different signs: 'int' and 'size_t' (aka 'unsigned long') [-Wsign-compare]
    for (int i = 0; i < dd->oids_len; i++) {
                    ~ ^ ~~~~~~~~~~~~
src/snmp_agent.c:289:37: warning: comparison of integers of different signs: 'int' and 'size_t' (aka 'unsigned long') [-Wsign-compare]
  for (i = 0; i < key_len && offset < oid->oid_len; i++)
                             ~~~~~~ ^ ~~~~~~~~~~~~
src/snmp_agent.c:355:23: warning: comparison of integers of different signs: 'int' and 'size_t' (aka 'unsigned long') [-Wsign-compare]
    for (int i = 0; i < dd->oids_len; i++)
                    ~ ^ ~~~~~~~~~~~~
src/snmp_agent.c:420:23: warning: comparison of integers of different signs: 'int' and 'size_t' (aka 'unsigned long') [-Wsign-compare]
    for (int i = 0; i < (*dd)->oids_len; i++)
                    ~ ^ ~~~~~~~~~~~~~~~
src/snmp_agent.c:429:25: warning: comparison of integers of different signs: 'int' and 'size_t' (aka 'unsigned long') [-Wsign-compare]
      for (int i = 0; i < (*dd)->oids_len; i++)
                      ~ ^ ~~~~~~~~~~~~~~~
src/snmp_agent.c:440:25: warning: comparison of integers of different signs: 'int' and 'size_t' (aka 'unsigned long') [-Wsign-compare]
      for (int i = 0; i < (*dd)->oids_len; i++)
                      ~ ^ ~~~~~~~~~~~~~~~
src/snmp_agent.c:532:20: warning: comparison of integers of different signs: 'int' and 'size_t' (aka 'unsigned long') [-Wsign-compare]
  assert(oid_index < values_num);
         ~~~~~~~~~ ^ ~~~~~~~~~~
/usr/include/assert.h:89:5: note: expanded from macro 'assert'
  ((expr)                                                               \
    ^~~~
src/snmp_agent.c:584:25: warning: comparison of integers of different signs: 'int' and 'size_t' (aka 'unsigned long') [-Wsign-compare]
      for (int i = 0; i < dd->oids_len; i++) {
                      ~ ^ ~~~~~~~~~~~~
src/snmp_agent.c:768:23: warning: comparison of integers of different signs: 'int' and 'size_t' (aka 'unsigned long') [-Wsign-compare]
    for (int i = 0; i < dd->oids_len; i++) {
                    ~ ^ ~~~~~~~~~~~~
src/snmp_agent.c:806:25: warning: comparison of integers of different signs: 'int' and 'size_t' (aka 'unsigned long') [-Wsign-compare]
      for (int i = 0; i < dd->oids_len; i++) {
                      ~ ^ ~~~~~~~~~~~~
src/snmp_agent.c:821:23: warning: comparison of integers of different signs: 'int' and 'size_t' (aka 'unsigned long') [-Wsign-compare]
    for (int i = 0; i < dd->oids_len; i++) {
                    ~ ^ ~~~~~~~~~~~~
src/snmp_agent.c:1287:23: warning: comparison of integers of different signs: 'int' and 'size_t' (aka 'unsigned long') [-Wsign-compare]
    for (int i = 0; i < dd->oids_len; i++) {
                    ~ ^ ~~~~~~~~~~~~
13 warnings generated.
```

7 years agoipvs plugin: minor cleanup
Ruben Kerkhof [Sat, 1 Jul 2017 12:54:41 +0000 (14:54 +0200)]
ipvs plugin: minor cleanup

- Remove some Yoda conditionals
- Give some variables better names
- Use C99 designated initializers in some places.

7 years agoMerge pull request #2327 from rpv-tomsk/snmp-custom-port
Ruben Kerkhof [Sat, 1 Jul 2017 10:57:27 +0000 (12:57 +0200)]
Merge pull request #2327 from rpv-tomsk/snmp-custom-port

snmp plugin: Option `Address` documented in more details.