Published 6月 08, 2018 by with 0 comment

Cisco Configuration Guides Lab Embedded Event Manager (EEM)


The command debug will lead to CPU loading get high.
We can use EEM to avoid CPU overload during debug

Scenario:
Setting EEM to poll CPU every 10 seconds. If CPU loading over 75%, trun all debug off.
And then check CPU loading form high % to low %.

Configuration Steps
1. Configure EEM for CPU usage threshold monitor
2. Enable debug


1. Configure EEM for CPU usage threshold monitor.
If CPU usage more than 75%, execute no debug all to shut down all debugging function.
SNMP OID 1.3.6.1.4.1.9.9.109.1.1.1.1.6 = cpmCPUTotal5secRev
EEM will poll SNMP OID 1.3.6.1.4.1.9.9.109.1.1.1.1.6 value every 10s.

event manager applet CPU_LOADING_MONITOR
 event snmp oid 1.3.6.1.4.1.9.9.109.1.1.1.1.6.1 get-type exact entry-op gt entry-val 75 poll-interval 10
 action 1.o cli command "enable"
 action 2.0 cli command "no debug all"
 action 3.0 syslog msg "CPU loading over 75%, trun all debug off!"
 action 4.0 cli command "show processes cpu sorted | append nvram:CPU.log"

!-- For GNS3 lab, I save CPU.log in the nvram. For real device, you can save log in the flash.


2. Enable debug
I using debug ip ospf packet for example.

debug ip ospf packet


When CPU loading over 75%...
R1#debug ip ospf packet
OSPF packet debugging is on
R1#
R1#
!-- You can see the OSPF debug processe is running.
R1#show debugging
IP routing:
  OSPF packet debugging is on




settlement:
  memory tracing is on
R1#
R1#
*Mar  1 00:41:38.739: %HA_EM-6-LOG: CPU_LOADING_MONITOR: CPU loading over 75%, trun all debug off!
R1#
!-- You can see there is not any debug processe running.
R1#show debugging




settlement:
  memory tracing is on
R1#
R1#
!-- Check nvram, there is a new file - CPU.log
R1#dir nvram:
Directory of nvram:/

  150  -rw-         896                      startup-config
  151  ----           0                      private-config
    1  ----          15                      persistent-data
    2  -rw-       20315                      CPU.log

155640 bytes total (132164 bytes free)
R1#
R1#
R1#
!-- I use more command to read the CPU.log file.
R1#more nvram:CPU.log
CPU utilization for five seconds: 3%/0%; one minute: 4%; five minutes: 4%
 PID Runtime(ms)   Invoked      uSecs   5Sec   1Min   5Min TTY Process
 148       41920     28624       1464  0.81%  1.25%  1.29%   0 RBSCP Background
  94         984      1294        760  0.65%  0.36%  0.20%   0 Exec
  86        9376     88100        106  0.40%  0.35%  0.42%   0 IP ARP Retry Age
  82        9880     88100        112  0.32%  0.46%  0.42%   0 ACCT Periodic Pr
 113        2448      6332        386  0.16%  0.05%  0.06%   0 CEF process
  47        4632       577       8027  0.16%  0.16%  0.16%   0 Compute load avg
  39         864      2870        301  0.16%  0.06%  0.06%   0 TTY Background
  40        2684      2878        932  0.08%  0.06%  0.07%   0 Per-Second Jobs
  13         140      2877         48  0.08%  0.04%  0.01%   0 IPC Periodic Tim
-------- ignore----------------


Checking command:
show debugging
show processes cpu sorted


Reference:
1. Embedded Event Manager Configuration Guide, Cisco IOS Release 12.4T
http://www.cisco.com/en/US/docs/ios-xml/ios/eem/configuration/12-4t/eem-12-4t-book.html

2. SNMP Object Navigator
http://tools.cisco.com/Support/SNMP/do/BrowseOID.do


最初發表 / 最後更新: 2013.12.19 / 2018.06.08

0 comments:

張貼留言