collectd -t should test config

Created on 13 Jul 2019  路  5Comments  路  Source: collectd/collectd

  • Version of collectd: 5.8.0

Expected behavior

Collectd should test config and report if it is broken/has errors.

Actual behavior

Daemon exits without config test.

Steps to reproduce

run collectd -t on broken config.
It exits immediately w/o any output.

Bug

Most helpful comment

Using bisect and totally not valid config

$ cat /opt/collectd/etc/collectd.conf
badconfig

found that this behavior has changed probably with 386ecab

$ /opt/collectd/sbin/collectd -t
$ echo $?
0

one earlier 6b64979 have build issue on Ubuntu16.04 and next one 6cde759 was working as following:

$ /opt/collectd/sbin/collectd -t
Parse error in file `/opt/collectd/etc/collectd.conf', line 2 near `<newline>': syntax error, unexpected EOL
yyparse returned error #1
configfile: Cannot read file `/opt/collectd/etc/collectd.conf'.
Unable to read config file /opt/collectd/etc/collectd.conf.
Error: Reading the config file failed!
Read the logs for details.
$ echo $?
1

I'm not fully familiar with daemon yet, so just sharing this find here for now and hope to get back later to investigate logic that was affected. Starting point most probably will be src/daemon/collectd.c#L402-L403 and verifying if code responsible for testing config is being executed somewhere before.

All 5 comments

I just wanted to report a similar issue: collectd 5.9.1 isn't starting here with errors like

Plugin syslog failed to handle option LogLevel, return code: 1

or

Plugin iptables failed to handle option Chain, return code: 1

However, configtest reports no problem.

@whissi due to #3232 too

I am not sure if this is the same problem. Sure: Once the mentioned bug is fixed, the reported plugins are working. However, isn't the problem that the plugins will report an error for whatever reason and the configtest doesn't notice?

I.e. see https://github.com/collectd/collectd/issues/3236#issuecomment-516355640 ... even with the patch applied, collectd -t didn't report an error. After recompiling collectd with --enable-debug which seems like making loglevel debug available, it worked.

you're absolutely right, thanks for clarifying this

Using bisect and totally not valid config

$ cat /opt/collectd/etc/collectd.conf
badconfig

found that this behavior has changed probably with 386ecab

$ /opt/collectd/sbin/collectd -t
$ echo $?
0

one earlier 6b64979 have build issue on Ubuntu16.04 and next one 6cde759 was working as following:

$ /opt/collectd/sbin/collectd -t
Parse error in file `/opt/collectd/etc/collectd.conf', line 2 near `<newline>': syntax error, unexpected EOL
yyparse returned error #1
configfile: Cannot read file `/opt/collectd/etc/collectd.conf'.
Unable to read config file /opt/collectd/etc/collectd.conf.
Error: Reading the config file failed!
Read the logs for details.
$ echo $?
1

I'm not fully familiar with daemon yet, so just sharing this find here for now and hope to get back later to investigate logic that was affected. Starting point most probably will be src/daemon/collectd.c#L402-L403 and verifying if code responsible for testing config is being executed somewhere before.

Was this page helpful?
0 / 5 - 0 ratings