Sha256: b512c5406bdceef9533fc0977669182de9231959a59c51ef722ed53ddc2ab721
Contents?: true
Size: 1.24 KB
Versions: 2
Compression:
Stored size: 1.24 KB
Contents
# # check-windows-ram.ps1 # # DESCRIPTION: # This plugin collects the RAM 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-ram.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" $Memory = (Get-WmiObject -Query "SELECT TotalVisibleMemorySize, FreePhysicalMemory FROM Win32_OperatingSystem") $Value = [System.Math]::Round(((($Memory.TotalVisibleMemorySize-$Memory.FreePhysicalMemory)/$Memory.TotalVisibleMemorySize)*100),2) If ($Value -gt $CRITICAL) { Write-Host CheckWindowsRAMLoad CRITICAL: RAM at $Value%. Exit 2 } If ($Value -gt $WARNING) { Write-Host CheckWindowsRAMLoad WARNING: RAM at $Value%. Exit 1 } Else { Write-Host CheckWindowsRAMLoad OK: RAM 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-ram.ps1 |
sensu-plugins-windows-0.1.0 | bin/powershell/check-windows-ram.ps1 |