Python module to work with zabbix.
Project description
Zabbix module for Python
Install
You can install Zabbix modules for Python with pip:
pip install py-zabbix
Official documentaion for py-zabbix
Examples
ZabbixAPI
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
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)
1.1.2 (2016-07-28)
Added parameter chunk_size for object ZabbixSender
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 Distributions
No source distribution files available for this release.See tutorial on generating distribution archives.
Built Distribution
Close
Hashes for py_zabbix-1.1.3-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a26396b21e799611c07973e69404121d625e573b1ba44ed89a22d7ff091f3a67 |
|
MD5 | 1c2b25ee03e53bfea466516e3eeb8655 |
|
BLAKE2b-256 | 4a6c08bd059c7c576f40464f1959abee94e4e8043a2048a83eb100d80094c03a |