Hi, collectd community. I finally found why my collectd ignores my sensors config. My problem is like to described at http://collectd.org/bugs/view.php?id=21 first comment.
The collectd does not need to use own hardcoded default config to initialise libsensors when SENSORS_API_VERSION >= 0x400. The sensors_init() with hardcoded (not NULL) default config breaks support for read extra configuration files from /etc/sensors.d, introduced in lm_sensors-3.1. We can use sensors_init(NULL) since API 0x400, as the lm_sensors-3.0.0 manpage describes the following usage: int sensors_init(FILE *input); sensors_init() loads the configuration file. If FILE is NULL, the default configuration files are used (see the FILES section below). Most applications will want to do that. FILES section: /etc/sensors3.conf /etc/sensors.conf The system-wide libsensors(3) configuration file. /etc/sen- sors3.conf is tried first, and if it doesn't exist, /etc/sen- sors.conf is used instead. So, all default config files will be processed when doing sensors_init(NULL). After the lm_sensors-3.1 release, the FILES section additionally has : /etc/sensors.d A directory where you can put additional libsensors configura- tion files. Files found in this directory will be processed in alphabetical order after the default configuration file. So, /etc/sensors.d directory will be processed too. ------ The proposed patch fixes the initialization for lm_sensors-3.х and adds a directive "SensorsConfigFile". For older lm_sensors the old behaviour remains. Also, some improvements was done at error processing: 1) If stat() fails, then sensors_config_mtime will be set to zero. When stat() succeedes later, plugin will not call sensors_free_features() before new sensors_init(). The 'features' chain will not be cleaned before adding new features to it, so each of sensors will be queried many times. Libsensors's sensors_cleanup() will not be called also. Fixed all these. 2) If stat() fails, we need no try to call fopen() at this cycle. So, the the log is clean now: Used collectd config has : <Plugin sensors> SensorsConfigFile "/etc/null.conf" </Plugin> No /etc/null.conf exists at the start moment. srv01:~/collectd/src/.libs# collectd -fC /root/tmp/04/collectd.conf [2011-12-14 21:02:02] sensors plugin: stat (/etc/null.conf) failed: No such file or directory [2011-12-14 21:02:02] read-function of plugin `sensors' failed. Will suspend it for 20 seconds. [2011-12-14 21:02:02] Initialization complete, entering read-loop. [2011-12-14 21:02:22] sensors plugin: stat (/etc/null.conf) failed: No such file or directory [2011-12-14 21:02:22] read-function of plugin `sensors' failed. Will suspend it for 40 seconds. ...doing touch /etc/null.conf [2011-12-14 21:03:02] sensors plugin: Reloading config from /etc/null.conf ...doing touch /etc/null.conf again [2011-12-14 21:04:02] sensors plugin: Reloading config from /etc/null.conf ...doing rm /etc/null.conf [2011-12-14 21:04:42] read-function of plugin `sensors' failed. Will suspend it for 20 seconds. [2011-12-14 21:05:02] sensors plugin: stat (/etc/null.conf) failed: No such file or directory [2011-12-14 21:05:02] read-function of plugin `sensors' failed. Will suspend it for 40 seconds. [2011-12-14 21:05:42] sensors plugin: stat (/etc/null.conf) failed: No such file or directory [2011-12-14 21:05:42] read-function of plugin `sensors' failed. Will suspend it for 80 seconds. ^C[2011-12-14 21:06:39] Exiting normally. [2011-12-14 21:06:39] collectd: Stopping 5 read threads. The proposed patch is attached. -- Regards,, Pavel mailto:pavel2...@ngs.ru
0005-Collectd-sensors-plugin-ignores-etc-sensors.d-Sensor.patch
Description: Binary data
_______________________________________________ collectd mailing list collectd@verplant.org http://mailman.verplant.org/listinfo/collectd