MRTG, SNMP and Load Averages

In snmpd.conf:

# Check for loads:
load 12 14 14

Restart snmpd and check the results:

$ snmpwalk -v 1 -c public localhost .1.3.6.1.4.1.2021.10
UCD-SNMP-MIB::laIndex.1 = INTEGER: 1
UCD-SNMP-MIB::laIndex.2 = INTEGER: 2
UCD-SNMP-MIB::laIndex.3 = INTEGER: 3
UCD-SNMP-MIB::laNames.1 = STRING: Load-1
UCD-SNMP-MIB::laNames.2 = STRING: Load-5
UCD-SNMP-MIB::laNames.3 = STRING: Load-15
UCD-SNMP-MIB::laLoad.1 = STRING: 0.08
UCD-SNMP-MIB::laLoad.2 = STRING: 0.09
UCD-SNMP-MIB::laLoad.3 = STRING: 0.09
UCD-SNMP-MIB::laConfig.1 = STRING: 12.00
UCD-SNMP-MIB::laConfig.2 = STRING: 14.00
UCD-SNMP-MIB::laConfig.3 = STRING: 14.00
UCD-SNMP-MIB::laLoadInt.1 = INTEGER: 8
UCD-SNMP-MIB::laLoadInt.2 = INTEGER: 9
UCD-SNMP-MIB::laLoadInt.3 = INTEGER: 9
UCD-SNMP-MIB::laLoadFloat.1 = Opaque: Float: 0.080000
UCD-SNMP-MIB::laLoadFloat.2 = Opaque: Float: 0.090000
UCD-SNMP-MIB::laLoadFloat.3 = Opaque: Float: 0.090000
UCD-SNMP-MIB::laErrorFlag.1 = INTEGER: noError(0)
UCD-SNMP-MIB::laErrorFlag.2 = INTEGER: noError(0)
UCD-SNMP-MIB::laErrorFlag.3 = INTEGER: noError(0)
UCD-SNMP-MIB::laErrMessage.1 = STRING: 
UCD-SNMP-MIB::laErrMessage.2 = STRING: 
UCD-SNMP-MIB::laErrMessage.3 = STRING: 

In mrtg.cfg (obviously, substituting your hostname for mine, and checking where UCD-SNMP-MIB is actually located):

LoadMIBs: /usr/share/mibs/netsnmp/UCD-SNMP-MIB
EnableSNMPv3: yes

Target[araminta_load]: laLoadInt.2&laLoadInt.3:public@araminta
Options[araminta_load]: gauge,growright,unknaszero
Title[araminta_load]: araminta load average
MaxBytes[araminta_load]: 100
YLegend[araminta_load]: centiProcs
ShortLegend[araminta_load]: Procs
PageTop[araminta_load]: <h1>araminta load average</h1>
LegendI[araminta_load]: 5m average
LegendO[araminta_load]: 15m average
Factor[araminta_load]: 0.01

You need to use laLoadInt, which gives you 100 times the load. If you use laLoad, or try to divide by 100, it seems MRTG trucates to an integer.

The “EnableSNMPv3: yes” is important; without it you will get something like this in mrtg.log:

Unknown SNMP var laLoad.2
 at /usr/bin/mrtg line 2207
Unknown SNMP var laLoad.3
 at /usr/bin/mrtg line 2207
2010-06-19 11:10:01: WARNING: Expected a number but got '0:57:47'
2010-06-19 11:10:01: WARNING: Expected a number but got 'araminta'

RJK | Contents