paksu / pytelegraf Goto Github PK
View Code? Open in Web Editor NEWPython client for sending metrics to Telegraf
License: MIT License
Python client for sending metrics to Telegraf
License: MIT License
As per https://github.com/influxdata/influxdb.com/issues/135, the InfluxDB line protocol character encoding is UTF8. I'm wondering why pytelegraf tries to do an ASCII encoding? Also, shouldn't it test whether data needs to be encoded at all? It I'm noot overlooking something, I'm willing to write a patch and tests for it.
When used in docker - just the line:
telegraf.metric("test", 1.2)
takes around 10s.
I use separate docker for telegraf (telegraf:1.22) and python script (FROM python:3.8-slim-buster), do you happend to know what could be the cause of this?
I'm using pytelegraf library but I want to send JSON format to telegraf agent. Is possible to support it? I think the command could be this:
client.metric("IMU_Acel",{"x": imu.get_x, "y": imu.get_y(), "z": imu.get_z()},
tags={'server_name': 'my-server'},
"timestamp"= 1458229140))
Line 51 in a5a326b
Hello developers,
Just wondering can we hv a return value (boolean) in the send() method? Therefore we can at least realise the Telegraf is offline and we can log it our way. Thanks
Is there a possibility to define Influx database to write measurements to using the TelegrafClient API? Equivalent of "USE dbname"?
On UDP listener page, it announced that UDP listener is deprecated.
You could replace with socket_listener and update configuration sample...
Thank you so much...
PS> I am trying this great module for my custom metrics. :)
Add an option/client implementation to write the line protocol to a file instead of socket or http request. Useful for debugging, when telegraf agent is down/inaccessible, or just to capture output.
The line protocol doesn't purge None or empty string values from tags. This causes Telegraf to fail parsing the message.
For example, for the following code:
from telegraf.client import TelegrafClient
client = TelegrafClient('localhost', 8094)
tags = {'foo': ''}
client.metric('metric', 1, tags=tags)
Running Telegraf version 1.8.0, the following error message is displayed:
2018-10-02T19:33:37Z E! Error in plugin [inputs.socket_listener]: unable to parse incoming packet: metric parse error: expected tag at offset 11: "metric,foo= value=1i\n"
Deprecation warnings are raised due to invalid escape sequences. This can be fixed by using raw strings or escaping the literals. pyupgrade also helps in automatic conversion : https://github.com/asottile/pyupgrade/
find . -iname '*.py' | grep -Ev 'vendor|example|doc|sphinx' | xargs -P4 -I{} python3.8 -Wall -m py_compile {}
./telegraf/utils.py:9: DeprecationWarning: invalid escape sequence \)
"""
./telegraf/utils.py:19: DeprecationWarning: invalid escape sequence \,
key = key.replace(",", "\,")
./telegraf/utils.py:20: DeprecationWarning: invalid escape sequence \
key = key.replace(" ", "\ ")
./telegraf/utils.py:21: DeprecationWarning: invalid escape sequence \=
key = key.replace("=", "\=")
./telegraf/tests.py:14: DeprecationWarning: invalid escape sequence \,
self.assertEquals(format_string('foo,bar'), 'foo\,bar')
./telegraf/tests.py:15: DeprecationWarning: invalid escape sequence \
self.assertEquals(format_string('foo bar'), 'foo\ bar')
./telegraf/tests.py:16: DeprecationWarning: invalid escape sequence \
self.assertEquals(format_string('foo ,bar'), 'foo\ \,bar')
./telegraf/tests.py:17: DeprecationWarning: invalid escape sequence \
self.assertEquals(format_string('foo ,bar,baz=foobar'), 'foo\ \,bar\,baz\=foobar')
./telegraf/tests.py:59: DeprecationWarning: invalid escape sequence \
"""white\ space,tag\ with\,\ comma=hello\,\ world value\,\ comma="foo\""""
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.