Make backup rake task export information about backup to prometheus
Description
Currently the gitlab:backup:create
does the backup and logs the information into a log file.
In order to make sure the backup is always run correctly it would be useful to export some information about the most recent backup to Prometheus.
Information that would be useful to monitor:
- start of last successful backup
- end of last successful backup
- size of last successful backup
Proposal
I think this can be achieved fairly easy by making the rake task put that information into a textfile that can be picked up by the node exporter textfile collector.
The propossed content of this file would be:
# HELP gitlab_rake_backup_create_start backup start time, in unixtime.
# TYPE gitlab_rake_backup_create_start gauge
gitlab_rake_backup_create_start 1503404700
# HELP gitlab_rake_backup_create_end backup end time, in unixtime.
# TYPE gitlab_rake_backup_create_end gauge
gitlab_rake_backup_create_end 1503404800
# HELP gitlab_rake_backup_create_size backup size, in bytes.
# TYPE gitlab_rake_backup_create_size gauge
gitlab_rake_backup_create_size 500000
Links / references
Documentation blurb
Overview
Backups are important and the monitoring should trigger an alert if something went wrong.
Having a history of the size of backups allows to better plan for future storage requirements.
Use cases
Operators of a GitLab instance that wants to be alerted if there was no new successful backup for a certain amount of time.
Feature checklist
Make sure these are completed before closing the issue, with a link to the relevant commit.
- Feature assurance
- Documentation
- Added to features.yml