I could use some help understanding what's happening (or if I'm doing
something wrong): I'm using the perl SNMP module to read/set a specific
Cisco OID that is read/create having integer as value.
I can set the OID using command line (to know it works):
snmpset -v 1 -c derp 172.30.10.254 ciscoMgmt.46.1.6.1.1.13.10118 i 1
.1.3.6.1.4.1.9.9.46.1.6.1.1.13.10118 = INTEGER: 1
'10118' is an ifIndex -- pretty straightforward. When I try to do the same
from within a perl script, I get a 'wrongType' error. Below is the code
sample, first reading the value and (re)setting the same.
#!/usr/bin/perl
use SNMP;
my $host = shift || 'localhost';
my $community = shift || 'private';
my $sess = new SNMP::Session (DestHost => $host,
Community => $community,
Version => 2,
UseNumeric => 1,
UseSprintValue => 1,
UseEnums => 1,
UseLongNames => 1,
Debugging => 2,
Retries => 2);
my $oid = ".1.3.6.1.4.1.9.9.46.1.6.1.1.13";
my $IF = 10118;
my $var = $sess->get([$oid,$IF]);
print "$var\n" ;
sleep 1 ;
$sess->set([$oid,10118,$var,'INTEGER']) ;
print $sess->{ErrorNum} . ' ' . $sess->{ErrorStr} . "\n" ;
exit ;
The output is '1' (per the read), and '7 wrongType (The set datatype does
not match the data type the agent expects)'
I've tried several syntax variations yet, for something so simple, it
doesn't work. As an aside, I created a 'Net::SNMP' equivalent to the script
and it worked perfectly fine -- I'm rather confounded as to why this one
doesn't. The module version is 5.05, that it relatively new (and I couldn't
find any references to this being buggy.)
I feel like I'm missing something obvious, but given the amount of time
I've put into trying to understand it...
------------------------------------------------------------------------------
One dashboard for servers and applications across Physical-Virtual-Cloud
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
_______________________________________________
Net-snmp-users mailing list
Net-snmp-users@lists.sourceforge.net
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/listinfo/net-snmp-users