My script is supposed to do 'set' request table on the device for config backup
my @request; push(@request, ("1.3.6.1.4.1.2011.6.10.1.2.4.1.2.$rand_value",INTEGER, +6)); push(@request, ("1.3.6.1.4.1.2011.6.10.1.2.4.1.3.$rand_value",INTEGER, +1)); push(@request, ("1.3.6.1.4.1.2011.6.10.1.2.4.1.4.$rand_value",OCTET_ST +RING,"$device_name")); push(@request, ("1.3.6.1.4.1.2011.6.10.1.2.4.1.5.$rand_value",IPADDRES +S,'192.168.0.1')); push(@request, ("1.3.6.1.4.1.2011.6.10.1.2.4.1.6.$rand_value",OCTET_ST +RING,'user')); push(@request, ("1.3.6.1.4.1.2011.6.10.1.2.4.1.7.$rand_value",OCTET_ST +RING,'password')); push(@request, ("1.3.6.1.4.1.2011.6.10.1.2.4.1.9.$rand_value",INTEGER, +4)); my ($session, $error) = Net::SNMP->session( -hostname => $device_ip, -version => 'snmpv1', -community => $device_comunity, ); $result = $session->set_request(-varbindlist=>[@request]); if (!defined $result) { printf "ERROR: %s\n", $session->error(); $session->close(); exit 1; } $session->close();
but it does not work and the device displays a message in the log Aug 4 2013 21:08:33+03:00 device %%01SNMP/4/SNMP_SET(l)[0]:MIB node set. (SourceIP=192.168.0.1, RequestId=376206003, ErrorStatus=7, ErrorIndex=7, hwCfgOperateRowStatus.2667=4) But request directly from the command line works
snmpset -v 1 -c private 192.168.0.2 .1.3.6.1.4.1.2011.6.10.1.2.4.1.2.1 +003 i 6 .1.3.6.1.4.1.2011.6.10.1.2.4.1.3.1003 i 1 .1.3.6.1.4.1.2011.6.10.1.2. +4.1.4.1003 s 'config.cfg' .1.3.6.1.4.1.2011.6.10.1.2.4.1.5.1003 a 192.168.0.1 .1.3.6.1.4.1.2011. +6.10.1.2.4.1.6.1003 s 'user' .1.3.6.1.4.1.2011.6.10.1.2.4.1.7.1003 s 'password' .1.3.6.1.4.1.2011.6 +.10.1.2.4.1.9.1003 i 4
what am I doing wrong?

In reply to 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.