Commit Graph

24 Commits

Author SHA1 Message Date
Hector
50c969014f Merge branch 'chore/create-new-src-folder' into 'main'
Chore/create new src folder

See merge request hectorjsmith/fail2ban-prometheus-exporter!9
2021-02-08 18:53:00 +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
b1c70da101 Merge branch '2-build-docker-image' into 'main'
Resolve "Build docker image"

Closes #2

See merge request hectorjsmith/fail2ban-prometheus-exporter!7
2021-02-07 13:11:16 +00:00
Hector
9dc8dd862f build: add project dockerfile (#2)
Add a project Dockerfile to allow deploying the application in a docker
container. Add a `run.sh` script to start the application in the container.
Add Makefile commands to build the docker image based on the Dockerfile.
Fix possible nil reference error in the `db` package.
2021-02-07 13:09:02 +00:00
Hector
f452100a75 Merge branch 'fix/compile-without-cgo-enabled' into 'main'
Fix/compile without cgo enabled

See merge request hectorjsmith/fail2ban-prometheus-exporter!8
2021-02-07 12:59:01 +00:00
Hector
0842419136 fix: compile tool without cgo_enabled flag
Remove the `CGO_ENABLED=0` flag from the `goreleaser` configuration. This
was causing the compiled binary to throw segmentation errors when
collecting metrics.
2021-02-07 11:43:07 +00:00
Hector
e94143e81c Merge branch '5-setup-project-changelog' into 'main'
Resolve "Setup project changelog"

Closes #5

See merge request hectorjsmith/fail2ban-prometheus-exporter!6
2021-02-07 11:20:56 +00:00
Hector
eaec4db47c docs: generate changelog file (#5) 2021-02-07 11:16:29 +00:00
Hector
50e1d4b8c8 build: add tool to auto-generate changelog (#5)
Add the `git-chglog` tool to handle auto-generating the project changelog
based on the commit history. Add a custom configuration and file template.
Update the Makefile to include a command to generate the changelog.
2021-02-07 11:15:41 +00:00
Hector
3cb7c71b17 Merge branch '6-setup-goreleaser-to-compile-tool' into 'main'
Resolve "Setup goreleaser to compile tool"

Closes #6

See merge request hectorjsmith/fail2ban-prometheus-exporter!5
2021-02-07 11:03:13 +00:00
Hector
acc42d8079 ci: restrict build step to main branch and tags (#6) 2021-02-07 11:00:13 +00:00
Hector
98c6da4796 Merge branch '8-fail-on-startup-if-database-file-does-not-exist' into 'main'
Resolve "Fail on startup if database file does not exist"

Closes #8

See merge request hectorjsmith/fail2ban-prometheus-exporter!4
2021-02-07 10:52:14 +00:00
Hector
88be0f358e ci: add build stage to gitlab ci/cd (#6)
Update the Gitlab CI/CD process to include a build stage that uses
`goreleaser` to build and package the application. The output of the build
is stored as an artifact for 1 day.
2021-02-07 10:51:43 +00:00
Hector
570c162c13 build: add goreleaser to build tool (#6)
Add the `goreleaser` tool to the repository to handle building and
publishing the application. Add a simple configuration file to build the
application for all major OS versions.
Update the Makefile to include commands to build release and snapshot
versions of the tool.
Add a placeholder CHANGELOG file to be included in the package files.
2021-02-07 10:46:25 +00:00
Hector
6355c9e8e1 feat: fail on startup if database file does not exist (#8)
Add a check when connecting to the sqlite3 database to ensure that the file
exists before connecting. If the file does not exist, the connection fails.
2021-02-07 10:36:08 +00:00
Hector
188626198f Merge branch '4-configure-tool-using-cli-parameters' into 'main'
Resolve "Configure tool using CLI parameters"

Closes #4

See merge request hectorjsmith/fail2ban-prometheus-exporter!3
2021-02-06 15:22:07 +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
5e81a98162 Merge branch 'feat/export-metrics-from-fail2ban-db' into 'main'
Feat/export metrics from fail2ban db

See merge request hectorjsmith/fail2ban-prometheus-exporter!2
2021-02-06 12:29:47 +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
e2661bf243 Merge branch 'feat/basic-metric-exports' into 'main'
feat/basic-metric-exports

See merge request hectorjsmith/fail2ban-prometheus-exporter!1
2021-02-05 23:06:29 +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