in reply to multiple set_requests snmp/perl

tommycahir,
Per our conversation in the CB, you indicated you are using Net::SNMP. After reading the docs I can't see a problem even though there aren't any examples with multiple sets in one statement. To be on the safe side - try this:
my @list = ( [$sysName, OCTET_STRING, $newname], [$sysDescr, OCTET_STRING, $newdescription], [$sysContact, OCTET_STRING, $newcontact] ); for my $item ( @list ) { my $result = $snmp_session->set_request( -varbindlist => $item ); warn "error: @{[$snmp_session->error]}\n" if ! $result; }
Cheers - L~R

Replies are listed 'Best First'.
Re: Re: multiple set_requests snmp/perl
by tommycahir (Acolyte) on Mar 03, 2004 at 17:56 UTC
    i tried that code L~R but as before it only sets the first value.. anybody help me before i crack up ere.
      tommycahir,
      Well that's sort of a good sign. It means that there was nothing wrong with your original code and the problem must be elsewhere. I am not sure if $result has any meaningful information but it may be worthwhile to print $result each time through the loop. Additionally, have you checked out the snmpset script that came with Net::SNMP? The only other thing I can suggest is turn the SNMP logging for the server you are setting on way up and tail the log.

      Cheers - L~R

        this is the error i get in the snmpset script when i try run snmpset -c***** -v2c ***.***.***.* sysContact.0 s "Me"
        Error in packet. Reason: notWritable (that object does not support modification)
        Failed object: SNMPv2-MIB::sysContact.0
        L~R tried the snmpset commandline tool and it wont allow me set anything but the sysName so it def not the code. i just wondering what would stop you from setting more than one value in the mib???