-
Notifications
You must be signed in to change notification settings - Fork 314
Home
PyZabbix is a Python module for working with the Zabbix API.
- Tested against Zabbix 1.8 through 2.2
Install PyZabbix using pip:
$ pip install pyzabbix
You can now import and use pyzabbix like so:
from pyzabbix import ZabbixAPI
zapi = ZabbixAPI("http://zabbixserver.example.com")
zapi.login("zabbix user", "zabbix pass")
print "Connected to Zabbix API Version %s" % zapi.api_version()
for h in zapi.host.get(extendoutput=True):
print h['hostid']
Refer to the Zabbix API Documentation and the PyZabbix Examples for more information.
PyZabbix uses the requests library for http. You can customize the request parameters by providing a configured requests Session object to PyZabbix.
This is useful for:
- Customizing headers
- Enabling HTTP authentication
- Enabling Keep-Alive
- Disabling SSL certificate verification
from pyzabbix import ZabbixAPI
from requests import Session
s = Session()
# Enable HTTP auth
s.auth = ("http user", "http password")
# Disable SSL certificate verification
s.verify = False
zapi = ZabbixAPI("http://zabbixserver.example.com", s)
LGPL 2.1 http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html
Zabbix API Python Library.
Original Ruby Library is Copyright (C) 2009 Andrew Nelson nelsonab(at)red-tux(dot)net
Original Python Library is Copyright (C) 2009 Brett Lentz brett.lentz(at)gmail(dot)com
This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA