Jump to content

Monitor for overloading process


Recommended Posts

Is it possible with AutoIT3 (I'm sure it is) to be made monitor, which to monitor specific process with known name ( or unknown name for unification) and this process overload CPU above some limit for specific time.

For ex. if process.exe runs above 90% CPU more than 1 min - kill it or restart it.

Will be thankful for any help.

I'm asking because made only simple scripts, nothing with WMI.

Some additional goals - this watched process may be run from different users and must be killed/restarted only specific.

I mean that snippets like "Finding if an Application is Hung" from URL http://quadryders.com/phpcc/snippet.php?sid=28 !! WILL NOT ABLE TO DO THE JOB !!

Edited by Topper
Link to comment
Share on other sites

It can be done using Performance Counters (see the link in my signature). I give an example on how to track CPU usage on the local PC, but it is also possible to monitor processes on other PC's with filtered wildcard counter results. The filtering isn't built-in but can be done simply enough on a returned array.

There's also WMI, but that can be really slow and unreliable

Link to comment
Share on other sites

I'm not sure I follow - all the processes are on one machine? Or are the processes being run on other people's machines?

If all the processes are locally run, then I'm not sure why you can't use that function? As long as you are an administrator and can see all sessions, I'm fairly sure you would be able to see all processes under all sessions. But if that's the case, I'm wondering how does a person run a process on a server, unless its spawned by the server itself when it receives some sort of request? (Sorry, I've never run a server). Well, whatever the case - if its all on a local machine, you should be able to see it as an administrator. You can read Session ID information if that helps (that'd be another function to determine that info).

Link to comment
Share on other sites

You are on right way.

It's not necessary to be a server, could be a personal computer with 2 or 3 co-workers logged in with Remote Desktop Protokol.

But one of them started long and heavy operation with program process.exe - by mistake or purposely.

So I want to kill this process when it takes a lot of processor time for a long period because I don't need to suffer rest of users.

Actually I'v got 15 remote users on Win2k3 running same program trough its login script. Some time one or two of them start to over load and I need to close this processes.

That's the way I think.

PS:This picture means, that we have on ONE machine few processes with different sessions and different CPU Usage:

123 server/user1 process.exe 1%

345 server/user2 process.exe 2%

567 server/user3 process.exe 90%

789 server/user4 process.exe 50%

The script must kill process PID 567 from user 3 if it takes 15 minute to run above watermark level 85% for examp.

Edited by Topper
Link to comment
Share on other sites

Check out the 'TestPDH_ObjectTests' module. There's an example of using the '_PDH_ProcessAll' module. You'd basically set it up like in the link you put, but you'd be getting an array back each time. You'd need to monitor different processes in that array and check the CPU usages. However - if there's a lot of changes in processes, the CPU Usage info will need two calls with an interval between them each time there's a change, so if its pretty busy on your machine, it might be you'll just have to get a _PDH_ProcessObject for each process and monitor them all as they come and go.

And use sesion ID and Owner information to find out what process belongs to who.

Well.. I hope maybe that helps.

Link to comment
Share on other sites

I need to monitor only one process from different users but not so important which user own that overloading process simple must to close/kill it when that overload continue 30 min for example.

Sorry that I disturb you, but I used AutoIt long time ago and I'm afraid that not have enough knowledge to make the script :blink:

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...