Skip to content
Branch: master
Go to file
Code

Latest commit

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
src
 
 
 
 
 
 
 
 
 
 
 
 

README.md

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}.

You can’t perform that action at this time.