-
Notifications
You must be signed in to change notification settings - Fork 4.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Service is flapping if output from script check changes #2754
Comments
If it's passing each time, it's not flapping. Flapping would be cycling between healthy and unhealthy states. If the output changes, then yes that's treated as a change, but the status is still healthy, right? |
Right, but is it expected that the watch handler is fired off when there has been no state change? |
Basically, I have a Consul watcher configured to start a service when its backends change, and the service is currently being restarted more often than expected. |
Yes, it's expected, even if it's not desired. Can you make your check output deterministic, instead? |
I can change my check to |
Hi @joshuaspence this is working as designed since the check output is part of the check record, so every time that changes it bumps the Raft index, which is what triggers the watcher which is looking for any change to the results. You definitely want to avoid check output with values that change all the time. You can also crank up https://www.consul.io/docs/agent/options.html#check_update_interval to throttle writes when the output changes but the state of the check doesn't change. |
I'm not sure if this is intentional, but under Consul 0.7.1 it seems that a
service
event is generated if the standard output from ascript
check changes. I have avarnish
service defined using the following configuration:Running
consul watch -service=varnish -type=service "date; curl --silent --show-error http://127.0.0.1:8500/v1/health/service/varnish?pretty; echo ----------"
, I see the child process executed every time that the output fromvarnishadm ping
changes:The text was updated successfully, but these errors were encountered: