update readme with new -h output & update dockerfile

This commit is contained in:
Hector 2022-01-30 19:01:42 +00:00
parent 315ecf4271
commit 94db2ec3de
3 changed files with 30 additions and 31 deletions

View File

@ -38,23 +38,22 @@ See the [releases page](https://gitlab.com/hectorjsmith/fail2ban-prometheus-expo
**Usage**
```
$ fail2ban-prometheus-exporter -h
usage: exporter [<flags>]
-collector.textfile
enable the textfile collector
-collector.textfile.directory string
directory to read text files with metrics from
-port int
port to use for the metrics server (default 9191)
-socket string
path to the fail2ban server socket
-version
show version info and exit
-web.basic-auth.password string
password to use to protect endpoints with basic auth
-web.basic-auth.username string
username to use to protect endpoints with basic auth
-web.listen-address string
address to use for the metrics server (default "0.0.0.0")
Flags:
-h, --help Show context-sensitive help (also try --help-long and --help-man).
--version show version info and exit
--port=9191 port to use for the metrics server
--web.listen-address="0.0.0.0"
address to use for the metrics server
--socket="" path to the fail2ban server socket
--collector.textfile enable the textfile collector
--collector.textfile.directory=""
directory to read text files with metrics from
--web.basic-auth.username=""
username to use to protect endpoints with basic auth
--web.basic-auth.password=""
password to use to protect endpoints with basic auth
```
**Example**

View File

@ -15,6 +15,6 @@ fi
# Start the exporter (use exec to support graceful shutdown)
# Inspired by: https://akomljen.com/stopping-docker-containers-gracefully/
exec /app/fail2ban-prometheus-exporter \
-socket "$socket_path" \
-collector.textfile=$textfile_enabled \
-collector.textfile.directory="$textfile_dir"
--socket "$socket_path" \
--collector.textfile=$textfile_enabled \
--collector.textfile.directory="$textfile_dir"

View File

@ -10,11 +10,11 @@ import (
const (
minServerPort = 1000
maxServerPort = 65535
portEnvName = "F2B_WEB_PORT"
addressEnvName = "F2B_WEB_LISTEN_ADDRESS"
socketEnvName = "F2B_COLLECTOR_SOCKET"
fileCollectorEnabledEnvName = "F2B_COLLECTOR_TEXT"
fileCollectorPathEnvName = "F2B_COLLECTOR_TEXT_PATH"
portEnvName = "F2B_WEB_PORT"
addressEnvName = "F2B_WEB_LISTEN_ADDRESS"
basicAuthUserEnvName = "F2B_WEB_BASICAUTH_USER"
basicAuthPassEnvName = "F2B_WEB_BASICAUTH_PASS"
)
@ -45,16 +45,6 @@ func readParamsFromCli(settings *AppSettings) {
Flag("version", "show version info and exit").
Default("false").
Bool()
port := kingpin.
Flag("port", "port to use for the metrics server").
Default("9191").
Envar(portEnvName).
Int()
address := kingpin.
Flag("web.listen-address", "address to use for the metrics server").
Default("0.0.0.0").
Envar(addressEnvName).
String()
socketPath := kingpin.
Flag("socket", "path to the fail2ban server socket").
Default("").
@ -70,6 +60,16 @@ func readParamsFromCli(settings *AppSettings) {
Default("").
Envar(fileCollectorPathEnvName).
String()
port := kingpin.
Flag("port", "port to use for the metrics server").
Default("9191").
Envar(portEnvName).
Int()
address := kingpin.
Flag("web.listen-address", "address to use for the metrics server").
Default("0.0.0.0").
Envar(addressEnvName).
String()
rawBasicAuthUsername := kingpin.
Flag("web.basic-auth.username", "username to use to protect endpoints with basic auth").
Default("").