×

Warning message

  • Cisco Support Forums is in Read Only mode while the site is being migrated.
  • Cisco Support Forums is in Read Only mode while the site is being migrated.

EEM Script Modification Help

Answered Question
Jul 7th, 2013
User Badges:

Hello Community,


David Lin, was the author of the Wan Load Alarm script.


When the alert appears it will appear as follows:




*Mar  1 00:46:31.027: %HA_EM-6-LOG: system:/lib/tcl/eem_scripts_registered/wan_load_alarm.tcl: Interface FastEthernet0/0 average load exceeded 4 percent over 1 seconds.


Is it possible to modify the script so that the text Interface FastEthernet0/0 average load exceeded 4 percent over 1 seconds., appears on separate line?


I need to strip out *Mar  1 00:46:31.027: %HA_EM-6-LOG: system:/lib/tcl/eem_scripts_registered/wan_load_alarm.tcl from the message


Cheers

Correct Answer by Joe Clarke about 4 years 1 month ago

I found a few bugs in this script.  I think this version should work better.

  • 1
  • 2
  • 3
  • 4
  • 5
Overall Rating: 5 (1 ratings)
Loading.
Joe Clarke Sun, 07/07/2013 - 21:20
User Badges:
  • Cisco Employee,
  • Hall of Fame,

    Founding Member

Whenever action_syslog is called, just add a "\n" at the start of the msg argument.  For example:


acton_syslog msg "\nThis appears on a new line"

Carlton Patterson Mon, 07/08/2013 - 01:52
User Badges:

Hi Joseph,


Thanks for getting back to me mate.


I will try your suggestion shortly.


In the meantime can you please tell me if the following line will work:


event manager environment wan_load_history_outfile tftp:wan_load_history_outfile.dat


Cheers mate

Joe Clarke Mon, 07/08/2013 - 09:00
User Badges:
  • Cisco Employee,
  • Hall of Fame,

    Founding Member

This can work, but it will slow the script down a bit.  It is recommended to use a local file.

Carlton Patterson Mon, 07/08/2013 - 02:55
User Badges:

Hi Joseph,


For some reason the wan_load-alarm.tcl isn't working.


I applied it last night and it worked fine. I've reapplied it to another device and its not working.


I wonder if you could take a quick glance at the configs and let me know if I've missed something?


Cheers

Carlton Patterson Mon, 07/08/2013 - 03:31
User Badges:

Joseph,


You will notice that I decreased the thresholds and duration to speed up the results....

Carlton Patterson Mon, 07/08/2013 - 03:40
User Badges:

Joseph,


Below is debug of tcl:


*Mar  1 02:11:58.831: %HA_EM-6-LOG: wan_load_alarm.tcl : DEBUG(cli_lib) : CTL : cli_open called.

*Mar  1 02:11:59.067: %HA_EM-6-LOG: wan_load_alarm.tcl : DEBUG(cli_lib) : OUT :

*Mar  1 02:11:59.067: %HA_EM-6-LOG: wan_load_alarm.tcl : DEBUG(cli_lib) : OUT : R2>

*Mar  1 02:11:59.071: %HA_EM-6-LOG: wan_load_alarm.tcl : DEBUG(cli_lib) : IN  : R2>enable

*Mar  1 02:11:59.279: %HA_EM-6-LOG: wan_load_alarm.tcl : DEBUG(cli_lib) : OUT :

*Mar  1 02:11:59.279: %HA_EM-6-LOG: wan_load_alarm.tcl : DEBUG(cli_lib) : OUT : R2#

*Mar  1 02:11:59.283: %HA_EM-6-LOG: wan_load_alarm.tcl : DEBUG(cli_lib) : IN  : R2#enable

*Mar  1 02:11:59.483: %HA_EM-6-LOG: wan_load_alarm.tcl : DEBUG(cli_lib) : OUT :

*Mar  1 02:11:59.483: %HA_EM-6-LOG: wan_load_alarm.tcl : DEBUG(cli_lib) : OUT : R2#

*Mar  1 02:11:59.483: %HA_EM-6-LOG: wan_load_alarm.tcl : DEBUG(cli_lib) : IN  : R2#show int Ethernet1/0 | inc txload

*Mar  1 02:11:59.695: %HA_EM-6-LOG: wan_load_alarm.tcl : DEBUG(cli_lib) : OUT :      reliability 255/255, txload 143/255, rxload 142/255

*Mar  1 02:11:59.695: %HA_EM-6-LOG: wan_load_alarm.tcl : DEBUG(cli_lib) : OUT : R2#

*Mar  1 02:11:59.727: %HA_EM-6-LOG: wan_load_alarm.tcl : DEBUG(cli_lib) : IN  : R2#more flash:wan_load_history_outfile.dat

*Mar  1 02:11:59.935: %HA_EM-6-LOG: wan_load_alarm.tcl : DEBUG(cli_lib) : OUT :      reliability 255/255, txload 143/255, rxload 142/255

*Mar  1 02:11:59.935: %HA_EM-6-LOG: wan_load_alarm.tcl : DEBUG(cli_lib) : OUT : R2#

*Mar  1 02:11:59.935: %HA_EM-6-LOG: wan_load_alarm.tcl : DEBUG(cli_lib) : OUT :

*Mar  1 02:11:59.935: %HA_EM-6-LOG: wan_load_alarm.tcl : DEBUG(cli_lib) : OUT : R2#

