All Projects → zabbix-tools → zabbix-module-python

zabbix-tools / zabbix-module-python

Licence: MIT license
Embedded Python interpreter module for Zabbix

Programming Languages

c
50402 projects - #5 most used programming language
M4
1887 projects
python
139335 projects - #7 most used programming language
Makefile
30231 projects
shell
77523 projects

Projects that are alternatives of or similar to zabbix-module-python

zabbix-module-sockets
A Zabbix loadable module to monitor Linux Sockets
Stars: ✭ 16 (-50%)
Mutual labels:  zabbix, zabbix-loadable
effluence
Zabbix loadable module for real-time export of history to InfluxDB
Stars: ✭ 26 (-18.75%)
Mutual labels:  zabbix, zabbix-loadable
libzbxmodbus
Loadable module to integrate Modbus (RTU, TCP and encapsulated) into Zabbix. Bulk data collection included.
Stars: ✭ 44 (+37.5%)
Mutual labels:  zabbix, zabbix-loadable
libzbxpgsql
Monitor PostgreSQL with Zabbix
Stars: ✭ 150 (+368.75%)
Mutual labels:  zabbix, zabbix-loadable
Django Oms
加强版运维系统,集成工单、发布、监控、管理dns、saltstack
Stars: ✭ 201 (+528.13%)
Mutual labels:  zabbix
Zapix
Online Zabbix API tool - test and develope Zabbix API queries in the browser
Stars: ✭ 157 (+390.63%)
Mutual labels:  zabbix
Opssam
opsSAM运维平台 (基于saltstack、cobbler和zabbix接口的集成管理)
Stars: ✭ 143 (+346.88%)
Mutual labels:  zabbix
Zabbix Notify
Notify alarms from Zabbix to Slack Hipchat and PagerDuty
Stars: ✭ 139 (+334.38%)
Mutual labels:  zabbix
zabbix-cachet
Python script which sync Zabbix IT Services with Cachet
Stars: ✭ 78 (+143.75%)
Mutual labels:  zabbix
Kubernetes Zabbix
📦 Kubernetes Zabbix/Grafana cluster (bare metal, Google Computer Engine - GCE, Google Container Engine - GKE)
Stars: ✭ 244 (+662.5%)
Mutual labels:  zabbix
Zabbix manager
🍀 (1)安装后一键设置 (2)日常管理工具 (3)一键导出常用报表 (4)Zabbix API 二次开发
Stars: ✭ 192 (+500%)
Mutual labels:  zabbix
Https Ssl Cert Check Zabbix
Script to check validity and expiration of TLS/SSL certificate on site. May be used with Zabbix or standalone.
Stars: ✭ 162 (+406.25%)
Mutual labels:  zabbix
Zbx Smartctl
Templates and scripts for monitoring disks health with Zabbix and smartmontools
Stars: ✭ 206 (+543.75%)
Mutual labels:  zabbix
Libzbxpgsql
Monitor PostgreSQL with Zabbix
Stars: ✭ 150 (+368.75%)
Mutual labels:  zabbix
Golang Stats Api Handler
Golang cpu, memory, gc, etc information api handler.
Stars: ✭ 247 (+671.88%)
Mutual labels:  zabbix
Zabbix Cli
Command-line interface for Zabbix
Stars: ✭ 141 (+340.63%)
Mutual labels:  zabbix
Wgcloud
linux运维监控工具,支持系统信息,内存,cpu,温度,磁盘空间及IO,硬盘smart,系统负载,网络流量等监控,API接口,大屏展示,拓扑图,进程监控,端口监控,docker监控,文件防篡改,日志监控,数据可视化,web ssh,堡垒机,指令下发批量执行,linux面板,探针,故障告警
Stars: ✭ 2,669 (+8240.63%)
Mutual labels:  zabbix
Rabbitmq Zabbix
Zabbix RabbitMQ Configuration
Stars: ✭ 241 (+653.13%)
Mutual labels:  zabbix
Thola
Tool for monitoring and provisioning network devices (mainly using SNMP) - monitoring check plugin
Stars: ✭ 179 (+459.38%)
Mutual labels:  zabbix
Zorka
Sophisticated monitoring agent for Java
Stars: ✭ 178 (+456.25%)
Mutual labels:  zabbix

zabbix-module-python

Embedded Python interpreter module for Zabbix.

This native Zabbix module allows you to write extensions for Zabbix in Python and run them embedded in the Zabbix agent, server or proxy.

Why bother?

  • Extensions are much simpler to write and manage.

    The following is a working Zabbix module written in Python. It creates item key python.echo[] which simply returns a string concatenation of each given parameter:

    import zabbix_module
    
    def echo(request):
      return " ".join(request.params)
    
    def zbx_module_item_list():
      return [
        zabbix_module.AgentItem("python.echo", fn = echo, test_param = [ 'hello', 'world' ]),
      ]

    It works like this:

    $ zabbix_agentd -t python.echo[hello,world]
    zabbix_agentd [19]: loaded python modules: dummy.py
    python.echo[hello,world]                      [s|hello world]
    
  • The embedded interpreter outperforms User Parameter scripts by an order of magnitude with a lower memory footprint

  • Maintaining state between requests, working with threads or watching resources is much simpler in a long lived, shared library context than in on-demand script calls

Requirements

This project is immature and pre-release.

For now, testing has only been completed with the following prerequisites:

  • Debian Jessie
  • Zabbix Agent v3.2
  • Python v3.4

Installation

This project is immature and pre-release.

Download source tarball here.

  • Build configure scripts

    ./autogen.sh  

  • Configure module sources with the desired Python version, the location of Zabbix sources and the install location of the Zabbix configuration directory

    $ PYTHON_VERSION=3 ./configure \
                          --libdir=/usr/lib/zabbix/modules \
                          --with-zabbix=/usr/src/zabbix-3.2.0 \
                          --with-zabbix-conf=/etc/zabbix
    
  • Compile the module binary

    $ make
    
  • Install the Zabbix and Python modules

    $ make install
    

Usage

See dummy.py for a fully functioning example.

  • Python modules need to be installed in a python subdirectory of the Zabbix module directory (default: /usr/lib/zabbix/modules/python3)

  • Start your Python module with import zabbix_module

  • If you need to initialize any globals or threads before Zabbix forks, you may do this by implementing zbx_module_init:

    def zbx_module_init():
      zabbix_module.info("Initalized my module")
  • Create handler functions for each item you wish to create. These funtions should accept a single request parameter and must return either a positive integer, a double or a string with less than 255 characters

    def my_handler(request):
      return 'hello world'

    The request parameter is an AgentRequest object and exposes the requested key and parameters.

  • Register your item handlers by implementing zbx_module_item_list

    def zbx_module_item_list():
      return [
        zabbix_module.AgentItem("my.item", fn = my_handler)
      ]
  • For discovery rules, convert a dict into a JSON discovery string using the discovery function:

    def my_handler(request):
      return zabbix_module.discovery( [ { 'id': 1 }, { 'id': 2 } ] )
  • To send an error to Zabbix, simply raise an exception:

    def my_handler(request):
      raise ValueError('Something went wrong')
  • You can log messages to the Zabbix log file using any of the following functions: trace, debug, info, warning, error or critical

    def my_hander(request):
      zabbix_module.info("Received request {0}".format(request))
    
      return 1
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].