Commit Graph

12 Commits

Author SHA1 Message Date
Hector
b6cec83503 ci: add go vet to test stage (!99)
* Add `go vet` to the test stage of the Gitlab CI/CD pipeline
* Fix issues raised by `go vet`

https://gitlab.com/hectorjsmith/fail2ban-prometheus-exporter/-/merge_requests/99
2023-06-22 18:24:15 +00:00
Hector
9c1a10e309 feat: add new dry run mode (!98)
* Add a new *dry-run* mode to exit just before running the server
* This allows testing that the socket is working before starting the server

https://gitlab.com/hectorjsmith/fail2ban-prometheus-exporter/-/merge_requests/98
2023-06-22 16:09:36 +00:00
Hector
11c4b26c0b refactor: move server setup code to new package (!90)
* Move code setting up the HTTP server to it's own package
* This helps clean up the `main` function and make it easier to read
* Rename the `BasicAuthMiddleware` to remove reference to Basic since it can now handle any type of auth type

https://gitlab.com/hectorjsmith/fail2ban-prometheus-exporter/-/merge_requests/90
2023-06-21 10:58:43 +00:00
Hector
3cff8ccd64 refactor: rewrite auth handler code (!89)
* Rewrite the code handling basic auth to make it easier to extend for other types of auth.
* The behaviour of the existing code is maintained.
* No changes to how basic auth is configured from a user's perspective.

https://gitlab.com/hectorjsmith/fail2ban-prometheus-exporter/-/merge_requests/89
2023-06-21 10:31:33 +00:00
Hector
ae1285dc66 chore: move source code to root folder 2023-06-19 17:58:16 +00:00
Hector
9bf3195743 chore: move all source files to new folder
Update the project structure to move all golang files to a new `src/`
folder. This keeps all the code located in the same place and easier to
work with.
Update the Makefile and goreleaser config to continue to work with the new
folder structure.
2021-02-08 18:49:48 +00:00
Hector
4f18bf35a8 feat: add cli parameters for db path and metrics port (#4)
Add support for configuring CLI parameters in the application using a new
`cfg` package. The `cfg` package exports an `AppSettings` struct that
contains the settings the application was run with.
Update the application to use the new CLI parameters to set the db to open
and the port to use for the metrics server.
Add support for setting the app version during build. The app includes a
`-version` flag to print the stored version data.
2021-02-06 15:17:35 +00:00
Hector
91cba8080c feat: export number of banned ips
Export the number of banned IPs stored in the fail2ban database as well
as the number of bad IPs.
Update the queries used to collect data to better handle cases where the
database table for bad/banned IPs is empty. The new query always lists all
jails, even when the count is zero.
2021-02-06 12:24:31 +00:00
Hector
4b965017d2 feat: export bad ip count per jail
Update exported metrics to spit the number of bad IPs per jail using metric
value labels. This includes a change to the database code to use a
different query that groups the count by the `jail` column.
2021-02-06 12:14:39 +00:00
Hector
0b40e5de82 feat: connect to fail2ban db and extract total bad ips
Add dependencies on `sqlite` to allow connecting to the fail2ban database.
Add a new `db` module to handle all the database connections and data
queries used to generate metrics.
Export a new metric for the total number of bad IPs stored in the fail2ban
database.
2021-02-06 11:50:13 +00:00
Hector
7ced8464e0 feat: initial setup of metric exporter
Add dependency on the prometheus library to start exporting metrics. Add
a new `up` metric that always returns `1` to ensure the exporter is
working as expected.
2021-02-05 23:04:07 +00:00
Hector
5e52baa4cf initial commit 2021-02-05 22:49:47 +00:00