Out of the box, FreeBSD’s default SNMP daemon bsnmpd(1) does not support the UCD-SNMP-MIBs which is where all the “good stuff” like CPU, disk, network and memory that us sysadmins like to monitor. Adding this module is as easy as installing the bsnmp-ucd port and doing a quick update to bsnmp’s config file:

$ cd /usr/ports/net-mgmt/bsnmp-ucd/
$ make install clean

Once that module is installed all we need to do is add these lines to end of /etc/snmpd.config:

#
# bsnmp-ucd (8)
#
begemotSnmpdModulePath."ucd" = "/usr/local/lib/snmp_ucd.so"

Finally we just need to restart bsnmpd to have it load the new module:

$ /etc/rc.d/bsnmpd restart
Stopping bsnmpd.
Starting bsnmpd.

Note: This assumes you have the following in your /etc/rc.conf:

bsnmpd_enable="YES"

That’s it! You should be able to retrieve full disk, CPU and memory information (as well as a bunch of other things UCD’s MIB adds) via SNMP queries!

6 Responses to “HOWTO: CPU, Disk, Network and Memory Usage Reporting via FreeBSD’s bsnmpd(1) and bsnmp-ucd(8)”

  1. Bob

    I’ve done this, but bsnmpwalk doesn’t display the UCD elements. What else needs to be done to include the MIB in the default view?

    Reply
    • Adam Strohl

      Doing a full walk should pick it up:


      snmpwalk -Ou -v 1 -c

      The MIB you load is up to you a that happens on the “client” side, but something like this should pull up CPU load without MIB:


      snmpwalk -Ou -v 1 -c .1.3.6.1.2.1.25.3.3.1.2

      It has been a while since I’ve worked with this though as we’ve moved to agent based monitoring for FreeBSD hosts.

      Reply
        • Adam Strohl

          We use Zabbix, it’s been great. We were using a mix of SNMP and Xymon before. Zabbix is much nicer and a lot more in line with what we needed as an MSP.

          Reply

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.