mirror of
https://github.com/shizunge/endlessh-go.git
synced 2026-08-07 07:15:02 +00:00
Rename prometheus_enable and healthcheck_enable flags to prometheus_enabled and healthcheck_enabled
This commit is contained in:
+1
-1
@@ -19,4 +19,4 @@ HEALTHCHECK --interval=30s --timeout=3s --start-period=10s --retries=3 \
|
||||
CMD ["/endlessh", "-healthcheck"]
|
||||
USER nobody
|
||||
ENTRYPOINT ["/endlessh"]
|
||||
CMD ["-logtostderr", "-v=1", "-healthcheck_enable"]
|
||||
CMD ["-logtostderr", "-v=1", "-healthcheck_enabled"]
|
||||
|
||||
@@ -55,12 +55,12 @@ Usage of ./endlessh-go
|
||||
-conn_type string
|
||||
Connection type. Possible values are tcp, tcp4, tcp6 (default "tcp")
|
||||
-enable_prometheus
|
||||
Enable prometheus (deprecated, use prometheus_enable)
|
||||
Enable prometheus (deprecated, use prometheus_enabled)
|
||||
-geoip_supplier string
|
||||
Supplier to obtain Geohash of IPs. Possible values are "off", "ip-api", "max-mind-db" (default "off")
|
||||
-healthcheck
|
||||
Perform healthcheck and exit. GET healthcheck_host:healthcheck_port/health and exit 1 if status is not ok or timeout is exceeded.
|
||||
-healthcheck_enable
|
||||
-healthcheck_enabled
|
||||
Enable healthcheck
|
||||
-healthcheck_host string
|
||||
The address for healthcheck. (default "127.0.0.1")
|
||||
@@ -90,7 +90,7 @@ Usage of ./endlessh-go
|
||||
SSH listening port. You may provide multiple -port flags to listen to multiple ports. (default "2222")
|
||||
-prometheus_clean_unseen_seconds int
|
||||
Remove series if the IP is not seen for the given time. Set to 0 to disable. (default 0)
|
||||
-prometheus_enable
|
||||
-prometheus_enabled
|
||||
Enable prometheus
|
||||
-prometheus_entry string
|
||||
Entry point for prometheus (default "metrics")
|
||||
@@ -123,7 +123,7 @@ Endlessh-go exports the following Prometheus metrics.
|
||||
| endlessh_client_open_count | count | Number of connections of clients. <br> Labels: <br> <ul><li> `ip`: Remote IP of the client </li> <li> `local_port`: Local port the program listens to </li> <li> `country`: Country of the IP </li> <li> `location`: Country, Region, and City </li> <li> `geohash`: Geohash of the location </li></ul> |
|
||||
| endlessh_client_trapped_time_seconds | count | Seconds a client spends on endlessh. <br> Labels: <br> <ul><li> `ip`: Remote IP of the client </li> <li> `local_port`: Local port the program listens to </li></ul> |
|
||||
|
||||
The metrics is off by default, you can turn it via the CLI argument `-prometheus_enable`.
|
||||
The metrics is off by default, you can turn it via the CLI argument `-prometheus_enabled`.
|
||||
|
||||
It listens to port `2112` and entry point is `/metrics` by default. The port and entry point can be changed via CLI arguments.
|
||||
|
||||
@@ -133,7 +133,7 @@ You could also use an offline GeoIP database from [MaxMind](https://www.maxmind.
|
||||
|
||||
## Healthcheck
|
||||
|
||||
The endlessh-go server exposes an HTTP health endpoint when the `-healthcheck_enable` flag is set. By default it listens on `127.0.0.1:51000` at `/health` and returns a JSON like this:
|
||||
The endlessh-go server exposes an HTTP health endpoint when the `-healthcheck_enabled` flag is set. By default it listens on `127.0.0.1:51000` at `/health` and returns a JSON like this:
|
||||
|
||||
```json
|
||||
{
|
||||
|
||||
@@ -263,7 +263,7 @@ func TestEndlesshIntegration_PrometheusMetrics(t *testing.T) {
|
||||
cmd := exec.Command(
|
||||
"go", "run", "main.go",
|
||||
"-port=0",
|
||||
"-prometheus_enable",
|
||||
"-prometheus_enabled",
|
||||
"-prometheus_port=0",
|
||||
"-interval_ms=100",
|
||||
"-logtostderr", "-v=1",
|
||||
@@ -329,7 +329,7 @@ func TestEndlesshIntegration_Healthcheck(t *testing.T) {
|
||||
cmd := exec.Command(
|
||||
"go", "run", "main.go",
|
||||
"-port=0",
|
||||
"-healthcheck_enable",
|
||||
"-healthcheck_enabled",
|
||||
"-healthcheck_port=0",
|
||||
"-interval_ms=100",
|
||||
"-logtostderr", "-v=1",
|
||||
|
||||
@@ -8,7 +8,7 @@ services:
|
||||
- -interval_ms=1000
|
||||
- -logtostderr
|
||||
- -v=1
|
||||
- -prometheus_enable
|
||||
- -prometheus_enabled
|
||||
- -geoip_supplier=ip-api
|
||||
networks:
|
||||
- example_network
|
||||
|
||||
@@ -14,7 +14,7 @@ spec:
|
||||
- -interval_ms=1000
|
||||
- -logtostderr
|
||||
- -v=1
|
||||
- -prometheus_enable
|
||||
- -prometheus_enabled
|
||||
- -geoip_supplier=ip-api
|
||||
- -host=[::]
|
||||
- -prometheus_host=[::]
|
||||
|
||||
@@ -144,8 +144,8 @@ func main() {
|
||||
proxyProtocolReadHeaderTimeout := flag.Int("proxy_protocol_read_header_timeout_ms", 200, "Timeout for reading the PROXY protocol header in milliseconds. If the connection does not send a valid PROXY protocol header in this time, the header is ignored.")
|
||||
|
||||
// Prometheus metrics flags
|
||||
prometheusEnabledOld := flag.Bool("enable_prometheus", false, "Enable prometheus (deprecated, use prometheus_enable)")
|
||||
prometheusEnabledNew := flag.Bool("prometheus_enable", false, "Enable prometheus")
|
||||
prometheusEnabledOld := flag.Bool("enable_prometheus", false, "Enable prometheus (deprecated, use prometheus_enabled)")
|
||||
prometheusEnabledNew := flag.Bool("prometheus_enabled", false, "Enable prometheus")
|
||||
prometheusHost := flag.String("prometheus_host", "0.0.0.0", "The address for prometheus")
|
||||
prometheusPort := flag.String("prometheus_port", "2112", "The port for prometheus")
|
||||
prometheusEntry := flag.String("prometheus_entry", "metrics", "Entry point for prometheus")
|
||||
@@ -156,7 +156,7 @@ func main() {
|
||||
maxMindDbFileName := flag.String("max_mind_db", "", "Path to the MaxMind DB file.")
|
||||
|
||||
// Healthcheck flags
|
||||
healthcheckEnabled := flag.Bool("healthcheck_enable", false, "Enable healthcheck")
|
||||
healthcheckEnabled := flag.Bool("healthcheck_enabled", false, "Enable healthcheck")
|
||||
healthcheckHost := flag.String("healthcheck_host", health.DefaultHost, "The address for healthcheck.")
|
||||
healthcheckPort := flag.String("healthcheck_port", health.DefaultPort, "HTTP port for healthcheck; Serves JSON with status and uptime at /health.")
|
||||
healthcheck := flag.Bool("healthcheck", false, "Perform healthcheck and exit. GET healthcheck_host:healthcheck_port/health and exit 1 if status is not ok or timeout is exceeded.")
|
||||
@@ -172,7 +172,7 @@ func main() {
|
||||
prometheusEnabled := *prometheusEnabledNew
|
||||
prometheusEnableSet := false
|
||||
flag.Visit(func(f *flag.Flag) {
|
||||
if f.Name == "prometheus_enable" {
|
||||
if f.Name == "prometheus_enabled" {
|
||||
prometheusEnableSet = true
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user