This article is part of the Net-SNMP series:
- Beginners Guide to Installing, Using, and Configuring Net-SNMP – Part 1
- Beginners Guide to Installing, Using, and Configuring Net-SNMP – Part 2
Simple Network Management Protocol (SNMP) is a protocol which is widely used for monitoring network-attached devices, including routers, switches, servers, and more, for conditions that require administrative attention.
Net-SNMP is a set of tools and libraries for using and deploying the SNMP protocol. In this article, we will discuss how to download, install, and start using the Net-SNMP suite.
Note – it is expected that readers have at least a basic knowledge of SNMP (including OIDs and MIBs) as well as how it works.
Download and Installation
You can download the latest version of the package from its Sourceforge page. For example, I downloaded version 5.7.3 of the package from the project hosting website using the following command:
Please note that the Net-SNMP package depends upon the Perl development package, which you can easily install using the following command:
sudo apt-get install libperl-dev
Once done, decompress the downloaded package using the following command:
tar -xvzf net-snmp-5.7.3.tar.gz
Then enter into the main directory and configure the package :
cd net-snmp-5.7.3/ sudo ./configure
This will throw up a series of questions that’ll help the Net-SNMP suite determine how the SNMP-related applications are to function. For example, it will ask you which SNMP version (1, 2c, or 3) to use as default:
Whom to contact:
Location of the system:
And location to store the logfile and persistent information.
You can either enter the requested values or keep pressing the Enter key for the configuration script to pick up the default values. Once done, the configuration script will continue with its work, and if everything goes well, you should get something similar to the following:
--------------------------------------------------------- Net-SNMP configuration summary: --------------------------------------------------------- SNMP Versions Supported: 1 2c 3 Building for: linux Net-SNMP Version: 5.7.3 Network transport support: Callback Unix Alias TCP UDP IPv4Base SocketBase TCPBase UDPIPv4Base UDPBase SNMPv3 Security Modules: usm Agent MIB code: default_modules => snmpv3mibs mibII ucd_snmp notification notification-log-mib target agent_mibs agentx disman/event disman/schedule utilities host MYSQL Trap Logging: unavailable Embedded Perl support: enabled SNMP Perl modules: building -- embeddable SNMP Python modules: disabled Crypto support from: internal Authentication support: MD5 SHA1 Encryption support: DES AES Local DNSSEC validation: disabled ---------------------------------------------------------
This means that the configuration part is successful. Next up, compile and install the package using the following two commands:
sudo make sudo make install
Now, execute the following command to download and install the Management Information Base (MIB) files on your system:
sudo apt-get install snmp-mibs-downloader
Next, download and install SNMP agent – a daemon process that performs network management functions as ordered by the manager, which itself is a central system used for monitoring traffic seen by the various SNMP agents. This can be done using the following command:
sudo apt-get install snmpd
Now start the daemon process using the following command:
This should start the network management service on your system.
To check if the package has been properly set up, use the
snmpget command to check the system uptime:
snmpget -v 2c -c public 127.0.0.1 SNMPv2-MIB::sysUpTime.0
If you aren’t aware,
snmpget is an application that uses the SNMP GET request to query for information on a network entity. On my Ubuntu box, the command produced the following output:
DISMAN-EVENT-MIB::sysUpTimeInstance = Timeticks: (26770) 0:04:27.70
In the output shown above, the last part is the system uptime, indicating that the system had been up for approximately 4 minutes 27 seconds. A point worth mentioning here is that this time is calculated from the time the
snmpd daemon was started.
Similarly, you can run the following
snmpwalk command to display values corresponding to system-specific variables present under the “.iso.org.dod.internet.mgmt.mib-2.system” MIB tree.
$ snmpwalk -v2c -c public localhost system SNMPv2-MIB::sysDescr.0 = STRING: Linux himanshu-desktop 3.13.0-32-generic #57-Ubuntu SMP Tue Jul 15 03:51:12 UTC 2014 i686 SNMPv2-MIB::sysObjectID.0 = OID: NET-SNMP-MIB::netSnmpAgentOIDs.10 DISMAN-EVENT-MIB::sysUpTimeInstance = Timeticks: (47647) 0:07:56.47 SNMPv2-MIB::sysContact.0 = STRING: Me <firstname.lastname@example.org> SNMPv2-MIB::sysName.0 = STRING: himanshu-desktop ... ... ...
For those who aren’t aware, the
snmpwalk command is designed to retrieve multiple OIDs and values from the remote agent.
As you would have observed, this article was aimed to give you an idea about how to download and install the Net-SNMP package properly. In the second part, we will cover all the basics related to Net-SNMP configuration.