Module pyzabbix.sender

class pyzabbix.sender.ZabbixMetric(host, key, value, clock=None)

The ZabbixMetric contain one metric for zabbix server.

  • host (str) – Hostname as it displayed in Zabbix.
  • key (str) – Key by which you will identify this metric.
  • value (str) – Metric value.
  • clock (int) – Unix timestamp. Current time will used if not specified.
>>> from pyzabbix import ZabbixMetric
>>> ZabbixMetric('localhost', 'cpu[usage]', 20)
class pyzabbix.sender.ZabbixResponse

The ZabbixResponse contains the parsed response from Zabbix.


Parse zabbix response.

class pyzabbix.sender.ZabbixSender(zabbix_server='', zabbix_port=10051, use_config=None, chunk_size=250)

The ZabbixSender send metrics to Zabbix server.

Implementation of zabbix protocol.

  • zabbix_server (str) – Zabbix server ip address. Default:
  • zabbix_port (int) – Zabbix server port. Default: 10051
  • use_config (str) – Path to zabbix_agentd.conf file to load settings from. If value is True then default config path will used: /etc/zabbix/zabbix_agentd.conf
  • chunk_size (int) – Number of metrics send to the server at one time
>>> from pyzabbix import ZabbixMetric, ZabbixSender
>>> metrics = []
>>> m = ZabbixMetric('localhost', 'cpu[usage]', 20)
>>> metrics.append(m)
>>> zbx = ZabbixSender('')
>>> zbx.send(metric)

Send the metrics to zabbix server.

Parameters:metrics (list) – List of zabbix.sender.ZabbixMetric to send to Zabbix
Return type:pyzabbix.sender.ZabbixResponse
Returns:Parsed response from Zabbix Server