Last active
August 29, 2015 14:22
-
-
Save MattHodge/a3c81e8601b300f14868 to your computer and use it in GitHub Desktop.
Sensu Windows Check
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Param | |
( | |
# Param1 help description | |
[Parameter(Mandatory=$true)] | |
$ServiceName | |
) | |
$status = (Get-Service -name $ServiceName) | |
if ($status.Status -ne 'Running') | |
{ | |
Write-Output "$($status.DisplayName) ($($status.Name)) is not currently running!" | |
exit 2 | |
} | |
else | |
{ | |
Write-Output "$($status.DisplayName) ($($status.Name)) is running." | |
exit 0 | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"checks": { | |
"service_w32time": { | |
"command": "powershell.exe -noprofile -executionpolicy unrestricted -nologo -file C:\\opt\\sensu\\conf.d\\check-service.ps1 -ServiceName w32time", | |
"subscribers": [ | |
"production" | |
], | |
"interval": 10, | |
"how_to_fix": "Restart the service" | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment