Solved

SNMP Walk in Perl

Posted on 2008-06-09
4
5,345 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

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Squid Connection Pools 3 68
Why VNC doesn't work in Redhat? 11 61
windows 7 starter missing password 21 77
What is linux 4.8.22? Is it the same as ubuntu 16.10 ?? 2 40
I have been pestered over the years to produce and distribute regular data extracts, and often the request have explicitly requested the data be emailed as an Excel attachement; specifically Excel, as it appears: CSV files confuse (no Red or Green h…
There are many situations when we need to display the data in sorted order. For example: Student details by name or by rank or by total marks etc. If you are working on data driven based projects then you will use sorting techniques very frequently.…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
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.

772 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