We have some Linux web servers that we use for Moodle they are setup behind a Barracuda Load Balancer that then distributes the load based on how busy each of the web servers are. Essentially the more busy the server the less clients it is given to process. The barracuda load balancer uses an SNMP query determining the current load.
The Barracuda load balancer side is well documented, but the configuration on your Linux box is not so much, so assuming you’ve configured the Barracuda you just need to follow these steps on the 14.04 LTS Ubuntu server. Remember this is a basic configuration, offering basic security, so if you are looking to do this you need to review these settings, but this gives a basic operational configuration.
Firstly install SNMPD (the SNMP agent) that can respond to SNMP queries:
apt-get install snmpd (Install the SNMP listener)
Now download the SNMP MIBS, these are not included in the SNMP package anymore you need to get them separately with this.
apt-get install snmp-mibs-downloader
Once this is done you need to replace the /etc/snmp/snmpd.conf file with the following, this will allow you to access this SNMP agent from any host on the 192.168.0.0/24 network using the community string: “mycommunitystring.”
###############################################################################
#
# AGENT BEHAVIOUR
#
###############################################################################
# Listen for connections from all IPv4 addresses on the network
agentAddress udp:161
###############################################################################
#
# ACCESS CONTROL
#
###############################################################################
view systemonly included .1.3.6.1.2.1.1
view systemonly included .1.3.6.1.2.1.25.1
#rocommunity communitystring default -V systemonly
rocommunity mycommunitystring 192.168.0.0/24
rouser authOnlyUser
###############################################################################
#
# SYSTEM INFORMATION
#
###############################################################################
sysLocation Place
sysContact Things servicedesk@somewhere.com
sysServices 72
proc mountd
proc ntalkd 4
proc sendmail 10 1
disk / 10000
disk /var 5%
includeAllDisks 10%
load 12 10 5
###############################################################################
#
# ACTIVE MONITORING
#
###############################################################################
trapsink localhost public
iquerySecName internalUser
rouser internalUser
defaultMonitors yes
linkUpDownNotifications yes
###############################################################################
#
# EXTENDING THE AGENT
#
###############################################################################
extend test1 /bin/echo Hello, world!
extend-sh test2 echo Hello, world! ; echo Hi there ; exit 35
master agentx
To get the SNMPD daemon to take the setting restart it:
service snmpd restart
Now from another Linux box you should be able to get the CPU load back using SNMPWalk to test with:
snmpwalk -v1 -c mycommunitystring myhost.domain.com 1.3.6.1.4.1.2021.10.1.3.1
If it works you should see something like: UCD-SNMP-MIB::laLoad.1 = STRING: 0.04
Now using the Test button on the Barracuda Load Balancer configuration, you can test the SNMP load balancing you should see it calculating a metric based on the current load of the server.
Additional Links:
http://thejoyofstick.com/blog/2012/12/01/installing-snmp-mib-files-in-linux-ubuntu-12-04-lts/
http://www.liquidweb.com/kb/how-to-install-and-configure-snmp-on-centos/
http://kaivanov.blogspot.co.uk/2012/02/linux-snmp-oids-for-cpumemory-and-disk.html
http://kb.paessler.com/en/topic/5353-monitoring-linux-problem-snmp-port-not-reachable