I have a windows only consul setup.
We are monitoring the health of Window Services.
We have Powershell scripts that determine if a service is running.
I want to restart the service if it has unexpected shutdown.
So i am trying to use watches.
"watches": [
{
"type": "checks",
"state": "critical",
"handler": "PowerShell -ExecutionPolicy Bypass -NoProfile -File C:\\scripts\\StartService.ps1"
}
]
I am trying to figure out how to access Payload in the handler script.
I have log level at debug and I do see handle script executes.
I need to payload to determine which service health check failed.
However I cannot figure out how to get the value of payload in a powershell script.
Automatic variable $input is empty. $args is empty as well
Let me know if somebody has a PowerShell watch handler example.