cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1494
Views
0
Helpful
1
Replies

EEM Script Excluding Commands

Hello Community,

The following script will only provide the output 'show ip traffic' in an email when it is invoked.

Can someone please show me how to modify the script so that all commands are sent to email, ie 'show process cpu sorted 5min', 'show process cpu sorted 1min'.


event manager applet High_CPU_SNMP

event none

action 0.0 syslog msg "High CPU DETECTED. Please wait - logging Information to disk0:high_cpu.txt"

action 0.1 cli command "enable"

action 0.2 cli command "term exec prompt timestamp"

action 0.3 cli command "term len 0"

action 1.2 cli command "show process cpu sorted 5min"

action 1.2 cli command "show process cpu sorted 1min"

action 1.6 cli command "show ip traffic"

action 1.7 mail server "150.50.5.2" to "carlton@keyloop.co.uk" from "carlton@keyloop.co.uk" subject "CPU Alert 5min" body "$_cli_result"

Cheers

Carlton

1 Accepted Solution

Accepted Solutions

Joe Clarke
Cisco Employee
Cisco Employee

Redirect the output of each command to a file on flash, then "more" the file:

action 1.2 cli command "show proc cpu sort 5min | redirect flash:tmp"

action 1.3 cli command "show process cpu sort 1min | append flash:tmp"

...

action 1.6 cli command "more flash:tmp"

action 1.7 mail server ... body "$_cli_result"

View solution in original post

1 Reply 1

Joe Clarke
Cisco Employee
Cisco Employee

Redirect the output of each command to a file on flash, then "more" the file:

action 1.2 cli command "show proc cpu sort 5min | redirect flash:tmp"

action 1.3 cli command "show process cpu sort 1min | append flash:tmp"

...

action 1.6 cli command "more flash:tmp"

action 1.7 mail server ... body "$_cli_result"

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community: