gpt4 book ai didi

python - Collectd 插件似乎没有启动

转载 作者:太空宇宙 更新时间:2023-11-03 18:30:52 25 4
gpt4 key购买 nike

问题是我在系统日志文件中没有看到预期的输出。我写了一个Python插件,位于“/home/my/collectd/pyPlugin.py”。 “/etc/collectd/collectd.conf”中的 Collectd 配置(Python 插件在全局变量 true 下启用)具有以下 block :

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

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

该插件非常简单:

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)

当我查看“/var/log/syslog”时,我没有看到任何输出。

最佳答案

将其放在collectd.conf文件的顶部:LoadPlugin“syslog”

来自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.

系统日志插件默认显示info级别。另外,要确认 Collectd 正在运行,请查看进程列表或 /etc/init.d/collectd status

关于python - Collectd 插件似乎没有启动,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22402445/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com