Kaseya Community

Capture Processes with top CPU usage

  • Hi,

    I'v been searching for this for quiet some time but haven't found a real sollution yet.
    I have monitor sets running which generate an alert when de CPU is above 90%.
    I am looking for a script i can run when this happends and capture the top processes with %CPU usages.

    Example:
    Monitor alert

    SNMP Device: N/A
    Monitor Set: Server Prestaties
    Type: Counter
    Log Object Name: CPU
    Agent Alarm Time: 17:24:02 17-Feb-15
    Event Time: 16:24:02 17-Feb-15 UTC
    Log Value: 100
    Alarm Operator: Over
    Alarm Threshold: 90 % Processor Time
    Alarm Duration: 1 Minute(s)

    Output of the script

    ImageName PID Threads Priority CPU Owner
    Idle 0 4 0 11 Error 0x6 : De ingang is ongeldig.
    System 4 167 8 0 Error 0x6 : De ingang is ongeldig.
    smss.exe 400 2 11 0 NT AUTHORITY\SYSTEM
    csrss.exe 544 9 13 0 NT AUTHORITY\SYSTEM
    wininit.exe 620 3 13 0 NT AUTHORITY\SYSTEM
    csrss.exe 648 15 13 0 NT AUTHORITY\SYSTEM
    services.exe 680 6 9 0 NT AUTHORITY\SYSTEM
    lsass.exe 704 7 9 0 NT AUTHORITY\SYSTEM
    lsm.exe 716 9 8 0 NT AUTHORITY\SYSTEM
    winlogon.exe 808 3 13 0 NT AUTHORITY\SYSTEM
    svchost.exe 868 10 8 0 NT AUTHORITY\SYSTEM

  • Ps. I have tried some tools like":

    - PSlist.exe

    - Procmon.exe

    - Process.exe

    But none give me the correct results. Process.exe does actualy come close but the % CPU is not correct.

  • jon.netdork.net/.../powershell-top-x-processes-using-cpu

    try this.

  • Procedure Performance.Get Top10 Precesses.zip

    Try this . IT's the Agent procedure plus to vbs files to get top 10 CPU and top 10 Mem users

  • You'll also need to edit the script and remove or disable the last 2 lines as they delete the files you actually need.

    So add a step before them to get the file content as a variable etc , or just delete them

    Paul