vdcloudcraft / fail2ban-geo-exporter

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

Fail2Ban exporter does not export data #7

Closed grimsi closed 4 years ago

grimsi commented 4 years ago

When I install the Fail2Ban exporter using docker I can't seem to get data out of it. Here is my configuration: docker-compose.yml (only relevant parts):

prometheus:
    image: prom/prometheus:latest
    container_name: prometheus
    restart: unless-stopped
    command:
      - --config.file=/etc/prometheus/prometheus.yml
    volumes:
      - prometheus-storage:/prometheus
      - ./prometheus.yml:/etc/prometheus/prometheus.yml:ro
    depends_on:
       - fail2ban-exporter
fail2ban-exporter:
    image: vdcloudcraft/fail2ban-geo-exporter:latest
    container_name: fail2ban-exporter
    restart: unless-stopped
    expose:
        - "9555"
    volumes:
        - /etc/fail2ban/jail.local:/etc/fail2ban/jail.local:ro
        - /var/lib/fail2ban/fail2ban.sqlite3:/var/lib/fail2ban/fail2ban.sqlite3:ro
        - ./fail2ban-geo-exporter/GeoLite2-City.mmdb:/f2b-exporter/db/GeoLite2-City.mmdb
        - ./fail2ban-geo-exporter/conf.yml:/f2b-exporter/conf.yml

prometheus.yml:

scrape_configs:
  - job_name: fail2ban-exporter
    scrape_interval: 60s
    static_configs:
    - targets:
      - fail2ban-exporter:9555

fail2ban-geo-exporter conf.yml:

server:
    listen_address: 127.0.0.1
    port: 9555
geo:
    enabled: True
    provider: 'MaxmindDB'
    enable_grouping: True
    maxmind:
        db_path: '/f2b-exporter/db/GeoLite2-City.mmdb'
f2b:
    conf_path: '/etc/fail2ban'
    db: '/var/lib/fail2ban/fail2ban.sqlite3'
    conf: ''

Output when running sudo fail2ban-client status sshd:

Status for the jail: sshd
|- Filter
|  |- Currently failed: 5
|  |- Total failed:     454
|  `- File list:        /var/log/auth.log
`- Actions
   |- Currently banned: 23
   |- Total banned:     89
   `- Banned IP list:   <censored>

Output when using the provided grafana dashboard: 0 IPs banned, no marks on the map widget

grimsi commented 4 years ago

Nevermind, I just copy-pasted the wrong dashboard (I used the "no-grouping" version while having enabled grouping in the exporter). Sorry for the inconvenience and thanks for your great tool!

vdcloudcraft commented 4 years ago

No inconvenience created. I'm glad it worked out and I always appreciate a well written ticket. ;)