-
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
Add Socket check type #1130
Add Socket check type #1130
Conversation
Agreed, although we are just passing parameters to Fixes #976. |
I think renaming the check type from "socket" to "tcp" is also more clear (does it support unix domain sockets for example?) |
I'm particularly not in love with the naming either. @armon can I ask why a UDP health check doesn't make sense? It does support UNIX sockets too BTW. |
Also, I figured that people may wish to check that a service is available explicitly on IPv4 or IPv6 - if we limit it to |
Hey @pdf, UDP checks wouldn't entirely make sense because of the connectionless nature of the protocol. You would need to send packets and wait to receive packets in order to determine a successful transmission, which would require specialized logic on the remote end. We should still be able to check IP4/IP6. Looking at the |
@ryanbreen of course you're correct on UDP, I wasn't thinking. We could send a packet with no payload though. WRT IPv6/IPv4, there's no way to check explicitly for one or the other if you also want to check via hostname, without specifying the protocol.. |
Okay, UDP is not going to be possible cross-platform due to lack of datagram ICMP support on Windows, so if we restrict this to TCP, do we care about supporting explicit IPv4 vs IPv6 checks? If not, I'll change this to use the The reason I raise the IPv4/IPv6 issue is that it may be important for people to check that a service is available on both IPv6 and IPv4, rather than 'any'. |
Adds the ability to simply check whether a TCP socket accepts connections to determine if it is healthy. This is a light-weight - though less comprehensive than scripting - method of checking network service health. The check parameter `tcp` should be set to the `address:port` combination for the service to be tested. Supports both IPv6 and IPv4, in the case of a hostname that resolves to both, connections will be attempted via both protocol versions, with the first successful connection returning a successful check result. Example check: ```json { "check": { "id": "ssh", "name": "SSH (TCP)", "tcp": "example.com:22", "interval": "10s" } } ```
Current version is |
@pdf This is looking great. Would you mind updating the documentation as well? I think that is all that is missing. |
Righteo, I think I hit all the documentation points. |
Eh, don't think my documentation changes broke the tests 😉 |
+1 |
Looks great, thanks! |
Adds the ability to simply check whether a socket accepts connections to
determine if it is healthy. This is a light-weight - though less
comprehensive than scripting - method of checking network service
health.
Two check parameters are used:
Socket
should be set to the location of the socket to be tested, forexample,
example.com:port
, or/path/to/unix.sock
Network
accepts any network type that the Go net library accepts,as documented here: https://golang.org/pkg/net/#Dial
Network
defaults totcp
Example check:
No documentation updates yet for this PR, if you're keen to accept this, I'll
take a pass at updating them too.