Skip to Content
Essential SNMP
book

Essential SNMP

by Douglas Mauro, Kevin Schmidt
July 2001
Intermediate to advanced
336 pages
10h 50m
English
O'Reilly Media, Inc.
Content preview from Essential SNMP

SNMP Operations

The routines for performing SNMP operations correspond to the standard SNMP Version 1 operations[78] and have the following parameters in common:

community (optional)

The community string. If no community string is specified, public is used.

host (required)

The hostname or IP address of the device you want to query.

port (optional)

The port number to which to send the query or trap. The default for all routines except snmptrap() is 161. The default for snmptrap() is 162.

timeout (optional)

The timeout in seconds; if no response is received within this period, the operation is considered to have failed and is retried. The default is 2 seconds.

retries (optional)

The number of retries before the routine returns failure. The default is 5.

backoff (optional)

The backoff value; for each successive retry, the new timeout period is obtained by multiplying the current timeout with the backoff. The default is 1.

OID (required)

The object ID or textual name of the object you are querying.

snmpget( )

The syntax of the snmpget() routine is:

snmpget(community@host:port:timeout:retries:backoff, OID, [OID...])

If snmpget() fails, it returns undef.

Recall that all the MIB-II objects are preloaded into this Perl module, so the following code is legal:

@sysDescr = snmpget("public\@cisco.ora.com", "sysDescr");

We did not specify any of the optional parameters (timeout, backoff, etc.); the default values will be used. This routine lets us request "sysDescr" as shorthand for sysDescr.0. When ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

Zabbix 4 Network Monitoring - Third Edition

Zabbix 4 Network Monitoring - Third Edition

Patrik Uytterhoeven
Essential SNMP, 2nd Edition

Essential SNMP, 2nd Edition

Douglas Mauro, Kevin Schmidt
Linux Server Hacks, Volume Two

Linux Server Hacks, Volume Two

William von Hagen, Brian K. Jones
Pro DNS and BIND 10

Pro DNS and BIND 10

Ron Aitchison

Publisher Resources

ISBN: 0596000200Catalog PageErrata