Florian Forster [Tue, 23 Jan 2024 12:14:02 +0000 (13:14 +0100)]
ci: Remove the "statgrab" task from CirrusCI.
The "statgrab" job builds collectd with the "statgrab" library and then expects
certain plugins to be linked against it. However, since the build runs on
Linux, the plugins are actually using the "native" implementation. The linker,
noticing that the plugin is not referring to any symbol in the statgrab
library, does not actually produce a link, causing the test to fail.
The native implementations provide much richer metrics than the libstatgrab
based implementations, so we'll drop the test.
Fabrice Fontaine [Mon, 22 Jan 2024 21:15:21 +0000 (22:15 +0100)]
configure.ac: fix grpc build
abseil and other google tools are now subject to
"Google's Foundational C++ Support Policy" [0][1]. This currently
mandates gcc 7.3.1 and C++14 as minimum versions. So replace -std=c++11
by -std=c++14 to fix following build failure:
checking whether /home/buildroot/autobuild/instance-0/output-1/host/bin/sparc64-linux-g++ accepts -std=c++11
configure:25105: result: yes
configure:25127: checking grpc++/grpc++.h usability
configure:25127: /home/buildroot/autobuild/instance-0/output-1/host/bin/sparc64-linux-g++ -c -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -O1 -g0 -D_FORTIFY_SOURCE=2 -std=c++11 -DNOMINMAX -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 conftest.cpp >&5
In file included from /home/buildroot/autobuild/instance-0/output-1/host/sparc64-buildroot-linux-gnu/sysroot/usr/include/absl/base/config.h:86,
from /home/buildroot/autobuild/instance-0/output-1/host/sparc64-buildroot-linux-gnu/sysroot/usr/include/absl/base/const_init.h:25,
from /home/buildroot/autobuild/instance-0/output-1/host/sparc64-buildroot-linux-gnu/sysroot/usr/include/absl/synchronization/mutex.h:67,
from /home/buildroot/autobuild/instance-0/output-1/host/sparc64-buildroot-linux-gnu/sysroot/usr/include/grpcpp/impl/codegen/sync.h:32,
from /home/buildroot/autobuild/instance-0/output-1/host/sparc64-buildroot-linux-gnu/sysroot/usr/include/grpcpp/completion_queue.h:41,
from /home/buildroot/autobuild/instance-0/output-1/host/sparc64-buildroot-linux-gnu/sysroot/usr/include/grpcpp/channel.h:25,
from /home/buildroot/autobuild/instance-0/output-1/host/sparc64-buildroot-linux-gnu/sysroot/usr/include/grpcpp/grpcpp.h:52,
from /home/buildroot/autobuild/instance-0/output-1/host/sparc64-buildroot-linux-gnu/sysroot/usr/include/grpc++/grpc++.h:26,
from conftest.cpp:167:
/home/buildroot/autobuild/instance-0/output-1/host/sparc64-buildroot-linux-gnu/sysroot/usr/include/absl/base/policy_checks.h:79:2: error: #error "C++ versions less than C++14 are not supported."
79 | #error "C++ versions less than C++14 are not supported."
| ^~~~~
zzzyhtheonly [Fri, 19 Jan 2024 08:51:17 +0000 (16:51 +0800)]
disk: add /proc/diskstats fields 15 to 20 in KERNEL_LINUX
Kernel 4.18+ appends four more fields for discard tracking putting
the total at 18.
Kernel 5.5+ appends two more fields for flush requests.
This patch makes collectd available for those fields.
Eero Tamminen [Wed, 17 Jan 2024 15:19:16 +0000 (17:19 +0200)]
Pass strcmp() to c_avl_create() as function pointer, not data one
Matches how strcmp() is passed to c_avl_create() elsewhere.
Reported by -Wpendantic:
------------------------------------
write_prometheus.c: In function ‘prom_init’:
write_prometheus.c:900:28: error: ISO C forbids conversion of function pointer to object pointer type [-Werror=pedantic]
900 | metrics = c_avl_create((void *)strcmp);
| ^
write_prometheus.c:900:28: error: ISO C forbids passing argument 1 of ‘c_avl_create’ between function pointer and ‘void *’ [-Werror=pedantic]
900 | metrics = c_avl_create((void *)strcmp);
| ^~~~~~~~~~~~~~
In file included from write_prometheus.c:30:
utils/avltree/avltree.h:54:34: note: expected ‘int (*)(const void *, const void *)’ but argument is of type ‘void *’
54 | c_avl_tree_t *c_avl_create(int (*compare)(const void *, const void *));
|
~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
------------------------------------
Signed-off-by: Eero Tamminen <eero.t.tamminen@intel.com>
Florian Forster [Thu, 11 Jan 2024 19:35:30 +0000 (20:35 +0100)]
write_riemann plugin: Terminate `riemann_event_set` arguments with `RIEMANN_EVENT_FIELD_NONE`.
`riemann_event_set` is a variadic function, that means it accepts a variable
number of arguments. That means it needs some way to determine – at runtime
– how many arguments there are. It appears to be doing so by using
`RIEMANN_EVENT_FIELD_NONE` to indicate the last element in the argument
list. Unfortunately I was unable to find the library's documentation and
code and could not verify this.
That means that the argument list passed to `riemann_event_set` was not
always terminated, causing it to read past where it was supposed to and
adding random crap into the message it crafted.
Takuro Ashie [Mon, 26 Oct 2020 02:22:29 +0000 (11:22 +0900)]
lua: Use a global lock to call Lua's API
Since vanilla Lua isn't multi-thread-safe, a global lock should be used
when calling their functions. The previous code causes unstable behavior
especially on loading Lua's C modules with both read & write threads.
Kentaro Hayashi [Mon, 8 Feb 2021 12:26:16 +0000 (21:26 +0900)]
collection3: Fix inappropriate usage of CGI:param
When using collection3 as a CGI, the following error is sent to logs
repeatedly.
FastCGI sent in stderr: "CGI::param called in list context from
/usr/share/doc/collectd-core/examples/collection3/lib/Collectd/Graph/Common.pm
line 529, this can lead to vulnerabilities. See the warning in
"Fetching the value or values of a single named parameter" at
/usr/share/perl5/CGI.pm line 412"
This is caused inappropriate usage of param(), it should be handled as
a scalar or should be treated by multi_param() explicitly.
Florian Forster [Thu, 21 Dec 2023 11:05:45 +0000 (12:05 +0100)]
common: Fix compiler warning in unit test.
Some compilers complained about using a value that depends on the input for the
size argument passed to `strncpy`. They missed that the size of `buf` also
depends on the source argument and therefore this use is fine.
```
CC src/utils/common/common_test.o
../../src/utils/common/common_test.c: In function 'test_parse_values':
../../src/utils/common/common_test.c:316:5: error: 'strncpy' specified bound depends on the length of the source argument [-Werror=stringop-overflow=]
316 | strncpy(buf, cases[i].buffer, buf_sz);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../src/utils/common/common_test.c:314:21: note: length computed here
314 | size_t buf_sz = strlen(cases[i].buffer) + 1;
| ^~~~~~~~~~~~~~~~~~~~~~~
```
Florian Forster [Tue, 28 Nov 2023 18:31:11 +0000 (19:31 +0100)]
procevent plugin: remove use of a nested flexible array member.
The previous code used an ad-hoc struct to construct or parse a Netlink
message. This relied on allocating a field _after_ the struct with the
flexible array member, which is prohibited by the C standard, leading to
compiler warnings.