You will find below another EEM configuration. This script is useful in order to determine the root cause of an high CPU.
Some high CPU alerts can be generated during off hours. Obviously, nobody is working during the night in order to diagnose this alert! It's why I have created the script below.
If an high CPU syslog message ("%SYS-1-CPURISINGTHRESHOLD") is detected, the command "show proc cpu sorted 5min" is executed. The result of this command is then send to a mailbox.
process cpu threshold type total rising 80 interval 30
!
event manager applet ALERT-CPU
event syslog pattern "%SYS-1-CPURISINGTHRESHOLD"
action 1.0 cli command "enable"
action 2.0 cli command "show proc cpu sorted 5min"
action 3.0 mail server "172.16.10.10" to "NetAdmin@mybox.com" from "myswitch@mylab.lab" subject "CPU Alert 5 min" body "$_cli_result"