PyZabbixObj is a Python module for working with Zabbix API, using a complete OO implementation

This module is the main module of the PyZabbixObj project

class PyZabbixObj.GenericZabbixObject(response, name_or_id, server, **kwargs)

Generic Zabbix object class. Implements some base methods

class PyZabbixObj.Host(response, hostname_or_id, server, **kwargs)

Host Class

Parameters:
  • response (String) – JSON string to be sent or received from the Zabbix Server
  • hostname_or_id (String) – hostname or id of the object
  • server (ZabbixServer) – ZabbixServer instance
  • Interfaces (Interface or list of Interface) – Not implemented yet! (optional) Interface instance
  • HostGroups – (optional) HostGroup instance
  • Template (Template or list of Template) – (optional) Template instance
Raise:
class:ZabbixRequestError exception if error
class PyZabbixObj.Hostgroup(response, name_or_id, server)

Host Group Class

Parameters:
  • response (String) – JSON string to be sent or received from the Zabbix Server
  • name_or_id (String) – name or id of the object
  • server (ZabbixServer) – Zabbix server
Raise:
class:ZabbixRequestError exception if error
class PyZabbixObj.Template(response, name_or_id, server, **kwargs)

Template Class

Parameters:
  • response (String) – JSON string to be sent or received from the Zabbix Server
  • name_or_id (String) – name or id of the object
  • server (ZabbixServer) – Zabbix server
Raise:
class:ZabbixRequestError exception if error
class PyZabbixObj.Trigger(response, name_or_id, server)

Trigger Class

Parameters:
  • response (String) – JSON string to be sent or received from the Zabbix Server
  • name_or_id (String) – name or id of the object
  • server (ZabbixServer) – Zabbix server
Raise:
class:ZabbixRequestError exception if error
exception PyZabbixObj.ZabbixRequestError(value, code, message)

Custom Zabbix Exception Class

class PyZabbixObj.ZabbixServer(server=u'http://localhost/zabbix')

Zabbix Server Class

Handle a zabbix Server. Get or write objects (not all implemented)

do(operation, object_type, **kwargs)

Main executing method for the server

Parameters:
  • operation – Type of operation to be done. Must be in allowed_operations
  • object_type – Type of the object where the operation is done. Must be in allowed_objects
Returns:

Instantiated class of the object or None if the object does not exist and the method does not provide creation

Return type:

Class of the object (Host, Hostname, Template, ecc.)

login(user, pw)

Routine login. - Username/password pair will be sent once. After the returning auth code will be used

Parameters:
  • username (String) – Username for the Zabbix Server
  • password (String) – Password for the Zabbix Server
Returns:

True if already logged, else False

Return type:

bool

Raise:
class:ZabbixRequestError exception if error

Indices and tables