Skip to main content
In this lesson you’ll learn how to monitor Jenkins by exposing Prometheus-format metrics using the Jenkins “Prometheus metrics” plugin, scraping those metrics with Prometheus, and visualizing them in Grafana. This guide includes configuration examples, a Docker Compose stack for Prometheus + Grafana, Prometheus scrape config, example Prometheus queries, and steps to import a community Jenkins dashboard into Grafana. What you’ll cover:
  • Install and configure the Jenkins Prometheus plugin
  • Verify the /prometheus metrics endpoint
  • Run Prometheus and Grafana (Docker Compose)
  • Configure Prometheus to scrape Jenkins
  • Add Prometheus as a Grafana data source and import a Jenkins dashboard
  • Create test Jenkins activity and validate dashboards
Prerequisites
  • A running Jenkins instance where you can install plugins and access Manage Jenkins → Configure System
  • Docker & Docker Compose (for the Prometheus + Grafana stack example) or an existing Prometheus/Grafana installation
  • Network connectivity between Prometheus and Jenkins (or adjust prometheus.yml accordingly)
Install the Jenkins Prometheus plugin
  1. In Jenkins go to Manage Jenkins → Manage Plugins and install the “Prometheus metrics” plugin.
  2. After installation open Manage Jenkins → Configure System to review plugin settings and enable the metric groups you need (JVM, build metrics, node status, disk usage, etc.).
A screenshot of the Jenkins "Prometheus metrics" plugin webpage, showing the plugin title, documentation tab, and an About/Metrics Exposed section. On the right are version details, install statistics, and links.
Configure the Prometheus metrics plugin
  • The plugin exposes metrics at /prometheus by default.
  • Typical settings include the collection interval (often 10s) and checkboxes to enable/disable metric groups (e.g., build durations, JVM metrics).
  • Some metrics (like disk usage) may require extra permissions or supplemental plugins.
A screenshot of a Jenkins "Manage Jenkins > System" settings page showing the Prometheus metrics plugin options, including a "Collecting metrics period in seconds" field and multiple checked checkboxes for counting build durations. The bottom shows job attribute name input and "Save" and "Apply" buttons.
If the Prometheus plugin requests a Jenkins restart after changing settings, restart Jenkins so the /prometheus endpoint is served correctly. The endpoint will be available at http://<jenkins-host>:<jenkins-port>/prometheus.
Verify the metrics endpoint When active, the /prometheus endpoint returns plain text in Prometheus exposition format. Example (truncated):
Run Prometheus + Grafana (example Docker Compose) This Docker Compose example brings up Prometheus and Grafana. Grafana is configured with admin / password credentials and is reachable on host port 8081. Prometheus reads /etc/prometheus/prometheus.yml from the ./prometheus folder.
Prometheus configuration: prometheus.yml Place this minimal prometheus.yml in ./prometheus/prometheus.yml (update the Jenkins target to your host/IP):
Start the stack
Example Docker Compose output:
Verify Prometheus is scraping Jenkins
  • Open Prometheus at http://<vm-ip>:9090 (or http://localhost:9090).
  • Navigate to Status → Targets and confirm the jenkins job target is UP and scraping the /prometheus path.
Exploring Jenkins metrics in Prometheus Common metric names exposed by the plugin: Example Prometheus expression queries:
Prometheus sample metric lines:
Add Prometheus as a Grafana data source
  1. Log in to Grafana at http://<vm-ip>:8081 using the admin credentials.
  2. Add a new Prometheus data source. If Grafana and Prometheus are in the same Docker network, use http://prometheus:9090. If accessing externally, use http://<vm-ip>:9090.
A dark-themed Grafana settings page for a Prometheus data source named "Jenkins-Prometheus," showing connection details including the Prometheus server URL set to "http://prometheus:9090."
Import a Jenkins dashboard Grafana has community dashboards for Jenkins. Search Grafana Dashboards for “Jenkins” and import one that fits your needs — for example, dashboard ID 9964 (“Jenkins: Performance and Health Overview”). To import:
  • In Grafana go to Dashboards → Import
  • Enter dashboard ID 9964, select a name and folder, and map the panels to your Prometheus data source
A Grafana Labs webpage showing a "Jenkins: Performance and Health Overview" dashboard screenshot with multiple metrics and graphs. A right-hand panel offers options to get the dashboard (create account, copy ID, download JSON).
A Grafana "Import dashboard" screen showing the process of importing a "Jenkins: Performance and Health Overview" dashboard from Grafana.com. The page displays fields for name, folder, UID and selecting a Prometheus data source.
Generate test metric activity in Jenkins To see activity in dashboards, create a simple Jenkins Pipeline job and run it repeatedly:
  1. Create a new Pipeline job (e.g., monitor-jenkins).
  2. Use an inline Pipeline script like:
A browser screenshot of the Jenkins "New Item" page in dark mode showing the item name field filled with "monitor-jenkins" and selectable job types (Freestyle project, Pipeline, Multi-configuration project, Folder). The page includes an OK button at the bottom and standard browser UI at the top.
Make sure the node label you reference exists and matches an available agent. The agent label can be verified on the agent details page:
A screenshot of the Jenkins web UI showing the "Agent ubuntu-agent" details page. The agent is connected and a label "ubuntu-docker-jdk17-node20" is highlighted, with the left sidebar of Jenkins management options visible.
Trigger the pipeline several times (Build Now). Prometheus will scrape the metrics at its configured interval and Grafana dashboards will begin to reflect the activity. You should see panels for JVM memory, CPU, job counts (total/successful/failed), executor usage, queue durations, and other Jenkins metrics. Customize panels (time series, gauge, heatmap, etc.) and refine PromQL queries to suit your monitoring and alerting needs.
A Grafana dashboard screenshot showing Jenkins performance and health metrics, with panels for JVM free memory, memory usage, Jenkins health, CPU usage, job counts (total/successful/failed), job duration and executor stats. The left sidebar shows navigation items like Dashboards, Explore, Alerting and Administration.
Prometheus summaries & quantiles The Prometheus exposition may include quantiles for summaries/histograms. Example for queue durations:
These quantiles help with capacity planning and diagnosing issues like executor saturation or slow builds. Further reading & references Summary You now know how to:
  • Expose Jenkins metrics via the Prometheus plugin at /prometheus
  • Configure Prometheus to scrape Jenkins metrics
  • Run Prometheus and Grafana with Docker Compose
  • Add Prometheus as a Grafana data source and import a Jenkins dashboard
  • Generate Jenkins activity to validate the metrics and dashboards
Use the dashboards to monitor Jenkins health, plan capacity, and create alerts when metrics indicate problems (e.g., queue growth or executor saturation).

Watch Video