Skip to content

Commit

Permalink
Update CLI help, types and documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
mweinelt committed Mar 21, 2024
1 parent 265ac05 commit d80cf23
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 23 deletions.
29 changes: 12 additions & 17 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -67,31 +67,26 @@ Usage

::

Usage: kea-exporter [OPTIONS] [SOCKETS]...

Options:
-m, --mode [socket|http] Select mode.
-a, --address TEXT Specify the address to bind against.
-p, --port INTEGER Specify the port on which to listen.
-i, --interval INTEGER Minimal interval between two queries to Kea in seconds.
-t, --target TEXT Target address and port of Kea server, e.g.
http://kea.example.com:8080.
--client-cert TEXT Client certificate file path used in HTTP mode
with mTLS
--client-key TEXT Client key file path used in HTTP mode with mTLS
--version Show the version and exit.
--help Show this message and exit.

Usage: python -m kea_exporter [OPTIONS] TARGETS...

Options:
-a, --address TEXT Address that the exporter binds to.
-p, --port INTEGER Port that the exporter binds to.
-i, --interval INTEGER Minimal interval between two queries to Kea in
seconds.
--client-cert PATH Path to client certificate used to in HTTP requests
--client-key PATH Path to client key used in HTTP requests
--version Show the version and exit.
--help Show this message and exit.

You can also configure the exporter using environment variables:

::

export MODE="http"
export ADDRESS="0.0.0.0"
export PORT="9547"
export INTERVAL="7.5"
export TARGET="http://kea"
export TARGETS="http://router.example.com:8000"
export CLIENT_CERT="/etc/kea-exporter/client.crt"
export CLIENT_KEY="/etc/kea-exporter/client.key"

Expand Down
13 changes: 7 additions & 6 deletions kea_exporter/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,17 @@ def time_elapsed(self):
"-a",
"--address",
envvar="ADDRESS",
type=str,
default="0.0.0.0",
help="Specify the address to bind against.",
help="Address that the exporter binds to.",
)
@click.option(
"-p",
"--port",
envvar="PORT",
type=int,
default=9547,
help="Specify the port on which to listen.",
help="Port that the exporter binds to.",
)
@click.option(
"-i",
Expand All @@ -48,15 +49,15 @@ def time_elapsed(self):
@click.option(
"--client-cert",
envvar="CLIENT_CERT",
type=str,
help="Client certificate file path used in HTTP mode with mTLS",
type=click.Path(exists=True),
help="Path to client certificate used to in HTTP requests",
required=False,
)
@click.option(
"--client-key",
envvar="CLIENT_KEY",
type=str,
help="Client key file path used in HTTP mode with mTLS",
type=click.Path(exists=True),
help="Path to client key used in HTTP requests",
required=False,
)
@click.argument("targets", envvar="TARGETS", nargs=-1, required=True)
Expand Down

0 comments on commit d80cf23

Please sign in to comment.