I am using the Net:SNMP product from within Active Perl 5.2 and am
experiencing issues. I perform two functions - first get a variable and
trim it then will use the value to tftp the ios from a router to a
server. The Get is working fine but the set is not. In order to
determine if I had set parms wrong I just tried to change the sys
contact info and still failed. I could use another set of eyes on the
code and any suggestions would be appreciated. I am also using the most
current version of Net:SNMP. The error code returned is an error-code
61 on the set.
Thanks,
George
sub SNMPSUBR {
my($Phost)=shift(@_);
my($Rcomm)=shift(@_);
use SNMP;
$sess = new SNMP::Session(Version=>'2c',Community
=>$Rcomm,DestHost=>$Phost,Output=>'v',ErrorNum,ErrorStr);
$Nval = $sess->get ('1.3.6.1.4.1.9.2.1.73.0') if
$sess->get ('1.3.6.1.4.1.9.2.1.73.0') ; # get ios Image name on router
$Errcode1 = "$sess->{ErrorNum}";
$Errmsg1 = "$sess->(ErrorStr)";
$Errcode2 = $Errcode1;
while ($Errcode2 == 0)
{
$Rdx1 = index($Nval,":")+1;
if (($Rdx1 > 0)) {$Retval =
substr($Nval,$Rdx1)}
else {$Retval = $Nval};
#print "SNMPREAD Subroutine ",$Nval,"
",$Rdx1," ",$Retval," ",$Errcode1," ",$Errmsg1,"\n";
$Errcode2=1;
}
return;
}
#
sub SNMPSUBW {
my($Phost)=shift(@_);
my($Wcomm)=shift(@_);
use SNMP;
$sess = new SNMP::Session(Version=>'2c',Community
=>$Wcomm,DestHost=>$Phost,Output=>'v',ErrorNum,ErrorStr);
$sess->set('.1.3.6.1.2.1.1.4.0 s "Test02"
1.3.6.1.2.1.1.4.0 = Test02');
$Errcode2 = "$sess->{ErrorNum}";
$Errmsg2 = "$sess->(ErrorStr)";
print $Phost," ",$Wcomm," ",$Errcode2," ",$Errmsg2,"\n";
#
#$Errcode2 = "$sess->{ErrorNum}";
#$Errmsg2 = "$sess->(ErrorStr)";
#print "SNMPWRITE Session Establishment ",$Errcode2,"
",$Errmsg2,"\n";
#Wrnet01 = $Wrnetmib.$Tftphost;
#$sess->set('$Wrnet01 s $Nval
enterprises.9.2.10.9.$Tftphost = $Retval');
#print "SNMPWRITE Set Results ",$Phost," ",$Wcomm,"
",$Wrnet01," ","enterprises.9.2.10.9.".$Tftphost," ",$Nval," ",$Retval,"
",$Errcode2, # " ",$Errmsg2,"\n";
#
return;
}
George R. Garcia
EDS-Nextel
Network Engineering
* phone: +01-248-863-6496
* mailto:[EMAIL PROTECTED]
-------------------------------------------------------
This SF.Net email is sponsored by Oracle Space Sweepstakes
Want to be the first software developer in space?
Enter now for the Oracle Space Sweepstakes!
http://ads.osdn.com/?ad_idt12&alloc_id344&op=click
_______________________________________________
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