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.1.tar.gz
(16.6 kB
view details)
Built Distribution
aiozabbix-1.3.1-py3-none-any.whl
(17.1 kB
view details)
File details
Details for the file aiozabbix-1.3.1.tar.gz
.
File metadata
- Download URL: aiozabbix-1.3.1.tar.gz
- Upload date:
- Size: 16.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a3ac8b39daab37d7db5bdce64159752805a4d0bad3cedd2526246574c5142cee |
|
MD5 | 4d32ca39f8ca44547b58343c35a6e090 |
|
BLAKE2b-256 | 5a71d28ec22b952ce2f03b03419b950f5e4ee1e0938fc24fa8ed2a06580d8ee2 |
Provenance
File details
Details for the file aiozabbix-1.3.1-py3-none-any.whl
.
File metadata
- Download URL: aiozabbix-1.3.1-py3-none-any.whl
- Upload date:
- Size: 17.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8f32546221464d54c36ed3f02884e62ce3a3a0f03e810d8584960296ce9ac0ef |
|
MD5 | 970d016cac33d7188007f264e66aaec3 |
|
BLAKE2b-256 | 795698a8e03c5f87a543b14bf06bd91dc8da3026f158c5e1976344cc30724bd3 |