Sha256: da9eeb1ea54cfb19e992f9784f4d3a98318fbabc5d25fed67d5ade9edf544c58

Contents?: true

Size: 820 Bytes

Versions: 4

Compression:

Stored size: 820 Bytes

Contents

#
#   metric-windows-cpu-load.ps1
#
# DESCRIPTION:
#   This plugin collects and outputs the CPU 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-cpu-load.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"

$Path = hostname
$Path = $Path.ToLower()

$Value = (Get-WmiObject CIM_Processor).LoadPercentage

$Time = [int][double]::Parse((Get-Date -UFormat %s))

Write-Host "$Path.system.processor_total.%_processor_time $Value $Time"

Version data entries

4 entries across 4 versions & 1 rubygems

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