When running the exporter at least one path is required (db, or socket),
but not both.
When one of the paths is not provided, the metrics that correspond to that
source are not exporter. For example, if the database path is not set, the
database metrics will not be shown.
At least one path is required. Startup will fail if neither path provided.
Fix the code writing commands to the fail2ban socket to correctly encode
the command terminator string. The terminator string should be encoded as
a simple byte array, not using the pickle format. Using the pickle format
allowed the first command to succeed, but would "break" the socket in the
sense that all following commands would fail with an underflow exception.
Update the code handling sending the ping command to the fail2ban server
to correctly handle the response. The response is of type `Tupple`, not
`[]string`.
Add support for sending a ping command to the fail2ban server over the
socket file. This includes encoding the command data using og-rek and
decoding the response using `gopickle`.
Update the database query counting the number of banned IPs to filter out
any bans that have already expired. An expired ban is defined as a ban
where the "time of ban" plus the "duration of ban" is less than the
current time.
This is necessary because bans that have expired are not automatically
removed from the database and will cause metrics to diverge from the counts
reported by `fail2ban-client`.
Add a new metric to count the number of database errors that have been
found since startup. This complements the `up` metric to have better
visibility into occasional database errors.
The `up` metric is now based on whether an error was found while reading
data from the database to build other metrics. Note that there is a chance
the `up` metric will not be correctly set if the last metric to be built
before the `up` metric does not throw an error.
Add a new prometheus metric to track which jails are currently enabled.
Add a new database query to read the jail name and enabled status from the
database.
Add new metric to readme file.
Update the Gitlab CI/CD pipeline to include a step to build and push the
project docker image. The CI/CD step uses existing Makefile commands to
build the docker image.
Update the project Dockerfile to compile the tool during the docker build
instead of assuming the goreleaser tool was run previously. This allows
for custom data to be set in the compiled tool (e.g. compiled by docker)
and removes the dependency on another build step.
Update the Makefile to include a new command to build the tool for docker
which sets the version data correctly. Rename the docker commands to follow
the `docker/build-...` format to avoid confusion with the build commands.
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.
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.
Remove the `CGO_ENABLED=0` flag from the `goreleaser` configuration. This
was causing the compiled binary to throw segmentation errors when
collecting metrics.
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.
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.
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.
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.