Web Hosting Talk







View Full Version : WSH script


dadulus
01-07-2011, 01:10 AM
Hi,

I got a windows server, that takes a lot of processing time to do its stuff. It litterally runs at 100% utilization for days on end.

So I was looking for a script that would email me when the processor usage drops below 80%, so that i would be notifed that i need to load up more data to process, to get it back at 100%.

I dont really want to buy any software to achieve this, so is it possible to get a script to do what i want?

MatthewR1
01-07-2011, 03:43 PM
See http://stackoverflow.com/questions/278071/how-to-get-the-cpu-usage-in-c

cpuCounter = new PerformanceCounter();

cpuCounter.CategoryName = "Processor";
cpuCounter.CounterName = "% Processor Time";
cpuCounter.InstanceName = "_Total";

ramCounter = new PerformanceCounter("Memory", "Available MBytes");


You can embed that script in a asp.net page and then use a free monitoring service to monitor this page for a OK/Not OK message. Some of our customers use this approach to monitor their servers for cpu load and available free drive space.

Of course, you can also embed email sending code directly into the asp.net page:
http://wiki.imacros.net/send-email.vbs