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

Welcome to Cisco Support Community. We would love to have your feedback.

For an introduction to the new site, click here. And see here for current known issues.

New Member

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
Cisco Employee

EEM Script Excluding Commands

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"

1 REPLY
Cisco Employee

EEM Script Excluding Commands

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"

405
Views
0
Helpful
1
Replies