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.

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


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.70.0.tar.gz (119.0 kB view details)

Uploaded Source

Built Distribution

zabbix_enums-1.70.0-py3-none-any.whl (237.7 kB view details)

Uploaded Python 3

File details

Details for the file zabbix_enums-1.70.0.tar.gz.

File metadata

  • Download URL: zabbix_enums-1.70.0.tar.gz
  • Upload date:
  • Size: 119.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.10

File hashes

Hashes for zabbix_enums-1.70.0.tar.gz
Algorithm Hash digest
SHA256 56d6ba17f1f5c6da3fe37bb528d49bb3865c0f74cbba35d7bd0dc1915554aab9
MD5 310bd4e83857c6c2b05e62e390d48e75
BLAKE2b-256 feae9cfb2f67631e9b9c12ac741d78850658a0966ec8949fdb5ac1a52567c6b9

See more details on using hashes here.

File details

Details for the file zabbix_enums-1.70.0-py3-none-any.whl.

File metadata

File hashes

Hashes for zabbix_enums-1.70.0-py3-none-any.whl
Algorithm Hash digest
SHA256 682683abac72831122d904202fa0b5bedf77c5ced63e199cee2b92edecb881d5
MD5 85f8451947c7ce07e196f5152ad74d6d
BLAKE2b-256 15796ca60598e8c20052bd5d792f161936579b1d2a238b813f9eda2a4213f55c

See more details on using hashes here.

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