O'Reilly logo

Essential SNMP by Kevin Schmidt, Douglas Mauro

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Setting a MIB Value

With snmpget and snmpwalk, we have retrieved management information only from devices. The next logical step is to change the value of a MIB object via SNMP. This operation is known as snmpset, or set. In this section we’ll read the value of an object, use snmpset to change its value, then read the value again to prove that it’s been changed.

There’s obviously some danger here: what happens if you change a variable that’s critical to the state of the system you’re monitoring? In this chapter, we’ll deal only with some simple objects, such as the administrative contact, that won’t damage anything if they’re changed incorrectly. Therefore, if you keep the OIDs correct, you shouldn’t worry about hurting any of your devices. All the objects we set in this chapter have an ACCESS of read-write. It’s a good idea to get a feel for which objects are writable by reading the MIB in which the object is defined -- either one of the RFCs or a MIB file provided by your vendor.

Let’s get started. Run the following OpenView command (or use one of the other programs we’ve discussed) to find out the sysContact for your chosen device:

$ /opt/OV/bin/snmpget -c public orarouter1 .1.3.6.1.2.1.1.4.0
system.sysContact.0 : DISPLAY STRING- (ascii):  ORA IT Group

The -c public switch passes the community string public to the snmpget command.

Tip

Keep in mind that your devices shouldn’t use the same (default) community strings that are used within this book. In addition, using the same string ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required