New Question
 
 
PRTG Network Monitor

Intuitive to Use.
Easy to manage.

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

Free PRTG
Download >>

 

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


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-script-exe custom-sensor prtg wmi-process-sensor

Created on May 5, 2010 12:04:07 PM by  Torsten Lindner [Paessler Support]

Last change on Mar 19, 2015 3:45:56 PM by  Martina Wittmann [Paessler Support]



5 Replies

Accepted Answer

Votes:

2

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]

Last change on May 5, 2010 12:56:08 PM by  Torsten Lindner [Paessler Support]



Votes:

0

Your Vote:

Up

Down

Hello, I know this is old, but I need to monitor a specific w3wp.exe process. Only one that is related to a specific application pool. There are other w3wp.exe processes I don't need to monitor, or at least I could monitor all but with separate names. Is there a way to do it? I want to have a monitoring of it's memory usage.

Thanks

Created on Feb 13, 2015 2:50:03 PM by  ekasaj (0)



Votes:

0

Your Vote:

Up

Down

Hello,

I'm afraid this is not possible with PRTGs default sensors or the above script, but please have a look at the following articles (and the links in them):

best regards

Created on Feb 16, 2015 8:59:08 AM by  Torsten Lindner [Paessler Support]

Last change on Sep 27, 2018 12:57:53 PM by  Luciano Lingnau [Paessler Support]



Votes:

0

Your Vote:

Up

Down

Hi,

I'm aware that this is a very old article, but I hope that someone can help me. This script works like a charm! except for when the proces that you're monitoring uses => 2GB of memory. Above 2GB of memory usage the value in PRTG will read 0.

Does anyone have a solution for this?

Thanks! Kind regards.

Created on Sep 27, 2018 12:01:28 PM by  ehofstede (0)



Votes:

0

Your Vote:

Up

Down

Well, the easiest approach is to use a HTTP Push Data (Advanced) sensor for each host, and run a script on the target host that pushes the data to it as a scheduled task:

get-process | Group-Object -Property ProcessName | Format-Table Name, @{n='Mem (MB)';e={'{0:N0}' -f (($_.Group|Measure-Object WorkingSet -Sum).Sum / 1MB)};a='right'} -AutoSize

This is just to get you started, it will give you an object list of all processes and their combined memory usage in Megabyte. You'll need to print it in the corresponding format, as described in the manual, though :)


PRTG Scheduler | PRTGapi | Feature Requests | WMI Issues | SNMP Issues

Kind regards,
Stephan Linke, Tech Support Team

Created on Sep 28, 2018 8:56:06 AM by  Stephan Linke [Paessler Support]



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.