Python module to work with zabbix.
Project description
It's a fork of https://github.com/adubkov/py-zabbix
# Zabbix module for Python
## Install
```
git clone https://github.com/nixargh/py-zabbix.git
cd ./py-zabbix
pip3 install -e ./
```
## Examples
### ZabbixAPI
```python
from zabbix.api import ZabbixAPI
# Create ZabbixAPI class instance
zapi = ZabbixAPI(url='https://localhost/zabbix/', user='admin', password='zabbix')
# Get all monitored hosts
result1 = zapi.host.get(monitored_hosts=1, output='extend')
# Get all disabled hosts
result2 = zapi.do_request('host.get',
{
'filter': {'status': 1},
'output': 'extend'
})
# Filter results
hostnames1 = [host['host'] for host in result1]
hostnames2 = [host['host'] for host in result2['result']]
```
### ZabbixSender
```python
from pyzabbix import ZabbixMetric, ZabbixSender
# Send metrics to zabbix trapper
packet = [
ZabbixMetric('hostname1', 'test[cpu_usage]', 2),
ZabbixMetric('hostname1', 'test[system_status]', "OK"),
ZabbixMetric('hostname1', 'test[disk_io]', '0.1'),
ZabbixMetric('hostname1', 'test[cpu_usage]', 20, 1411598020),
]
result = ZabbixSender(use_config=True).send(packet)
```
All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
## [1.2.0] - 2018-08-20
### Added
- `api` allow session reusage.
# Zabbix module for Python
## Install
```
git clone https://github.com/nixargh/py-zabbix.git
cd ./py-zabbix
pip3 install -e ./
```
## Examples
### ZabbixAPI
```python
from zabbix.api import ZabbixAPI
# Create ZabbixAPI class instance
zapi = ZabbixAPI(url='https://localhost/zabbix/', user='admin', password='zabbix')
# Get all monitored hosts
result1 = zapi.host.get(monitored_hosts=1, output='extend')
# Get all disabled hosts
result2 = zapi.do_request('host.get',
{
'filter': {'status': 1},
'output': 'extend'
})
# Filter results
hostnames1 = [host['host'] for host in result1]
hostnames2 = [host['host'] for host in result2['result']]
```
### ZabbixSender
```python
from pyzabbix import ZabbixMetric, ZabbixSender
# Send metrics to zabbix trapper
packet = [
ZabbixMetric('hostname1', 'test[cpu_usage]', 2),
ZabbixMetric('hostname1', 'test[system_status]', "OK"),
ZabbixMetric('hostname1', 'test[disk_io]', '0.1'),
ZabbixMetric('hostname1', 'test[cpu_usage]', 20, 1411598020),
]
result = ZabbixSender(use_config=True).send(packet)
```
All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
## [1.2.0] - 2018-08-20
### Added
- `api` allow session reusage.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
zabbix-1.2.0.tar.gz
(8.3 kB
view hashes)
Built Distribution
zabbix-1.2.0-py3-none-any.whl
(10.2 kB
view hashes)