cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
10023
Views
13
Helpful
62
Replies

is it possible to create two scripts?

Josiah Inubio
Level 1
Level 1

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)#

62 Replies 62

hi joseph, what is the script to put inside the event manager environment q "

event manager environment q

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"

is this it?

All this does is create a variable, q, to stand for the double quote character.  All you need to configure is:

event manager environment q "

Then you can use $q in your applets to stand for the embedded double quote.

Hi Joseph, I just found an error on using the script and the action doesn't work. It says there's something wrong with the variable "hour". How can I resolve this? Thanks.

Aug 25 08:23:57.362: %CELLWAN-2-MODEM_DOWN: Modem in HWIC slot 0/0 is DOWN

Aug 25 08:23:57.690: %HA_EM-3-FMPD_UNKNOWN_ENV: fh_parse_var: could not find environment variable: hour

Aug 25 08:23:57.690: %HA_EM-3-FMPD_UNKNOWN_ENV: fh_parse_var: could not find environment variable: hour

The output of show clock must not be matching the regexp.  Run "debug event manager action cli" and look at the output to see what "show clock" looks like to EEM.

I have now executed the command, so how do i exactly see the output? thanks

ROUTER#debug event manager action cli

Debug EEM action cli debugging is on

ROUTER#sh clo

14:32:03.655 Wed Aug 28 2013

I meant enable debug, get your policy to execute, then look at the debug output to see what the show clock output looks like to EEM.

This is what looks like.

Aug 29 14:31:07.757 MNL: %CELLWAN-2-MODEM_DOWN: Modem in HWIC slot 0/0 is DOWN

Aug 29 14:31:07.761 MNL: %HA_EM-6-LOG: cell2 : DEBUG(cli_lib) : : CTL : cli_open called.

Aug 29 14:31:07.761 MNL: %HA_EM-6-LOG: cell2 : DEBUG(cli_lib) : : OUT : ROUTER>

Aug 29 14:31:07.761 MNL: %HA_EM-6-LOG: cell2 : DEBUG(cli_lib) : : IN  : ROUTER>enable

Aug 29 14:31:08.073 MNL: %HA_EM-6-LOG: cell2 : DEBUG(cli_lib) : : OUT : No authorization entry found for 172.29.7.17

Aug 29 14:31:08.073 MNL: %HA_EM-6-LOG: cell2 : DEBUG(cli_lib) : : OUT :

Aug 29 14:31:08.073 MNL: %HA_EM-6-LOG: cell2 : DEBUG(cli_lib) : : OUT : ROUTER>

Aug 29 14:31:08.073 MNL: %HA_EM-6-LOG: cell2 : DEBUG(cli_lib) : : IN  : ROUTER>show clock

Aug 29 14:31:08.085 MNL: %HA_EM-6-LOG: cell2 : DEBUG(cli_lib) : : OUT : 14:31:08.077 MNL Thu Aug 29 2013

Aug 29 14:31:08.085 MNL: %HA_EM-6-LOG: cell2 : DEBUG(cli_lib) : : OUT : ROUTER>

Aug 29 14:31:08.085 MNL: %HA_EM-3-FMPD_UNKNOWN_ENV: fh_parse_var: could not find environment variable: hour

Aug 29 14:31:08.085 MNL: %HA_EM-3-FMPD_UNKNOWN_ENV: fh_parse_var: could not find environment variable: hour

Aug 29 14:31:08.085 MNL: %HA_EM-6-LOG: cell2 : DEBUG(cli_lib) : : CTL : cli_close called.

Not sure what your applet looks like now, but try this:

action 003 regexp "([0-9]+):[0-9]+:[0-9]+" $_cli_result match hour

ok thanks. i'll inform you if it works.

This is what it looks like. does the script works?

Sep  4 08:19:14.565 MNL: %CELLWAN-2-MODEM_DOWN: Modem in HWIC slot 0/0 is DOWN

Sep  4 08:19:14.565 MNL: %HA_EM-6-LOG: cell2 : DEBUG(cli_lib) : : CTL : cli_open called.

Sep  4 08:19:14.569 MNL: %HA_EM-6-LOG: cell2 : DEBUG(cli_lib) : : OUT : PHILAM-ANT-BR01>

Sep  4 08:19:14.569 MNL: %HA_EM-6-LOG: cell2 : DEBUG(cli_lib) : : IN  : PHILAM-ANT-BR01>enable

Sep  4 08:19:14.881 MNL: %HA_EM-6-LOG: cell2 : DEBUG(cli_lib) : : OUT : No authorization entry found for 172.29.7.17

Sep  4 08:19:14.881 MNL: %HA_EM-6-LOG: cell2 : DEBUG(cli_lib) : : OUT :

Sep  4 08:19:14.881 MNL: %HA_EM-6-LOG: cell2 : DEBUG(cli_lib) : : OUT : PHILAM-ANT-BR01>

Sep  4 08:19:14.881 MNL: %HA_EM-6-LOG: cell2 : DEBUG(cli_lib) : : IN  : PHILAM-ANT-BR01>show clock

Sep  4 08:19:14.893 MNL: %HA_EM-6-LOG: cell2 : DEBUG(cli_lib) : : OUT : 08:19:14.881 MNL Wed Sep 4 2013

Sep  4 08:19:14.893 MNL: %HA_EM-6-LOG: cell2 : DEBUG(cli_lib) : : OUT : PHILAM-ANT-BR01>

Sep  4 08:19:14.893 MNL: %HA_EM-6-LOG: cell2 : DEBUG(cli_lib) : : CTL : cli_close called.

Sep  4 08:19:31.233 MNL: %LINK-5-CHANGED: Interface Cellular0/0/0, changed state to reset

Sep  4 08:19:34.477 MNL: %CELLWAN-2-MODEM_UP: Modem in HWIC slot 0/0 is now UP

hi joseph, there should be an enable password after these bold text indicated. how to put password on it? thanks

Sep  4 16:49:21.764 MNL: %HA_EM-6-LOG: cell2 : DEBUG(cli_lib) : : IN  : PHILAM-BLA-BR01>enable

Sep  4 16:49:22.076 MNL: %HA_EM-6-LOG: cell2 : DEBUG(cli_lib) : : OUT : No authorization entry found for 172.29.7.20

Sep  4 16:49:22.076 MNL: %HA_EM-6-LOG: cell2 : DEBUG(cli_lib) : : OUT :

Hi joseph, I think it needed an username before action "enable" and a password after "enable". so how can i put that in the script? thanks

Configure:

event manager session cli username USER

Where USER is a username authorized to run all of the CLI commands in your applet.

is it also possible to configure telnet password and enable password?

No.  They are not used or needed by EEM.