I am using net::snmp to make a cisco router write its running-configuration to its startup-configuration. my oid value seems to be correct, and my net::snmp syntax also seems to be correct. however, my $s->error; call continues to get a value.
I receive No response from agent on remote host 'router' when i run the code against the router. The odd part, is that it works! The config actually gets committed to the router's startup memory, however it almost seems as though the process is taking long enough that net::snmp is thinking that the connection has timed out or that the router is not responding to the snmpset.

my code is as follows:

my $mib = "$wrmem"; for my $host(@routers) { my $s = Net::SNMP->session( -hostname => $host, -community => $community ); $s->set_request($mib, INTEGER, "1"); my $error = $s->error; $s->close; if ($error) { print "\n$error\n\n"; } else { print "\nSuccessfully wrote config to memory on $host.\n\n"

So, although not directly a perl question, does anyone have input on how i could get around this issue but still keep error checking in the mix?

humbly -c


In reply to SNMP question more than a perl question by c

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.