cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1390
Views
0
Helpful
4
Replies

EEM to start and close a telnet session?

pingduck
Level 1
Level 1

I wrote an EEM script to start a telnet session 

 

event manager applet getip

event none maxrun 20

action 10 cli command "enable"

action 20 cli command "telnet someserver 54321" pattern "Open"

action 30 cli command "show internal ip" pattern "prompt"

action 50 regexp "([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)" "$_cli_result" ip

action 60 puts "$ip"

 

However, the telnet session is not closed by remote. As a result, my script cannot apply additional config. Is there a way to close the current EEM triggered telnet session? e.g. injecting the escape sequence using "cli command"?

 

4 Replies 4

Hi, can you test another service like this:

telnet telnetmyip.com

 

When you get the IP, the remote server close the connection.

 

Regards.

Regarding using telnetmyip.com. It is not what my EEM script trying to do. It was just an example, I don't have control over the server. I know it does not close connection for minutes.

mkazam001
Level 3
Level 3

I have seen that thread but I don't want to use Tcl script. Specifically there is difficulty adding a file as oppose to a simple config change. I feel that I am very close. I can think of triggering another EEM script to continue with the result but I would much prefer doing it in a single EEM script to keep it simple.