Sha256: 759bd5c434e733969ce7ca38f698e640433055e9584a2fbf0acd67065a698ea1

Contents?: true

Size: 1.36 KB

Versions: 11

Compression:

Stored size: 1.36 KB

Contents

#
#   check-windows-pagefile.ps1
#
# DESCRIPTION:
#   This plugin collects the Pagefile Usage and compares against the WARNING and CRITICAL thresholds.
#
# OUTPUT:
#   plain text
#
# PLATFORMS:
#   Windows
#
# DEPENDENCIES:
#   Powershell 3.0 or above
#
# USAGE:
#   Powershell.exe -NonInteractive -NoProfile -ExecutionPolicy Bypass -NoLogo -File C:\\opt\\sensu\\plugins\\check-windows-pagefile.ps1 75 85
#
# NOTES:
#
# LICENSE:
#   Copyright 2016 sensu-plugins
#   Released under the same terms as Sensu (the MIT license); see LICENSE for details.
#

#Requires -Version 3.0

[CmdletBinding()]
Param(
  [Parameter(Mandatory=$True,Position=1)]
   [int]$WARNING,

   [Parameter(Mandatory=$True,Position=2)]
   [int]$CRITICAL
)

$ThisProcess = Get-Process -Id $pid
$ThisProcess.PriorityClass = "BelowNormal"

[int]$pagefileAllocated = Get-WmiObject -Class Win32_PageFileUsage | Select -ExpandProperty AllocatedBaseSize
[int]$pagefileCurrentUsage = Get-WmiObject -Class Win32_PageFileUsage | Select -ExpandProperty CurrentUsage

[int]$Value = ($pagefileCurrentUsage/$pagefileAllocated) * 100

If ($Value -gt $CRITICAL) {
  Write-Host CheckWindowsPagefile CRITICAL: Pagefile usage at $Value%.
  Exit 2 }

If ($Value -gt $WARNING) {
  Write-Host CheckWindowsPagefile WARNING: Pagefile usage at $Value%.
  Exit 1 }

Else {
  Write-Host CheckWindowsPagefile OK: Pagefile usage at $Value%.
  Exit 0 }

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
sensu-plugins-windows-2.8.1 bin/powershell/check-windows-pagefile.ps1
sensu-plugins-windows-2.8.0 bin/powershell/check-windows-pagefile.ps1
sensu-plugins-windows-2.7.0 bin/powershell/check-windows-pagefile.ps1
sensu-plugins-windows-2.6.0 bin/powershell/check-windows-pagefile.ps1
sensu-plugins-windows-2.5.0 bin/powershell/check-windows-pagefile.ps1
sensu-plugins-windows-2.4.1 bin/powershell/check-windows-pagefile.ps1
sensu-plugins-windows-2.4.0 bin/powershell/check-windows-pagefile.ps1
sensu-plugins-windows-2.3.0 bin/powershell/check-windows-pagefile.ps1
sensu-plugins-windows-2.2.1 bin/powershell/check-windows-pagefile.ps1
sensu-plugins-windows-2.2.0 bin/powershell/check-windows-pagefile.ps1
sensu-plugins-windows-2.1.0 bin/powershell/check-windows-pagefile.ps1