Skip to main content

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


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)

Uploaded Source

Built Distribution

zabbix_enums-1.5.4-py3-none-any.whl (96.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