Question

The problem is I don't see expected output in the syslog file. I wrote a Python plugin located at "/home/my/collectd/pyPlugin.py". The Collectd configuration in "/etc/collectd/collectd.conf" (Python plugin is enabled with globals true) has this block:

<Plugin python>
    ModulePath "/home/my/collectd/"
    LogTraces true
    Interactive false
    Import pyPlugin

    <Module pyPlugin>
        Test "arg1" "arg2"
    </Module>
</Plugin>

The plugin is quite simple:

import collectd

def configer(confObj):
    collectd.info('config called')

def init_fun():
    collectd.info('my py module init called')

def reader(input_data=None):
    collectd.info('my py read called')

def writer(input_data=None)
    collectd.info('my py write called')


collectd.register_config(configer)
collectd.register_init(init_fun)
collectd.register_read(reader)
collectd.register_write(writer)

When I look in "/var/log/syslog" I don't see any of the output.

Was it helpful?

Solution

Put this at the top of your collectd.conf file: LoadPlugin "syslog"

From the FAQ:

In order to get any output at all, you need to load a log plugin. The two main log plugins are the LogFile and SysLog plugins. We recommend that loading one of those plugins is the first thing you do in your config file, i.e. put the LoadPlugin line at the very top. If no log plugin is loaded, collectd will write to STDERR. After the daemon has forked to the background, you won't be able to see this output anymore, though.

The syslog plugin will show the info level by default. Also to confirm that Collectd is running look at a process list or /etc/init.d/collectd status.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top