Commit Graph

8 Commits

Author SHA1 Message Date
Private Creator
7932ccbe23 fix: support python2 fail2ban
Python2 pickles use different class names for some types. Specifically,
builtins.str is __builtin__.str.
2021-12-18 06:58:40 +00:00
Hector
56730c8774 feat: add new jail config metrics
Add new metrics around basic jail configuration. The new metrics expose the
max retries, ban time, and find time for each jail.
Update project README with the new metrics.
2021-10-14 20:52:25 +00:00
Hector
fba9ee2809 feat: export new version metric (#12)
Add a new `f2b_version` metric that includes the version of the fail2ban
server and the exporter.
Add a new socket command to get back the fail2ban server version.
2021-09-10 06:13:56 +00:00
Hector
4da46f3c4a feat: export metrics with socket errors
Add new metric to collect the number of errors found when connecting to the
fail2ban server socket. Errors are split into two categories: connection
errors (e.g. socket file not found), and request errors (e.g. invalid
response received from server).
Update the `up` metric to return `0` if the socket connection fails.
Improve error logging.
2021-08-30 07:19:11 +00:00
Hector
acb40a94bd fix: recover from fail2ban server restarts
Update the code collecting metrics to open a new socket connection each
time metrics are collected. This ensures that a new socket connection is
used each time and avoids errors caused by fail2ban being restarted.
2021-08-30 07:36:15 +01:00
Hector
1964dde273 feat: export metrics for failed/banned counts
Add new metric to track the total number of jails configured in fail2ban.
Add new metrics for the current and total number of filter failures for
each jail, as well as the current/total number of banned IPs per jail.
The new metrics are collected by sending the `status [jail]` command to the
fail2ban server and parsing the response data.
2021-08-29 16:54:20 +00:00
Hector
e5714b7485 fix: read socket response data in chunks
Read the response data from the socket in chunks to prevent errors when
processing large payloads. The initial implementation solved large payloads
by just defining a very large buffer, but this is not a solution. The new
code reads the socket data in a loop until a terminator is found and
appends all the data into a single byte array.
Reduce the buffer size to `1024` bytes.
2021-08-29 16:02:31 +01:00
Hector
39133d0a76 feat: collect new up metric from fail2ban socket
Add support for connecting the exporter directly to the fail2ban server's
socket to send requests and receive data. The path to the socket file is
optional and specified on startup.
Export a new metric based on the response of the `ping` command sent to the
fail2ban server. The metric is set to 1 if the server responds with `pong`
and 0 in any other case. This metric is only shown if the path to the
socket file was provided on startup.
2021-08-29 11:50:53 +00:00