2021-02-07 13:04:24 +00:00
|
|
|
#/bin/sh
|
|
|
|
|
|
|
|
# Print version to logs for debugging purposes
|
2022-01-31 22:51:13 +00:00
|
|
|
/app/fail2ban-prometheus-exporter --version
|
2021-02-07 13:04:24 +00:00
|
|
|
|
2021-08-29 17:36:27 +00:00
|
|
|
socket_path=/var/run/fail2ban/fail2ban.sock
|
2021-10-12 20:38:26 +00:00
|
|
|
textfile_dir=/app/textfile/
|
|
|
|
textfile_enabled=false
|
2021-08-29 17:36:27 +00:00
|
|
|
|
2022-01-31 22:51:13 +00:00
|
|
|
# Start the exporter (use exec to support graceful shutdown)
|
|
|
|
# Inspired by: https://akomljen.com/stopping-docker-containers-gracefully/
|
2021-10-15 18:02:26 +00:00
|
|
|
# Enable textfile metrics if the folder exists (i.e. was mounted by docker)
|
2021-10-12 20:38:26 +00:00
|
|
|
if [ -d $textfile_dir ]; then
|
2022-01-31 22:51:13 +00:00
|
|
|
exec /app/fail2ban-prometheus-exporter \
|
|
|
|
--socket "$socket_path" \
|
|
|
|
--collector.textfile \
|
|
|
|
--collector.textfile.directory "$textfile_dir"
|
|
|
|
else
|
|
|
|
exec /app/fail2ban-prometheus-exporter \
|
|
|
|
--socket "$socket_path"
|
2021-10-12 20:38:26 +00:00
|
|
|
fi
|