Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

SNMP Walk in Perl

Posted on 2008-06-09
4
Medium Priority
?
5,376 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 2000 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 Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

A year or so back I was asked to have a play with MongoDB; within half an hour I had downloaded (http://www.mongodb.org/downloads),  installed and started the daemon, and had a console window open. After an hour or two of playing at the command …
Google Drive is extremely cheap offsite storage, and it's even possible to get extra storage for free for two years.  You can use the free account 15GB, and if you have an Android device..when you install Google Drive for the first time it will give…
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

618 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