vdcloudcraft / fail2ban-geo-exporter

A Prometheus.io exporter that geotags your jailed IPs
MIT License
18 stars 7 forks source link

fail2ban_banned_ip metric is always empty #18

Open rmartinez-dasnano opened 2 years ago

rmartinez-dasnano commented 2 years ago

Hi,

We configured this fail2ban exporter to export metrics. We followed instructions to install it as a system service.Everything seems to work properly with the following configuration

server:
  listen_address: 0.0.0.0
  port: 9412
geo:
    enabled: True
    provider: 'MaxmindDB'
    enable_grouping: False
    maxmind:
        db_path: "/opt/vpn-vol/fail2ban_exporter/geoip/data/GeoLite2-City.mmdb"
f2b:
    conf_path: '/etc/fail2ban'
    db: '/opt/vpn-vol/fail2ban/fail2ban.sqlite3'

Note the custom location of the database, both the exporter and fail2ban are pointing to this file.

Config file is located under /opt/vpn-vol/fail2ban_exporter/env/conf.yml

Service configuration is as follows

[Unit]
Description=fail2ban geo exporter
After=network.target

[Service]
Type=simple
User=root
WorkingDirectory=/opt/vpn-vol/fail2ban_exporter/env
Environment=PYTHONPATH=/opt/vpn-vol/fail2ban_exporter/env/bin
ExecStart=/opt/vpn-vol/fail2ban_exporter/env/bin/python3 /opt/vpn-vol/fail2ban_exporter/env/fail2ban-exporter.py
Restart=always

[Install]
WantedBy=multi-user.target

The problem we are experiencing is that the metric is never printed

...
# HELP process_max_fds Maximum number of open file descriptors.
# TYPE process_max_fds gauge
process_max_fds 1024.0
# HELP fail2ban_banned_ip IP banned by fail2ban
# TYPE fail2ban_banned_ip gauge

Even when whe have some IP banned

Status for the jail: sshd
|- Filter
|  |- Currently failed: 0
|  |- Total failed: 20
|  `- File list:    /var/log/auth.log
`- Actions
   |- Currently banned: 1
   |- Total banned: 1
   `- Banned IP list:   172.22.5.71

What are we doing wrong?

captainabloc commented 2 years ago

up? same issue here

Kontr3X commented 2 years ago

same issue, this belongs to: https://github.com/vdcloudcraft/fail2ban-geo-exporter/issues/19