This uses Gitlab's API to fetch some data and exposes it to Prometheus.
Get your personal access token from https://git.example.com/profile/personal_access_tokens
Run with Docker:
docker run --rm -it \
-p 3001:3001 \
-e URL=$YOUR_GITLAB_URL
-e TOKEN=$YOUR_GITLAB_TOKEN
nomaster/gitlab-exporter
Install requirements, e.g.:
pip install -r requirements.txt
Run this:
./gitlab_exporter.py
Check metrics:
curl localhost:3001/metrics
The following environment variables may be set:
LOGLEVEL=INFO PORT=3002 INTERVAL=180 ./gitlab_exporter.py
Environment Variable | Description |
---|---|
LOGLEVEL | Standard Python log level |
PORT | Port to listen on |
INTERVAL | Interval in seconds to wait between data fetches |
URL | URL to your GitLab installation |
TOKEN | Your personal access token for the GitLab API |
There are efforts for native Prometheus integration in Gitlab, e.g. https://gitlab.com/gitlab-org/gitlab-workhorse/issues/61
- REST API Reference https://github.com/gitlabhq/gitlabhq/tree/master/doc/api
- Python API http://python-gitlab.readthedocs.io/en/stable/api-usage.html
https://github.com/prometheus/client_python
For an omnibus install:
/opt/gitlab/embedded/bin/redis-cli -s '/var/opt/gitlab/redis/redis.socket' del resque:gitlab:stat:processed
/opt/gitlab/embedded/bin/redis-cli -s '/var/opt/gitlab/redis/redis.socket' del resque:gitlab:stat:failed
http://stackoverflow.com/questions/15834911/how-do-i-reset-my-sidekiq-counters