			Linux-HA SNMP Subagent

1. Introduction

    The SNMP Subagent is based on AgentX protocol.  It is implemented
using the NET-SNMP api.  It exports the Linux-HA cluster information
through the SNMP interface so that the cluster can be monitored 
remotely.  

    Currently, node, link, membership and heartbeat configuration 
parameters can be viewed through SNMP command.  In addition, SNMP traps
will be sent for node, link, and membership events.  


2. Build 

    Here's how to build the subagent: 

    ./ConfigureMe config --enable-snmp-subagent

    You must have NET-SNMP library and header installed.  On most
systems, these are the net-snmp and net-snmp-devel packages.  The old 
UCD-SNMP is no longer supported.  As of this writing, the latest 
NET-SNMP version is 5.1. 

3. SNMP daemon Configuration

    You need to turn on the Agentx support in the SNMP daemon.
Also you need to define at least one trap sink in order to receive
the traps.  Also, the LINUX-HA-MIB.mib file needs to be installed
to your default mib location so the SNMP daemon can parse it. 
This should be taken care of by the 'make install' though.  

    Here's what it normally takes in your snmpd.conf file:

    # create a SNMPv1/SNMPv2 community
    rocommunity  public 
    # if you want to limit access to a host you can use
    # rocommunity  public xxx.xxx.xxx.xxx/24
    # For more complex setups consult the snmpd.conf man page

    # this makes the snmpd a master snmp agent, which can
    # support AgentX subagents.
    master yes

    # this defines your localhost as the trapsink.  so traps
    # or rather the SNMPv2 informs, will be sent to localhost.  
    trap2sink localhost

4. Test the setup
   a) (re)start your master SNMP daemon (e.g. net-snmpd)
      /etc/init.d/snmpd restart
   b) start the HB agent 
      /usr/lib/heartbeat/hbagent -d
   c) run snmpwalk (while hbagent is running)
      snmpwalk -c public <YOUR.NODE.NAME> -v2c \
        -mLINUX-HA-MIB enterprises.4682

      (if you get a error message you may have to copy 
       /usr/share/snmp/mibs/LINUX-HA-MIB.mib from one of
       the cluster machines to your management station 
       to /usr/share/snmp/mibs/)

   You shoud see a output like the one shown in step (7).

   d) end the hbagent process (CRTL+C)

5. Make the snmp subagent started by heartbeat

   # /etc/ha.d/ha.cf
   #[...]
   respawn root /usr/lib/heartbeat/hbagent

   (note: also make sure that the snmp master daemon 
    is startet before heartbeat during system boot)

6. Restart Heartbeat

   note: Watch out on production systems. Restarting heartbeat
         without proper handling will cause downtime. 
   hint: You can use is-managed-default=false on heartbeatv2 
         clusters

7. Demo Output

    yourshell# snmpwalk -c public <YOUR.HOST.NAME> -v2c -mLINUX-HA-MIB enterprises.4682

    LINUX-HA-MIB::LHATotalNodeCount.0 = Counter32: 2
    LINUX-HA-MIB::LHALiveNodeCount.0 = Counter32: 2
    LINUX-HA-MIB::LHANodeName.0 = STRING: phantom
    LINUX-HA-MIB::LHANodeName.1 = STRING: matrix
    LINUX-HA-MIB::LHANodeType.0 = STRING: normal
    LINUX-HA-MIB::LHANodeType.1 = STRING: normal
    LINUX-HA-MIB::LHANodeStatus.0 = STRING: active
    LINUX-HA-MIB::LHANodeStatus.1 = STRING: active
    LINUX-HA-MIB::LHAIFStatus."matrix.".0."eth0." = STRING: up
    LINUX-HA-MIB::LHAIFStatus."phantom.".0."eth0." = STRING: up
    LINUX-HA-MIB::LHAResourceGroupResources."matrix.".1 = STRING: 192.168.1.112
    LINUX-HA-MIB::LHAResourceGroupResources."phantom.".1 = STRING: 192.168.1.111 httpd
    LINUX-HA-MIB::LHAResourceGroupStatus."matrix.".1 = INTEGER: 0
    LINUX-HA-MIB::LHAResourceGroupStatus."phantom.".1 = INTEGER: 3
    LINUX-HA-MIB::LHAMemberName.0 = STRING: matrix
    LINUX-HA-MIB::LHAMemberAddress.0 = STRING:
    LINUX-HA-MIB::LHAMemberClusterName.0 = STRING:
    LINUX-HA-MIB::LHAMemberIsMember.0 = INTEGER: true(1)
    LINUX-HA-MIB::LHAMemberLastChange.0 = INTEGER: nochange(1)
    LINUX-HA-MIB::LHAMemberBootTime.0 = Timeticks: (0) 0:00:00.00
    LINUX-HA-MIB::LHAHBVersion.0 = STRING: 1.3.0.cvs.20040616
    LINUX-HA-MIB::LHAHOPFudge.0 = STRING: 1
    LINUX-HA-MIB::LHAKeepAlive.0 = STRING: 500ms
    LINUX-HA-MIB::LHADeadTime.0 = STRING: 30
    LINUX-HA-MIB::LHADeadPing.0 = STRING: 30000ms
    LINUX-HA-MIB::LHAWarnTime.0 = STRING: 10
    LINUX-HA-MIB::LHAInitDead.0 = STRING: 120
    LINUX-HA-MIB::LHAWatchdogTimer.0 = STRING: N/A
    LINUX-HA-MIB::LHABaudRate.0 = STRING: 19200
    LINUX-HA-MIB::LHAUDPPort.0 = STRING: 694
    LINUX-HA-MIB::LHNiceFailBack.0 = STRING: N/A
    LINUX-HA-MIB::LHAutoFailBack.0 = STRING: on
    LINUX-HA-MIB::LHAStonith.0 = STRING: N/A
    LINUX-HA-MIB::LHAStonithHost.0 = STRING: N/A
    LINUX-HA-MIB::LHARespawn.0 = STRING: N/A
    LINUX-HA-MIB::LHAGenMethod.0 = STRING: file
    LINUX-HA-MIB::LHARealTime.0 = STRING: true
    LINUX-HA-MIB::LHARTPriority.0 = STRING: N/A
    LINUX-HA-MIB::LHADebugLevel.0 = STRING: 0
    LINUX-HA-MIB::LHANormalPoll.0 = STRING: true
    LINUX-HA-MIB::LHAAPIAuth.0 = STRING: N/A
    LINUX-HA-MIB::LHAMsgFmt.0 = STRING: classic
    LINUX-HA-MIB::LHALogFile.0 = STRING: /var/log/ha-log
    LINUX-HA-MIB::LHADebugFile.0 = STRING: /var/log/ha-debug
    LINUX-HA-MIB::LHALogFacility.0 = STRING: local0

8. Bugs
 
    Please forward all bug report to Linux-HA dev mailing list.

