diff --git a/README.md b/README.md index 81e217b..8dea942 100644 --- a/README.md +++ b/README.md @@ -7,20 +7,19 @@ usage: clickhouse-exporter [] Flags: -h, --help Show context-sensitive help (also try --help-long and --help-man). - --chi-name="localhost" - Clickhouse cluster name. - --namespace="default" The namespace label for metrics. + --chi-name="MacBook-Pro.local" + Clickhouse cluster name or $HOSTNAME. + --namespace="default" The namespace label for metrics or $NAMESPACE. --metrics-endpoint=":8888" The Prometheus exporter endpoint. --chi-list-endpoint=":8888" The CHI list endpoint. - --scheme=http Clickhouse HTTP scheme. - --username="default" Clickhouse username. - --password="" Clickhouse user password. - --port=8123 Clickhouse HTTP port number. + --scheme=http Clickhouse HTTP scheme or $CH_SCHEME + --username="default" Clickhouse username or $CH_USERNAME. + --password="" Clickhouse user password or $CH_PASSWORD. + --port=8123 Clickhouse HTTP port number or $CH_PORT. --address=127.0.0.1 ... A list of Clickhouse hosts - --log-level=info Only log messages with the given severity or above. Valid levels: [debug, info, warn, - error, fatal] + --log-level=info Only log messages with the given severity or above. Valid levels: [debug, info, warn, error, fatal] --log-format=json Set the log format. Valid formats: [json, text] --version Show application version. ``` diff --git a/main.go b/main.go index d08608c..d7d9aba 100644 --- a/main.go +++ b/main.go @@ -48,21 +48,21 @@ var ( func init() { host, _ := os.Hostname() - kingpin.Flag("chi-name", "Clickhouse cluster name."). - Default(host).StringVar(&chiName) - kingpin.Flag("namespace", "The namespace label for metrics."). + kingpin.Flag("chi-name", "Clickhouse cluster name or $HOSTNAME."). + Default(host).Envar("HOSTNAME").StringVar(&chiName) + kingpin.Flag("namespace", "The namespace label for metrics or $NAMESPACE."). Default(defaultNamespace).Envar("NAMESPACE").StringVar(&namespace) kingpin.Flag("metrics-endpoint", "The Prometheus exporter endpoint."). Default(defaultMetricsEndpoint).StringVar(&metricsEP) kingpin.Flag("chi-list-endpoint", "The CHI list endpoint."). Default(defaultChiListEP).StringVar(&chiListEP) - kingpin.Flag("scheme", "Clickhouse HTTP scheme."). + kingpin.Flag("scheme", "Clickhouse HTTP scheme or $CH_SCHEME"). Default(defaultChScheme).Envar("CH_SCHEME").EnumVar(&scheme, "http", "https") - kingpin.Flag("username", "Clickhouse username."). + kingpin.Flag("username", "Clickhouse username or $CH_USERNAME."). Default(defaultChUser).Envar("CH_USERNAME").StringVar(&username) - kingpin.Flag("password", "Clickhouse user password."). + kingpin.Flag("password", "Clickhouse user password or $CH_PASSWORD."). Default(defaultChPass).Envar("CH_PASSWORD").StringVar(&password) - kingpin.Flag("port", "Clickhouse HTTP port number."). + kingpin.Flag("port", "Clickhouse HTTP port number or $CH_PORT."). Default(defaultChPort).Envar("CH_PORT").IntVar(&port) kingpin.Flag("address", "A list of Clickhouse hosts"). Default(defaultChHost).StringsVar(&hostnames)