cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
2307
Views
5
Helpful
4
Replies

EEM action with question mark in URL

dmitry
Level 1
Level 1

Hi

I'm trying to copy a fragment of the IOS config (class-map update) into running-config using EEM (2.3 on 12.4.15T7):

event manager environment ip1 10.224.129.109
event manager applet MACUpdate
event timer watchdog time 30 maxrun 5
action 1.0 info type routername
action 2.0 cli command "enable"
action 3.0 cli command "config t"
action 4.0 cli command "file prompt quiet"
action 5.0 cli command "end"
action 6.0 cli command "copy http://$ip1/cgi-bin/rtr-mac-check.cgi?rtr=$_info_routername running-config"
action 7.0 cli command "config t"
action 8.0 cli command "no file prompt quiet"
action 9.0 cli command "end"

Need to track that the router has actually copied the file, so using the cgi (the rtr-mac-check.cgi does work if run manually on the router)

The problem is that EEM does not escape the "?" in the URL:

*Mar 10 06:30:25.669: %HA_EM-6-LOG: MACUpdate : DEBUG(cli_lib) : : OUT : R1#
*Mar 10 06:30:25.669: %HA_EM-6-LOG: MACUpdate : DEBUG(cli_lib) : : IN  : R1#copy http://10.224.129.109/cgi-bin/rtr-mac-check.cgi?rtr=R1 running-config
*Mar 10 06:30:25.681: cli_history_entry_add: free_hist_list size=0, hist_list size=7
*Mar 10 06:30:25.681: eem_no_scan flag set, skipping scan of command_string=check_eem_cli_policy_handler
*Mar 10 06:30:25.725: %HA_EM-6-LOG: MACUpdate : DEBUG(cli_lib) : : OUT :   http://10.224.129.109/cgi-bin/rtr-mac-check.cgi  A URL beginning with this
*Mar 10 06:30:25.725: %HA_EM-6-LOG: MACUpdate : DEBUG(cli_lib) : : OUT :                                                    prefix
*Mar 10 06:30:25.725: %HA_EM-6-LOG: MACUpdate : DEBUG(cli_lib) : : OUT :
*Mar 10 06:30:25.725: %HA_EM-6-LOG: MACUpdate : DEBUG(cli_lib) : : OUT : R1#
*Mar 10 06:30:25.725: %HA_EM-6-LOG: MACUpdate : DEBUG(cli_lib) : : OUT : %Error opening http://10.224.129.109/cgi-bin/rtr-mac-check.cgirtr=R1 (No such file or directory)
*Mar 10 06:30:25.725: %HA_EM-6-LOG: MACUpdate : DEBUG(cli_lib) : : OUT : R1#

Is there a way to somehow escape it, so it does not get dropped by the EEM?

Thanks

4 Replies 4

Joe Clarke
Cisco Employee
Cisco Employee

Try replacing the '?' with \134077:

action 6.0 cli command "copy http://$ip1/cgi-bin/rtr-mac-check.cgi\134077rtr=$_info_routername running-config"

Thanks for the hint, tried it, the IOS parser eats the \134 leaving only 077, so the copy in the appet fails. I tried \026? and it worked (\026 is the ctrl-V), in the IOS config it looks like:

action 6.0 cli command "copy http://$ip1/cgi-bin/rtr-mac-check.cgi^V?rtr=$_info_routername running-config"

Also rebooted the router to confirm that the parser would not reject it

Regards

Good to hear.  I tested \134077 with a configuration change since I didn't have a CGI URL handy.  This works:

action 1.0 cli command "enable"

action 2.0 cli command "config t"

action 3.0 cli command "event manager environment question \134077"

Thanks for the update.

I just tried this and i cannot get it to work. any tips? i'm pulling my hair out!!