zappix


Namezappix JSON
Version 1.0.2 PyPI version JSON
download
home_pagehttps://gitlab.com/szuro/zappix
SummaryA Python replacement for Zabbix sender and get.
upload_time2023-10-24 16:30:43
maintainer
docs_urlNone
authorRobert Szulist
requires_python
license
keywords zabbix get sender
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # zappix - a package for Zabbix sender and get.

zappix aims to be a drop-in replacement for zabbix_get as well as zabbix_sender.
Its components are available not only as a module but from the command line as well.

zappix requires Python3 and is guaranteed to work with 3.6.

## Instalation 

zappix is not dependant on any third party modules.
The easiest way to install it with pip:
```sh
pip install zappix
```

# Usage

As mentioned earlier - zappix can be used both as a module inside of an application, as well as from the Command Line Interface.

## As a module

At the moment zappix has two classes: Sender and Get. Both of which can be imported in the following manner:
```python
>>> from zappix.sender import Sender
>>> from zappix.get import Get
```

Then you can send or get some data. Asuming both Zabbix Agent and Server run on localhost and default ports:

```python
>>> getter = Get("127.0.0.1")
>>> getter.get_value("agent.ping")
1
>>> sender = Sender("127.0.0.1")
>>> sender.send_value('testhost', 'test', 1)
{"processed": 1, "failed": 0, "total": 1, "seconds spent": 0.005}

```

## CLI

To use this utility from the command line, you need to invoke python with the -m flag, followed by the module name and required parameters:

```sh
python -m zappix.sender -z 127.0.0.1 -s testhost -k testkey -o 1
```

## Testing

If you wish to contribute it's good to know how to conduct tests.
You can go with mocked tests only or add integration tests as well.

To enable integration tests, set the envvar `ZAPPIX_TEST_INTEGRATION=yes`

After if you wish to proceed with services in docker containers run the following:

```shell
docker run -d -e "ZBX_CACHEUPDATEFREQUENCY=1" -p 10051:10051 -p 80:80 zabbix/zabbix-appliance
docker run -d -e "ZBX_SERVER_HOST=0.0.0.0/0" -p 10050:10050 zabbix/zabbox-agent
```

Note that the zabbix-appliance might take a while to start. Once both containers are up and running, just run `tox`.

If you have your custom Zabbix services, it is possible to configure tests via envvars to connect to those:

| envvar          | usage                                                                                                              |
| --------------- | ------------------------------------------------------------------------------------------------------------------ |
| ZAPPIX_AGENT    | IP address or DNS name of running Zabbix agent                                                                     |
| ZAPPIX_SERVER   | IP address or DNS name of running Zabbix Server                                                                    |
| ZAPPIX_API      | URL of Zabbix fronted. Schema is required                                                                          |
| ZAPPIX_API_USER | User for creating entities via API. Should have RW permissions to a Host group with ID=2 - Usually 'Linux Servers' |
| ZAPPIX_API_PASS | Password for that user                                                                                             |

            

