Pavel Rochnyack [Wed, 1 May 2019 17:21:02 +0000 (00:21 +0700)]
lua plugin: Make it possible to register more than one reader/writer.
lua_tostring(), used to identify readers/writers, doesn't work
on functions (it returns NULL). So, callback name is not unique and
its registration fail.
Added code to store script path and callback index in LUA Registry and
to build callback name based on them.
Added possibility to pass LUA callback as global-scope function name.
In this case callback name is built using function name, not callback
index.
Previously all domains were visible even if certain domains
should be filtered (only block devices and interface devices
were filtered instead of entire domains)
Now entire domains are filtered - if domain should be filtered
out, then it won't be visible the same way as filtered
block devices and network interfaces.
Previously network device filtering was not working properly
if InterfaceFormat was set to 'name' or 'address' values.
Additionally implementation for filtering by interface number
was missing.
-lv_config function was re-written to use complex config callback
-fixed invalid parsing that caused collectd termination even if values
in config file for virt were correct(ExtraStats and RefreshInterval)
-added return statement to properly finish successful parsing
'ExtraStats' option value - without that, parsing of config file will
fail if 'ExtraStats' option is used in the collectd config file
because return code is the one for unrecognized parameter key.
-fixed parsing of RefreshInterval - previously error was thrown by
mistake if value was not written between double quotes(i.e. "60" was
fine but 60 was not)
-previously validation for boolean option value(such as value of
'IgnoreSelected' parameter) in virt plugin was missing and bad input
in config file could be unnoticed by user(in config file, boolean
value is parsed from its string representation). Now validation is
added and error is thrown whenever value can't be parsed directly as
'true'|'yes'|'on' or 'false'|'no'|'off'.
-additionally error messages have been added in all places where
parsing failed in order to notify the user about the reason of
collectd initialization failure.
virt: Fetch block info stats from libvirt only if needed
Domain block info statistics will be retrieved from libvirt
only if one of extra stats is enabled:
- ex_stats_disk_allocation
- ex_stats_disk_capacity
- ex_stats_disk_physical
Pavel Rochnyack [Tue, 26 Feb 2019 19:59:17 +0000 (02:59 +0700)]
virt plugin: Fix segfaults on shutdown
If connection has failed then `lv_init' returns early without initializing `notif_thread'.
This causes segfault due to incorrect `pthread_join()` call on Collectd shutdown.
Ruben Kerkhof [Wed, 20 Feb 2019 12:25:00 +0000 (13:25 +0100)]
intel_rdt plugin: fix compiler warnings
make[1]: Entering directory '/home/ruben/src/collectd'
CC src/intel_rdt_la-intel_rdt.lo
src/intel_rdt.c: In function ‘rdt_dump_cgroups’:
src/intel_rdt.c:74:23: warning: comparison of integer expressions of different signedness: ‘int’ and ‘size_t’ {aka ‘long unsigned int’} [-Wsign-compare]
74 | for (int j = 0; j < cgroup->num_cores; j++) {
| ^
src/intel_rdt.c: In function ‘rdt_dump_data’:
src/intel_rdt.c:103:21: warning: comparison of integer expressions of different signedness: ‘int’ and ‘size_t’ {aka ‘long unsigned int’} [-Wsign-compare]
103 | for (int i = 0; i < g_rdt->num_groups; i++) {
| ^
CCLD intel_rdt.la
Ruben Kerkhof [Wed, 20 Feb 2019 11:06:27 +0000 (12:06 +0100)]
oauth.c: fix compiler warning
make[1]: Entering directory '/home/ruben/src/collectd'
CC src/utils/oauth/liboauth_la-oauth.lo
src/utils/oauth/oauth.c: In function ‘get_assertion’:
src/utils/oauth/oauth.c:283:19: warning: comparison of integer expressions of different signedness: ‘int’ and ‘size_t’ {aka ‘long unsigned int’} [-Wsign-compare]
283 | else if (status >= buffer_size)
| ^~
Ruben Kerkhof [Wed, 20 Feb 2019 10:22:30 +0000 (11:22 +0100)]
turbostat plugin: fix two compiler warnings
src/turbostat.c:1466:5: warning: no previous prototype for function 'save_affinity' [-Wmissing-prototypes]
int save_affinity(void) {
^
src/turbostat.c:1479:6: warning: no previous prototype for function 'restore_affinity' [-Wmissing-prototypes]
void restore_affinity(void) {
^
Ruben Kerkhof [Wed, 20 Feb 2019 10:19:16 +0000 (11:19 +0100)]
ovs_stats plugin: fix compiler warning
src/ovs_stats.c:863:23: warning: comparison of integers of different signs: 'int' and 'size_t' (aka 'unsigned long') [-Wsign-compare]
for (int i = 0; i < YAJL_GET_ARRAY(ifaces_list)->len; i++) {
~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 warning generated.
Ruben Kerkhof [Tue, 19 Feb 2019 17:53:19 +0000 (18:53 +0100)]
sensu plugin: fix compiler warning when build with --enable-debug
In file included from src/write_sensu.c:31:
src/write_sensu.c: In function ‘sensu_config’:
./src/daemon/plugin.h:398:20: warning: ‘%s’ directive argument is null [-Wformat-overflow=]
398 | #define DEBUG(...) plugin_log(LOG_DEBUG, __VA_ARGS__)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/write_sensu.c:1227:7: note: in expansion of macro ‘DEBUG’
1227 | DEBUG("write_sensu plugin: Got tag: %s", tmp);
| ^~~~~
src/write_sensu.c:1227:43: note: format string is defined here
1227 | DEBUG("write_sensu plugin: Got tag: %s", tmp);
|
Ruben Kerkhof [Tue, 19 Feb 2019 17:27:46 +0000 (18:27 +0100)]
Don't hide errors when creating manpage
Apparently the default behaviour for pod2man changed at some point and
now it exits with a syntax error instead of exiting successfully with a
<POD ERRORS> section.
Now we do display the syntax issue:
[ruben@localhost collectd]$ make -j
POD2MAN src/collectd.conf.5
src/collectd.conf.pod around line 10361: You forgot a '=back' before '=head2'
POD document had syntax errors at /usr/bin/pod2man line 69.
make: *** [Makefile:9641: src/collectd.conf.5] Error 255
Ruben Kerkhof [Tue, 19 Feb 2019 10:58:26 +0000 (11:58 +0100)]
Reduce the nr of allocations when parsing types.db
We allocate a number of times for each line in types.db.
Since plugin_register_dataset() makes a copy of the dataset anyway, we
can create the dataset on the stack instead of the heap.
This reduces the number of calloc calls on my system from 624 to 337
when running collectd -T with the default types.db.
Ruben Kerkhof [Tue, 19 Feb 2019 09:57:03 +0000 (10:57 +0100)]
lua plugin: cleanup properly when shutting down
Found while running collectd -T under valgrind:
==25971== 75 (64 direct, 11 indirect) bytes in 1 blocks are definitely lost in loss record 154 of 274
==25971== at 0x483AB1A: calloc (vg_replace_malloc.c:762)
==25971== by 0x4854009: lua_cb_register_read (lua.c:288)
==25971== by 0x4FBE886: ???
==25971== by 0x4FD4900: ???
==25971== by 0x4FBEAD7: ???
==25971== by 0x4FBEB04: ???
==25971== by 0x4FBDF16: ???
==25971== by 0x4FBEE5E: ???
==25971== by 0x4FB53ED: ???
==25971== by 0x48536E7: lua_script_load (lua.c:465)
==25971== by 0x485387E: lua_config_script (lua.c:532)
==25971== by 0x485395E: lua_config (lua.c:557)