04-25-2013 05:36 PM
Is it possible this way if I'm making two script? Thanks.
Script 1
For this log:
Apr 24 07:40:01.884 MNL: %LINK-3-UPDOWN: Interface Cellular0/2/0, changed state
to down
ROUTER(config)#event manager applet cell1
ROUTER(config-applet)# event syslog pattern "Interface Cellular0/2/0, changed state to down"
ROUTER(config-applet)# action 1.0 cli command "enable"
ROUTER(config-applet)# action 1.1 cli cmmand "configure term"
ROUTER(config-applet)# action 1.2 cli command "interface Cellular0/2/0"
ROUTER(config-applet)# action 1.3 cli command "no shut"
ROUTER(config-applet)#
Script 2
For this log:
Apr 25 11:17:49.881 MNL: %CELLWAN-2-MODEM_DOWN: Modem in HWIC slot 0/2 is DOWN
ROUTER(config)#event manager applet cell2
ROUTER(config-applet)# event syslog pattern "Modem in HWIC slot 0/2 is DOWN"
ROUTER(config-applet)# action 1.0 cli command "enable"
ROUTER(config-applet)# action 1.1 cli cmmand "reload at 19:00"
ROUTER(config-applet)#
Solved! Go to Solution.
10-07-2013 06:15 PM
On the underlined logs below, i can see now that the script is working on the 2 downtime instances but there's no indication that the reload command works.
Oct 7 09:09:33.086 MNL: %CELLWAN-2-MODEM_DOWN: Modem in HWIC slot 0/0 is DOWN
Oct 7 09:09:49.674 MNL: %LINK-5-CHANGED: Interface Cellular0/0/0, changed state
to reset
Oct 7 09:09:52.926 MNL: %CELLWAN-2-MODEM_UP: Modem in HWIC slot 0/0 is now UP
Oct 7 09:09:54.674 MNL: %LINK-3-UPDOWN: Interface Cellular0/0/0, changed state
to down
Oct 7 09:10:14.718 MNL: %LINK-3-UPDOWN: Interface Cellular0/0/0, changed state
to up
Oct 8 08:29:28.113 MNL: %CELLWAN-2-MODEM_DOWN: Modem in HWIC slot 0/0 is DOWN
ROUTER#sh event manager history events
No. Job Id Proc Status Time of Event Event Type Name
1 1 Actv success Mon Oct 7 09:09:33 2013 syslog applet: cell2
2 2 Actv success Tue Oct 8 08:29:28 2013 syslog applet: cell2
Oct 8 09:14:14.948 MNL: %HA_EM-6-LOG: cell2 : DEBUG(cli_lib) : : CTL : cli_open called.
Oct 8 09:14:14.952 MNL: %HA_EM-6-LOG: cell2 : DEBUG(cli_lib) : : OUT : PHILAM-ANT-BR01>
Oct 8 09:14:14.952 MNL: %HA_EM-6-LOG: cell2 : DEBUG(cli_lib) : : IN : PHILAM-ANT-BR01>enable
Oct 8 09:14:15.264 MNL: %HA_EM-6-LOG: cell2 : DEBUG(cli_lib) : : OUT : PHILAM-ANT-BR01#
Oct 8 09:14:15.264 MNL: %HA_EM-6-LOG: cell2 : DEBUG(cli_lib) : : IN : PHILAM-ANT-BR01#show clock
Oct 8 09:14:15.276 MNL: %HA_EM-6-LOG: cell2 : DEBUG(cli_lib) : : OUT : 09:14:15.264 MNL Tue Oct 8 2013
Oct 8 09:14:15.276 MNL: %HA_EM-6-LOG: cell2 : DEBUG(cli_lib) : : OUT : PHILAM-ANT-BR01#
Oct 8 09:14:15.276 MNL: %HA_EM-6-LOG: cell2 : DEBUG(cli_lib) : : CTL : cli_close called.
Also HWIC slot 0/0 keeps and always be down. How to prevent this?
Thank you so much.
10-07-2013 11:13 PM
The reload will only be invoked if the time is between 19:00 and 06:00. The current time is 09:14. So the router will not reload. In terms of the HWIC, you don't do anything in your applet to bring it back up. If there are commands that need to be run, add them to your cell2 applet.
10-08-2013 12:42 AM
is it still works even if it doesn't show up in sh logs? normally reload will take 3-5mins, but logs shows HWIC slot 0/0 is UP after a split second. (in bold)
Oct 7 09:09:33.086 MNL: %CELLWAN-2-MODEM_DOWN: Modem in HWIC slot 0/0 is DOWN
Oct 7 09:09:49.674 MNL: %LINK-5-CHANGED: Interface Cellular0/0/0, changed state
to reset
Oct 7 09:09:52.926 MNL: %CELLWAN-2-MODEM_UP: Modem in HWIC slot 0/0 is now UP
Oct 7 09:09:54.674 MNL: %LINK-3-UPDOWN: Interface Cellular0/0/0, changed state
to down
Oct 7 09:10:14.718 MNL: %LINK-3-UPDOWN: Interface Cellular0/0/0, changed state
to up
Oct 8 08:29:28.113 MNL: %CELLWAN-2-MODEM_DOWN: Modem in HWIC slot 0/0 is DOWN
10-08-2013 08:03 AM
I don't really understand what the flow from a hardware standpoint should be. All I can tel you is what I see from the applet commands. The cell1 applet runs the test command (what it should do, I don't know, but it is running). The cell2 applet checks the time and reloads the whole router if the time is within a specific window. That should work, too, if the time is right.
10-08-2013 05:52 PM
Sorry for being persistent, but for this scenario below, the HWIC did state it was down as of 00:05, but i think the applet didn't works, it supposed to reload between 19:00-6:00. So i reloaded it manually after i've noticed it at 8:43.
Oct 9 00:05:58.018 MNL: %CELLWAN-2-MODEM_DOWN: Modem in HWIC slot 0/0 is DOWN
Oct 9 08:43:05.044 MNL: %SYS-5-SCHEDULED_RELOAD: Reload requested for 20:00:00 MNL Wed Oct 9 2013 at 08:43:03 MNL Wed Oct 9 2013 by jvi01131990 on vty0 (10.49.
135.135). Reload Reason: Reload Command.
Oct 9 08:46:47.592 MNL: %SYS-5-CONFIG_I: Configured from console by jvi01131990 on vty0 (10.49.135.135)
Oct 9 08:46:56.184 MNL: %HA_EM-6-LOG: cell2 : DEBUG(cli_lib) : : CTL : cli_open called.
Oct 9 08:46:56.192 MNL: %HA_EM-6-LOG: cell2 : DEBUG(cli_lib) : : OUT : Reload scheduled for 20:00:00 MNL Wed Oct 9 2013 (in 11 hours and 13 minutes) by jvi0113
1990 on vty0 (10.49.135.135)
Oct 9 08:46:56.192 MNL: %HA_EM-6-LOG: cell2 : DEBUG(cli_lib) : : OUT : Reload reason: Reload Command
Oct 9 08:46:56.192 MNL: %HA_EM-6-LOG: cell2 : DEBUG(cli_lib) : : OUT : PHILAM-ANT-BR01>
Oct 9 08:46:56.192 MNL: %HA_EM-6-LOG: cell2 : DEBUG(cli_lib) : : IN : PHILAM-ANT-BR01>enable
Oct 9 08:46:56.504 MNL: %HA_EM-6-LOG: cell2 : DEBUG(cli_lib) : : OUT : PHILAM-ANT-BR01#
Oct 9 08:46:56.504 MNL: %HA_EM-6-LOG: cell2 : DEBUG(cli_lib) : : IN : PHILAM-ANT-BR01#show clock
Oct 9 08:46:56.516 MNL: %HA_EM-6-LOG: cell2 : DEBUG(cli_lib) : : OUT : 08:46:56.508 MNL Wed Oct 9 2013
Oct 9 08:46:56.516 MNL: %HA_EM-6-LOG: cell2 : DEBUG(cli_lib) : : OUT : PHILAM-ANT-BR01#
Oct 9 08:46:56.516 MNL: %HA_EM-6-LOG: cell2 : DEBUG(cli_lib) : : CTL : cli_close called.
Oct 9 08:48:40.104 MNL: %HA_EM-4-FMPD_NO_EVENT: No event configured for applet cell2
Oct 9 08:48:40.104 MNL: %SYS-5-CONFIG_I: Configured from console by jvi01131990 on vty0 (10.49.135.135)
10-09-2013 08:02 AM
This debug is from 08:46, though. It doesn't show what happened at midnight.
11-05-2013 05:16 PM
I've noticed that the syslog below sometimes occur between 6AM - 6PM, so which means the event applet below will not take effect. question, how can i do a script that whenever the syslog pattern occur b/n 6AM-6PM i could set it up to reload automatically at 7PM. thanks
event manager applet cell2
description "TEST ONLY"
event syslog pattern "Modem in HWIC slot 0/0 is DOWN"
action 1.0 cli command "enable"
action 1.1 cli command "show clock"
action 1.2 regexp "([0-9]+):[0-9]+:[0-9]+" "$_cli_result" match hour
action 1.3 if $hour ge 18
action 1.4 reload
action 1.5 end
action 1.6 if $hour le 6
action 1.7 reload
action 1.8 end
11-06-2013 11:55 AM
Have this applet configure another applet that triggers a reload at 19:00. That is, add actions like:
event manager environment q "
!
action 1.7 cli command "config t"
action 1.8 cli command "event manager applet reload-at-seven"
action 1.9 cli command "event timer cron cron-entry $q 0 19 * * *$q"
action 2.0 cli command "action 1.0 reload"
action 2.1 cli command "end"
action 2.2 end
Same thing starting at action 1.4.
11-06-2013 04:11 PM
is this correct?
event manager applet cell3
description "TEST ONLY"
event syslog pattern "Modem in HWIC slot 0/0 is DOWN"
action 1.0 cli command "enable"
action 1.1 cli command "show clock"
action 1.2 regexp "([0-9]+):[0-9]+:[0-9]+" "$_cli_result" match hour
action 1.3 if $hour ge 18
action 1.4 reload
action 1.5 end
action 1.6 if $hour le 6
action 1.7 reload
action 1.8 end
action 1.9 cli command "config t"
action 2.0 cli command "event manager applet reload-at-seven"
action 2.1 cli command "event timer cron cron-entry $q 0 19 * * *$q"
action 2.2 cli command "action 1.0 reload"
action 2.3 cli command "end"
action 2.4 end
11-07-2013 04:45 PM
No. The action numbers I listed were what I meant. Meaning what I provided was designed to replace action 1.7 on. Note: you'll also have to replace actions 1.4 and 1.5 with the same list of items I did starting at action 1.7.
11-07-2013 10:22 PM
is this right?
the script must have this 2 scenario below. thanks.
event manager applet cell3
description "TEST ONLY"
event syslog pattern "Modem in HWIC slot 0/0 is DOWN"
action 1.0 cli command "enable"
action 1.1 cli command "show clock"
action 1.2 regexp "([0-9]+):[0-9]+:[0-9]+" "$_cli_result" match hour
action 1.3 if $hour ge 18
action 1.4 cli command "config t"
action 1.5 cli command "event manager applet reload-at-seven"
action 1.6 cli command "event timer cron cron-entry $q 0 19 * * *$q"
action 1.7 cli command "action 1.0 reload"
action 1.8 cli command "end"
action 1.9 end
action 2.0 if $hour le 6
action 2.1 cli command "config t"
action 2.2 cli command "event manager applet reload-at-seven"
action 2.3 cli command "event timer cron cron-entry $q 0 19 * * *$q"
action 2.4 cli command "action 1.0 reload"
action 2.5 cli command "end"
action 2.6 end
11-09-2013 02:36 PM
No. Not given these scenarios.
event manager applet cell3
description "TEST ONLY"
event syslog pattern "Modem in HWIC slot 0/0 is DOWN"
action 0.5 set timed_reload 0
action 1.0 cli command "enable"
action 1.1 cli command "show clock"
action 1.2 regexp "([0-9]+):[0-9]+:[0-9]+" "$_cli_result" match hour
action 1.3 if $hour ge 18
action 1.4 reload
action 1.9 else
action 2.0 set timed_reload 1
action 2.1 end
action 2.2 if $hour lt 6
action 2.4 reload
action 2.8 else
action 2.9 set timed_reload 1
action 3.0 end
action 3.1 if $timed_reload eq 1
action 3.2 cli command "config t"
action 3.3 cli command "event manager applet reload-at-seven"
action 3.4 cli command "event timer cron cron-entry $q 0 19 * * *$q"
action 3.5 cli command "action 1.0 reload"
action 3.6 cli command "end"
action 3.7 end
11-11-2013 11:19 PM
Hi Joseph, i've run the script and see if it works the way 2 scenarios should be. Thank you very much
Nov 12 15:19:04.828 MNL: %HA_EM-6-LOG: cell2 : DEBUG(cli_lib) : : CTL : cli_open called.
Nov 12 15:19:04.828 MNL: %HA_EM-6-LOG: cell2 : DEBUG(cli_lib) : : OUT : PHILAM-ANT-BR01>
Nov 12 15:19:04.828 MNL: %HA_EM-6-LOG: cell2 : DEBUG(cli_lib) : : IN : PHILAM-ANT-BR01>enable
Nov 12 15:19:05.140 MNL: %HA_EM-6-LOG: cell2 : DEBUG(cli_lib) : : OUT : PHILAM-ANT-BR01#
Nov 12 15:19:05.140 MNL: %HA_EM-6-LOG: cell2 : DEBUG(cli_lib) : : IN : PHILAM-ANT-BR01#show clock
Nov 12 15:19:05.152 MNL: %HA_EM-6-LOG: cell2 : DEBUG(cli_lib) : : OUT : 15:19:05.140 MNL Tue Nov 12 2013
Nov 12 15:19:05.152 MNL: %HA_EM-6-LOG: cell2 : DEBUG(cli_lib) : : OUT : PHILAM-ANT-BR01#
Nov 12 15:19:05.152 MNL: %HA_EM-6-LOG: cell2 : DEBUG(cli_lib) : : IN : PHILAM-ANT-BR01#config t
Nov 12 15:19:05.464 MNL: %HA_EM-6-LOG: cell2 : DEBUG(cli_lib) : : OUT : Enter configuration commands, one per line. End with CNTL/Z.
Nov 12 15:19:05.464 MNL: %HA_EM-6-LOG: cell2 : DEBUG(cli_lib) : : OUT : PHILAM-ANT-BR01(config)#
Nov 12 15:19:05.464 MNL: %HA_EM-6-LOG: cell2 : DEBUG(cli_lib) : : IN : PHILAM-ANT-BR01(config)#event manager applet reload-at-seven
Nov 12 15:19:05.776 MNL: %HA_EM-6-LOG: cell2 : DEBUG(cli_lib) : : OUT : PHILAM-ANT-BR01(config-applet)#
Nov 12 15:19:05.776 MNL: %HA_EM-3-FMPD_UNKNOWN_ENV: fh_parse_var: could not find environment variable: q
Nov 12 15:19:05.776 MNL: %HA_EM-3-FMPD_ERROR: Error executing applet cell2 statement 3.4
Nov 12 15:19:05.776 MNL: %HA_EM-6-LOG: cell2 : DEBUG(cli_lib) : : CTL : cli_close called.
PHILAM-ANT-BR01#sh event manager history events
No. Job Id Proc Status Time of Event Event Type Name
4 4 Actv success Tue Nov12 15:19:04 2013 none applet: cell2
12-02-2013 05:05 PM
Nov 12 15:19:05.464 MNL: %HA_EM-6-LOG: cell2 : DEBUG(cli_lib) : : IN : PHILAM-ANT-BR01(config)#event manager applet reload-at-seven
Nov 12 15:19:05.776 MNL: %HA_EM-6-LOG: cell2 : DEBUG(cli_lib) : : OUT : PHILAM-ANT-BR01(config-applet)#
Nov 12 15:19:05.776 MNL: %HA_EM-3-FMPD_UNKNOWN_ENV: fh_parse_var: could not find environment variable: q
Nov 12 15:19:05.776 MNL: %HA_EM-3-FMPD_ERROR: Error executing applet cell2 statement 3.4
12-02-2013 06:09 PM
You need to make sure the following is configured on your device:
event manager environment q "
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