rochaporto / collectd-ceph

collectd plugins and dashboards for ceph
GNU General Public License v2.0
60 stars 65 forks source link

Values in config are ignored #23

Open benh57 opened 10 years ago

benh57 commented 10 years ago

I'm running collectd 5.4.1 on CentOS 6.5, running with the CentOS scl python27 embedded into collectd (since this plugin requires python 2.7 due to its use of subprocess.check_output)

I noticed any values i set in the config are ignored

14:13:53 root@sm-sensu /usr/lib/collectd/plugins/ceph-git/plugins $ cat /etc/collectd.d/ceph_latency.conf <LoadPlugin "python"> Globals true Interval 10 Debug True

<Plugin "python"> ModulePath "/usr/lib/collectd/plugins/ceph-git/plugins"

Import "ceph_latency_plugin"

<Module "ceph_latency_plugin">
            Verbose "true"
            Cluster ceph
            Interval 10
            TestPool test
</Module>

I believe this is because the register_read happens before the configure_callback is called.

config key: Cluster - ceph config key: Interval - 10 config key: TestPool - test Stopping collectd: [ OK ] Starting collectd: latency plugin registering with interval: 60.0

To fix this, i moved the register_read inside the callback, and now it works: def configure_callback(conf): """Received configuration information""" plugin.config_callback(conf) collectd.error("latency plugin registering with interval: %s" % plugin.interval) collectd.register_read(read_callback, plugin.interval)

Stopping collectd: [ OK ] Starting collectd: config key: Verbose - true config key: Cluster - ceph config key: Interval - 10.0 config key: TestPool - test latency plugin registering with interval: 10.0

rochaporto commented 10 years ago

Thanks for this. I can't check this right now, but will in a couple days. Want to send a pull request in the meantime? I'm happy to have a look.

Can you give a bit more details on the subprocess.check_output and python 2.7 requirement? I've been using it with python 3.4.

Thanks!

ghost commented 8 years ago

What's the status on this? We are seeing the same issue! I could trace it to the configure_callback function in base.py and could verify that the Interval value makes it there. Still, I am getting values into InfluxDB in other intervals than the 10s I configured.