Giter VIP home page Giter VIP logo

libzbxhaproxy's Introduction

libzbxhaproxy Build Status BCH compliance

This project provides monitoring of HAProxy servers. libzbxhaproxy is natively compiled Zabbix agent module, written in C. The module enables discovery and present HAProxy servers stats and general information.

RPM packages for RHEL 6, 7 are available in the Release .

How it works

libzbxhaproxy is a shared library used by Zabbix agent daemon and loaded on startup. The module extends Zabbix agent functionality with keys:

  • haproxy.discovery[<socket>] - discovering all HAProxy servers (FRONTEND, BACKEND)

  • haproxy.info[<socket>,<key>] - present general information of HAProxy instance, such as Version, Uptime, etc

  • haproxy.stat[<socket>,<pxname>,<svname>,<key>] - present stats of HAProxy servers

More about Zabbix agent loadable modules see Zabbix documentation.

Installation

  1. You will need Zabbix headers for the assembly of the module. Download and unpack Zabbix source from official site.

  2. Clone libzbxhaproxy repository.

    $ git clone https://github.com/k1nky/libzbxhaproxy.git

  3. In "libzbxhaproxy" directory:

    $ make zbx_include=<ZABBIX_INCLUDE>

ZABBIX_INCLUDE is path to directory "include" from Zabbix source archive (see step i)

  1. $ sudo make install

  2. Now you have libzbxhaproxy, default placed in "/usr/local/lib". Then you should modify Zabbix agent configuration ("zabbix_agentd.conf") and set directive

    LoadModule=/usr/local/lib/libzbxhaproxy.so

  3. Please restart Zabbix agent. You can verify that the module has started by Zabbix agent log:

	XXXX:XXXXXXXX:XXXXX.XXX using configuration file: /etc/zabbix/zabbix_agentd.conf
	XXXX:XXXXXXXX:XXXXX.XXX starting agent module zbxhaproxy
	XXXX:XXXXXXXX:XXXXX.XXX loaded modules: libzbxhaproxy.so
	XXXX:XXXXXXXX:XXXXX.XXX agent #0 started [main process]

Post-Installation

Currently metrics values is obtained via HAProxy stats UNIX socket. Please, make sure stats option enabled in your HAProxy server configuration like:

stats socket /var/lib/haproxy/stats level user

Also, Zabbix agent daemon user must have read/write access to the stats socket file. For example, one of the solutions:

  1. Get uid Zabbix user:

$ id zabbix >> uid=123(zabbix) gid=128(zabbix) groups=128(zabbix) ...

  1. Modify HAProxy server configuration:

stats socket /var/lib/haproxy/stats level user uid <zabbix_uid> mode 660

More information about HAProxy stats you can find in HAProxy Documentation.

Zabbix templates

A preconfigured Zabbix Template is also included in the project. You can take it from templates directory.

  • zbx_haproxy_template.xml - preconfigured HAProxy template contains discovery rule and general HAProxy information

Set path to the HAProxy stats socket file by template defined macros {$HAPROXY_SOCKET}.

libzbxhaproxy's People

Contributors

k1nky avatar gnought avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.