Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mivek/fail2ban_exporter
A fail2ban exporter for Prometheus
https://github.com/mivek/fail2ban_exporter
exporter fail2ban prometheus
Last synced: about 17 hours ago
JSON representation
A fail2ban exporter for Prometheus
- Host: GitHub
- URL: https://github.com/mivek/fail2ban_exporter
- Owner: mivek
- License: apache-2.0
- Created: 2022-02-26T18:01:50.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2022-10-07T14:52:44.000Z (over 2 years ago)
- Last Synced: 2023-02-28T09:11:24.365Z (almost 2 years ago)
- Topics: exporter, fail2ban, prometheus
- Language: Python
- Homepage:
- Size: 24.4 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# Fail2Ban-exporter
Fail2ban exporter is an exporter for Prometheus.
The exporter exposes metrics on port 9921.## Requirements
- Python 3: Only required if you execute the script.
# Installation
## Python script
Check the latest version.
Download the latest version.
Unarchive it
```
wget https://github.com/mivek/fail2ban_exporter/releases/download/{{version}}/fail2ban_exporter-{{version}}.tar.gz
tar -xzf fail2ban_exporter-{{version}}.tar.gz
```Install the dependencies
Launch the script```
python -m pip install prometheus_client
python fail2ban_exporter-0.0.2/src/fail2ban_exporter &
```## Python executable
Check the latest version
Download the latest version of the executable
Unarchive it.
```
wget https://github.com/mivek/fail2ban_exporter/releases/download/{{ version }}/fail2ban_exporter_executable-{{ version }}.tar.gz
tar -xzf fail2ban_exporter_executable-{{version}}.tar.gz
```Set the execution mod to the executable and run it as the user running fail2ban-client.
```
chmod ug+x fail2ban_exporter_executable-{{ version }}/fail2ban_exporter
./fail2ban_exporter &
```## Docker image
It is possible to run the exporter as a docker container.
The parent folder of the fail2ban socket needs to be mapped.**Note**: Do not map the socket itself as it is destroyed whenever fail2ban is stopped.
### Docker run
```
docker run -d \
--name "fail2ban_exporter" \
-v /var/run/fail2ban:/var/run/fail2ban:ro
- p "9921:9921"
ghcr.io/mivek/fail2ban_exporter:latest
```### Docker compose
```(yaml)
services:
fail2ban_exporter:
image: ghcr.io/mivek/fail2ban_exporter:latest
ports:
- "9921:9921"
volumes:
- /var/run/fail2ban:/var/run/fail2ban:ro
```# Metrics
The following metrics are exposed:
| Name | Type | Description |
|----------------------- |------- |--------------------------------------------------------------|
| fail2ban_jail_count | Gauge | Number of active jails |
| fail2ban_failed_total | Counter | Total number of failures. Labelled by the name of the jail |
| fail2ban_currently_failed | Gauge | Current number of failures. Labelled by the name of the jail |
| fail2ban_currently_banned | Gauge | Current number of bans. Labelled by the name of the jail |
| fail2ban_banned_total | Counter | Total number of bans. Labelled by the name of the jail |# Environment variable
- FAIL2BAN_EXPORTER_PORT . If specified the exporter will run on this port.