smoss has asked for the wisdom of the Perl Monks concerning the following question:

On a command line using snmpset I can send two snmpset messages together, i.e. snmpset 195.7.51.87 private .1.3.6.1.4.1.429.1.2.4.3.0 i 10 .1.3.6.1.4.1.429.1.2.4.5.0 s "config.cfm" This works fine for me, however in my script I only know how to send the OIDs individually,
my $set_file_name = '.1.3.6.1.4.1.429.1.2.4.5.0'; my $set_setfile = '.1.3.6.1.4.1.429.1.2.4.3.0'; my $result = $session->set_request( -varbindlist => [$set_setfile, INTEGER32, 10] ); my $result1 = $session->set_request( -varbindlist => [$set_file_name, OCTET_STRING, "config.cfm"] );
I get a generic error in response. Therefore I think they have to be sent at the same time. Anyone how this can be done?

Replies are listed 'Best First'.
Re: How can I send 2 snmp set_requests at the same time
by RMGir (Prior) on Jun 12, 2002 at 13:57 UTC
    I'm completely clueless about SNMP (and others will say, you can drop the "about SNMP" part :-) ), but looking at Net::SNMP, they don't have leading .'s on the keys they're setting in the examples:
    my $sysUpTime = '1.3.6.1.2.1.1.3.0'; my $result = $session->get_request( -varbindlist => [$sysUpTime] );
    Maybe they're only needed for the commandline utility?
    --
    Mike
      Thanks for the response. It usually works with or without the leading dot. I have tried to make sure here though and indeed I do have the same result either way.
        Darn. Here's hoping some Net::SNMP-clued person wanders by, then.
        --
        Mike
Re: How can I send 2 snmp set_requests at the same time
by zengargoyle (Deacon) on Aug 15, 2002 at 21:00 UTC

    Like this:

    my $set_file_name = '.1.3.6.1.4.1.429.1.2.4.5.0'; my $set_setfile = '.1.3.6.1.4.1.429.1.2.4.3.0'; my $result = $session->set_request( -varbindlist => [ $set_setfile, INTEGER32, 10, $set_file_name, OCTET_STRING, "config.cfm", ]); $result or warn "error: @{[$session->error]}\n";