A few potential problems (Net::SNMP may take care of some of these for you):

push(@request, ("1.3.6.1.4.1.2011.6.10.1.2.4.1.2.$rand_value",INTEGER, +6)); # ^ -- Add a leading dot here

You are missing the leading dot on your fully-qualified OID; the examples in Net::SNMP don't include it either, though, but it may be worth a try.

You might also need a trailing .0 after $rand_value to specify the (scalar) index, unless you've accounted for that in $rand_value.

An ErrorStatus of 7 normally corresponds to a WRONGTYPE error. My SNMP is a bit rusty, but I note you are setting up an INTEGER varbind but passing in '6'. Do you need to pack that to a 32-bit signed int? Try:

push(@request, ($OID,INTEGER,pack('l>',6)));

Finally, what does $session->error report? Is it the same as what you see in the log? What happens if you send separate set_request()s for each varbind—i.e., do all of them fail similarly, or is it a more specific problem?

Sorry for the "multiple guess" answer, but it's been a while, and I have no environment capable of testing this. Hope it helps!

use strict; use warnings; omitted for brevity.

In reply to Re: Problem with set request. Net::SNMP module by rjt
in thread Problem with set request. Net::SNMP module by Sergeyk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.