cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1453
Views
0
Helpful
3
Replies

How can I run EEM script for one time?

Essam Ahmad
Level 1
Level 1

Dears,

I have the following EEM script:

event manager applet CPU_Test

event snmp oid 1.3.6.1.4.1.9.2.1.58.0 get-type exact entry-op ge entry-val "10" poll-interval 0.5

action 1.0 mail server "192.168.1.1" to "essmmamn@gmail.com" from "Router@mail.com" cc "noc@mail.com" subject "EEM Script test" body "The test is Ok! EEM Script executed successfully!" source-address 192.168.1.4

I want to complete this script to do the following:

Send an E-mail only for once as long as the CPU threshold is exceeding the threshold value (10%), and when the CPU is lower than another threshold (5%) it will send another E-mail only for once informing that the CPU utilization is normal now.

Also I need another option to run this script only for once and then it will be disabled or distroyed, whatever.

Could you please assist me in this configuration?

Best Regards,

3 Replies 3

nkarpysh
Cisco Employee
Cisco Employee

Hello,

You can created two different EEM scripts. One for CPU going higher than certain threshold and another going below that threshold. Then you can crate some non-feasible exit value for the correpsonding script. E.G. if script expecting CPU to raise above threshold you can specifiy exit value to ve above 100 which wont be reached and script will never rerun. Similar with the second one:

exit-op eq exit-val 101

or 
exit-op eq exit-val 0

Niko

HTH,
Niko

Thanks, but I have some questions:

1-What about running the script to be triggered for only one time and then destroyed, what is the required configuration? (you didn't reply on this point)

2-With your suggestion, If the CPU utilization reached the threshold value and the script is executed once, then the CPU utilization went down under the threshold again, will the script going to be executed again?

This question is because I think (and correct me if I'm wrong) that the exit-op eq exit-val 101 will keep the script in a closed loop untill the condition of exit-val 101 is met which will never happen, and hence it will not execute again if the CPU threshold is reached again which is not acceptable for me.

Best Regards,

Hello,

Seems that I did not get you. What do you mean by destroying script? Removing it form config? The way I suggested will do the following:

- it will hit once when CPU got higher tan threshold. It will then wait for exit event to restart again. As the exit event will never happen - it wont restart and never run once again.

Can you just explain on examples on what you want to do with script. I thought you wanted to run it once but as per your last statement you want it still to be able to re-run so get confused here.

Niko

HTH,
Niko
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:

Review Cisco Networking products for a $25 gift card