[THIN] Re: tool to restart a service if it's memory usage gets over a certai n amount

  • From: "Callahan, Michael (TICS)" <MichaelCallahan@xxxxxxxxxxxxxxxx>
  • To: "thin@xxxxxxxxxxxxx" <thin@xxxxxxxxxxxxx>
  • Date: Wed, 2 Feb 2005 12:01:56 -0600

Something like this:
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
    & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colProcessList = objWMIService.ExecQuery _
    ("Select * from Win32_Process")
For Each objProcess in colProcessList
If instr(objProcess.Name, "spoolsv.exe") Then
    Wscript.Echo "Process: " & objProcess.Name 
    Wscript.Echo "Process ID: " & objProcess.ProcessID 
    Wscript.Echo "Page File Size: " & objProcess.PageFileUsage 
    Wscript.Echo "Page Faults: " & objProcess.PageFaults 
    Wscript.Echo "Working Set Size: " & objProcess.WorkingSetSize 
End If
You could set up a conditional test on the WorkingSetSize, PageFaults, what
have you, then tell it to restart the service if they reach a certain
threshold.  With that and the service restart script previously sent, you
have the beginnings of something.  Then run as a scheduled task.

 -----Original Message-----
From: Lilley, Brian [mailto:brian.lilley@xxxxxxxx]
Sent: Wednesday, February 02, 2005 11:43 AM
To: 'thin@xxxxxxxxxxxxx'
Subject: [THIN] Re: tool to restart a service if it's memory usage get s
over a certai n amount

if you have the coding skills, you could would write a script/executable
that has a WMI hook into the OS... and then... as if by magic, when the
memory rises above X, it will fire an event which triggers your program to
restart the service.  

-----Original Message-----
From: thin-bounce@xxxxxxxxxxxxx [mailto:thin-bounce@xxxxxxxxxxxxx]On Behalf
Of Jim Kenzig Kenzig.com
Sent: 02 February 2005 17:39
To: thin@xxxxxxxxxxxxx
Subject: [THIN] Re: tool to restart a service if it's memory usage gets over
a certai n amount

You want services Sentinel from WMSoftware.  Reasonably priced per server at
http://www.wmsoftware.com/svcsent/ <http://www.wmsoftware.com/svcsent/> 

"Stratton, Doug MSER:EX" <Doug.M.Stratton@xxxxxxxxxxxxxxx> wrote:

Anyone know of such a thing?
Might even be able to do it with a script.???
This is on windows 2000 that I need it.
Reason is for some reason our print spooler service is bloating up (don't
know why) and using 100,000K of memory.  
I can't figure out what is going on so I want to put something in place that
restarts the service if this happens.
Thanks  As usual free would be nice.

Doug Stratton
Telephone: (250) 356-6678 
Email: Doug.M.Stratton@xxxxxxxxxxxxxxx 


This message is for the sole use of the intended recipient. If you received
this message in error please delete it and notify us. If this message was
misdirected, CSFB does not waive any confidentiality or privilege. CSFB
retains and monitors electronic communications sent through its network.
Instructions transmitted over this system are not binding on CSFB until they
are confirmed by us. Message transmission is not guaranteed to be secure.

**********    Confidentiality Notice    **********
This electronic transmission and any attached documents or other
writings are confidential and are for the sole use of the intended
recipient(s) identified above. This message may contain information
that is privileged, confidential or otherwise protected from disclosure
under applicable law. If the receiver of this information is not the
intended recipient, or the employee, or agent responsible for delivering
the information to the intended recipient, you are hereby notified that
any use, reading, dissemination, distribution, copying or storage of this
information is strictly prohibited. If you have received this information in
error, please notify the sender by return email and delete the electronic
transmission, including all attachments from your system.

Other related posts: