Tool to retrieve remote files like vcf and ics files, with a Prometheus exporter for monitoring.
This tool was initially built in order to retrieve some remote ics and vcf files (calendar and contacts) and backup them.
Because I wanted to check that the retrieval was done with success, I implemented a Prometheus Exporter that expose metrics related to the retrieved files.
This tool should run as a daemon and a control on http://localhost:9289/metrics shows if everything is going well.
Of course, a shell script like this would do the same, but without any control on the retrieved files:
while true; do
curl -sL -u username:password http://remote.url/remote/file -o backup_file
sleep 86400 # 1 day
doneRun a binary. Example:
./backup_remote_files -h
./backup_remote_files -c config.yamlRun with docker or podman
podman run --rm -it ghcr.io/ymettier/backup_remote_files:latest -V
podman run --rm -it \
-v .:/files:z \
-p 9289:9289 \
ghcr.io/ymettier/backup_remote_files:latest -c /files/config.yamlSee config.yaml.sample
Note: logging.filename can be set to one of stdout, stderr or a filename. If a filename is set, rotation of the log file will be automatically performed.
All environment variables are prefixed with BRF_.
See config.yaml.sample for a list of environment variables that can be used to override configuration values. Example:
BRF_LOGGING_LEVEL: log level
go mod download
echo build > version.txt
go test ./...
go build -v .GOLANGCILINTVERSION="2.12.2" # See https://hub.docker.com/r/golangci/golangci-lint/tags
DOCKER=podman # or DOCKER="sudo docker" or DOCKER="docker"
${DOCKER} run -t --rm --privileged -v $(pwd):/app -w /app "golangci/golangci-lint:v${GOLANGCILINTVERSION}" golangci-lint run -vgo mod download
git tag <version>
git tag --points-at HEAD > version.txt
go test ./...
go build -v .Optional :
git tag <version>Build:
podman build -t backup_remote_files:build .