Page 1 of 1
PS script for top CPU and Memory Usage
Posted: Fri Sep 19, 2025 12:16 pm
by 11abbidoa
We are 99% windows and our agents is NSClient++.
The monitoring only provide alerts for high cpu or memory.
Anyone here have good scripts to capture the top 5 or 10 services using the CPU or Memory?
It should capture the service name, pid and the comsumed resrouces in percentage.
Thanks in advance
Re: PS script for top CPU and Memory Usage
Posted: Fri Sep 19, 2025 5:19 pm
by kg2857
exchange.nagios.org
Re: PS script for top CPU and Memory Usage
Posted: Wed Sep 24, 2025 8:28 pm
by tiffincrane
oh i want this script too! thanks!
Re: PS script for top CPU and Memory Usage
Posted: Fri Oct 03, 2025 8:44 am
by AngeloMileto
If you know how to create custom plugins, just make a quick powershell script and call that from XI. Unless there is a way to just execute PowerShell directly from XI.
Anyway, the PowerShell is simple:
Code: Select all
(Get-Counter '\Process(*)\% Processor Time').CounterSamples
This will get you a list of processes with the CPU usage represented in the CookedValue parameter. So then capturing those:
Code: Select all
(Get-Counter '\Process(*)\% Processor Time').CounterSamples | Where-Object {$_.CoodedValue -gt 0}
You could then filter out the idle and _total entries and sort/display whatever you want from there. Not sure what value that is in monitoring as it will report all the time even when CPU usage isn't high - unless you code it that way.
This should get you a start.