HAProxy Enterprise Documentation 1.7r2

SNMP

Simple Network Management Protocol (SNMP) offers a way to collect information about network devices. Having been around for decades, it can be found in many different types of devices such as routers, switches, servers and printers. The HAProxy Enterprise SNMP module enables the load balancer to send metrics data to your network monitoring device or software.

Enable the SNMP module

  1. Install the SNMP daemon for your operating system (snmpd), which listens on UDP port 161 for requests from the SNMP management software (i.e. the monitoring device):

    # On Debian/Ubuntu
    $ apt install install snmpd
    
    # On CentOS/RedHat
    $ yum install install net-snmp
  2. Install the HAProxy Enterprise SNMP module. This collects data from HAProxy Enterprise for snmpd:

    $ # On Debian/Ubuntu
    $ sudo apt-get install hapee-1.7r2-snmp-lb
    $ # On CentOS/RedHat/Oracle
    $ sudo yum install hapee-1.7r2-snmp-lb
  3. In your HAProxy Enterprise configuration, add a new stats socket line that points to /var/run/hapee-extras/hapee-lb.sock. to the global section. The SNMP module connects to this socket to retrieve metrics data.

    global
       stats socket /var/run/hapee-extras/hapee-lb.sock user hapee-lb group hapee mode 660 level user

    Note

    On Debian and Ubuntu, set the group parameter on this line to Debian-snmp instead of hapee. That is the group within which the SNMP daemon runs.

  4. Restart the HAProxy Enterprise service:

    $ sudo systemctl restart hapee-1.7-lb
  5. Edit the file /etc/snmp/snmpd.conf to have the SNMP daemon listen on all interfaces instead of 127.0.0.1:

    • Comment out the line agentAddress udp:127.0.0.1:161.

    • Uncomment the line agentAddress udp:161,udp6:[::1]:161.

    # Listen for connections from the local system only
    # agentAddress  udp:127.0.0.1:161
    
    # Listen for connections on all interfaces (both IPv4 *and* IPv6)
    agentAddress udp:161,udp6:[::1]:161
  6. Add the following view line to the Access Control section of the file. This creates a view of the HAProxy Enterprise data from a part of the larger SNMP tree of data. The first six numbers 1,3,6,1,4,1, map to iso.org.dod.internet.private.enterprise. This is the same for every network device and never changes. The last number, 23263, is the OID that identifies the device manufacturer HAProxy Technologies.

    view systemonly included .1.3.6.1.4.1.23263
  7. Add the following pass_persist line to the end of the file. It configures the SNMP daemon to pass requests through to the HAProxy Enterprise module:

    pass_persist  .1.3.6.1.4.1.23263.4.3.1.3 /opt/hapee-1.7/bin/hapee-snmp-lb
  8. Restart the SNMP service:

    $ sudo systemctl restart snmpd
  9. Configure your SNMP monitoring software to collect metrics from the HAProxy Enterprise server.

How it works

The SNMP stack is split into two main components:

  • The Operating system SNMP daemon, called snmpd. It listens on a network interface on port 161/UDP and handles SNMP requests from clients.

  • The SNMP module for HAProxy Enterprise, which collects data from the load balancer for snmpd.

The diagram below illustrates how the SNMP deamon monitors the system's network, system disks, and HAProxy Enterprise:

HAProxy Enterprise SNMP Daemon

The counters are defined in the file /opt/hapee-extras/misc/HAPEE.mib.


Next up

Monitoring