To customize the data provided by snmpd, you may add an snmpd.conf file using /usr/bin/snmpconf:

$ sudo /usr/bin/snmpconf -i

You will then see a series of text menus. Make these choices in this order:

1Select File: 1 (snmpd.conf)

2Select section: 5 (System Information Setup)

3Select section: 1 (The [typically physical] location of the system)

4The location of the system: type text string here—such as server_room

5Select section: f (finish)

6Select section: f (finish)

7Select File: q (quit)

This creates an snmpd.conf file with a creation date of today.

To view the snmp.conf file:

$ ls -l /usr/share/snmpd.conf

Once the configuration file is created, restart the snmpd process.

To start snmpd, execute this as root:

$ sudo /usr/sbin/snmpd

Collecting SNMP Information from the Host

To get the SNMP information you just added, execute this command from a host that has the SNMP tools installed, where hostname is replaced with the actual name of the target host:

$ snmpget -v 1 -c public hostname system.sysLocation.0

You should see the location you provided. In this example, you would see:

system.sysLocation.0 = server_room

The other options in the menu you were working in are:

$ snmpget -v 1 -c hostname public system.sysContact.0

$ snmpget -v 1 -c hostname public system.sysServices.0

The final .0 indicates you are looking for the index object. The word public is the name of the SNMP community, which you did not alter. If you need information about either of these, or explanations of SNMP syntax, there are tutorials available at www.netsnmp.sourceforge.net.

Another way to retrieve SNMP information is by retrieving a subtree of management values using the snmpwalk tool.

Chapter 6 Setting Network Preferences

75

Page 75
Image 75
Apple Mac OS X Server manual Collecting Snmp Information from the Host, To view the snmp.conf file