Hi Monks

I am a newbie to SNMP and learning to program SNMP in Perl i have a problem in setting the value of the OID. I have tried to run even in the command line gives me the same error

ERROR: Set -> Received notWritable(17) error-status at error-index 0.

I can smell that there is some problem with the permission for which i am not able to set the value i am able to get the requested information using the Get command perfectly but when i am using set i get the error. By default, the agent responds to the "public" community for read only access, so how can i make it possible to make the set to work.

My Code is

#!/usr/bin/perl use strict; use Net::SNMP; my ($session, $error) = Net::SNMP->session( -hostname => shift || 'localhost', -community => shift || 'public', -port => '161', -version => 'snmpv2' ); # -username => 'root' # -authkey => '0x05c7fbde31916f64da4d5b77156bdfa7', # -authprotocol => 'md5', # -privkey => '0x93725fd3a02a48ce02df4e065a1c1746' # ); #print "=======$session"; if (!defined($session)) { printf("ERROR: %s.\n", $error); exit 1; } my $sysName = '1.3.6.1.2.1.1.5.0'; my $result = $session->set_request( -varbindlist => [$sysName, OCTET_STRING, "Help Desk x911"] ); if (!defined($result)) { printf("ERROR: Set -> %s.\n", $session->error); $session->close; exit 1; } printf("sysContact for host '%s' set to '%s'\n", $session->hostname, $result->{$sysName} ); $session->close; exit 0;

Work Hard Party Harderrr!!
Sushil Kumar

In reply to SNMP Set Error - Set -> Received notWritable(17) by msk_0984

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.