Blame doc/source/snmp_support.rst

Packit c22fc9
########################
Packit c22fc9
Configuring SNMP Support
Packit c22fc9
########################
Packit c22fc9
Packit c22fc9
Keepalived provides an SNMP subsystem that can gather various metrics about the
Packit c22fc9
VRRP stack and the health checker system. The keepalived MIB is in
Packit c22fc9
the ``doc`` directory of the project. The base SNMP OID for the MIB is
Packit c22fc9
`.1.3.6.1.4.1.9586.100.5`, which is hosted under the `Debian OID space`_
Packit c22fc9
assigned by IANA.
Packit c22fc9
Packit c22fc9
.. _Debian OID space: https://dsa.debian.org/iana/
Packit c22fc9
Packit c22fc9
Packit c22fc9
Prerequisites *************
Packit c22fc9
Packit c22fc9
Install the SNMP protocol tools and libraries onto your system.  This requires
Packit c22fc9
the installation of a few packages::
Packit c22fc9
Packit c22fc9
    yum install net-snmp net-snmp-utils net-snmp-libs
Packit c22fc9
Packit c22fc9
Once SNMP has been installed on your system, configure keepalived with SNMP
Packit c22fc9
support.  When compiling keepalived, add the ``--enable-snmp`` configure
Packit c22fc9
option.  For example::
Packit c22fc9
Packit c22fc9
    ./configure --enable-snmp
Packit c22fc9
Packit c22fc9
During the configure step of the compiling process, you will get a
Packit c22fc9
configuration summary before building with ``make``.  For example, you may see
Packit c22fc9
similar output on a CentOS 6 machine::
Packit c22fc9
Packit c22fc9
    ./configure --prefix=/usr/local/keepalived-1.2.15 --enable-snmp
Packit c22fc9
    Keepalived configuration
Packit c22fc9
    ------------------------
Packit c22fc9
    Keepalived version       : 1.2.15
Packit c22fc9
    Compiler                 : gcc
Packit c22fc9
    Compiler flags           : -g -O2 -I/usr/include/libnl3
Packit c22fc9
    Extra Lib                : -Wl,-z,relro -Wl,-z,now -L/usr/lib64
Packit c22fc9
    -lnetsnmpagent -lnetsnmphelpers -lnetsnmpmibs -lnetsnmp -Wl,-E
Packit c22fc9
    -Wl,-rpath,/usr/lib64/perl5/CORE -lssl -lcrypto -lcrypt  -lnl-genl-3 -lnl-3
Packit c22fc9
    Use IPVS Framework       : Yes
Packit c22fc9
    IPVS sync daemon support : Yes
Packit c22fc9
    IPVS use libnl           : Yes
Packit c22fc9
    fwmark socket support    : Yes
Packit c22fc9
    Use VRRP Framework       : Yes
Packit c22fc9
    Use VRRP VMAC            : Yes
Packit c22fc9
    SNMP support             : Yes
Packit c22fc9
    SHA1 support             : No
Packit c22fc9
    Use Debug flags          : No
Packit c22fc9
Packit c22fc9
Notice the *Extra Lib* section of the configuration summary.  It lists various
Packit c22fc9
library flags that gcc will use to build keepalived, several of which have to do with
Packit c22fc9
SNMP.
Packit c22fc9
Packit c22fc9
Configuring Support
Packit c22fc9
*******************
Packit c22fc9
Packit c22fc9
Enable SNMP AgentX support by including the following line in the SNMP
Packit c22fc9
daemon configuration file, typically ``/etc/snmp/snmpd.conf`` if you installed
Packit c22fc9
via RPMs on a CentOS machine::
Packit c22fc9
Packit c22fc9
    master agentx
Packit c22fc9
Packit c22fc9
.. note::
Packit c22fc9
   Be sure to reload or restart the SNMP service for the configuration change
Packit c22fc9
   to take effect.
Packit c22fc9
Packit c22fc9
Adding the MIB
Packit c22fc9
**************
Packit c22fc9
Packit c22fc9
You can query keepalived SNMP managed objects by using the OID.  For example::
Packit c22fc9
Packit c22fc9
    snmpwalk -v2c -c public localhost .1.3.6.1.4.1.9586.100.5.1.1.0
Packit c22fc9
    SNMPv2-SMI::enterprises.9586.100.5.1.1.0 = STRING: "Keepalived v1.2.15 (01/10,2015)"
Packit c22fc9
Packit c22fc9
Alternatively, with the keepalived MIB, you can query using the MIB available
Packit c22fc9
from the project.  First, copy the MIB to the system's global MIB directory or
Packit c22fc9
to the user's local MIB directory::
Packit c22fc9
Packit c22fc9
    cp /usr/local/src/keepalived-1.2.15/doc/KEEPALIVED-MIB /usr/share/snmp/mibs
Packit c22fc9
Packit c22fc9
or::
Packit c22fc9
Packit c22fc9
    cp /usr/local/src/keepalived-1.2.15/doc/KEEPALIVED-MIB ~/.snmp/mibs
Packit c22fc9
Packit c22fc9
The SNMP daemon will check both directories for the existence of the MIB.  Once
Packit c22fc9
the MIB is in place, the SNMP query can look as follows::
Packit c22fc9
Packit c22fc9
    snmpwalk -v2c -c public localhost KEEPALIVED-MIB::version
Packit c22fc9
    KEEPALIVED-MIB::version.0 = STRING: Keepalived v1.2.15 (01/10,2015)
Packit c22fc9
Packit c22fc9
Packit c22fc9
MIB Overview
Packit c22fc9
************
Packit c22fc9
Packit c22fc9
There are four main sections to the keepalived MIB:
Packit c22fc9
Packit c22fc9
* global
Packit c22fc9
* vrrp
Packit c22fc9
* check
Packit c22fc9
* conformance
Packit c22fc9
Packit c22fc9
Global
Packit c22fc9
======
Packit c22fc9
Packit c22fc9
The global section includes objects that contain information about the
Packit c22fc9
keepalived instance such as version, router ID and administrative email
Packit c22fc9
addresses.
Packit c22fc9
Packit c22fc9
VRRP
Packit c22fc9
====
Packit c22fc9
Packit c22fc9
The VRRP section includes objects that contain information about each
Packit c22fc9
configured VRRP instance.  Within each instance, there are objects that include
Packit c22fc9
instance name, current state, and virtual IP addresses.
Packit c22fc9
Packit c22fc9
Check
Packit c22fc9
=====
Packit c22fc9
Packit c22fc9
The Check section includes objects that contain information about each
Packit c22fc9
configured virtual server.  It includes server tables for virtual and real
Packit c22fc9
servers and also configured load balancing algorithms, load balancing method,
Packit c22fc9
protocol, status, real and virtual server network connection statistics.
Packit c22fc9
Packit c22fc9
Conformance
Packit c22fc9
===========
Packit c22fc9
Packit c22fc9
.. todo::
Packit c22fc9
   do conformance
Packit c22fc9
Packit c22fc9
.. note::
Packit c22fc9
   Use a MIB browser, such as mbrowse, to see what managed objects are available to
Packit c22fc9
   query for monitoring the health of your LVS servers.
Packit c22fc9