Problem with Net-snmp Perl module
Raul Miguel Nery Ferreira Sa <[email protected]>
| Newsgroups | gmane.network.net-snmp.user |
|---|---|
| Message-ID | <[email protected]> |
Hello all, I'm having a little trouble with using SNMP and Perl to get a
specific information from a Cisco Acess Point. Here is the situation:
I'm using SNMP and The Perl5 'SNMP' Extension Module for the Net-SNMP Library
(http://www.net-snmp.org/docs/perl-SNMP-README.html) to basically get a
configuration file from a Cisco AP 1200. This is possible thanks to the
CISCO-CONFIG-COPY-MIB and to the ccCopyTable OBJECT that exists in this
MIB.Now to do this operation with SNMP from the command line i execute
this command,wich i will call command ONE:
snmpset -v2c -c TRW 192.168.0.18 .1.3.6.1.4.1.9.9.96.1.1.1.1.2.104 i 1
.1.3.6.1.4.1.9.9.96.1.1.1.1.3.104 i 4 .1.3.6.1.4.1.9.9.96.1.1.1.1.4.104 i 1
.1.3.6.1.4.1.9.9.96.1.1.1.1.5.104 a "192.168.0.11"
.1.3.6.1.4.1.9.9.96.1.1.1.1.6.104 s "cisco-config"
.1.3.6.1.4.1.9.9.96.1.1.1.1.14.104 i 4
If i am not wrong the command above does multiple sets at the same time in
the specified OIDs. Also the command above works fine. However if i want to
execute the command ONE more than one time i have to execute this
other command,wich i will call command TWO:
snmpset -v2c -c TRW 192.168.0.18 .1.3.6.1.4.1.9.9.96.1.1.1.1.14.104 i 6
This command will clear something on table wich will allow me to execute
command one again. This is just for your information.
Now what i am trying to do is to use the perl extension module to
emulate command ONE in Perl.So in Perl the code will be something like this:
-------Code Snipet--------------------------
my $host= 192.168.0.18; my $ver = '2c';
my $comm = 'TRW';
&SNMP::addMibFiles("CISCO-SMI.txt");
&SNMP::addMibFiles("CISCO-CONFIG-COPY-MIB.txt");
$protocol="1";
#ccCopySourceFileType
$file_source_type="4";
#ccCopyDestFileType
$file_dest_type="1";
#ccCopyServerAddress
$tftp="192.168.0.11";
#ccCopyFileName
$file="$host";
#ccCopyEntryRowStatus
$action="4";
#Creating a SNMP Session.
$sess = new SNMP::Session (DestHost => $host, Community => $comm, Version
=> $ver) or die "Got $sess->{ErrorStr} on opening session.\n";
$itens = new SNMP::VarList(['ccCopyProtocol', 104, $protocol]
,['ccCopySourceFileType', 104, $file_source_type],['ccCopyDestFileType',
104,$file_dest_type], ['ccCopyServerAddress', 104, $tftp],
['ccCopyFileName', 104, $file], ['ccCopyEntryRowStatus', 104, $action] );
$sess->set($itens) or die "Got $sess->{ErrorStr} querying host.\n";
--------------End of Code Snipet--------------------------------
Before i ran this on Perl i executed command TWO offcourse.
So when i finally ran the code above in Perl it returned timeout in the
section of the code where i apply $sess->set. The session creating part did
ok but it failed to apply the set to the OIDs.
Is there anyone that can help me with this problem?
Thanks in advance,
Raul de Sá
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Net-snmp-users mailing list
[email protected]
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/listinfo/net-snmp-users