Cisco Support Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Community Member

EEM Script Modification Help

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

1 ACCEPTED SOLUTION

Accepted Solutions
Cisco Employee

Re: EEM Script Modification Help

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

23 REPLIES
Cisco Employee

EEM Script Modification Help

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"

Community Member

EEM Script Modification Help

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

Cisco Employee

EEM Script Modification Help

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

Community Member

Re: EEM Script Modification Help

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

Community Member

Re: EEM Script Modification Help

Joseph,

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

Community Member

Re: EEM Script Modification Help

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...

Community Member

Re: EEM Script Modification Help

Joseph,

Could you show me how to remove

wan_load_history_outfile.dat

Cheers mate

Community Member

Re: EEM Script Modification Help

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

Cisco Employee

Re: EEM Script Modification Help

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.

Cisco Employee

Re: EEM Script Modification Help

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

Community Member

Re: EEM Script Modification Help

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

Cisco Employee

Re: EEM Script Modification Help

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.

Community Member

EEM Script Modification Help

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

Community Member

EEM Script Modification Help

Hi Joesph,

I presume you're too busy to help me with this any further ;-(

Community Member

EEM Script Modification Help

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

Community Member

Re: EEM Script Modification Help

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

Cisco Employee

Re: EEM Script Modification Help

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.

Community Member

EEM Script Modification Help

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.

Community Member

Re: EEM Script Modification Help

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.

Cisco Employee

EEM Script Modification Help

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.

Community Member

EEM Script Modification Help

Hi Joseph,

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

Cheers

Carlton

Cisco Employee

EEM Script Modification Help

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.

Community Member

EEM Script Modification Help

No worries Joseph, its all sorted.

Thanks anyway mate

869
Views
0
Helpful
23
Replies
CreatePlease to create content