An Enum collection for Zabbix API scripting
Project description
zabbix-enums
Zabbix enumerations for API scripting.
This package aims to provide enumerations for Zabbix object parameters. So instead of using bare numbers and constantly browsing the docs, you can just use a nice enum.
Example 1: Use nice enums in API calls
from zabbix_enums.z60 import TriggerState
from pyzabbix import ZabbixAPI
zapi = ZabbixAPI('http://localhost')
zapi.login('Admin', 'zabbix')
# this
unknown_triggers = zapi.trigger.get(filter={'state': 1})
# becomes this
unknown_triggers = zapi.trigger.get(filter={'state': TriggerState.UNKNOWN})
zapi.user.logout()
Example 2: Filter entities offline, based on their status
from zabbix_enums.z60 import HostStatus
from pyzabbix import ZabbixAPI
zapi = ZabbixAPI('http://localhost')
zapi.login('Admin', 'zabbix')
hosts = zapi.host.get()
monitored = [h for h in hosts if HostStatus(h['status']) == HostStatus.MONITORED]
zapi.user.logout()
Example 3: Filter problems with severities above a certain level
from zabbix_enums.z60 import ProblemSeverity
from pyzabbix import ZabbixAPI
zapi = ZabbixAPI('http://localhost')
zapi.login('Admin', 'zabbix')
problems = zapi.problem.get()
important = [p for p in problems if ProblemSeverity(p['severity']) > ProblemSeverity.AVERAGE]
zapi.user.logout()
Limitations
Please bare in mind that not all enumerations are present at this time.
For comparing Enums do not use is keyword - see second example
At this moment, only Zabbix 5.0 and above is supported.
Versioning
The following version schema is used: X.Y.Z
X - major version. If this changes, your code might break - update with caution.
Y - latest supported Zabbix version. I.E 1.60.0 supports Zabbix 6.0 and below but not 6.2.
Z - minor version. For bugfixes.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file zabbix_enums-1.74.0.tar.gz.
File metadata
- Download URL: zabbix_enums-1.74.0.tar.gz
- Upload date:
- Size: 162.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
60ad52217815a90879db6e55858b82d5abca14169068ab304ac7c77ffd2f6ee7
|
|
| MD5 |
7b9423061de28fbad1805e99f8c074ff
|
|
| BLAKE2b-256 |
ce1827c7110035bc32476dd1903450a72402ead44daefbf9e73cf4cb812ea82c
|
File details
Details for the file zabbix_enums-1.74.0-py3-none-any.whl.
File metadata
- Download URL: zabbix_enums-1.74.0-py3-none-any.whl
- Upload date:
- Size: 339.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ea366b3f32b7820f65411334f7393b6c0de0fd81bf468b08a2267074711f0525
|
|
| MD5 |
5997cd99b124e3c5e9f4f18af07c6be6
|
|
| BLAKE2b-256 |
c6d622c54485aa4e2438fc6b72fc33c4ffa3c589962997b3f2e13ba67a0cc458
|