cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Announcements
Popup Hotspot Using ISR 1000 with WiFi/LTE for Teleworkers and Micro Branchesr
1272
Views
0
Helpful
7
Replies
Highlighted
Cisco Employee

EEM - Event help after executio cli in the global prompt

Router#cellular 0/0/0 cdma activate otasp *228

Beginning OTASP activation

OTASP number is *228.

After execution of "cellular 0/0/0 cdma activate otasp *228" on the global prompt of the router...

will  see output “OTASP number is *228.” Log on the console,

Would it be possible to trigger the event after execution  cli and by seeing “OTASP number is *228” logs?.

Also upon event execution, I want to put some delay between action cli commands, how to do this?.

event manager applet OTAF

event ???.

action 2.0  syslog msg "dailing modem"

action 2.1  cli command "enable"

action 2.10 syslog msg "sending dtmf digit 2"

action 2.2  cli command "start-chat script 3"

action 2.3  syslog msg " After 30 seconds delay"

action 2.4  cli command "start-chat tata1 3"

action 2.5  syslog msg "sending dtmf digit 1"

action 2.6  cli command "start-chat script1 3"

action 2.7  syslog msg " After 6 seconds delay"

action 2.9  cli command "start-chat tata2 3"

Appreciate your support here..

Everyone's tags (7)
7 REPLIES 7
Highlighted
Hall of Fame Cisco Employee

EEM - Event help after executio cli in the global prompt

Does that OTASP message actually show up in syslog?  If so then you can do:

event syslog pattern "OTASP number is .228"

As for the delay, while you can add a "wait 30" if you have EEM 3.0 or higher, this may not be recommended.  You would need to increase the maxrun time to probably 50 or higher.  While this is fine to do, it will lock this EEM thread for those 30 seconds.  If you do not anticipate a lot of simultaneous events, then that should be fine.  All you would need to do is add "maxrun 50" after your event line and change action 2.3 to:

action 2.3 wait 30

Highlighted
Cisco Employee

EEM - Event help after executio cli in the global prompt

Hi Joseph,

            Thanks for helping here on this requirment. Actually "OTASP number is .228" not a syslog message, it is message output of the cli , when we execute "Router#cellular 0/0/0 cdma activate otasp *228" this cli.

               Also, I have addede wait 30 action cli command, Whenever event trigger it lock the thread for 30 second, after that action 2.6 cli is not executiing , it is coming out of the event.

action 2.3  cli command "start-chat script 3"

action 2.4  syslog msg " After 30 seconds delay"

action 2.5  wait 20

action 2.6  cli command "start-chat tata1 3"

Highlighted
Hall of Fame Cisco Employee

EEM - Event help after executio cli in the global prompt

If the message is not a syslog message, then you can't match it with EEM.  Can you trigger off of the CLI command itself?

event cli pattern "cellular .* cdma activate otasp" maxrun 50

action 1.0 regexp "otasp (*228)" $_cli_line match pattern

...

Would that work?

Highlighted
Cisco Employee

EEM - Event help after executio cli in the global prompt

i did tried it , it seems to be there is syntax error in the regexp match getting following error after execution of cli.

Reliance-otasp#cellular 0/0/0 cdma activate otasp *228

Beginning OTASP activation

OTASP number is *228

Reliance-otasp#

*Oct 29 03:28:19.442: %HA_EM-6-FMPD_REGCOMP: Error compiling regular expression: *** unknown regexp error code ***

*Oct 29 03:28:19.442: %HA_EM-3-FMPD_ERROR: Error executing applet OTAF statement 1.9

event manager applet OTAF

event cli pattern "cellular .* cdma activate otasp" maxrun 50 enter

action 1.9 regexp "OTASP (*228)" $_cli_line match pattern

action 2.0  syslog msg "dailing modem"

action 2.2  cli command "enable"

action 2.3  cli command "start-chat script 3"

Highlighted
Hall of Fame Cisco Employee

EEM - Event help after executio cli in the global prompt

Sorry, regex should be:

action 1.9 regexp "otasp (.228)" $_cli_line match pattern

You have to match the CLI command, not its output.  You could use "\*" instead of '.', but the '.' will work.

Highlighted
Cisco Employee

EEM - Event help after executio cli in the global prompt

Hi Joseph,

          Now i am not seeing any syntax in regexp but event triggering immediately without seeing this message "

OTASP number is *228"  after entering the cli.

Reliance-otasp#cellular 0/0/0 cdma activate otasp *228

*Oct 29 04:22:03.818: %HA_EM-6-LOG: OTAF: dailing modem

*Oct 29 04:22:03.838: CHAT0/0/0: Matched chat script script to string script

*Oct 29 04:22:03.838: CHAT0/0/0: Asserting DTR

*Oct 29 04:22:03.838: CHAT0/0/0: Chat script script started

*Oct 29 04:22:03.838: CHAT0/0/0: Sending string: AT!AVTONEPLAY=1,31

*Oct 29 04:22:03.838: CHAT0/0/0: Expecting string: OK

*Oct 29 04:22:03.886: CHAT0/0/0: Completed match for expect: OK

*Oct 29 04:22:03.886: CHAT0/0/0: Chat script script finished, status = Success

*Oct 29 04:22:03.946: %HA_EM-6-LOG: OTAF:  After 30 seconds delay

Highlighted
Hall of Fame Cisco Employee

EEM - Event help after executio cli in the global prompt

This is expected.  As I said, you won't be able to match on the message coming from the CLI command.  If you have to wait, introduce another wait statement as the first action.  For example:

action 0.5 wait 5

CreatePlease to create content
Content for Community-Ad