Giter Site home page Giter Site logo

zbxsend's Introduction

=====
Usage
=====

Sample usage:::

    >>> from zbxsend import Metric, send_to_zabbix    
    >>> send_to_zabbix([Metric('localhost', 'bucks_earned', 99999)], 'localhost', 10051)

zbxsend's People

Contributors

pistolero avatar ronreiter avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

zbxsend's Issues

Support for Python 3

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

Return value is True even if value is not actually sent

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

zbxsend.py sends a non-integer timestamp

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.