[HOWTO] Reduce CPU/disk I/O by controlling MIB compilation

If you figure out how to do something interesting/cool in Cacti and want to share it with the community, please post your experience here.

Moderators: Moderators, Developers

Post Reply
User avatar
Posts: 7
Joined: Mon Sep 25, 2006 7:44 pm

[HOWTO] Reduce CPU/disk I/O by controlling MIB compilation

#1 Post by phreakocious » Sun Jul 25, 2010 8:53 am

Is Cacti running slowly for you? Missing polls, gaps in graphs, poor performance on the system? It's 7PM, do you know what your SNMP library is doing?

Cacti depends very heavily on the Net-SNMP tools. By default, Net-SNMP comes with 59 MIB files stored usually in /usr/share/snmp/mibs representing some 1.7MB of disk. Newer Linux distributions will put MIB files for installed software packages there as well.

snmpget/snmpwalk/snmpbulkwalk perform run-time compilation of all MIB files when they execute. Depending on the quantity and size of MIBs and polled items, you could be scanning these files hundreds or thousands of times per hour. The Cacti templates I have seen don't usually refer to objects by name, so this may be pointless.

The first thing to try is removing MIB files from the default directory that you don't need or want.

Many people customize their Net-SNMP installation with /etc/snmp/snmp.conf:

defVersion 2c
defCommunity NOTPUBLIC!
mibdirs +/mycompany/mibs
mibAllowUnderline true
mibs ALL

An easy solution for this is to set the MIBDIRS environment variable for Net-SNMP in your include/config.php.

Including a - before the name removes a dir from the list:
Or just make sure there's nothing to scan (this may generate errors):

See the snmpcmd man page for more information.

Post Reply