This adds an argument --info/-i which specifies an address and port (e.g. localhost:9080), which exposes a HTTP server that provides health status metric of the server.
Currently two endpoints are implemented:
/metrics: Exposes information of the wireguard daemon, this provides the same information you would get with wg show. This shows an example of what the response would look like.
/readyz: This responds with a json which shows the last time a pong is received from an IP specified with CheckAlive. When CheckAlive is set, a ping is sent out to addresses in CheckAlive per CheckAliveInterval seconds (defaults to 5) via wireguard. If a pong has not been received from one of the addresses within the last CheckAliveInterval seconds (+2 seconds for some leeway to account for latency), then it would respond with a 503, otherwise a 200.
Close #96
ping @erikschul @fmierlo
This adds an argument
--info/-i
which specifies an address and port (e.g.localhost:9080
), which exposes a HTTP server that provides health status metric of the server.Currently two endpoints are implemented:
/metrics
: Exposes information of the wireguard daemon, this provides the same information you would get withwg show
. This shows an example of what the response would look like./readyz
: This responds with a json which shows the last time a pong is received from an IP specified withCheckAlive
. WhenCheckAlive
is set, a ping is sent out to addresses inCheckAlive
perCheckAliveInterval
seconds (defaults to 5) via wireguard. If a pong has not been received from one of the addresses within the lastCheckAliveInterval
seconds (+2 seconds for some leeway to account for latency), then it would respond with a 503, otherwise a 200.For example:
/readyz
would respond withAnd for:
/readyz
would respond withIf nothing is set for
CheckAlive
, an empty JSON object with 200 will be the response.The peer which the ICMP ping packet is routed to depends on the
AllowedIPs
set for each peers.