Sha256: ca345fdb991f4cbf1fd86ae8d2ffe802b1cde1e6d4203c38c49c3af0c82ded7e
Contents?: true
Size: 1.15 KB
Versions: 2
Compression:
Stored size: 1.15 KB
Contents
# # check-windows-cpu-load.ps1 # # DESCRIPTION: # This plugin collects the CPU Usage and compares against the WARNING and CRITICAL thresholds. # # OUTPUT: # plain text # # PLATFORMS: # Windows # # DEPENDENCIES: # Powershell # # USAGE: # Powershell.exe -NonInteractive -NoProfile -ExecutionPolicy Bypass -NoLogo -File C:\\etc\\sensu\\plugins\\check-windows-cpu-load.ps1 90 95 # # NOTES: # # LICENSE: # Copyright 2016 sensu-plugins # Released under the same terms as Sensu (the MIT license); see LICENSE for details. # [CmdletBinding()] Param( [Parameter(Mandatory=$True,Position=1)] [int]$WARNING, [Parameter(Mandatory=$True,Position=2)] [int]$CRITICAL ) $ThisProcess = Get-Process -Id $pid $ThisProcess.PriorityClass = "BelowNormal" $Value = [System.Math]::Round((Get-Counter '\processor(_total)\% processor time' -SampleInterval 1 -MaxSamples 1).CounterSamples.CookedValue) If ($Value -gt $CRITICAL) { Write-Host CheckWindowsCpuLoad CRITICAL: CPU at $Value%. Exit 2 } If ($Value -gt $WARNING) { Write-Host CheckWindowsCpuLoad WARNING: CPU at $Value%. Exit 1 } Else { Write-Host CheckWindowsCpuLoad OK: CPU at $Value%. Exit 0 }
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
sensu-plugins-windows-1.0.0 | bin/powershell/check-windows-cpu-load.ps1 |
sensu-plugins-windows-0.1.0 | bin/powershell/check-windows-cpu-load.ps1 |