Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

perl/snmp set_request

Status
Not open for further replies.

tommycahir1

Programmer
Feb 20, 2004
34
IE
hi all hope ye can help i trying to set multiple values in the smp mib2 and the following is the code i using but it only sets the first one
$snmp_session is an net::snmp object to the host and with the correct community name. i have no problem, setting the first one but when i try to set the second one it doesnt change it at all i using perl to write the script

my $setResponsePDU = $snmp_session->set_request(sysName,OCTET_STRING,$newname );
my $setResponsePDU1 = $snmp_session->set_request(sysDescr,OCTET_STRING,$newdescription );
my $setResponsePDU2 = $snmp_session->set_request(sysLocation,OCTET_STRING,$newlocation );
my $setResponsePDU3 = $snmp_session->set_request(sysContact,OCTET_STRING,$newcontact );

any help would be great
tanx

 
Try something like ...

my( @list);

push( @list, ($oid1, $type1, $value1));
push( @list, ($oid2, $type2, $value2));
push( @list, ($oid3, $type3, $value3));
push( @list, ($oid4, $type4, $value4));

$result = $snmp_port->set_request( -varbindlist => [@list]);
 
still doesnt work with the varbindlist option
it just doesnt write at all using the varbindlist option
any other ideas

ps what is returned from the set_request?
 
To get the results try ...

$value = $result->{$oid1};
if (defined( $value)) {
print "$count $oid1=$value \n";
}

This will also show any protocol/connection errors.
Can you actually ping the destination?

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top