No way to configure remote_mirror probe options in gitlab-exporter
Summary
gitlab-exporter has a remote_mirrors
probe which can be used to gather metrics about mirrors configured with the "push" direction. One of the settings that needs to be set is the project_ids
that the remote_mirrors
probe should check.
But, there is no setting in gitlab.rb
which sets the project_ids
option in the gitlab-exporter.yml
file. Any manual change made to the gitlab-exporter.yml
file will be overwritten the next time reconfigure
is run.
Steps to reproduce
- Enable gitlab-exporter
- Check the
/var/opt/gitlab/gitlab-exporter/gitlab-exporter.yml
file. Note that it does not have aremote_mirrors
section at all. - Add a
remote_mirrors
section similar to gitlab-exporter.yml.example#L63-69 - Reconfigure
- The
remote_mirrors
section will have been removed from the/var/opt/gitlab/gitlab-exporter/gitlab-exporter.yml
file.
If you want to see the remote_mirrors
probe in action:
-
Configure a project to be mirrored. Make sure the direction is "push".
-
Add a
remote_mirrors
section to/var/opt/gitlab/gitlab-exporter/gitlab-exporter.yml
similar to gitlab-exporter.yml.example#L63-69. Make sure you set the project ID of the project you configured to be mirrored in step -
Also, make sure that
/var/opt/gitlab/gitlab-exporter/gitlab-exporter.yml
has the similar content at the beginning of the file (connection string can be different depending on your psql configuration):db_common: &db_common methods: - probe_db opts: &db_common_opts connection_string: dbname=gitlabhq_production user=gitlab host=/var/opt/gitlab/postgresql port=5432 password=```
-
Restart the gitlab-exporter by running
sudo gitlab-ctl restart gitlab-exporter
. Do not reconfigure since that will delete the changes you made to the/var/opt/gitlab/gitlab-exporter/gitlab-exporter.yml
file. -
Let at least one sync of the mirrored repository run.
-
Open the gitlab-exporter metrics page (usually at
localhost:9168/metrics
) and search for the remote_mirrors metrics:project_remote_mirror_last_successful_update_time_seconds
andproject_remote_mirror_last_update_time_seconds
.
What is the current bug behavior?
There is no easy way to configure options for the gitlab-exporter remote-mirrors
probe.
What is the expected correct behavior?
We should be able to configure options for the remote-mirrors probe in /etc/gitlab/gitlab.rb
.