Solved

SNMP Walk in Perl

Posted on 2008-06-09
4
5,341 Views
Last Modified: 2008-06-19
Hello All,

I'm trying to figure out how to issue a snmpwalk command through perl. I have never done anything with snmp and programming before.

Attach is the system command that I use.

Thanks
snmpwalk -v2c -c public localhost

Open in new window

0
Comment
Question by:thomasbonham
  • 2
4 Comments
 
LVL 5

Expert Comment

by:rendaduiyan
ID: 21748681
write a perl script for it.
use BER;
use SNMP_util "0.92";

...
Usage: @result = $snmp->walk(-format => 'ne',
                               -oids =>['ifAdminStatus'],
                               -print => 'on');
                           
                  where print = 'on' or 'off'

        or use the shortcut format (Note: print will be disabled by default
                                     
        @result = $snmp->walk('ne','ifAdminStatus');                          

the output will  be:
        $result[0] = ifAdminStatus.1
        $result[1] = 'up'
        $result[2] = ifAdminStatus.2
        $result[3] = 'up'
        ...
0
 

Author Comment

by:thomasbonham
ID: 21750224
Okay now how do I install "BER" and "SNMP_util" because of the fact cpan can't find them.

Thanks,
Thomas
0
 
LVL 28

Expert Comment

by:FishMonger
ID: 21751978
I'm not sure about BER (I'd need to do some searching) but here's SNMP::Util
http://search.cpan.org/~wmarq/SNMP-Util-1.8/Util.pm
0
 
LVL 28

Accepted Solution

by:
FishMonger earned 500 total points
ID: 21752060
SNMP::Util is a little old.  You may want to look ant Net::SNMP instead.
http://search.cpan.org/~dtown/Net-SNMP-5.2.0/lib/Net/SNMP.pm

Or, you might look over some of the other snmp modules to see if there is one tailored to your needs.
http://search.cpan.org/search?query=snmp&mode=all
0

Featured Post

Free camera licenses with purchase of My Cloud NAS

Milestone Arcus software is compatible with thousands of industry-leading cameras for added flexibility. Upon installation on your My Cloud NAS, you will receive two (2) camera licenses already enabled in the software. And for a limited time, get additional camera licenses FREE.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Checking the Alert Log in AWS RDS Oracle can be a pain through their user interface.  I made a script to download the Alert Log, look for errors, and email me the trace files.  In this article I'll describe what I did and share my script.
I. Introduction There's an interesting discussion going on now in an Experts Exchange Group — Attachments with no extension (http://www.experts-exchange.com/discussions/210281/Attachments-with-no-extension.html). This reminded me of questions tha…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now