【发布时间】:2017-01-26 09:24:23
【问题描述】:
我们在同一台机器上有一个带有 Collectd 和 InfluxDB 的测试环境。 在我们添加 Python Collectd 插件之前,一切正常。 当 Python 插件调度值时,我们会从 InfluxDB 收到以下错误日志:
Jan 26 10:00:24 influxdb influxd: [I] 2017-01-26T09:00:24Z Collectd parse error: invalid data service=collect
我们的设置: 收集到 5.6 涌入数据库 1.2。
收集的 Python 插件配置:
<LoadPlugin python>
Globals true
</LoadPlugin>
<Plugin python>
ModulePath "/opt/python-collectd"
LogTraces true
Interactive false
Import "randomtest"
</Plugin>
收集的网络配置:
LoadPlugin network
<Plugin network>
Server "localhost" "25826"
</Plugin>
“随机测试”的来源
import collectd
import random
def configer(confObj):
collectd.info('config called')
def init_fun():
collectd.info('init called')
def reader(input_data=None):
value = collectd.Values()
value.plugin = 'test_plugin'
value.host = 'test-host'
value.interval = 10
value.type = 'absolute'
value.type_instance = 'test'
value.values = [random.randint(0,10)]
value.dispatch()
collectd.register_config(configer)
collectd.register_init(init_fun)
collectd.register_read(reader)
InfluxDB 收集配置:
[[collectd]]
enabled = true
bind-address = ":25826"
database = "collectd"
retention-policy = ""
typesdb = "/usr/share/collectd/types.db"
# These next lines control how batching works. You should have this enabled
# otherwise you could get dropped metrics or poor performance. Batching
# will buffer points in memory if you have many coming in.
# Flush if this many points get buffered
batch-size = 5000
# Number of batches that may be pending in memory
batch-pending = 10
# Flush at least this often even if we haven't hit buffer limit
batch-timeout = "10s"
# UDP Read buffer size, 0 means OS default. UDP listener will fail if set above OS max.
read-buffer = 0
只是为了澄清: 如果我在 Collectd python 配置中将 Import "randomtest" 注释掉,一切似乎又可以正常工作了。 我们还查看了 tcpdumps,但我们没有注意到 Python Collectd 插件和其他 Collectd 插件之间的区别。
【问题讨论】:
标签: python influxdb collectd influxdb-python