Zabbix API包装
zabbix-client的Python项目详细描述
zabbix client是用python编写的zabbix api包装器。它在工作 python 2.6+和3.2+。
Zabbix API
Zabbix API是在Zabbix 1.8中引入的,允许您创建、更新 并通过 JSON-RPC2.0协议。
Zabbix API文档:
JSON-RPC文档:
zabbix客户端支持所有zabbix版本,包括json-rpc API,从Zabbix 1.8开始。
用法
调用不需要身份验证的方法:
>>> from zabbix_client import ZabbixServerProxy >>> s = ZabbixServerProxy('http://localhost/zabbix') >>> s.apiinfo.version() '2.0.12'
调用需要先前身份验证的方法:
>>> from zabbix_client import ZabbixServerProxy >>> s = ZabbixServerProxy('http://localhost/zabbix') >>> s.user.login(user='Admin', password='zabbix') '44cfb35933e3e75ef51988845ab15e8b' >>> s.host.get(output=['hostid', 'host']) [{'host': 'Zabbix server', 'hostid': '10084'}, {'host': 'Test', 'hostid': '10085'}] >>> s.user.logout() True
许可证
根据apache许可证授权。