pistolero / zbxsend Goto Github PK
View Code? Open in Web Editor NEWPython module for sending metrics to Zabbix
Python module for sending metrics to Zabbix
===== Usage ===== Sample usage::: >>> from zbxsend import Metric, send_to_zabbix >>> send_to_zabbix([Metric('localhost', 'bucks_earned', 99999)], 'localhost', 10051)
Hello,
The script does not support Python 3.
Are you actively working on it or it has been abandoned?
I have a few changes if you are interested
Hey,
The function for sending data only evaluates if the response from the Zabbix server was valid or not:
if resp.get('response') != 'success':
There are cases where the response is successful though actually sending the value failed:
[Dbg]>>> print resp.get('info')
processed: 0; failed: 1; total: 1; seconds spent: 0.000022
[Dbg]>>> print resp.get('response')
success
Maybe you could add another condition for the evaluation, something as simple as:
if resp.get('response') != 'success' or resp.get('info').find('failed: 1') != -1:
Thanks
There is a bug in how the clock
element of JSON is formed:
for m in metrics:
clock = m.clock or time.time()
metrics_data.append(('\t\t{\n'
'\t\t\t"host":%s,\n'
'\t\t\t"key":%s,\n'
'\t\t\t"value":%s,\n'
'\t\t\t"clock":%s}') % (j(m.host), j(m.key), j(m.value), clock))
If a timestamp is not provided with the metric, it uses time.time()
, which returns a floating-point value and that floating-point value is then inserted into the JSON. However, according to the protocol, Zabbix expects to have an integer Unix timestamp there.
Please see https://support.zabbix.com/browse/ZBX-10234 for more information.
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.