How can I monitor the memory usage of Windows Processes without alarms?

Votes:

0

Your Vote:

Up

Down

if I want to monitor the memory usage of (multiple instances) from a certain Windows Process on a certain target machine, but do not want to have a red sensor if the process does not run at all, how can I do this? The Working Set Size shall be recorded in PRTG.

custom-sensor prtg wmi-process-sensor

Created on May 5, 2010 12:04:07 PM by  Torsten Lindner [Paessler Support] (15,450) 3 1

Last change on May 5, 2010 12:04:33 PM by  Torsten Lindner [Paessler Support] (15,450) 3 1



1 Reply

Accepted Answer

Votes:

1

Your Vote:

Up

Down

This can be done with the following vb-Script:

Please copy the script into PRTGs subfolder for Custom Script Sensors "\PRTG Network Monitor\Custom Sensors\EXE" and then add a sensor in PRTG choosing this script. A few things have to be considered when you want to use this script:

Demo VBScrpt - Monitors WWS of Process X

Dim lByte
Dim lSumme
lByte = 0
lSumme = 0
strComputer = "."

set Param = wScript.Arguments

if Param.Count < 1 Then
   WScript.echo "4: No parameters set"
   WScript.Quit(4)
ElseIf Param.Count > 2 Then
   WScript.echo "4: Too many parameters"
   WScript.Quit(4)
ElseIf Param.Count < 2 Then
On Error Resume Next
Set objWMIService = GetObject("winmgmts:" _
    & "{impersonationLevel=impersonate}!\\" _
    & strComputer & "\root\cimv2")
if Err.Number > 0 then
   WScript.echo "4: Access denied"
   WScript.Quit(4)
   Err.Clear
end if
else
On Error Resume Next
Set objWMIService = GetObject("winmgmts:" _
    & "{impersonationLevel=impersonate}!\\" _
    & Param(1) & "\root\cimv2")
if Err.Number > 0 then
   WScript.echo "4: Access denied"
   WScript.Quit(4)
   Err.Clear
end if
end if

Set colItems = objWMIService.ExecQuery( _
    "Select * from Win32_Process WHERE name ='"&Param(0)&"'")

For Each objProcess in colItems
    lByte = CLng (lSumme)
    lSumme = CLng (objProcess.WorkingSetSize) + CLng (lByte)
Next

WScript.echo lSumme & ":OK"


  • The script expects two parameters (they can be set in the Settings-tab of the sensor in PRTG, the field is "Parameters"):
    • First the name of Process which should be monitored.
    • Secondly the name of the target machine. This parameter can be left, then the check runs on the local machine (the probe machine under which the sensor runs in PRTG)
    • Example: "chrome.exe server2003.mydomain.local" (without the "")
  • The script returns the size of the Working Set in bytes, cumulated if more than instance of the particular process is running.
  • It is most likely necessary to run the according PRTG Probe under a (domain) administrators account, as the LOCAL SYSTEM-Account does probably not have sufficient access rights/permission to request the information from other targets than the local machine.

Created on May 5, 2010 12:51:20 PM by  Torsten Lindner [Paessler Support] (15,450) 3 1

Last change on May 5, 2010 12:56:08 PM by  Torsten Lindner [Paessler Support] (15,450) 3 1



Please log in or register to enter your reply.


Disclaimer: The information in the Paessler Knowledge Base comes without warranty of any kind. Use at your own risk. Before applying any instructions please exercise proper system administrator housekeeping. You must make sure that a proper backup of all your data is available.

PRTG
Network Monitor
Intuitive to Use.
Easy to manage.

150.000 administrators have chosen PRTG to monitor their network. Find out how you can reduce cost, increase QoS and ease planning, as well.

Visit
www.paessler.com

What is this?

This knowledgebase contains questions and answers about PRTG Network Monitor and network monitoring in general. You are invited to get involved by asking and answering questions!

Learn more

Top Tags


View all Tags