Perl Script to copy running config

I'm writing a Perl script that will set several MIB variables that when complete will cause the target host to push it's running configuration to a TFTP server. When I run the script I get the following error messages:

STORE(SNMP::MIB=HASH(0x996ce74) enterprises. HASH(0x9aadf08)) : write access to the MIB not implemented

snmpset index 5 . 6

set Bad variable type (Sub-id not found: (top) -> enterprises)

Here's a very short version of the script:

--------------------------- #!/usr/bin/perl

use SNMP::Util;

$h = ""; $c = "private"; $oid="."; $ix = "5"; $value="6"; #destroy

$session = new SNMP::Util(-device => $h, -community => $c, -timeout => 2); $session->set(index => $ix,$oid => $value)


If I change the OID to something like . (ifAdminStatus) along with an appropriate index, the script runs fine. The problem I think might have something do to with the fact that the OID's index does not exist until the set operation is performed. However, there are no snmp packets (of any sort) sent when the script fails - so I know it's not doing a get operation prior to the set. (verified with Wireshark)

Any thoughts/ideas would be greatly appreciated.

Thanks JC

Reply to
Loading thread data ...

There's a wealth of already-invented wheels here:

Cisco-centric Open Source Initiative

formatting link

Reply to
Alan Strassberg

Thanks for your suggestion Alan, however, this does not solve my problem. I need to know how to get perl using SNMP::Util to write to the OID I mentioned before.

Reply to
J.Cottingim Forums website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.