Skip to main content

A Python replacement for Zabbix sender and get.

Project description

zappix - a package for Zabbix sender and get.

zappix aims to be a drop-in replacement for zabbix_get as well as zabbix_sender. Its components are available not only as a module but from the command line as well.

zappix requires Python3 and is guaranteed to work with 3.6.

Instalation

zappix is not dependant on any third party modules. The easiest way to install it with pip:

pip install zappix

Usage

As mentioned earlier - zappix can be used both as a module inside of an application, as well as from the Command Line Interface.

As a module

At the moment zappix has two classes: Sender and Get. Both of which can be imported in the following manner:

>>> from zappix.sender import Sender
>>> from zappix.get import Get

Then you can send or get some data. Asuming both Zabbix Agent and Server run on localhost and default ports:

>>> getter = Get("127.0.0.1")
>>> getter.get_value("agent.ping")
1
>>> sender = Sender("127.0.0.1")
>>> sender.send_value('testhost', 'test', 1)
{"processed": 1, "failed": 0, "total": 1, "seconds spent": 0.005}

CLI

To use this utility from the command line, you need to invoke python with the -m flag, followed by the module name and required parameters:

python -m zappix.sender -z 127.0.0.1 -s testhost -k testkey -o 1

Testing

If you wish to contribute it's good to know how to conduct tests. You can go with mocked tests only or add integration tests as well.

To enable integration tests, set the envvar ZAPPIX_TEST_INTEGRATION=yes

After if you wish to proceed with services in docker containers run the following:

docker run -d -e "ZBX_CACHEUPDATEFREQUENCY=1" -p 10051:10051 -p 80:80 zabbix/zabbix-appliance
docker run -d -e "ZBX_SERVER_HOST=0.0.0.0/0" -p 10050:10050 zabbix/zabbox-agent

Note that the zabbix-appliance might take a while to start. Once both containers are up and running, just run tox.

If you have your custom Zabbix services, it is possible to configure tests via envvars to connect to those:

envvar usage
ZAPPIX_AGENT IP address or DNS name of running Zabbix agent
ZAPPIX_SERVER IP address or DNS name of running Zabbix Server
ZAPPIX_API URL of Zabbix fronted. Schema is required
ZAPPIX_API_USER User for creating entities via API. Should have RW permissions to a Host group with ID=2 - Usually 'Linux Servers'
ZAPPIX_API_PASS Password for that user

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

zappix-1.0.3.tar.gz (11.7 kB view details)

Uploaded Source

Built Distribution

zappix-1.0.3-py3-none-any.whl (12.8 kB view details)

Uploaded Python 3

File details

Details for the file zappix-1.0.3.tar.gz.

File metadata

  • Download URL: zappix-1.0.3.tar.gz
  • Upload date:
  • Size: 11.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.10.14

File hashes

Hashes for zappix-1.0.3.tar.gz
Algorithm Hash digest
SHA256 8119905a992d1feee36380882dc2f69f771381ee97292ae59a01f8b24df70b11
MD5 0eaae48ff6b847d354262ab61cf34a15
BLAKE2b-256 ab39d85c57b412d3e0e7659f632abf99a7c5cb78a2b6903c5fb25a0da42cb16b

See more details on using hashes here.

File details

Details for the file zappix-1.0.3-py3-none-any.whl.

File metadata

  • Download URL: zappix-1.0.3-py3-none-any.whl
  • Upload date:
  • Size: 12.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.10.14

File hashes

Hashes for zappix-1.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 f42b60301ac8523b139211c61f38f3de5675a6585df87531772dcc4765b13e3a
MD5 968ef3b601bce61b1f3d52bf80e6bbcb
BLAKE2b-256 34ef32e72986b48680370a44421cd7aae4e66a824f5ac34bc5ca1790d3e3a5ac

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page