Raw data

            {
    "_id": null,
    "home_page": "https://gitlab.com/szuro/zappix",
    "name": "zappix",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "zabbix get sender",
    "author": "Robert Szulist",
    "author_email": "r.szulist@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/16/a2/420a1cfa80856969eb064d6c0d817c053b3edbb0d177b53104c13553de93/zappix-1.0.2.tar.gz",
    "platform": null,
    "description": "# zappix - a package for Zabbix sender and get.\n\nzappix aims to be a drop-in replacement for zabbix_get as well as zabbix_sender.\nIts components are available not only as a module but from the command line as well.\n\nzappix requires Python3 and is guaranteed to work with 3.6.\n\n## Instalation \n\nzappix is not dependant on any third party modules.\nThe easiest way to install it with pip:\n```sh\npip install zappix\n```\n\n# Usage\n\nAs mentioned earlier - zappix can be used both as a module inside of an application, as well as from the Command Line Interface.\n\n## As a module\n\nAt the moment zappix has two classes: Sender and Get. Both of which can be imported in the following manner:\n```python\n>>> from zappix.sender import Sender\n>>> from zappix.get import Get\n```\n\nThen you can send or get some data. Asuming both Zabbix Agent and Server run on localhost and default ports:\n\n```python\n>>> getter = Get(\"127.0.0.1\")\n>>> getter.get_value(\"agent.ping\")\n1\n>>> sender = Sender(\"127.0.0.1\")\n>>> sender.send_value('testhost', 'test', 1)\n{\"processed\": 1, \"failed\": 0, \"total\": 1, \"seconds spent\": 0.005}\n\n```\n\n## CLI\n\nTo use this utility from the command line, you need to invoke python with the -m flag, followed by the module name and required parameters:\n\n```sh\npython -m zappix.sender -z 127.0.0.1 -s testhost -k testkey -o 1\n```\n\n## Testing\n\nIf you wish to contribute it's good to know how to conduct tests.\nYou can go with mocked tests only or add integration tests as well.\n\nTo enable integration tests, set the envvar `ZAPPIX_TEST_INTEGRATION=yes`\n\nAfter if you wish to proceed with services in docker containers run the following:\n\n```shell\ndocker run -d -e \"ZBX_CACHEUPDATEFREQUENCY=1\" -p 10051:10051 -p 80:80 zabbix/zabbix-appliance\ndocker run -d -e \"ZBX_SERVER_HOST=0.0.0.0/0\" -p 10050:10050 zabbix/zabbox-agent\n```\n\nNote that the zabbix-appliance might take a while to start. Once both containers are up and running, just run `tox`.\n\nIf you have your custom Zabbix services, it is possible to configure tests via envvars to connect to those:\n\n| envvar          | usage                                                                                                              |\n| --------------- | ------------------------------------------------------------------------------------------------------------------ |\n| ZAPPIX_AGENT    | IP address or DNS name of running Zabbix agent                                                                     |\n| ZAPPIX_SERVER   | IP address or DNS name of running Zabbix Server                                                                    |\n| ZAPPIX_API      | URL of Zabbix fronted. Schema is required                                                                          |\n| ZAPPIX_API_USER | User for creating entities via API. Should have RW permissions to a Host group with ID=2 - Usually 'Linux Servers' |\n| ZAPPIX_API_PASS | Password for that user                                                                                             |\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "A Python replacement for Zabbix sender and get.",
    "version": "1.0.2",
    "project_urls": {
        "Homepage": "https://gitlab.com/szuro/zappix"
    },
    "split_keywords": [
        "zabbix",
        "get",
        "sender"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "0627cbf3fda647951e145d616040e7f1f9da03d7fb9183764ecd29f632eb5f04",
                "md5": "5eac82819a9135894219931f230df2b8",
                "sha256": "4c9d1b188951e60a10b8eb3bf209688cfdbf36e4dcdaf14de598639836d37267"
            },
            "downloads": -1,
            "filename": "zappix-1.0.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "5eac82819a9135894219931f230df2b8",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 12529,
            "upload_time": "2023-10-24T16:30:41",
            "upload_time_iso_8601": "2023-10-24T16:30:41.801663Z",
            "url": "https://files.pythonhosted.org/packages/06/27/cbf3fda647951e145d616040e7f1f9da03d7fb9183764ecd29f632eb5f04/zappix-1.0.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "16a2420a1cfa80856969eb064d6c0d817c053b3edbb0d177b53104c13553de93",
                "md5": "90846fa9661070ba908c0ff727ab81b0",
                "sha256": "9380de592a71225ef7ebc01ad019c0bf7589902196c4d27fdcf2f877947d2cd4"
            },
            "downloads": -1,
            "filename": "zappix-1.0.2.tar.gz",
            "has_sig": false,
            "md5_digest": "90846fa9661070ba908c0ff727ab81b0",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 11425,
            "upload_time": "2023-10-24T16:30:43",
            "upload_time_iso_8601": "2023-10-24T16:30:43.446789Z",
            "url": "https://files.pythonhosted.org/packages/16/a2/420a1cfa80856969eb064d6c0d817c053b3edbb0d177b53104c13553de93/zappix-1.0.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-10-24 16:30:43",
    "github": false,
    "gitlab": true,
    "bitbucket": false,
    "codeberg": false,
    "gitlab_user": "szuro",
    "gitlab_project": "zappix",
    "lcname": "zappix"
}
        
Elapsed time: 0.13462s