Perl Script to copy running config

Discussion in 'Cisco' started by J.Cottingim, Jul 11, 2007.

  1. J.Cottingim

    J.Cottingim Guest

    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.9.9.96.1.1.1.1.14
    HASH(0x9aadf08)) : write access to the MIB not implemented

    snmpset 10.10.1.1 index 5 .1.3.6.1.4.1.9.9.96.1.1.1.1.14 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 = "10.10.1.1";
    $c = "private";
    $oid=".1.3.6.1.4.1.9.9.96.1.1.1.1.14";
    $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 .1.3.6.1.2.1.2.2.7
    (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
    J.Cottingim, Jul 11, 2007
    #1
    1. Advertising

  2. In article <>,
    J.Cottingim <> wrote:
    >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.


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

    Cisco-centric Open Source Initiative

    http://sourceforge.net/project/showfiles.php?group_id=25401

    alan
    Alan Strassberg, Jul 14, 2007
    #2
    1. Advertising

  3. J.Cottingim

    J.Cottingim Guest

    > There's a wealth of already-invented wheels here:
    >
    > Cisco-centric Open Source Initiative
    >
    > http://sourceforge.net/project/showfiles.php?group_id=25401
    >
    > alan


    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.
    J.Cottingim, Jul 16, 2007
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. mkinsman

    NAS Perl/CGI Script

    mkinsman, Nov 23, 2003, in forum: Cisco
    Replies:
    0
    Views:
    547
    mkinsman
    Nov 23, 2003
  2. Replies:
    4
    Views:
    9,181
    Hansang Bae
    Mar 10, 2005
  3. tomviolin
    Replies:
    9
    Views:
    1,066
    Richard Graves
    Apr 26, 2005
  4. Replies:
    4
    Views:
    10,359
  5. business one way

    Is it a Perl program or a Perl script?

    business one way, Jan 5, 2008, in forum: Digital Photography
    Replies:
    0
    Views:
    669
    business one way
    Jan 5, 2008
Loading...

Share This Page