Merge branch 'feat/update-docker-container-for-socket-based-metrics' into 'main'
Feat/update docker container for socket based metrics See merge request hectorjsmith/fail2ban-prometheus-exporter!25
This commit is contained in:
commit
aef73df3fa
1 changed files with 13 additions and 1 deletions
|
@ -3,7 +3,19 @@
|
||||||
# Print version to logs for debugging purposes
|
# Print version to logs for debugging purposes
|
||||||
/app/fail2ban-prometheus-exporter -version
|
/app/fail2ban-prometheus-exporter -version
|
||||||
|
|
||||||
|
db_path=/app/fail2ban.sqlite3
|
||||||
|
socket_path=/var/run/fail2ban/fail2ban.sock
|
||||||
|
|
||||||
|
# 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
|
||||||
|
|
||||||
# Start the exporter (use exec to support graceful shutdown)
|
# Start the exporter (use exec to support graceful shutdown)
|
||||||
# Inspired by: https://akomljen.com/stopping-docker-containers-gracefully/
|
# Inspired by: https://akomljen.com/stopping-docker-containers-gracefully/
|
||||||
exec /app/fail2ban-prometheus-exporter \
|
exec /app/fail2ban-prometheus-exporter \
|
||||||
-db /app/fail2ban.sqlite3
|
-db "$db_path" \
|
||||||
|
-socket "$socket_path"
|
||||||
|
|
Loading…
Reference in a new issue