Cisco Support Community
Community Member

Use an EEM to send a message to all current VTY lines

Hello again, community.

I'm currently looking for documentation on EEM commands as a whole. One that has me stuck, is having EEM send a message to all VTY lines.


The reason behind this, is to send output in the event that my EEM fails. I've configured an If / else statement that would work great for it.


If you have everything you need to complete the task, then do it. Else, send a message to all VTY lines saying "I'm unable to complete my task."


I'm stuck on what commands are needed to do this, as I'm not quite sure hwo I can send the "CTRL-Z" via EEM.


Thanks in advance for the assistance! Please let me know if you need me to clarify anything. (I can post me EEM for review, if you would like.)

Everyone's tags (1)
Cisco Employee

You can use the ASCII code

You can use the ASCII code for the "sub" character to trigger a Control+Z.  That code is \032.  If you have your policy interacting with the "send" prompt already, then send \032 to cause the Control+Z.  You may run into issues doing this with an applet as Control+Z will be interpreted by the config.  It's much easier to do this via Tcl.

Community Member

Joseph,Thank you for the


Thank you for the suggestion! I'd like to try this and see where I get. Do you know of an example config that uses this within an EEM, or is it something that is typically done via TCL? I'm really trying to find a way to send custom information to the VTY lines. That's the only way I can think of, to inform a user that an EEM has failed to complete.


Another thought, would be to have the EEM run the action "terminal monitor" before executing, and then running the terminal no monitor when it's finished. That would theoretically display the failed EEM output. At the same time, however, it would display any input currently logging to the console. =/


If you're curious, this is my EEM in question.

The goal is to have it inform the user in the event of a failure. (I currently have it doing this via e-mail):


event manager applet backup_config_on_save
 event cli pattern "write" sync no skip no
 action 0.01 info type routername
 action 1.00 cli command "enable"
 action 1.01 cli command "ping $tftp_server"
 action 1.02 regexp "is (0) percent" "$_cli_result" match ping_result
 action 1.03 if $_regexp_result eq "0"
 action 1.04  cli command "configure terminal"
 action 1.05  cli command "file prompt quiet"
 action 1.06  cli command "end"
 action 1.07  cli command "copy running-config tftp://$tftp_server/$_info_routername"
 action 1.08  cli command "configure terminal"
 action 1.09  cli command "no file prompt quiet"
 action 2.00 else
 action 2.01  mail server "$_email_server" to "$_email_to" from "$_email_from" subject "EEM: Unable to save $_info_routername config." body "Unable to ping TFTP server: $tftp_server from device: $_info_routername.\nPlease review."
 action 2.02 end



Thanks again for your assistance on this!

Cisco Employee

What you have here is very

What you have here is very dangerous.  You should consider changing your pattern to "^write" at the very least.  But even so, this would match write net, write term, and wouldn't catch "copy runn start".


In terms of sending a ^Z in an applet, I don't have an example I can think of.  Though this is familiar, so maybe if you search around you might find one.  Within EEM Tcl, this is trivial.  One can simply add \032 in a cli_write call to cause the ^Z.  In an applet, you might have to do something like:


event manager applet slash \

event manager applet cz 032


action X cli command "$slash$cz"

CreatePlease to create content