Icinga / icinga-powershell-plugins

A collection of Windows check plugins for the Icinga PowerShell Framework
GNU General Public License v2.0
51 stars 28 forks source link

Invoke-IcingaCheckProcess / Invoke-IcingaCheckCPU | #403

Closed sgruber94 closed 1 month ago

sgruber94 commented 4 months ago

Hi togehter,

is there a way to Monitor a Service CPU Usage? Actual i have three Services that are using the same ProcessName like "edge", so i can`t determinate the Service with the ProcessName

So my first thought is writing a wrapper to determinate the PID and then Checking the usage. Is there something planned in the near future? Otherwise I´m Planning

-> Check Command -Service "myservice1" -> (internal PID Check -> Determinate CPU Usage

Regards Sarah

LordHepipud commented 3 months ago

Thank you for the message. The main problem is that the PID is always changing if the process gets terminated.

But based on your requirements, wouldn the Invoke-IcingaCheckProcesssolve this issue?

icinga> icinga { Invoke-IcingaCheckProcess -Process msedge -Verbosity 3 }

[OK] Process Overview: 1 Ok (All must be [OK])
\_ [OK] msedge (All must be [OK])
   \_ [OK] msedge [10004] (All must be [OK])
      \_ [OK] CPU Usage: 0%
      \_ [OK] Memory Usage: 190.48MiB
      \_ [OK] Page File Usage: 218.07KiB
      \_ [OK] Thread Count: 20c
   \_ [OK] msedge [10580] (All must be [OK])
      \_ [OK] CPU Usage: 0%
      \_ [OK] Memory Usage: 76.38MiB
      \_ [OK] Page File Usage: 84.64KiB
      \_ [OK] Thread Count: 18c
   \_ [OK] msedge [11828] (All must be [OK])
      \_ [OK] CPU Usage: 0%
      \_ [OK] Memory Usage: 1.56MiB
      \_ [OK] Page File Usage: 2.32KiB
      \_ [OK] Thread Count: 8c
   \_ [OK] msedge [12096] (All must be [OK])
      \_ [OK] CPU Usage: 0%
      \_ [OK] Memory Usage: 2.68MiB
      \_ [OK] Page File Usage: 7.82KiB
      \_ [OK] Thread Count: 8c
      ...
| 'msedge::ifw_process::memory'=826130400B;;;0;6436880000 'msedge::ifw_process::count'=19c;; 'msedge::ifw_process::threads'=314c;; 'msedge::ifw_process::cpu'=0%;;;0;100 'msedge::ifw_process::pagefile'=1007492B;;;0;4563403000

This will print all PIDs for the msedge process and report the CPU, Memory, Pagfile and Thread usage.

You can then use the plugin arguments to check for the total resource consumption or globally for each single PID.