Net-SNMP and lm-sensors on Ubuntu 10.04
Notes
This is a Wiki tutorial for using Net-SNMP and lm-sensors on Ubuntu 10.04.1 LTS.
Source Download
You can download the latest sources of Net-SNMP from here:
Net-SNMP Download Page
You can download the latest sources of lm-sensors from here:
lm-sensors Download Page
Configure lm-sensors
Ubuntu 10.04.1 includes lm-sensors 3.1.2 pre-installed. To verify your version of lm-sensors, run:
> sensors -v sensors version 3.1.2 with libsensors version 3.1.2
Lm-sensors needs to be configured using sensors-detect before it can be used. Sensors-detect is an interactive script for detecting hardware sensor chips. Run the following command, and then follow the on-screen instructions:
> sudo sensors-detect
Reboot your system, or use the following command to load the necessary kernel modules:
> sudo /etc/init.d/module-init-tools start
To verify that lm-sensors is operating properly, use the sensors command. Example output is shown below.
> sensors coretemp-isa-0000 Adapter: ISA adapter Core 0: +36.0°C (high = +82.0°C, crit = +100.0°C) coretemp-isa-0001 Adapter: ISA adapter Core 3: +36.0°C (high = +82.0°C, crit = +100.0°C) coretemp-isa-0002 Adapter: ISA adapter Core 1: +36.0°C (high = +82.0°C, crit = +100.0°C) coretemp-isa-0003 Adapter: ISA adapter Core 2: +32.0°C (high = +82.0°C, crit = +100.0°C) it8718-isa-0290 Adapter: ISA adapter in0: +1.34 V (min = +0.00 V, max = +4.08 V) in1: +1.98 V (min = +0.00 V, max = +4.08 V) in2: +3.30 V (min = +0.00 V, max = +4.08 V) in3: +2.93 V (min = +0.00 V, max = +4.08 V) in4: +0.80 V (min = +0.00 V, max = +4.08 V) in5: +0.21 V (min = +0.14 V, max = +0.26 V) in6: +0.10 V (min = +0.00 V, max = +4.08 V) in7: +3.06 V (min = +0.00 V, max = +4.08 V) Vbat: +3.23 V fan1: 0 RPM (min = 0 RPM) fan2: 0 RPM (min = 0 RPM) fan3: 0 RPM (min = 0 RPM) fan4: 1834 RPM (min = 0 RPM) temp1: +37.0°C (low = +127.0°C, high = +127.0°C) sensor = thermistor temp2: +27.0°C (low = +127.0°C, high = +127.0°C) sensor = thermal diode temp3: -2.0°C (low = +127.0°C, high = +127.0°C) sensor = thermistor cpu0_vid: +1.219 V
Install and Configure Net-SNMP
Ubuntu 10.04 does not have Net-SNMP pre-installed. To install basic Net-SNMP functionality, run the following:
> sudo apt-get install snmp > sudo apt-get install snmpd
Several other SNMP packages are available for Ubuntu. The Ubuntu Software Center (Applications > Ubuntu Software Center) is a good resource for determining which packages are currently installed (search for "snmp").
To test that the SNMP Daemon was successfully installed, run the following:
> snmpwalk -v 2c -c public localhost system
General system information should be printed to the terminal window. An example is shown below.
SNMPv2-MIB::sysDescr.0 = STRING: Linux ubuntu 2.6.32-29-generic-pae #58-Ubuntu SMP Fri Feb 11 19:15:25 UTC 2011 i686 SNMPv2-MIB::sysObjectID.0 = OID: NET-SNMP-MIB::netSnmpAgentOIDs.10 DISMAN-EVENT-MIB::sysUpTimeInstance = Timeticks: (1218) 0:00:12.18 SNMPv2-MIB::sysContact.0 = STRING: Root <root@localhost> (configure /etc/snmp/snmpd.local.conf) SNMPv2-MIB::sysName.0 = STRING: ubuntu SNMPv2-MIB::sysLocation.0 = STRING: Unknown (configure /etc/snmp/snmpd.local.conf) SNMPv2-MIB::sysORLastChange.0 = Timeticks: (0) 0:00:00.00 SNMPv2-MIB::sysORID.1 = OID: SNMP-FRAMEWORK-MIB::snmpFrameworkMIBCompliance SNMPv2-MIB::sysORID.2 = OID: SNMP-MPD-MIB::snmpMPDCompliance SNMPv2-MIB::sysORID.3 = OID: SNMP-USER-BASED-SM-MIB::usmMIBCompliance SNMPv2-MIB::sysORID.4 = OID: SNMPv2-MIB::snmpMIB SNMPv2-MIB::sysORID.5 = OID: TCP-MIB::tcpMIB SNMPv2-MIB::sysORID.6 = OID: IP-MIB::ip SNMPv2-MIB::sysORID.7 = OID: UDP-MIB::udpMIB SNMPv2-MIB::sysORID.8 = OID: SNMP-VIEW-BASED-ACM-MIB::vacmBasicGroup 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: (0) 0:00:00.00 SNMPv2-MIB::sysORUpTime.2 = Timeticks: (0) 0:00:00.00 SNMPv2-MIB::sysORUpTime.3 = Timeticks: (0) 0:00:00.00 SNMPv2-MIB::sysORUpTime.4 = Timeticks: (0) 0:00:00.00 SNMPv2-MIB::sysORUpTime.5 = Timeticks: (0) 0:00:00.00 SNMPv2-MIB::sysORUpTime.6 = Timeticks: (0) 0:00:00.00 SNMPv2-MIB::sysORUpTime.7 = Timeticks: (0) 0:00:00.00 SNMPv2-MIB::sysORUpTime.8 = Timeticks: (0) 0:00:00.00 SNMPv2-MIB::sysORUpTime.8 = No more variables left in this MIB View (It is past the end of the MIB tree)
The SNMP Daemon requires additional setup. The snmpconf command is an interactive script for configuring Net-SNMP functionality (it can be used to generate snmp.conf and snmpd.conf). Run the following:
> sudo snmpconf -i -g basic_setup
NOTE: If you are unfamiliar Net-SNMP, it might be easier to create a simple snmpd.conf file manually. Using a text editor, create a file named "snmpd.conf". Add the following text:
rocommunity public
Copy the new snmpd.conf file to the correct path (In Ubuntu, the default paths for Net-SNMP applications are slightly different):
> sudo mv /etc/snmp/snmpd.conf /etc/snmp/snmpd.conf.old > sudo cp /usr/share/snmp/snmpd.conf /etc/snmp/snmpd.conf
Restart the SNMP daemon:
> sudo /etc/init.d/snmpd restart
Test the lm-sensors MIB. The OID for the lm-sensors MIB is 1.3.6.1.4.1.2021.13.16.
> snmpwalk -v 2c -c public localhost lmSensors
> snmpwalk -v 2c -c public localhost 1.3.6.1.4.1.2021.13.16