zabbix-enums


Namezabbix-enums JSON
Version 1.70.0 PyPI version JSON
download
home_pagehttps://github.com/szuro/zabbix-enums
SummaryAn Enum collection for Zabbix API scripting
upload_time2024-09-11 22:28:54
maintainerNone
docs_urlNone
authorRobert Szulist
requires_python>=3.6
licenseNone
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # 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

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

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

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

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/szuro/zabbix-enums",
    "name": "zabbix-enums",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": null,
    "keywords": null,
    "author": "Robert Szulist",
    "author_email": "r.szulist@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/fe/ae/9cfb2f67631e9b9c12ac741d78850658a0966ec8949fdb5ac1a52567c6b9/zabbix_enums-1.70.0.tar.gz",
    "platform": null,
    "description": "# zabbix-enums\r\n\r\nZabbix enumerations for API scripting.\r\n\r\n\r\nThis package aims to provide enumerations for Zabbix object parameters.\r\nSo instead of using bare numbers and constantly browsing the docs, you can just use a nice enum.\r\n\r\nExample 1:\r\nUse nice enums in API calls\r\n\r\n```python\r\nfrom zabbix_enums.z60 import TriggerState\r\nfrom pyzabbix import ZabbixAPI\r\n\r\nzapi = ZabbixAPI('http://localhost')\r\nzapi.login('Admin', 'zabbix')\r\n\r\n# this\r\nunknown_triggers = zapi.trigger.get(filter={'state': 1})\r\n# becomes this\r\nunknown_triggers = zapi.trigger.get(filter={'state': TriggerState.UNKNOWN})\r\n\r\n\r\nzapi.user.logout()\r\n```\r\n\r\nExample 2:\r\nFilter entities offline, based on their status\r\n\r\n```python\r\nfrom zabbix_enums.z60 import HostStatus\r\nfrom pyzabbix import ZabbixAPI\r\n\r\n\r\nzapi = ZabbixAPI('http://localhost')\r\nzapi.login('Admin', 'zabbix')\r\n\r\nhosts = zapi.host.get()\r\n\r\nmonitored = [h for h in hosts if HostStatus(h['status']) == HostStatus.MONITORED]\r\n\r\nzapi.user.logout()\r\n\r\n```\r\n\r\nExample 3:\r\nFilter problems with severities above a certain level\r\n\r\n```python\r\nfrom zabbix_enums.z60 import ProblemSeverity\r\nfrom pyzabbix import ZabbixAPI\r\n\r\n\r\nzapi = ZabbixAPI('http://localhost')\r\nzapi.login('Admin', 'zabbix')\r\n\r\nproblems = zapi.problem.get()\r\n\r\nimportant = [p for p in problems if ProblemSeverity(p['severity']) > ProblemSeverity.AVERAGE]\r\n\r\nzapi.user.logout()\r\n```\r\n\r\n# Limitations\r\nPlease bare in mind that not all enumerations are present at this time.\r\nFor comparing Enums do not use `is` keyword - see second example\r\n\r\nAt this moment, only Zabbix 5.0 and above is supported.\r\n\r\n# Versioning\r\nThe following version schema is used: X.Y.Z\r\n\r\nX - major version. If this changes, your code might break - update with caution.\r\n\r\nY - latest supported Zabbix version. I.E 1.60.0 supports Zabbix 6.0 and below but not 6.2.\r\n\r\nZ - minor version. For bugfixes.\r\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "An Enum collection for Zabbix API scripting",
    "version": "1.70.0",
    "project_urls": {
        "Bug Tracker": "https://github.com/szuro/zabbix-enums/issues",
        "Homepage": "https://github.com/szuro/zabbix-enums"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "15796ca60598e8c20052bd5d792f161936579b1d2a238b813f9eda2a4213f55c",
                "md5": "85f8451947c7ce07e196f5152ad74d6d",
                "sha256": "682683abac72831122d904202fa0b5bedf77c5ced63e199cee2b92edecb881d5"
            },
            "downloads": -1,
            "filename": "zabbix_enums-1.70.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "85f8451947c7ce07e196f5152ad74d6d",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.6",
            "size": 237737,
            "upload_time": "2024-09-11T22:28:47",
            "upload_time_iso_8601": "2024-09-11T22:28:47.448432Z",
            "url": "https://files.pythonhosted.org/packages/15/79/6ca60598e8c20052bd5d792f161936579b1d2a238b813f9eda2a4213f55c/zabbix_enums-1.70.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "feae9cfb2f67631e9b9c12ac741d78850658a0966ec8949fdb5ac1a52567c6b9",
                "md5": "310bd4e83857c6c2b05e62e390d48e75",
                "sha256": "56d6ba17f1f5c6da3fe37bb528d49bb3865c0f74cbba35d7bd0dc1915554aab9"
            },
            "downloads": -1,
            "filename": "zabbix_enums-1.70.0.tar.gz",
            "has_sig": false,
            "md5_digest": "310bd4e83857c6c2b05e62e390d48e75",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 119029,
            "upload_time": "2024-09-11T22:28:54",
            "upload_time_iso_8601": "2024-09-11T22:28:54.111844Z",
            "url": "https://files.pythonhosted.org/packages/fe/ae/9cfb2f67631e9b9c12ac741d78850658a0966ec8949fdb5ac1a52567c6b9/zabbix_enums-1.70.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-09-11 22:28:54",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "szuro",
    "github_project": "zabbix-enums",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "zabbix-enums"
}
        
Elapsed time: 2.82746s