2021-02-07 14:04:24 +01:00
|
|
|
#/bin/sh
|
|
|
|
|
|
|
|
# Print version to logs for debugging purposes
|
|
|
|
/app/fail2ban-prometheus-exporter -version
|
|
|
|
|
2021-08-29 19:36:27 +02:00
|
|
|
db_path=/app/fail2ban.sqlite3
|
|
|
|
socket_path=/var/run/fail2ban/fail2ban.sock
|
2021-10-12 22:38:26 +02:00
|
|
|
textfile_dir=/app/textfile/
|
|
|
|
textfile_enabled=false
|
2021-08-29 19:36:27 +02:00
|
|
|
|
|
|
|
# Blank out the file paths if they do not exist - a hacky way to only use these files if they were mounted into the container.
|
|
|
|
if [ ! -f "$db_path" ]; then
|
|
|
|
db_path=""
|
|
|
|
fi
|
|
|
|
if [ ! -S "$socket_path" ]; then
|
|
|
|
socket_path=""
|
|
|
|
fi
|
2021-10-12 22:38:26 +02:00
|
|
|
if [ -d $textfile_dir ]; then
|
|
|
|
textfile_enabled=true
|
|
|
|
fi
|
2021-08-29 19:36:27 +02:00
|
|
|
|
2021-02-07 14:04:24 +01:00
|
|
|
# Start the exporter (use exec to support graceful shutdown)
|
|
|
|
# Inspired by: https://akomljen.com/stopping-docker-containers-gracefully/
|
|
|
|
exec /app/fail2ban-prometheus-exporter \
|
2021-08-29 19:36:27 +02:00
|
|
|
-db "$db_path" \
|
2021-10-12 22:38:26 +02:00
|
|
|
-socket "$socket_path" \
|
|
|
|
-collector.textfile=$textfile_enabled \
|
|
|
|
-collector.textfile.directory="$textfile_dir"
|