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

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

Replies are listed 'Best First'.
Re: SNMP Set Error - Set -> Received notWritable(17)
by traveler (Parson) on Aug 19, 2006 at 15:00 UTC
    Your error means what it says: you tried to set a variable that is not writable. Most SNMP implementations of which I am aware do not allow remote setting of the system name. (Think security.) Try 'get'ting the system name or setting something else.