10-26-2012 11:12 PM
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..
10-27-2012 09:36 AM
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
10-27-2012 07:38 PM
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"
10-28-2012 03:14 PM
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?
10-28-2012 08:33 PM
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"
10-28-2012 09:03 PM
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.
10-28-2012 09:24 PM
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
10-31-2012 03:33 PM
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
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide