Let systemd handle logging
notify_systemd: unset NOTIFY_SOCKET later
getenv returns a pointer, possibly to a static buffer.
If I understand the specs correctly, unsetenv is basically free
to do what it wants with this, so don't keep using the pointer
after we do unsetenv.
getenv returns a pointer, possibly to a static buffer.
If I understand the specs correctly, unsetenv is basically free
to do what it wants with this, so don't keep using the pointer
after we do unsetenv.
notify_systemd: remove dead code
The whole function is already wrapped in #ifdef KERNEL_LINUX
The whole function is already wrapped in #ifdef KERNEL_LINUX
notify_systemd: use close-on-exit on socket
collectd-tg: Fall back to gettimeofday(3) if clock_gettime(3) is not available.
Sometimes Mac OS/X is stupid. clock_gettime() was introduced in 1997, just
sayin'.
Fixes: #1247
Sometimes Mac OS/X is stupid. clock_gettime() was introduced in 1997, just
sayin'.
Fixes: #1247
Merge branch 'collectd-5.5'
src/daemon/utils_time_test.c: add ULL suffix to large literals
This should prevent some 32bit compilers from complaining about:
`integer constant is too large for 'long' type`
This should prevent some 32bit compilers from complaining about:
`integer constant is too large for 'long' type`
Merge branch 'collectd-5.4' into collectd-5.5
Fix harmless build warnings with newer binutils
I see a lot of those on Rawhide:
ar: `u' modifier ignored since `D' is the default (see `U')
It's going to take a while to get this fixed upstream.
Meanwhile, silence the warnings.
Macro copied from libvirt.
I see a lot of those on Rawhide:
ar: `u' modifier ignored since `D' is the default (see `U')
It's going to take a while to get this fixed upstream.
Meanwhile, silence the warnings.
Macro copied from libvirt.
liboconfig: Fix implicit declaration warning
strlen declaration is in string.h
strlen declaration is in string.h
Don't unlock lock twice
Fixes make check on OpenBSD
Fixes make check on OpenBSD
pf: fix compilation on OpenBSD
dns: fix compilation on OpenBSD
OpenBSD doesn't have pcap-bpf.h
pcap.h has been including pcap/bpf.h since 2006.
Since we require a pcap which has PCAP_ERROR_IFACE_NOT_UP, introduced in 2008
this shouldn't break anything.
OpenBSD doesn't have pcap-bpf.h
pcap.h has been including pcap/bpf.h since 2006.
Since we require a pcap which has PCAP_ERROR_IFACE_NOT_UP, introduced in 2008
this shouldn't break anything.
Fix pipe leak in exec plugin
Fixes #762
Fixes #762
src/testing.h: Rename the EXPECT_EQ_{DOUBLE,INT,STR} macros.
Let all equality macros follow a common naming and logging schema.
Let all equality macros follow a common naming and logging schema.
src/testing.h: Rewrite the EXPECT_EQ_UINT64() macro.
Cast the input to uint64_t, so we don't need to do this when calling the
macro. This results in cleaner log messages and prevents macros to be
expanded in the log output.
Cast the input to uint64_t, so we don't need to do this when calling the
macro. This results in cleaner log messages and prevents macros to be
expanded in the log output.
src/daemon/utils_time_test.c: Test ms conversion.
The CDTIME_T_TO_MS() macro is used by all plugins using the cURL library,
so we should properly test this macro, too.
The CDTIME_T_TO_MS() macro is used by all plugins using the cURL library,
so we should properly test this macro, too.
src/daemon/utils_time.h: Don't cast input to time_t.
The CDTIME_T_TO_TIME_T() macro used to cast its input to time_t, which is
a 32bit type on (some?) 32bit architectures.
This is a regression introduced in db1391aaa66b8b8fad82219494f61f3452441f62
and not found in any released version of collectd. Phew!
The CDTIME_T_TO_TIME_T() macro used to cast its input to time_t, which is
a 32bit type on (some?) 32bit architectures.
This is a regression introduced in db1391aaa66b8b8fad82219494f61f3452441f62
and not found in any released version of collectd. Phew!
src/daemon/utils_time.h: Treat nanoseconds as 64bit integer.
The assumed type was "long", because that is what struct timespec is
using. However, struct timespec only stores the fraction of a second in
the approrpiate field and therefore only cares about values up to 10^9.
We, on the other hand, assume a UNIX epoch in ns precision, so we
require the entire 64bits.
This patch changes the [MUN]S_TO_CDTIME_T() macros to assume a uint64_t
input and moves the casting to the appropriate data type for struct
time{val,spec} to the CDTIME_T_TO_TIME{VAL,SPEC}() macros. Appropriate
casts are added to the cURL based plugins which need to pass a "long" to
cURL when specifying timeouts.
It also fixes the unit test, which assigned large (> 32 bit) literals to
a "long" field, which breaks on 32 bit architectures.
The assumed type was "long", because that is what struct timespec is
using. However, struct timespec only stores the fraction of a second in
the approrpiate field and therefore only cares about values up to 10^9.
We, on the other hand, assume a UNIX epoch in ns precision, so we
require the entire 64bits.
This patch changes the [MUN]S_TO_CDTIME_T() macros to assume a uint64_t
input and moves the casting to the appropriate data type for struct
time{val,spec} to the CDTIME_T_TO_TIME{VAL,SPEC}() macros. Appropriate
casts are added to the cURL based plugins which need to pass a "long" to
cURL when specifying timeouts.
It also fixes the unit test, which assigned large (> 32 bit) literals to
a "long" field, which breaks on 32 bit architectures.
src/daemon/utils_time.h: Improve precision of conversion macros.
This patch also adds test cases for most conversions. It is inspired by
collectd/go-collectd#5 and uses some of the same test cases.
This patch also adds test cases for most conversions. It is inspired by
collectd/go-collectd#5 and uses some of the same test cases.
ltdl: only compile included libltdl when needed
If configure finds an external libltdl, it's going to
use it, so there's no use in compiling the shipped libltdl.
If configure finds an external libltdl, it's going to
use it, so there's no use in compiling the shipped libltdl.
Merge remote-tracking branch 'origin/pr/1216'
Merge remote-tracking branch 'origin/pr/1188'
Use the devstat struct directly instead of using devstat_compute_statistics().
powerdns: update recursor stats to 3.7.3
Fixes #555
Fixes #555
Merge branch 'collectd-5.5'
Merge branch 'collectd-5.4' into collectd-5.5
routeros: fix a small build error pointed out by clang
routeros.c:334:35: error: 'memset' call operates on objects of type 'cr_data_t' (aka 'struct cr_data_s') while the size is based on a different type 'cr_data_t *' (aka 'struct cr_data_s *') [-Werror,-Wsizeof-pointer-memaccess]
memset (router_data, 0, sizeof (router_data));
~~~~~~~~~~~ ^~~~~~~~~~~
routeros.c:334:35: note: did you mean to dereference the argument to 'sizeof' (and multiply it by the number of elements)?
memset (router_data, 0, sizeof (router_data));
^~~~~~~~~~~
routeros.c:334:35: error: 'memset' call operates on objects of type 'cr_data_t' (aka 'struct cr_data_s') while the size is based on a different type 'cr_data_t *' (aka 'struct cr_data_s *') [-Werror,-Wsizeof-pointer-memaccess]
memset (router_data, 0, sizeof (router_data));
~~~~~~~~~~~ ^~~~~~~~~~~
routeros.c:334:35: note: did you mean to dereference the argument to 'sizeof' (and multiply it by the number of elements)?
memset (router_data, 0, sizeof (router_data));
^~~~~~~~~~~
Merge pull request #1153 from mbethke/fix-unixsock
Fix Unixsock.pm
Fix Unixsock.pm
Merge pull request #1178 from rubenk/fix-libmodbus-compilation-on-freebsd
core: include <sys/socket.h> in collectd.h
core: include <sys/socket.h> in collectd.h
ipc: enable _GNU_SOURCE to fix build with musl libc
This fixes compile the compile error:
> ipc.c:154:49: error: 'struct shm_info' has no member named 'used_ids'
> ipc_submit_g("shm", "segments", NULL, shm_info.used_ids);
> ^
Fixes #1147
This fixes compile the compile error:
> ipc.c:154:49: error: 'struct shm_info' has no member named 'used_ids'
> ipc_submit_g("shm", "segments", NULL, shm_info.used_ids);
> ^
Fixes #1147
Revert "amqp: look for librabbitmq in /usr/local as well"
This reverts commit c1c5087fd5d9e66427cee8c98c523519d578bee6.
... as a follow-up to the discussion which took place in #1201
This reverts commit c1c5087fd5d9e66427cee8c98c523519d578bee6.
... as a follow-up to the discussion which took place in #1201
fhcount: this plugin only works on Linux
Merge pull request #1196 from rubenk/travis
Travis
Travis
Travis: add some whitelisted packages
The list is at https://github.com/travis-ci/apt-package-whitelist/blob/master/ubuntu-precise
The list is at https://github.com/travis-ci/apt-package-whitelist/blob/master/ubuntu-precise
Travis: test with both gcc and clang
Travis does this in parallel so the build doesn't become
twice as long.
Travis does this in parallel so the build doesn't become
twice as long.
Travis: run make distcheck
This way we test if we can successfully build from tarball,
and we didn't leave out any files or forgot to clean something up.
This way we test if we can successfully build from tarball,
and we didn't leave out any files or forgot to clean something up.
disk: no need to link with kvm, bsdxml, sbuf
disk: rename snap_present to snap
There's only one of them now
There's only one of them now
disk: gather statistics since boot on FreeBSD
disk_octets and disk_ops are derives, so we don't want rates
but absolute values.
I tested this with fio with a constant IO rate and confirmed
that the values are correct for disk_octets and disk_ops.
disk_time is a different matter and I need some help with that.
devstat_compute_statistics returns a long double and it didn't
seem to increase much on my system, but that might be because I
tested this with a fast SSD.
disk_octets and disk_ops are derives, so we don't want rates
but absolute values.
I tested this with fio with a constant IO rate and confirmed
that the values are correct for disk_octets and disk_ops.
disk_time is a different matter and I need some help with that.
devstat_compute_statistics returns a long double and it didn't
seem to increase much on my system, but that might be because I
tested this with a fast SSD.
Make disk plugin compatible with FreeBSD.
Merge branch 'collectd-5.5'
systemd.collectd.service: take debian/ubuntu's env file in account too
Merge remote-tracking branch 'origin/pr/1191'
Merge remote-tracking branch 'origin/pr/1181'
Merge remote-tracking branch 'origin/pr/1175'
Merge remote-tracking branch 'origin/pr/1164'
Merge branch 'collectd-5.4' into collectd-5.5
logstash: initialize conf struct to 0
With YAJL 1 (at least on Ubuntu Precise), if `conf.indentString` is not
initialized correctly, we would get a segfault even when `conf.beautify`
is set to 0. We avoid this case by initializing the whole structure to
0. `conf.beautify = 0` is kept for explicitness.
With YAJL 1 (at least on Ubuntu Precise), if `conf.indentString` is not
initialized correctly, we would get a segfault even when `conf.beautify`
is set to 0. We avoid this case by initializing the whole structure to
0. `conf.beautify = 0` is kept for explicitness.
Fix libmodbus detection on FreeBSD
We look for modbus/modbus.h in /usr/local/include/modbus
but we should look for modbus.h
This is only an issue on FreeBSD since /usr/local/include is not
in the default search path.
We look for modbus/modbus.h in /usr/local/include/modbus
but we should look for modbus.h
This is only an issue on FreeBSD since /usr/local/include is not
in the default search path.
amqp: look for librabbitmq in /usr/local as well
This detects it automatically on FreeBSD.
Ideally we should just use pkg-config but that is
left as an exercise for the reader ;)
This detects it automatically on FreeBSD.
Ideally we should just use pkg-config but that is
left as an exercise for the reader ;)
Fix varnish detection on FreeBSD
We look for varnish/vapi/vsc.h in /usr/include/varnish
but we should look for vapi/vsc.h
This is only an issue on FreeBSD since /usr/local/include is not
in the default search path.
We look for varnish/vapi/vsc.h in /usr/include/varnish
but we should look for vapi/vsc.h
This is only an issue on FreeBSD since /usr/local/include is not
in the default search path.
irq: skip FIQ line in /proc/interrupts
/proc/interrupts on my Raspberry PI contains:
FIQ: usb_fiq
This line doesn't contain any per cpu counters
but we try to parse it anyway, resulting in:
parse_value: Failed to parse string as derive: usb_fiq.
Fixes #971
/proc/interrupts on my Raspberry PI contains:
FIQ: usb_fiq
This line doesn't contain any per cpu counters
but we try to parse it anyway, resulting in:
parse_value: Failed to parse string as derive: usb_fiq.
Fixes #971
configure.ac: remove some redundant x'es
configure.ac: fix indentation
Fix a memory leak on shutdown
Use environmental variables from /etc/sysconfig/collectd
Change-Id: I948ce3d7a3071cc1ac26a24b059a5ee4aacba0d9
Change-Id: I948ce3d7a3071cc1ac26a24b059a5ee4aacba0d9
travis: make check as well
Add more test stuff to .gitignore
core: include <sys/socket.h> in collectd.h
Fixes #1127
Fixes #1127
Merge branch 'collectd-5.5'
Merge branch 'collectd-5.4' into collectd-5.5
Add utils_parse_option.c/h to amqp plugin source files list
collectd -T: fix memory leak
Fix some small leaks on error paths
liboconfig: really fix lex warnings
Flex has two options to disable input and unput.
Turn them on.
Flex has two options to disable input and unput.
Turn them on.
Add remark about length of HostnameFormat string in virt plugin
Merge remote-tracking branch 'origin/pr/1168'
Use standard ints in write_kafka plugin for portability
travis: move to new infra
travis: update script
travis: enable ci
src/utils_latency.c: Fix format string error.
src/utils_latency.c: Ensure that LLONG_MAX is defined.
EPEL5 doesn't have it in <limits.h> apparently.
EPEL5 doesn't have it in <limits.h> apparently.
RPM specfile: take mqtt plugin in account
write_redis: fix a few typos in manpage
Also correct the maximum length of the node name.
The callback name is "write_redis/%s" so the maximum
length of a node name is DATA_MAX_NAME_LEN - strlen("write_redis") -1.
Also correct the maximum length of the node name.
The callback name is "write_redis/%s" so the maximum
length of a node name is DATA_MAX_NAME_LEN - strlen("write_redis") -1.
write_graphite: set service at config time
write_graphite: set service at config time
This fixes the (null) I saw in an error message:
write_graphite plugin: send to localhost:(null) (udp) failed with status -1 (Connection refused)
This fixes the (null) I saw in an error message:
write_graphite plugin: send to localhost:(null) (udp) failed with status -1 (Connection refused)
write_graphite: set default node at config time
write_graphite: remove #ifndefs
If these are defined somewhere else to a different value,
we'd like to know about it.
If these are defined somewhere else to a different value,
we'd like to know about it.
make _escape_argument() readonly-safe on older Perls
fix evil autoderef
src/utils_latency_test.c: Disable the "-1" test for now.
Issue: #1139
Issue: #1139
src/utils_latency_test.c: Assure that large latency values also work.
The cdtime_t representation of 99s doesn't fit into 32bit anymore, thereby
assuring that cdtime_t is actually 64bit on platforms that currently
don't pass the test, i.e. EPEL {5,6} on i386.
Issue: #1139
The cdtime_t representation of 99s doesn't fit into 32bit anymore, thereby
assuring that cdtime_t is actually 64bit on platforms that currently
don't pass the test, i.e. EPEL {5,6} on i386.
Issue: #1139
src/utils_latency_test.c: Log result of DOUBLE_TO_CDTIME_T() conversion.
The test fails on some i386 architectures. Time for some printf debugging.
The test fails on some i386 architectures. Time for some printf debugging.
src/daemon/utils_time_mock.c: Mark static return value as "ULL".
Build on i386 squeeze fails with:
utils_time_mock.c:31: error: integer constant is too large for 'long' type
Build on i386 squeeze fails with:
utils_time_mock.c:31: error: integer constant is too large for 'long' type
Link libcommon.la with $(COMMON_LIBS).
This hopefully fixes link errors on Solaris:
CCLD test_utils_vl_lookup
Undefined first referenced
symbol in file
kstat_data_lookup daemon/.libs/libcommon.a(common.o)
kstat_lookup daemon/.libs/libcommon.a(common.o)
kstat_read daemon/.libs/libcommon.a(common.o)
getaddrinfo daemon/.libs/libcommon.a(common.o)
freeaddrinfo daemon/.libs/libcommon.a(common.o)
gai_strerror daemon/.libs/libcommon.a(common.o)
ld: fatal: symbol referencing errors. No output written to test_utils_vl_lookup
collect2: error: ld returned 1 exit status
This hopefully fixes link errors on Solaris:
CCLD test_utils_vl_lookup
Undefined first referenced
symbol in file
kstat_data_lookup daemon/.libs/libcommon.a(common.o)
kstat_lookup daemon/.libs/libcommon.a(common.o)
kstat_read daemon/.libs/libcommon.a(common.o)
getaddrinfo daemon/.libs/libcommon.a(common.o)
freeaddrinfo daemon/.libs/libcommon.a(common.o)
gai_strerror daemon/.libs/libcommon.a(common.o)
ld: fatal: symbol referencing errors. No output written to test_utils_vl_lookup
collect2: error: ld returned 1 exit status
src/utils_latency.c: Fix format string error.
src/utils_latency.c: Ensure that LLONG_MAX is defined.
EPEL5 doesn't have it in <limits.h> apparently.
EPEL5 doesn't have it in <limits.h> apparently.
plugin_mock.c: Declare "kc".
This hopefully fixes "make check" on Solaris, which currently fails
with:
CC common_test.o
CCLD test_common
Undefined first referenced
symbol in file
kc ./.libs/libcommon.a(common.o)
ld: fatal: symbol referencing errors. No output written to test_common
collect2: error: ld returned 1 exit status
This hopefully fixes "make check" on Solaris, which currently fails
with:
CC common_test.o
CCLD test_common
Undefined first referenced
symbol in file
kc ./.libs/libcommon.a(common.o)
ld: fatal: symbol referencing errors. No output written to test_common
collect2: error: ld returned 1 exit status
Merge remote-tracking branch 'github/pr/1124'
Merge remote-tracking branch 'github/pr/1130'
src/utils_latency.c: Add unit test.
This test successfully reproduces the crash reported in #1131 by calling
latency_counter_add (l, DOUBLE_TO_CDTIME_T (-1.0));
This test successfully reproduces the crash reported in #1131 by calling
latency_counter_add (l, DOUBLE_TO_CDTIME_T (-1.0));
Merge branch 'collectd-5.5'
src/utils_latency.c: Store "bin_width" as cdtime_t.
This solves the integer overflow when passing huge latency values to
latency_counter_add(). In addition to fixing the overflow the function
will now ignore values that are larger than LLONG_MAX, i.e. the longest
possible latency is 272 years. As a nice side-effect, the precission of
latency_counter_get_percentile() is improved.
Issue: #1131
This solves the integer overflow when passing huge latency values to
latency_counter_add(). In addition to fixing the overflow the function
will now ignore values that are larger than LLONG_MAX, i.e. the longest
possible latency is 272 years. As a nice side-effect, the precission of
latency_counter_get_percentile() is improved.
Issue: #1131
src/utils_latency.c: Fix change_bin_width().
A missing cast when calculating "width_change_ratio" caused all metrics to
be moved to bucket #0.
A missing cast when calculating "width_change_ratio" caused all metrics to
be moved to bucket #0.
Added option to choose redis database to use
Testing: Return failure from OK1() and other fixes.
* The tests for common and meta_data logged "not ok" but didn't signal
failure because OK1() didn't include a return(-1) line. Adding this line
caused some restructuring of the utils_vl_lookup test, because it used
that macro in non-int functions.
* Fix DBLEQ() to work correctly with an expected NaN. Previously, the
if condition would fall through to the "expect != actual" part, which
is true for "NaN != NaN".
* Let the mock cdtime() return a non-zero value, as the (invalid) zero
value is used in parse_values() to detect whether the time has been
parsed already. This lead to the "N:..." tests failing.
* Correct the expected behavior of meta_data_add_*() when keys already
exist: they're replaced rather than causing an error.
* The tests for common and meta_data logged "not ok" but didn't signal
failure because OK1() didn't include a return(-1) line. Adding this line
caused some restructuring of the utils_vl_lookup test, because it used
that macro in non-int functions.
* Fix DBLEQ() to work correctly with an expected NaN. Previously, the
if condition would fall through to the "expect != actual" part, which
is true for "NaN != NaN".
* Let the mock cdtime() return a non-zero value, as the (invalid) zero
value is used in parse_values() to detect whether the time has been
parsed already. This lead to the "N:..." tests failing.
* Correct the expected behavior of meta_data_add_*() when keys already
exist: they're replaced rather than causing an error.
varnish: fix leak on read
Since VSM_Close doesn't free the object we leak a few bytes
every interval
Since VSM_Close doesn't free the object we leak a few bytes
every interval