Giter Site home page Giter Site 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

gnought avatar k1nky avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

libzbxhaproxy's Issues

syntax error near unexpected token `newline'

Hi

I am using cenos-7 for this:
1st VM ( zabbix-server )
2nd VM( zabbix-agent ) where HAProxy 2.0.7 is running.

after cloning libzbx from github : https://github.com/k1nky/libzbxhaproxy.git
cd /libzbxhaproxy
run " make zbx_include=<ZABBIX_INCLUDE>"

[root@haproxy-test2 libzbxhaproxy]# make zbx_include=<ZABBIX_INCLUDE>
-bash: syntax error near unexpected token `newline'

If I skip this and run next cmd as below:

[root@haproxy-test libzbxhaproxy]# make install
install -Z -v -m 755 ./build/libzbxhaproxy.so /usr/local/lib/libzbxhaproxy.so
install: cannot stat โ€˜./build/libzbxhaproxy.soโ€™: No such file or directory
make: *** [install] Error 1
[root@haproxy-test libzbxhaproxy]#

zabbix-agent on this machine is running:
[root@haproxy-test2 libzbxhaproxy]# zabbix_agentd -V
zabbix_agentd (daemon) (Zabbix) 3.0.31
Revision 3e15255cda 27 April 2020, compilation time: Apr 27 2020 15:15:48

On zabbix-server'
[root@test-ui ~]# zabbix_server -V
zabbix_server (Zabbix) 4.0.26
Revision eb5a408168 26 October 2020, compilation time: Oct 26 2020 09:34:12

I used below ansible script to install zabbix:
https://github.com/shailendra-singh93/zabbix-ansible-centos

Please suggest how cab I make this work.
Thanks in advance.

ERROR: Got signal [signal:11(SIGSEGV),reason:128,refaddr:(nil)]. Crashing ...

hello,
After installing your module I have this error Do you have a solution to solve this problem thank you

# zabbix_agentd -V

zabbix_agentd (daemon) (Zabbix) 3.4.9

# haproxy -v

HA-Proxy version 1.5.18 2016/05/10

# zabbix_agentd -t haproxy.discovery[/var/lib/haproxy/stats]

zabbix_agentd [8605]: starting agent module zbxhaproxy
zabbix_agentd [8605]: DEBUG: module zbxhaproxy have discovery
zabbix_agentd [8605]: ERROR: Got signal [signal:11(SIGSEGV),reason:128,refaddr:(nil)]. Crashing ...
zabbix_agentd [8605]: ERROR: ====== Fatal information: ======
zabbix_agentd [8605]: ERROR: Program counter: 0x7fdb995a86f5
zabbix_agentd [8605]: ERROR: === Registers: ===
zabbix_agentd [8605]: ERROR: r8      =                0 =                    0 =                    0
zabbix_agentd [8605]: ERROR: r9      = 6870223a227d454d =  7525552610418181453 =  7525552610418181453
zabbix_agentd [8605]: ERROR: r10     =             ffff =                65535 =                65535
zabbix_agentd [8605]: ERROR: r11     =             c0c0 =                49344 =                49344
zabbix_agentd [8605]: ERROR: r12     =     563ef4148bd0 =       94828382948304 =       94828382948304
zabbix_agentd [8605]: ERROR: r13     =     7ffdf2a1ffd0 =      140728674156496 =      140728674156496
zabbix_agentd [8605]: ERROR: r14     =                0 =                    0 =                    0
zabbix_agentd [8605]: ERROR: r15     =                0 =                    0 =                    0
zabbix_agentd [8605]: ERROR: rdi     =     7ffdf2a1f380 =      140728674153344 =      140728674153344
zabbix_agentd [8605]: ERROR: rsi     =                e =                   14 =                   14
zabbix_agentd [8605]: ERROR: rbp     =     7ffdf2a1f5b0 =      140728674153904 =      140728674153904
zabbix_agentd [8605]: ERROR: rbx     = 3a2261746164227b =  4189017755886035579 =  4189017755886035579
zabbix_agentd [8605]: ERROR: rdx     =     7ffdf2a1f5be =      140728674153918 =      140728674153918
zabbix_agentd [8605]: ERROR: rax     = 6d706870223a227d =  7885917778345599613 =  7885917778345599613
zabbix_agentd [8605]: ERROR: rcx     =     7ffdf2a1f330 =      140728674153264 =      140728674153264
zabbix_agentd [8605]: ERROR: rsp     =     7ffdf2a1f2f0 =      140728674153200 =      140728674153200
zabbix_agentd [8605]: ERROR: rip     =     7fdb995a86f5 =      140581147412213 =      140581147412213
zabbix_agentd [8605]: ERROR: efl     =            10202 =                66050 =                66050
zabbix_agentd [8605]: ERROR: csgsfs  =   2b000000000033 =    12103423998558259 =    12103423998558259
zabbix_agentd [8605]: ERROR: err     =                0 =                    0 =                    0
zabbix_agentd [8605]: ERROR: trapno  =                d =                   13 =                   13
zabbix_agentd [8605]: ERROR: oldmask =                0 =                    0 =                    0
zabbix_agentd [8605]: ERROR: cr2     =                0 =                    0 =                    0
zabbix_agentd [8605]: ERROR: === Backtrace: ===
Segmentation fault

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.