Showing results for 
Search instead for 
Did you mean: 

Event manager with large output (how to filter???)

Hello experts,


I'm trying to figure it out a way that I can manipulate an output in a way that I can store 2 variables, here's my output:


SW-CLOSET_3-100#show cts interface summary | in MANUAL
Te5/2      MANUAL  OPEN      unknown    unknown    invalid  Invalid
Te6/2      MANUAL  OPEN      unknown    unknown    invalid  Invalid


I need to grab Te5/2 and Te6/2 from that output since I need to make some configurations after the device reloads since I have a BUG that everytime that these devices (Catalyst 9400) reload CTS fails so I need to remove CTS and re-apply it back.


I have another example where I'm trying to manipulate a big output:

Translating ""...domain server ( [OK]

"comment": "##     Your IP Address is XXX.XXX.XXX.XXX (43683)     ##",

"family": "ipv4",
"ip": "XXX.XXX.XXX.XXX",
"port": "43683",
"protocol": "ssh",
"version": "v1.0.0",
"website": ""
[Connection to closed by foreign host]


I'm using this output to build another EEM that works with DDNS on a DMZ area, but I have no idea how to just grab the IP part.


Any ideas on both solutions???


Thanks as always and appreciate the time that you take to read my post.




After reviewing the whole thing I validate that I don't need to update with a specific IP since automatically the http will receive the public IP so I'm trying to make a TCL quite simple but I'm not sure how to do it, if I use tclsh to test everything works fine but I'm not sure how to translate the tclsh to the tcl Scrip, for example, if I go to the tclsh I can update my address:


WS-C3560CG(tcl)#set result [exec {more}]
good X.X.X.X



Where the user, password and fqdn are my account values (the ones that I use to validate my user and fqdn) and X.X.X.X is the public IP address.


So my question is how to translate this tclsh to the tcl script: set result [exec {more}] every 4 hours and every time the router is reloaded?


Also, I needed to type Ctrl+V then ? to be able to paste the question mark.


Thanks and appreciate it

Joe Clarke
Hall of Fame Cisco Employee

You can either do the same CLI within EEM+Tcl (you already have examples of CLI) or you can do what I suggested in order to modify your URL, correct the get_url usage, and use the http client library without any CLI interaction.

Thanks Joe for all your help. I figure it how to sent the ? for my ddns query, here's the final output:


event manager applet ddns authorization bypass
 event none
 action 010 set noip "\x16"
 action 020 append noip "\x3f"
 action 025 append noip "hostname=fqdn"
 action 030 puts "$noip"
 action 035 cli command "enable"
 action 040 cli command "more $noip"


From the debug I can see now the query:

WS-C3560CG#%HA_EM-6-LOG: ddns : DEBUG(cli_lib) : : IN  : WS-C3560CG#more
Feb 23 11:00:56.904 ET: %HA_EM-6-LOG: ddns : DEBUG(cli_lib) : : OUT : good <PUBLIC IP>
Feb 23 11:00:56.904 ET: %HA_EM-6-LOG: ddns : DEBUG(cli_lib) : : OUT :
Feb 23 11:00:56.904 ET: %HA_EM-6-LOG: ddns : DEBUG(cli_lib) : : OUT : WS-C3560CG#
Feb 23 11:00:56.904 ET: %HA_EM-6-LOG: ddns : DEBUG(cli_lib) : : CTL : cli_close called.


I really appreciate all your help.