How to Receive High CPU Usage Email Alerts on Server

April 25, 2011 / Virtual Server

Most of the times, web hosting accounts get suspended due to the exceeding of CPU usage limits allocated to your server. In this tutorial, we will show you how to get high cpu usage alerts of server on your email.

The following script on the server will automatically send alert on your email, when the disk space, high memory and cpu usage exceeds the limit.

Let’s see how…

Step 1: Download Blat from its official site and extract it in the root of the C:\ drive:

Blat is a small, efficient SMTP command line mailer for Windows available for free.

Step 2: Create a batch file named “send.bat” and add the following code in it:

c:\blat\blat.exe -body %1 –f “ServerName” -server –to [email protected] -subject “ALERT: ServerName CPU Usage High”
echo %1 > alert.out

Make sure you change the server name, smtp address, email with your own settings and simply save the batch file within the blat folder into the root drive.

Step 3: Now, right-click on the “My Computer” icon on your server and click the Manage. Open the options under “Performance logs >> Alerts” and right-click “Alerts” and choose “New Alert Settings“. (See image below)

Step 4: Enter a name for the new alert. (See image below)

Step 5: Select Performance Object as “Processor” and select “%Processor Time” from the counters list and click on the “Close” button. (See image below)

Step 6: On the next window, set a limit value when you wish to receive alert. For example: if you set a value of 90, you will receive an alert on your email if the CPU usage exceeds more than 90% for the time interval mentioned below. (See image below)

You can also run the alert on a different credentials, for that you just need to enter the username in the “Run As” field and click the “Set Password” button and fill out the rest of the credentials.

Step 7: Click on the “Action” tab >> Tick the “Run this program” and click on the “Browse” button. Browse the “send.bat” file. (See image below)

Step 8: Lastly, Hit the OK button.

That’s it ! Now, simply right-click the alert and start it. From now on, whenever your server exceeds the CPU usage limit you have set, you will receive an email alert on your specified email address. This script is applicable only for Windows VPS and Windows Dedicated Server.

Spread the love