python-diamond / Diamond

Diamond is a python daemon that collects system metrics and publishes them to Graphite (and others). It is capable of collecting cpu, memory, network, i/o, load and disk metrics. Additionally, it features an API for implementing custom collectors for gathering metrics from almost any source.
http://diamond.readthedocs.org/
MIT License
1.74k stars 601 forks source link

InfluxdbHandler can not send metric to influxdb v1.2 #653

Closed jindov closed 2 years ago

jindov commented 7 years ago

Hi guys,

I set up an influxdb v1.2 then I want to use Diamond to send server's metrics to influxdb but it's error:

[2017-05-26 01:17:12,555] [ERROR] [MainThread:Handlers] Traceback (most recent call last): File "/usr/lib/python2.7/site-packages/diamond/handler/Handler.py", line 74, in _process self.process(metric) File "/usr/lib/python2.7/site-packages/diamond/handler/influxdbHandler.py", line 149, in process self._send() File "/usr/lib/python2.7/site-packages/diamond/handler/influxdbHandler.py", line 180, in _send time_precision=self.time_precision) File "/usr/lib/python2.7/site-packages/influxdb/client.py", line 456, in write_points tags=tags, protocol=protocol) File "/usr/lib/python2.7/site-packages/influxdb/client.py", line 506, in _write_points protocol=protocol File "/usr/lib/python2.7/site-packages/influxdb/client.py", line 292, in write data = make_lines(data, precision).encode('utf-8') File "/usr/lib/python2.7/site-packages/influxdb/line_protocol.py", line 149, in make_lines for field_key, field_value in sorted(iteritems(point['fields'])): KeyError: u'fields'

My stack is:

diamond.conf

handlers = diamond.handler.influxdbHandler.InfluxdbHandler
[[InfluxdbHandler]]
hostname = 192.168.1.100
port = 8086 #8084 for HTTPS
batch_size = 100 # default to 1
cache_size = 1000 # default to 20000
username = root
password = root
database = influxdb
time_precision = s

The question is "Does InfluxdbHandler support to send metric to influxdb v1.2 or only v0.9 and prior version?"

Thanks

szibis commented 7 years ago

https://github.com/python-diamond/Diamond/pull/504

shortdudey123 commented 2 years ago

See #137.