Sha256: 13c7dd811d92809de3d9225446b1f424e218802013ac118941755b75b2472aab
Contents?: true
Size: 1.01 KB
Versions: 2
Compression:
Stored size: 1.01 KB
Contents
# # check-windows-service.ps1 # # DESCRIPTION: # This plugin checks whether a User-inputted Windows service is running or not. # # OUTPUT: # plain text # # PLATFORMS: # Windows # # DEPENDENCIES: # Powershell # # USAGE: # Powershell.exe -NonInteractive -NoProfile -ExecutionPolicy Bypass -NoLogo -File C:\\etc\\sensu\\plugins\\check-windows-service.ps1 # # 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)] [string]$ServiceName ) $ThisProcess = Get-Process -Id $pid $ThisProcess.PriorityClass = "BelowNormal" $Exists = Get-Service $ServiceName -ErrorAction SilentlyContinue If ($Exists) { If (($Exists).Status -eq "Running") { Write-Host OK: $ServiceName Running. Exit 0 } If (($Exists).Status -eq "Stopped") { Write-Host CRITICAL: $ServiceName Stopped. Exit 2 } } If (!$Exists) { Write-Host CRITICAL: $ServiceName not found! Exit 2 }
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
sensu-plugins-windows-1.0.0 | bin/powershell/check-windows-service.ps1 |
sensu-plugins-windows-0.1.0 | bin/powershell/check-windows-service.ps1 |