*Mar  1 02:11:59.959: %HA_EM-6-LOG: wan_load_alarm.tcl : DEBUG(cli_lib) : CTL : cli_close called.

*Mar  1 02:11:59.959: %HA_EM-6-LOG: wan_load_alarm.tcl : DEBUG(cli_lib) : IN  : R2#exit


As you can see, threshold have been breached...

Carlton Patterson Mon, 07/08/2013 - 04:46
User Badges:

Joseph,


Could you show me how to remove


wan_load_history_outfile.dat



Cheers mate

Carlton Patterson Mon, 07/08/2013 - 05:03
User Badges:

Hi Joseph,


Sorry for bombarding you with messages,


I'm also getting the following error message


*Mar  1 00:43:37.207: %HA_EM-7-FMS_POLICY_MAX_ENTRIES: fh_schedule_policy: Maximum number of script publish entries exceeded; some events have been discarded

*Mar  1 00:43:39.211: %HA_EM-7-FMS_POLICY_MAX_ENTRIES: fh_schedule_policy: Maximum number of script publish entries exceeded; some events have been discarded



Is there a reason for this?


Cheers

Joe Clarke Mon, 07/08/2013 - 09:11
User Badges:
  • Cisco Employee,
  • Hall of Fame,

    Founding Member

This means that too many policies are being executed at one time, and the EEM server queue is filling up.  You might have some EEM policies stuck in the queue, or you've descreased the interval too low.

Carlton Patterson Mon, 07/08/2013 - 10:50
User Badges:

How Joseph, thanks for getting back to me. I haven't had a chance to test the new script. Does it exclude the logging to flash? If not can you please show me how stop the logging. I tried myself but I failed miserably.

Appreciate it.

Sent from Cisco Technical Support iPad App

Joe Clarke Tue, 07/09/2013 - 08:14
User Badges:
  • Cisco Employee,
  • Hall of Fame,

    Founding Member

The "logging" needs to be done to track the multiple samples.  However, when the samples have been collected, the file will be deleted by the script.  That part of the script looked okay to me.

Carlton Patterson Mon, 07/08/2013 - 13:00
User Badges:

Hi Joseph,


I've tested the new script and it appears to working fine.


As I mentioned, would you be kind enough to show me how remove the out file,

'wan_load_history_outfile.dat' ?


Would really appreciate it mate.


Cheers


Carlton

Carlton Patterson Tue, 07/09/2013 - 01:12
User Badges:

Hi Joesph,


When I attempt to run the script, I'm now getting the error:


'Compile check and registration failed:policy file does not start with event register cmd

Tcl policy execute failed: policy file does not start with event register cmd



Embedded Event Manager configuration: failed to retrieve intermediate registration result for policy wan_load_alarm.tcl: Unknown error 0'


Do you think you could help?


Cheers

Carlton Patterson Sun, 07/21/2013 - 03:07
User Badges:

Hi Joseph,


For some reason, I'm getting the error message:


R1(config)#even ma p wan_load_alarm.tcl

Compile check and registration failed:policy file does not start with event register cmd

Tcl policy execute failed: policy file does not start with event register cmd



Embedded Event Manager configuration: failed to retrieve intermediate registration result for policy wan_load_alarm.tcl: Unknown error 0


I was getting it before but it somehow managed to fix itself - I'm now getting it again - using the same script you modified above.


I wonder if you could shed some light on it?


Cheers

Joe Clarke Sun, 07/21/2013 - 07:44
User Badges:
  • Cisco Employee,
  • Hall of Fame,

    Founding Member

Check the contents of the file on flash and make sure it looks like a plain ASCII file and starts with a ::cisco::eem::event_register_* line.

Carlton Patterson Tue, 07/09/2013 - 01:36
User Badges:

Hi Joesph,


Please ignore my previous posts.... I'm being what they call here in London a NUMPTY!


Its working fine.


Once again you're a star.


Cheers mate.

Carlton Patterson Sun, 07/21/2013 - 07:44
User Badges:

Hi Joseph,


I tried running the script on a 7200 and getting similar error:


R3(config)#event  mana p wan_load_alarm.tcl

EEM Register event failed: Error empty reg spec, policy does not start with EEM registration commands.



EEM configuration: failed to retrieve intermediate registration result for policy wan_load_alarm.tcl


The interesting thing is the policy does have EEM registration commands - at least  I think it does.

Joe Clarke Sun, 07/21/2013 - 08:06
User Badges:
  • Cisco Employee,
  • Hall of Fame,

    Founding Member

Make sure this file is encoded as an ASCII file when you transfer it to the device.  You should be using a plain text editor if you're doing any modifications to this.

Carlton Patterson Sun, 07/21/2013 - 14:39
User Badges:

Hi Joseph,


Silly question, but can you let me know how to ensure the file is encoded as an ASCII file?


Cheers


Carlton

Joe Clarke Sun, 07/21/2013 - 14:44
User Badges:
  • Cisco Employee,
  • Hall of Fame,

    Founding Member

Make sure any changes done to the file are done so in a plain text editor like TextWrangler, Notepad++, Emacs, Vim, Text Editor, Notepad, etc.  If your editor has a setting for encoding, make sure it's set to US-ASCII.  If not, make sure there aren't any charatcers that fall outside of the 7-bit ASCII range.

Actions

This Discussion