Sha256: 04e6ad2e597bf0cecb5f80589c3374afb8de9ecb0b0f5455dbcbcd253fb0653b

Contents?: true

Size: 1.07 KB

Versions: 4

Compression:

Stored size: 1.07 KB

Contents

#
#   metric-windows-ram-usage.ps1
#
# DESCRIPTION:
#   This plugin collects and outputs the Ram Usage in a Graphite acceptable format.
#
# OUTPUT:
#   metric data
#
# PLATFORMS:
#   Windows
#
# DEPENDENCIES:
#   Powershell
#
# USAGE:
#   Powershell.exe -NonInteractive -NoProfile -ExecutionPolicy Bypass -NoLogo -File C:\\etc\\sensu\\plugins\\metric-windows-ram-usage.ps1
#
# NOTES:
#
# LICENSE:
#   Copyright 2016 sensu-plugins
#   Released under the same terms as Sensu (the MIT license); see LICENSE for details.
#
$ThisProcess = Get-Process -Id $pid
$ThisProcess.PriorityClass = "BelowNormal"

$FreeMemory = (Get-WmiObject -Query "SELECT TotalVisibleMemorySize, FreePhysicalMemory FROM Win32_OperatingSystem").FreePhysicalMemory
$TotalMemory = (Get-WmiObject -Query "SELECT TotalVisibleMemorySize, FreePhysicalMemory FROM Win32_OperatingSystem").TotalVisibleMemorySize

$Path = (hostname).ToLower()
$Value = [System.Math]::Round(((($TotalMemory-$FreeMemory)/$TotalMemory)*100),2)
$Time = [int][double]::Parse((Get-Date -UFormat %s))

Write-host "$Path.system.ram.RamUsagePercent $Value $Time"

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
sensu-plugins-windows-2.1.0 bin/powershell/metric-windows-ram-usage.ps1
sensu-plugins-windows-2.0.0 bin/powershell/metric-windows-ram-usage.ps1
sensu-plugins-windows-1.0.0 bin/powershell/metric-windows-ram-usage.ps1
sensu-plugins-windows-0.1.0 bin/powershell/metric-windows-ram-usage.ps1