Turn Jenkins into a Real‑Time Monitoring Hub with Prometheus & Grafana
This guide shows how to integrate Jenkins with Prometheus and Grafana, covering plugin installation, metric endpoint exposure, Prometheus scraping configuration, verification via curl, and importing a ready‑made Grafana dashboard to achieve proactive, visualized CI/CD monitoring.
Why integrate Jenkins with Prometheus and Grafana?
When an alarm wakes you at 3 am and you only see vague logs, you realize traditional ops are like searching in the dark. Combining Jenkins with Prometheus and Grafana provides a "god‑view" of server health, turning raw data into clear visual alerts from code commit to service status.
Step 1: Enable Prometheus metrics in Jenkins
Install the Prometheus plugin in Jenkins.
Restart Jenkins to apply the plugin.
Access the metrics endpoint, e.g.,
http://<jenkins-host>/prometheus/.
Step 2: Configure Prometheus to scrape Jenkins
<code>job_name: 'jenkins'
metrics_path: /prometheus/
scrape_interval: 60s
kubernetes_sd_configs:
- role: service
relabel_configs:
- action: keep
source_labels: [__meta_kubernetes_namespace,__meta_kubernetes_service_name,__meta_kubernetes_service_port_name]
regex: jenkins;jenkins;http
</code>Step 3: Verify collection
<code>$ curl -s -u admin http://10.109.157.19/prometheus/api/v1/query --data-urlencode 'query=up{job=~"jenkins"}' | jq '.data.result[] | {job: .metric.job, instance: .metric.instance ,status: .value[1]}'
</code>Step 4: Add Grafana dashboard
Import the dashboard JSON from the repository
https://github.com/donhui/awesome-jenkins-monitor/blob/main/grafana_dashboards/jenkins-monitoring.json. The following screenshots illustrate the resulting dashboards.
Conclusion
When monitoring shifts from reactive firefighting to proactive insight, data becomes readable and visual, making operations elegant and efficient. The Jenkins‑Grafana integration is not just a technical choice but a mindset change toward true system guardianship.
Linux Ops Smart Journey
The operations journey never stops—pursuing excellence endlessly.
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.