How To Setup High CPU Usage Alerts On Servers

Since I had this incident with one of our servers I blogged about a few days ago ( link here ) I’m trying to be more proactive with these kind of problems, so I am the first person that know when there is anything wrong with any of the servers. for that reason I have set scripts on the servers that will alert me when there is lack of disks space, high memory and CPU usage etc. on them.

the script I used to monitor high CPU usage is very simple and easy to setup. it only takes a few minutes to setup and it does not hurt your budget at all..

let’s get started.

step 1. download blat from this link  http://www.blat.net and extract it at the root of the C: drive.

Step 2. create a batch file named send.bat and add this line of code in it:

c:blatblat.exe -body %1 –f “forevergeek server” -server smtp.forevergeeks.com –to [email protected] -subject “ALERT: ForeverGeeks Server CPU Usage High”
echo %1 > alert.out

don’t forget to change the settings above with your own settings. save the batch file within the blat folder at the root drive.

Step 3. right-click My Computer icon on the server and go to Manage, expand Performance logs and Alerts then right-click Alerts and select New Alert Settings:

image

name the new alert:

image

add an alert counter and choose %Processor Time :

image

click on the close button.

then on the next window, enter a limit value when you want to get the alert. for example, enter 90 if you want to get an alert if the CPU usage stay more than 90% for the time interval specified below.

image

If you want the alert to run on a different credentials, enter the username on the Run As field, and then click on the set password button, and enter the rest of the credentials.

now click on the Action tab and on the Run this program field, click on Browse. browse to the blat directory we created above, and choose the send.bat file.

image

click on OK.

that’s it. right-click the alert and start it. from now on you will get alerts when the server hit the 90% CPU usage, and stay there for the interval time you specified.

More Windows Server 2003 Tutorials