-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Expose Consul health check identifier #4020
Comments
Hi, thanks for opening this issue. We don't currently have the ability to look up health check identifiers in Nomad, but we have plans to make this better in the future. As you mentioned, in the meantime you can look up the health check identifier in Consul after Nomad has registered it via Consul's check API: https://www.consul.io/docs/agent/checks.html. Let us know if there is anything else we can help with, leaving this issue open to track future improvements for this. |
Just for the record. In our case we use Java so I used the consul-client library to communicate with the agent. And I did:
Two highlights:
Now I believe I still have one problem. In our current set up we run a consul agent per Nomad worker. So this agent gets registrations of all services running on that host. If a service has two instances on one worker agent checks would return two health checks with same name and service name. I can see three ways out of this:
Please let me know if I missed anything. |
I'm using telegraf's Consul input plugin which generates health metrics based on consul checks. I register my services through nomad and it generates new check IDs every time. This makes the tags in influxdb assume tens of thousands of values which makes the monitoring completely useless as there's no way to associate anything to anything. All that is needed is to allow an |
Any updates on this? We would still love to use Consul's telemetry for health checks. |
@Fuco1 We are facing the exactly issue, since the community is not actively looking into this issue, we are planning to prepare a patch, would you be interested ? |
We've also hit this. At the moment, we've settled for either reserving a static port in our job spec or using If you're willing to rely on a naming convention, it is possible to retrieve the checks for an allocation like this: $ curl -s "http://127.0.0.1:8500/v1/health/checks/$NOMAD_JOB_NAME" | jq -r '.[] | select(.ServiceID | contains("'"$NOMAD_ALLOC_ID"'")).CheckID'
_nomad-check-a323981091ed884a533faa3c8bd57108563c33a5
_nomad-check-d7d37722cee669a96a6e80b40bfd0d0fd183b832 This relies on Nomad embedding the allocation ID into the Consul service ID, which I don't believe is documented/guaranteed, but does seem to be the case, at least in the versions of Nomad we've tried. |
We want to use Nomad together with Consul. One of our libraries registers a session with Consul and adds additional checks (serf and service). The Consul API is not very specific about it but it looks from observed behavior that the checks are actually IDs of checks (https://www.consul.io/api/session.html#checks).
Our current implementation does not use Nomad. It registers checks manually on Consul and it sets the ID which is then used by the library. The Consul API permits that (https://www.consul.io/docs/agent/checks.html).
When running with Nomad the ID of the Consul check is generated. Hence the library doesn't know it. I would like to set the ID of the check - currently Nomad does not allow that: https://www.nomadproject.io/docs/job-specification/service.html#check-parameters
Alternatively, since I set the ID of the additional check as an env variable, if Nomad exports the generated value in some way I can use that.
The text was updated successfully, but these errors were encountered: