Net Snmp

net-snmp enables a snmp service that can be used to monitor the device CPU, network activity, …. and perhaps more.

Notice: this page is derived from this thread, help out!

Installing net-snmp

As root, do the following.
It is advised to get the latest net-snmp source from

Setting up:

# create a tmp folder
mkdir /root/netsnmp
cd /root/netsnmp

# get latest source as of 20080330

# unpack (creates folder net-snmp-5.4.1)
tar xfz net-snmp-5.4.1.tar.gz

Compiling: configure

# go to the folder containing the sources
cd net-snmp-5.4.1


After 10 minutes it presented a net-snmp configuration trivia.
Since trivia is not my hobby i accepted the defaults.

Compiling: make & make install


These need respectivly 2 hours and 20 minutes.

Make it run:

1. Create start/stop script

Place in /etc/init.d a file named

# Start snmpd

start() {
        export LD_LIBRARY_PATH=.:/lib:/usr/lib:/usr/local/lib
        echo "Starting SNMPD"

stop() {
        echo "Stopping SNMPD"
        killall snmpd > /dev/null 2>&1
        killall snmpd > /dev/null 2>&1
restart() {

case "$1" in
                echo $"Usage: $0 {start|stop|restart}"
                exit 1

exit $?

and make it executable:
chmod +x /etc/init.d/

2. Initiate on startup

Modify the script as below to include the start stop reference to snmpd

(only part of the file is shown)

start() {
        if [ ! -e "$POST_NETWORK_STARTED_FILE" ]
                $SCRIPTS_PATH/ start
                $SCRIPTS_PATH/ start
                $SCRIPTS_PATH/ start
                touch $POST_NETWORK_STARTED_FILE

stop() {
        if [ -e "$POST_NETWORK_STARTED_FILE" ]
                $SCRIPTS_PATH/ stop
                $SCRIPTS_PATH/ stop
                $SCRIPTS_PATH/ stop
                rm $POST_NETWORK_STARTED_FILE

3. Test it

Using the script you just created:

/etc/init.d/ start

Or manually:

Now check that port 161 UDP is listening by doing

netstat -an
you should see "udp 0 0*" somewhere in the results.

Another way is doing a snmpwalk
(you might have to run export LD_LIBRARY_PATH=.:/lib:/usr/lib:/usr/local/lib first. )

snmpwalk localhost -c public -v1

i for example got this result (with example strings replacing privacy stuff)
SNMPv2-MIB::sysDescr.0 = STRING: Linux mybook #1 PREEMPT Mon Mar 26 12:36:33 BST 2007 armv5tejl
SNMPv2-MIB::sysObjectID.0 = OID: NET-SNMP-MIB::netSnmpAgentOIDs.10
DISMAN-EVENT-MIB::sysUpTimeInstance = Timeticks: (34353) 0:05:43.53
SNMPv2-MIB::sysContact.0 = STRING:
SNMPv2-MIB::sysName.0 = STRING: mybook
SNMPv2-MIB::sysLocation.0 = STRING: MyHouseInTheTrees
SNMPv2-MIB::sysORLastChange.0 = Timeticks: (7) 0:00:00.07
SNMPv2-MIB::sysORID.1 = OID: SNMP-FRAMEWORK-MIB::snmpFrameworkMIBCompliance
SNMPv2-MIB::sysORID.2 = OID: SNMP-MPD-MIB::snmpMPDCompliance
SNMPv2-MIB::sysORID.4 = OID: SNMPv2-MIB::snmpMIB
SNMPv2-MIB::sysORID.6 = OID: IP-MIB::ip
SNMPv2-MIB::sysORDescr.1 = STRING: The SNMP Management Architecture MIB.
SNMPv2-MIB::sysORDescr.2 = STRING: The MIB for Message Processing and Dispatching.
SNMPv2-MIB::sysORDescr.3 = STRING: The management information definitions for the SNMP User-based Security Model.
SNMPv2-MIB::sysORDescr.4 = STRING: The MIB module for SNMPv2 entities
SNMPv2-MIB::sysORDescr.5 = STRING: The MIB module for managing TCP implementations
SNMPv2-MIB::sysORDescr.6 = STRING: The MIB module for managing IP and ICMP implementations
SNMPv2-MIB::sysORDescr.7 = STRING: The MIB module for managing UDP implementations
SNMPv2-MIB::sysORDescr.8 = STRING: View-based Access Control Model for SNMP.
SNMPv2-MIB::sysORUpTime.1 = Timeticks: (4) 0:00:00.04
SNMPv2-MIB::sysORUpTime.2 = Timeticks: (5) 0:00:00.05
SNMPv2-MIB::sysORUpTime.3 = Timeticks: (5) 0:00:00.05
SNMPv2-MIB::sysORUpTime.4 = Timeticks: (7) 0:00:00.07
SNMPv2-MIB::sysORUpTime.5 = Timeticks: (7) 0:00:00.07
SNMPv2-MIB::sysORUpTime.6 = Timeticks: (7) 0:00:00.07
SNMPv2-MIB::sysORUpTime.7 = Timeticks: (7) 0:00:00.07
SNMPv2-MIB::sysORUpTime.8 = Timeticks: (7) 0:00:00.07
End of MIB

Configuring net-snmp

The file /usr/local/share/snmp/snmpd.conf contains the juice.

Here is a working example, a very minimal snmpd.conf file.
This uses the "public" community name, only allowed from a specific IP and from localhost.
This config could be improved by adding disk IOs, temperature monitoring, etc…

com2sec local localhost public
com2sec localnet your-monitoring-ip public

group MyROSystem v1 local
group MyROSystem v2c local
group MyROSystem usm local
group MyROGroup v1 localnet
group MyROGroup v2c localnet
group MyROGroup usm localnet
group MyRWGroup v1 local
group MyRWGroup v2c local
group MyRWGroup usm local

view all included .1 80
view system included

access MyROSystem "" any noauth exact system none none
access MyROGroup "" any noauth exact all none none
access MyRWGroup "" any noauth exact all all none

syslocation MyHouseInTheTrees

disk /var 10000
disk /shares/internal 10000
disk / 10000

!! If you can make a more feature-complete snmpd.conf example please contribute.

What will you get

Screenshots of Cacti showing mybook graphs can be found in this thread.

SNMP Agents

There are several available. Many will find that MRTG and Cacti suit the needs.
You can install these yourself.

  • STG - Ideal small tool for quick tests or debugging. Windows only, no installation required.

Virtual appliances:

Other SNMP Deamons

net-snmp is a deamon that provides a service. Other interesting deamons are:

  • Windows SNMP Service - Enable SNMP in Windows Server 2003.
  • optware/gumstix1151 - To save some compilation time you can also use this package.
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License