OBTAIN SYSTEM INFORMATION WITH UCD-SNMP

Most Linux distributions come with a useful server called ucd-snmp, which is a Simple Network Management Protocol (SNMP) server for Linux systems. Many network appliances, such as printers and firewalls, use SNMP to provide information about themselves. Linux uses SNMP to obtain information about a given Linux system.

Make sure you have the ucd-snmp package installed. You will need to configure it via the configuration file, which is usually located in /etc or /etc/snmp as snmpd.conf. (As a word of caution: The default configuration file is difficult to read because it also shows examples of other tools with which the ucd-snmp package comes.)

A very simple snmpd.conf file might look like the following:

com2sec somerandomstring default somerandomstring

group somerandomstring v1 somerandomstring

group somerandomstring v2c somerandomstring

view all included .1

access somerandomstring "" any noauth exact all none none

syslocation myhost.mydomain.com

syscontact Joe Admin joe@localhost

This is the bare minimum that you will need. In the default configuration file, you will see that "somerandomstring" is replaced by public. You don't want this. Instead, pick a unique name at random, something other than public, to prevent unauthorized individuals from reading information on your system.


Next, to get information on the system, use the following command:

# snmpwalk -v 1 localhost somerandomstring system

This will give you some system information, such as the system description (kernel information), uptime, location, and contact.

You can perform other queries, as well, some of which are shown as examples in the configuration file. You can also configure snmpd to provide process information, disk usage information, and much more.