Specifications
Chapter 6 Setting Network Preferences 77
Collecting SNMP Information from the Host
To get the SNMP information you just added, enter this command from a host that
has the SNMP tools installed:
$ snmpget -c
community_string
hostname
system.sysLocation.0
Replace
community_string
with the string provided during basic setup. The default
community string (or password) is public. Also, replace
hostname
with the name of the
target host, which could be localhost.
After running the command, you should the location you provided during basic setup,
for example:
system.sysLocation.0 = server_room
The other options defined during basic setup include:
$ snmpget -c
community_string
hostname
system.sysContact.0
$ snmpget -c
community_string
hostname
system.sysServices.0
The final .0 indicates you are looking for the index object.
For more information, see the tutorials at net-snmp.sourceforge.net.
Another way to retrieve SNMP information is by retrieving a subtree of management
values using the snmpwalk tool.
To gather SNMP information in bulk:
$ snmpwalk -c
community_string
localhost system
This lists multiple entries of SNMP data similar to the following output, where system
name and location are defined in the snmp.conf file.
SNMPv2-MIB::sysName.0 - system name
SNMPv2-MIB::sysLocation.0 - system location
SNMPv2-MIB::sysUpTime.0 - time in 1/100ths of a second since the last system
start
To display all management values:
$ snmpwalk -c
community_string
localhost .1
Note: This command generates several thousand lines of output.
To view the system name:
$ snmpget -c
community_string
localhost system.sysName.0
SNMPv2-MIB::sysName.0 = STRING: xlabxs06.example.com
To view the system location:
$ snmpget -c
community_string
localhost system.sysLocation.0
SNMPv2-MIB::sysLocation.0 = STRING: "server_room"