Solved

SNMP Walk in Perl

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

NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

Question has a verified solution.

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

Email validation in proper way is  very important validation required in any web pages. This code is self explainable except that Regular Expression which I used for pattern matching. I originally published as a thread on my website : http://www…
Introduction We as admins face situation where we need to redirect websites to another. This may be required as a part of an upgrade keeping the old URL but website should be served from new URL. This document would brief you on different ways ca…
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.

821 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