cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1059
Views
10
Helpful
0
Replies
Highlighted
Cisco Employee

Introduce Delay between Commands in High CPU for 6500 (EEM Script)

Hi,

Whenever there is a High CPU occur in customer premise and if it is intermittent it is very hectic to find out the root cause. Because, the High CPU issues mostly have to be checked live to identify the cause of it.

In order to detect the High CPU and to collect the necessary logs during off-hours, the EEM script is a boon to customer.

As part of the High CPU command outputs, we need a 'debug' in NetDr capture. After few seconds of delay timing, we need to collect the 'show' of NetDr result. So, we need to introduce a delay (for example: 60 seconds) between the 'debug' and 'show' command outputs.

The below script is mainly based on 6500 series switches.

How to Introduce a delay in Script (a sample example):

Create Event Manager with Timer Enabled and set the high CPU level to 2% (for testing purpose)

event manager applet ga

event snmp oid 1.3.6.1.4.1.9.9.109.1.1.1.1.3.1 get-type exact entry-op gt entry-val "3" exit-op lt exit-val "2" poll-interval 5

action 1.01 syslog msg "**Hello Anand, High CPU triggered**, CPU: $_snmp_oid_val %"

action 1.02 cli command "enable"

action 1.03 cli command "debug netdr cap rx | append disk0:ga"

action 1.04 cli command "event tag 1.0 timer countdown time 60"     >>>>> Introduced delay for 60 seconds between 'debug' & 'show'

action 1.05 cli command "show netdr cap | append disk0:ga"

action 1.06 cli command "show version | append disk0:ga"

action 1.07 cli command "undebug all"

Remove Event Manager (or script) from the switch:

no event manager applet ga

The above sample script was applied in a 6500 switch and it successfully introduced a delay for one min and captured the result.

Please see the attached file for a sample run & result.

A syslog will be shown on the terminal when a high CPU is detected. (I set the High CPU level to 2% to test the delay whether it works as expected)

*Sep  6 00:55:12.139: %HA_EM-6-LOG: ga: **Hello Anand, High CPU triggered**, CPU: 5 %


A complete EEM Script for High CPU on 6500 switch is also attached here for your reference.

Hope this document found useful !

Thanks & Regards,

Anand G.

Everyone's tags (7)
CreatePlease to create content
Content for Community-Ad
July's Community Spotlight Awards