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.
Take the following code as an example:
from zabbix_enums.z54 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})
Another use case is checking entity state:
from zabbix_enums.z54 import HostStatus
from pyzabbix import ZabbixAPI
zapi = ZabbixAPI('http://localhost')
zapi.login('Admin', 'zabbix')
hosts = zapi.host.get()
monitored = [host for host in hosts if HostStatus(host['status']) is HostStatus.MONITORED]
For some cases mathematical operations might be appropriate:
from zabbix_enums.z54 import ProblemSeverity
from pyzabbix import ZabbixAPI
zapi = ZabbixAPI('http://localhost')
zapi.login('Admin', 'zabbix')
problems = zapi.problem.get()
important = [problem for problem in problems if ProblemSeverity(problem['severity']) > ProblemSeverity.AVERAGE]
Limitations
Please bare in mind that not all enumerations are present at this time.
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
zabbix-enums-1.5.4.tar.gz
(48.6 kB
view hashes)
Built Distribution
Close
Hashes for zabbix_enums-1.5.4-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b0b48501e226aed7b1d8a196eaa079cf4321f5801d718fe9e6f88995bf68f851 |
|
MD5 | 20a4e9c2dabbc3807f40161fd7cef4bf |
|
BLAKE2b-256 | 76dde30f195d929b91f7fcf955fd7b7ff6916e5cea35bc7341dfea361198bb32 |