Jenkins Monitoring with Prometheus and Grafana

Jenkins Monitoring with Prometheus and Grafana

Prerequisites

  • Jenkins (any recent version)
  • Prometheus
  • Grafana
  • Internet access to download plugins
  • Administrative access to Jenkins


Go to Manage Jenkins PluginsAvailable Plugins Search for Prometheus and install it

Locate the Prometheus metrics plugin and click the “Download now and install after restart” button.

  • Once you see the message “Downloaded successfully”, check the box labeled “Restart Jenkins when installation is complete and no jobs are running”. Jenkins will then automatically restart.
  • After Jenkins restarts, log in and navigate to Manage Jenkins → Configure System.
  • Scroll down to the Prometheus section.
    Prometheus collects metrics by scraping a specified endpoint. By default, it uses the /prometheus endpoint.
    If needed, you can customize this by changing the value in the “Path” field.

Nothing to change click on apply and save

  1. Now, open your Jenkins URL and add the /prometheus suffix, for example:
    http://localhost:8080/prometheus
    This will display a large set of Jenkins metrics.

Note: When you access /prometheus, it will automatically redirect to /prometheus/.
This redirection is important to keep in mind when configuring Prometheus later.

To create a static target, you need to add job_name with static_configs

$ sudo nano /etc/prometheus/prometheus.yml

Paste below code

- job_name: 'jenkins'
metrics_path: '/prometheus'
static_configs:
- targets: ['<jenkins-ip>:8080']

After changes in config file we need to restart prometheus

$ sudo systemctl restart prometheus

Check the targets section

Access the Prometheus page again with the URL http://localhost:9090/. Open the menu Status -> Targets

You will see Jenkins is added to it

Let’s add Dashboard for a better view in Grafana

Click On Dashboard+ symbol → Import Dashboard

Use Id 9964 and click on load

Select the data source and click on Import

Now you will see the Detailed overview of Jenkins

we have covered Jenkins monitoring with Prometheus and Grafana.

Conclusion:

In this article we have covered How to Monitor Jenkins Using Prometheus, Node exporter and Grafana | Jenkins monitoring with Prometheus and Grafana.

Mahesh Wabale
Latest posts by Mahesh Wabale (see all)

Leave a Comment