[c-nsp] Cisco - TCL script document

Shakeel Ahmad shakeelahmad at gmail.com
Sun Sep 10 14:39:09 EDT 2006


I came across this few weeks back in a document - till now i have been
working with perl scripts to automate various things  like i have provided
web-access to some of the very naive technicians to reset few voice ports
from web (using apache)

most often i prefer to use Net::Telnet::Cisco module (install this)

someone asked to run a job every minute here's an example:
save it as a .pl in your cgi-bin directory - there you go it'll be also
available on webserver to call :)

-----------------------------

#!/usr/bin/perl

use Net::Telnet::Cisco;

my $session = Net::Telnet::Cisco->new(Host => '197.x.x.x');

$session->login('USER', 'PASSWORD');

if ($session->enable("ENABLE_PASSWORD") ) {
     @output = $session->cmd('show privilege');
     print "My privileges: @output\n";
} else {
     warn "Contact Admin; Can't enable: " . $session->errmsg;
}

@out = $session->cmd("configure terminal");

@out = $session->cmd("voice-port 3/0/0");
@out = $session->cmd("shutdown");
@out = $session->cmd("no shutdown");
@out = $session->cmd("exit");

@out = $session->cmd("exit");

print "Done Successfully";

$session->close;

-----------------------------



On 9/10/06, Mike Butash <der.mikus at gmail.com> wrote:
>
> I definitely stand corrected, I'd not looked into EEM (am doing so now)
> and whizzing through email I just assumed it was some functionality of
> tclsh given the thread.  Sorry for the confusion.  :)
>
> -mb
>
>
> Rodney Dunn wrote:
> > That's right. There is a a considerable amount you can do with
> > EEM without needing the TCL plugin capability.
> >
> > TCL just gives you a lot more flexibility that what is coded
> > in directly as reaction and trigger events.
> >
> > There will be more coming.
> >
> > Rodney
> >
> > `On Sun, Sep 10, 2006 at 06:55:36PM +1000, David J. Hughes wrote:
> >> On 10/09/2006, at 8:42 AM, Tassos Chatzithomaoglou wrote:
> >>
> >>> Correct me if i'm wrong, but i think what Rodney gave as an example
> >>> is using EEM and not tcl.
> >> That makes more sense.  The example Rodney posted looked nothing like
> >> any TCL I've ever seen before.
> >>
> >>
> >> David
> >> ...
> >> _______________________________________________
> >> cisco-nsp mailing list  cisco-nsp at puck.nether.net
> >> https://puck.nether.net/mailman/listinfo/cisco-nsp
> >> archive at http://puck.nether.net/pipermail/cisco-nsp/
> > _______________________________________________
> > cisco-nsp mailing list  cisco-nsp at puck.nether.net
> > https://puck.nether.net/mailman/listinfo/cisco-nsp
> > archive at http://puck.nether.net/pipermail/cisco-nsp/
> >
> _______________________________________________
> cisco-nsp mailing list  cisco-nsp at puck.nether.net
> https://puck.nether.net/mailman/listinfo/cisco-nsp
> archive at http://puck.nether.net/pipermail/cisco-nsp/
>


More information about the cisco-nsp mailing list