Welcome to Scribd. Sign in or start your free trial to enjoy unlimited e-books, audiobooks & documents.Find out more
Standard view
Full view
of .
Look up keyword
Like this
0 of .
Results for:
No results containing your search query
P. 1
SNMP in Practice

SNMP in Practice



|Views: 204|Likes:
Published by api-3716512

More info:

Published by: api-3716512 on Oct 14, 2008
Copyright:Attribution Non-commercial


Read on Scribd mobile: iPhone, iPad and Android.
download as DOC, PDF, TXT or read online from Scribd
See more
See less





SNMP in Practice
The Simple Network Management Protocol (SNMP) is the ubiquitous protocol used to
manage devices on a network. Unfortunately, as we metioned at the beginning ofChapt er
10, "Security and Network Monitoring", SNMP is not a particularly simple protocol
(despite its name). This longish tutorial will give you the information you need to get
started with Version 1 of SNMP.

SNMP is predicated on the notion that you have a management station that polls an
SNMP agent running on a remote device for information. The agent can also be
instructed to signal the management station if an important condition arises (like a
counter exceeding a threshold). When we programmed in Perl in Chapter 10, "Security

and Network Monitoring", we essentially acted as a management station, polling the
SNMP agents on other network devices.

We're going to concentrate on Version 1 of SNMP. There have been seven versions of the
protocol (SNMPv1, SNMPsec, SNMPv2p, SNMPv2c, SNMPv2u, SNMPv2* and
SNMPv3) proposed. v1 is the only one that has been widely implemented and deployed,
though v3 is expected to eventually ascend thanks to its superior security architecture.

Perl and SNMP both have simple data types. Perl uses a scalar as its base type. Lists and
hashes are just collections of scalars in Perl. In SNMP, you also work with scalar
variables. SNMP variables can hold one of four primitive types: integers, strings, object

identifiers (more on this in a moment), or null values. And just like Perl, in SNMP a set of
related variables can be grouped together to form larger structures (most oftentables).
This is where their similarity ends.

Perl and SNMP diverge radically when we come to the subject of variable names. In Perl,
you can, given a few restrictions, name your variables anything you'd like. SNMP
variable names are considerably more restrictive. All SNMP variables exist within a
virtual hierarchical storage structure known as the Management Information Base (MIB).
All valid variable names are defined within this framework. The MIB, now at version
MIB-II, defines a tree structure for all of the objects (and their names) that can be
managed via SNMP.

In some ways the MIB is similar to a filesystem. Instead of organizing files, the MIB
logically organizes management information in a hierarchical tree-like structure. Each
node in this tree has a short text string, called alabe l, and an accompanying number that
represents its position at that level in the tree. To give you a sense of how this works, let's
go find the SNMP variable in the MIB used to hold a system's description of itself. Bear
with me; we have a bit of a tree walking (eight levels' worth) to get there.

Figure E-1 shows a picture of the top of the MIB tree.
Figure E-1. Finding sysDescr(1) in the MIB
The top of the tree consists of standards organizations:iso(1),ccitt(2),joint-iso-
ccitt(3). Under the iso(1) node, there is a node called org(3) for other organizations.
Under this node isdod(6), for the Department of Defense. Under that node is
internet(1), a subtree for the Internet community.
Here's where things start to get interesting. The Internet Activities Board has assigned the
subtrees listed in Table E-1 underinternet(1).
Table E-1. Subtrees of the internet(1) Node
OSI directory
RFC standard objects
experimental(3)Internet experiments
SNMP internals
Because we're interested in using SNMP for device management, we will want to take the
mgmt(2) branch, The first node under mgmt(2) is the MIB itself (this is almost recursive).
Since there is only one MIB, the only node undermgmt(2) ismib-2(1).
The real meat (or tofu) of the MIB begins at this level in the tree. We find the first set of
branches, called object groups, that hold the variables we'll want to query:


Remember, we're hunting for the "system description" SNMP variable, so thesystem(1)
group is the logical place to look. The first node in that tree issysDescr(1). We've
located the object we need.

Why bother with all of this tree-walking stuff? This trip provides us withsysDescr(1)'s
Object Identifier. The Object Identifier, or OID, is just the dotted set of the numbers from
each label of the tree we encountered on our way to this object. Figure E-2 shows this

Figure E-2. Finding the OID for our desired object
So the OID for the Internet tree is1.3.6.1, the OID for the system object group is, and the OID for the sysDescr object is

Activity (9)

You've already reviewed this. Edit your review.
1 thousand reads
1 hundred reads
mortenstarck5225 liked this
Thai Nguyen Xuan liked this
sachin.rane liked this
soret.so liked this
rkplan08 liked this
Slamet Riyadi liked this
Slamet Riyadi liked this

You're Reading a Free Preview

/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->