Applications in Network Discovery Using Perl and Net

advertisement
Applications in Network Discovery
Using Perl and Net-SNMP
Denis Sitailo
Department of Computer Science
Loyola University Chicago
Chicago, IL, 60640
dsitail@luc.edu
Abstract – Networks are no longer a
simple mesh of interconnected computers
used for sparse communication and basic
data services. On the contrary, networks
are frequently the backbone, and
indispensible link that is utilized every
day for maintaining critical applications
and providing a reliable link to
applications in the cloud. The ever
increasing importance of maintaining
these links has prompted for simple
programs that can be used to quickly
collect information from network devices
and take action if necessary. This paper
provides a brief overview of how network
administrators are now able to
accomplish all this using Perl and the Net
– SNMP library.
I. Introduction
The World Economic Forum
estimates that by 2010, spending on mobile
internet devices will increase by 1/3 from
$64 billion to $91 billion [2]. Furthermore,
they also claim a steady shift towards data
services on mobile devices as opposed to
traditional voice [2]. These figures are
significant because the mobile internet
market continues to dominate in remote
regions where more traditional PC use has
been stifled. All of these figures,
compounded with a surge in internet usage
that is now hovering at 23.7% of the world
population, have created an increased need
to ensure the reliability of network
deployments to handle these growth needs.
As global bandwidth utilization continues to
rise, and network hardware becomes
overloaded with traffic, the result is an
increased risk of failure that must be closely
monitored, specifically on backbone
devices.
II. SNMP Structure
Fortunately the Simple Network
Management Protocol (SNMP) provides an
effective means to monitor for these kinds of
events. In addition to monitoring SNMP also
has the capability to take a predetermined
action on the basis of a specific event. Such
actions are typically executed as a result of a
trap. The trap is like a red flag that is set off
by the destination host, and is sent to the
network management system (NMS),
alerting it of abnormal behavior. Such alerts
can be specified on the basis of threshold
levels, 1oolean values, or counters. For
instance, if the device status changes from
up/down the host will automatically notify
the NMS and the network admin can then
troubleshoot the problem. Sometimes issues
can be spotted before they occur. One
example is by using a temperature gauge
that some SNMP capable devices will
support. If the temperature has reaches a
critical level, this may be a sign of an
impending hardware failure.
In general, SNMP devices are
designed to manage individual objects on
the device. These objects are commonly
referred to as object identifiers (OID’s), and
they are programmatically configured in a
logical grouping known as a management
information base (MIB) file [1]. The MIB
file can then be loaded onto a managed
device to facilitate the necessary monitoring
of the OID’s defined in the MIB. OID’s
within the MIB are organized according to a
hierarchical standard known as SMIv2. The
result is a tree hierarchy of objects, sharing a
series of common root nodes. Many of the
most frequently used OID’s reside under the
MIB2 branch of the tree, which has a
corresponding OID of 1.3.6.1.2.1. This node
contains OID’s pertaining to interface,
system, IP, TCP, and UDP, among others.
Most importantly, MIB files are
highly customizable. Given that all MIB
files and OID declarations must follow the
same standard, it is very common for
network administrators to add in their own
OID definitions as long as the hardware can
support them. Many of these definitions are
typically found in the private tree node
under OID 1.3.6.1.4. This node is generally
reserved for large network equipment
vendors such as Cisco. These vendors have
their own OID address, under which they
can define their own custom MIB’s
pertaining to their line of devices. In fact,
Network Instruments praises SNMP for its
non-proprietary framework and crossvendor support [3].
III. Applications
Knowing how to leverage the
functionality described above can be
invaluable for even a seasoned network
administrator, and all it takes is the right set
of tools. By using Perl and the Net-SNMP
package, a network administrator can write
scripts to configure traps, queries, or sets for
devices on the network. In order to write
such a script, several things are necessary:
an SNMP capable device, an iReasoning
MIB Browser, and an IDE configured to
support Perl and the Net-SNMP module.
The iReasoning browser provides a GUI that
can be used to connect to the agent and
retrieve the OID values necessary. This tool
is very useful because it shows the
information, address values, and data types
that will be later pulled by the script. When
writing the script, the first step is to establish
a connection with the agent to form an
SNMP session. Once the session is
established, the script can use OID values to
query the agent by using standard SNMP
commands such as get, get-next, get-bulk,
etc.
One of the most efficient ways of
obtaining device information is by creating a
VarList that will extract the necessary
varbind pair (OID, value) and will
temporarily store the data in the current
iteration. To extract the value from the
varbind component, a get request can be
used, and the value can then be stored in an
array for later access. In a simple query
request, this data can then be printed to the
screen. Certainly, scripts can be written to
handle more sophisticated scenarios such as
setting values on agents, or kicking off other
queries all based on the results of a single
query or trap. In final analysis, both Perl and
Net-SNMP provide a powerful platform for
network administrators to help anticipate,
monitor, and resolve potential issues on their
networks, ensuring that even if a failure
occurs, its effects will be short lived.
References
1. Mauro, Douglas, and Kevin Schmidt.
Essential SNMP. 1st ed. O'Reilly &
Associates, 2001. 17. Print.
2. "MOBILE INTERNET FOR GROWTH:
PROJECT REPORT." Bain & Company.
001 2009. World Economic Forum, Web. 7
Dec 2009.
<http://www.bain.com/bainweb/PDFs/cms/P
ublic/WEF_2009_Mobile_internet.pdf>.
3. "SNMP Monitoring: One Critical
Component to Network Management."
Network Instruments, LLC, Web. 7 Dec
2009.
<http://www.netinst.com/assets/pdf/SNMP_
WP.pdf>.
.
Download