Chapter 7. Polling and Setting

We've put a lot of work into getting things set up so that we can use SNMP effectively. But now that we've installed a fancy node manager and configured agents on all our devices, what can we do? How can we interact with the devices that are out there?

The three basic SNMP operations are snmpget, snmpset, and snmpwalk. They are fairly self-explanatory: snmpget reads a value from a managed device, snmpset sets a value on a device, and snmpwalk reads a portion of the MIB tree from a device. For example, you can use snmpget to query a router and find out its administrative contact (i.e., the person to call if the router appears to be broken), snmpset to change this contact information, and snmpwalk to traverse a MIB to get an idea of which objects the router has implemented or to retrieve status information on all the router's interfaces.

This chapter shows you how to use these operations in day-to-day network management. First, we will use Perl to demonstrate how you can set, get, and walk objects in a script (the nice thing about using Perl is that you can easily extend the simple scripts in this chapter to fit your needs and environment). We will then use HP OpenView and Net-SNMP to perform the same operations, but from the command line. Finally, as an alternative to the command line, we will demonstrate OpenView's graphical MIB Browser, which has a nice interface for getting, setting, and walking MIB data.

Retrieving a Single MIB Value

Let's start by ...

Get Essential SNMP, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.