Skip to main content

Asynchronous Zabbix API Python interface

Project description

aiozabbix

aiozabbix is a Python package that provides an asynchronous interface to the Zabbix API, using aiohttp. It is based on PyZabbix.

Example usage

The interface mimics PyZabbix as closely as possible:

import asyncio

from aiozabbix import ZabbixAPI


async def main():
    zapi = ZabbixAPI('https://zabbixserver.example.com/zabbix')
    await zapi.login('zabbix user')
    hosts = await zapi.host.get(output=['host', 'hostid', 'name', 'status'])
    print(hosts)


if __name__ == '__main__':
    loop = asyncio.get_event_loop()
    loop.run_until_complete(main())
    loop.close()

To customize the HTTP requests, for example to perform HTTP basic authentication, you need to provide your own aiohttp.ClientSession:

import asyncio

import aiohttp
from aiozabbix import ZabbixAPI


async def main():
    auth = aiohttp.BasicAuth('zabbix user', password='zabbix password')
    async with aiohttp.ClientSession(auth=auth) as session:
        zapi = ZabbixAPI('https://zabbixserver.example.com/zabbix', client_session=session)
        await zapi.login('zabbix user')
        hosts = await zapi.host.get(output=['host', 'hostid', 'name', 'status'])
        print(hosts)


if __name__ == '__main__':
    loop = asyncio.get_event_loop()
    loop.run_until_complete(main())
    loop.close()

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

aiozabbix-1.3.0.tar.gz (16.2 kB view hashes)

Uploaded Source

Built Distribution

aiozabbix-1.3.0-py3-none-any.whl (17.0 kB view hashes)

Uploaded Python 3

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