Solved

SNMP Walk in Perl

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Note: for this to work properly you need to use a Cross-Over network cable. 1. Connect both servers S1 and S2 on the second network slots respectively. Note that you can use the 1st slots but usually these would be occupied by the Service Provideā€¦
The purpose of this article is to demonstrate how we can use conditional statements using Python.
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.
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.

744 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

9 Experts available now in Live!

Get 1:1 Help Now