Monitoring GitLab Runner and GitLab CI Pipelines with Prometheus
This guide details how to enable Prometheus metrics on GitLab Runner, configure Prometheus to scrape those metrics, and set up the gitlab-ci-pipelines-exporter with Grafana dashboards to monitor both runner performance and CI/CD pipeline health.
This article explains how to configure Prometheus to monitor GitLab Runner and GitLab CI/CD pipelines, including enabling the built‑in metrics endpoint, adjusting the Runner's config.toml , and verifying the HTTP server.
It lists the exposed metrics (runner business‑logic, Go runtime, and general system metrics) and shows two ways to enable the HTTP server: setting the global listen_address in config.toml or adding the --listen-address flag when starting the Runner.
listen_address = "[::]:9252"
concurrent = 10
check_interval = 30
log_level = "info"After modifying config.toml , the Runner must be restarted. The listening port can be verified with netstat :
bash-5.0$ netstat -anlpt | grep 9252
tcp 0 0 :::9252 :::* LISTEN 1/gitlab-runner
tcp 0 0 ::ffff:10.244.0.102:9252 ::ffff:10.244.0.1:35880 ESTABLISHED 1/gitlab-runner
...When port 9252 is listening, the metrics endpoint is active and can be queried:
curl 127.0.0.1:9252/metrics
# HELP gitlab_runner_api_request_statuses_total ...
# TYPE gitlab_runner_api_request_statuses_total counter
gitlab_runner_api_request_statuses_total{endpoint="request_job",runner="6i2MzLuX",status="204"} 178
# HELP gitlab_runner_autoscaling_machine_creation_duration_seconds ...
...A Prometheus scrape job for the Runner is added to prometheus.yml :
- job_name: 'gitlab-runner'
metrics_path: '/metrics'
scheme: http
bearer_token: bearer_token
static_configs:
- targets: ['192.168.1.200:30092']The target can be verified in the Prometheus UI (e.g., http://192.168.1.200:30003/new/targets ) and then visualized with a Grafana dashboard (ID 9631).
The second part covers monitoring GitLab CI pipelines using the gitlab-ci-pipelines-exporter . The steps include cloning the exporter repository, editing chart/values.yaml to set the GitLab URL and token, and installing the chart with Helm:
git clone https://github.com/mvisonneau/gitlab-ci-pipelines-exporter.git
vim chart/values.yaml
# key configuration
config:
gitlab:
url: http://192.168.1.200:30088
token: Z-smAyB8pFyttu6D2d_J
wildcards:
- owner:
name: cidevops
kind: group
helm install gitlabci-pipline-exporter --namespace gitlab-runner ./chartA Prometheus job for the exporter is added:
- job_name: 'gitlab-runner-ci-pipeline'
metrics_path: '/metrics'
scheme: http
bearer_token: bearer_token
static_configs:
- targets: ['10.1.234.132:80']Finally, a Grafana dashboard (ID 10620) is imported to display pipeline metrics.
DevOps Cloud Academy
Exploring industry DevOps practices and technical expertise.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.