Metadata-Version: 2.1
Name: zabbix-enums
Version: 1.5.4
Summary: An Enum collection for Zabbix API scripting
Home-page: https://github.com/szuro/zabbix-enums
Author: Robert Szulist
Author-email: r.szulist@gmail.com
Project-URL: Bug Tracker, https://github.com/szuro/zabbix-enums/issues
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Requires-Python: >=3.6
Description-Content-Type: text/markdown
License-File: LICENSE

# 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:

```python
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:

```python
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:

```python
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.
