04-10-2014 05:38 AM
Can EEM telnet to other switches.
It doesn't seem to work and when you run debug it drops out at the password for telnet.
I have tried using the "pattern" option to put the telnet password in. but can't get it to work
All I won't to be able to do is automatically run a few commands on other switches from the core.
Any ideas
04-10-2014 05:51 AM
I can assure you EEM on IOS can initiate telnet session without a hitch, but on IOX, still struggling to find out the workaroud.
proc remote_cmd_telnet { remote_host username password prompt_expect clist } {
# this function will carry out each command contained in the clist on remote host.
if { [catch {cli_open} result] } {
PUTS $result
return 1
} else {
array set cliarr $result
}
#Login to remote router
if { [catch {cli_write $cliarr(fd) "telnet $remote_host" } result] } {
PUTS $result
return 1
}
PUTS $result
# if { [catch {cli_read_pattern $cliarr(fd) "Username:"} result] } {
# PUTS error "Failed to read response: '$result'"
# return 1
# }
#
#
# PUTS $result
#
if { [catch {cli_write $cliarr(fd) $username } result] } {
PUTS $result
return 1
}
PUTS $result
if { [catch {cli_read_pattern $cliarr(fd) "Password:"} result] } {
PUTS error "Failed to read response: '$result'"
return 1
}
PUTS $result
if { [catch {cli_write $cliarr(fd) $password } result] } {
PUTS $result
return 1
}
PUTS $result
if { [catch {cli_read_pattern $cliarr(fd) "#"} result] } {
04-10-2014 08:32 AM
Yes EEM does initiate telnet, I can see that from the debug but doesn't seem to accept the password using pattern. What you have written looks great but way over my head. I take it it I could just paste it to the switch and that would create the process remote_cms_telnet.
there is no username required, there is just the vty/telnet password.
All I want to do is run a progam that will telnet to various switches and run a few commands on a selection of ports It was 6 commands using EEM but it doesn't work.
Regards
Paul
04-10-2014 08:45 AM
Hi Paul,
Please tell me which IOS /IOX version you are running ?
04-10-2014 08:50 AM
Version 12.2(17r)SX3, RELEASE SOFTWARE (fc1)
04-10-2014 09:08 AM
Paul,
I believe that IOS is not capable of doing that, like Ivan posted long time ago.
http://blog.ipspace.net/2007/10/you-cannot-start-telnet-session-from.html
If possible, please upgrade to 15.X, which fixed some bugs about eem.
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide