How to configure Jenkins Exporter for Prometheus


Getting started:

Install the Prometheus exporter plugin in Jenkins:

  • If this is your first time using Jenkins, you can have a look at their documentation here and familiarize yourself with the Jenkins Dashboard.
  • Go to “Manage Jenkins” then “Manage Plugins” and install “ Prometheus metrics plugin”.
  • This plugin will expose an endpoint (default /prometheus) with metrics where a Prometheus Server can scrape data.
  • You can see the output of this plugin visiting this URL

Configure Prometheus to scrape metrics from Jenkins:

  • To configure Prometheus server you will need to edit in the configuration file
  • In the scrape_configs section you will need to add a job for Jenkins server:
- job_name: 'Jenkins'
  metrics_path: '/prometheus/'
    - targets: ['Jenkins_Host:PORT']
  - action: replace
    source_labels: [exported_job]
    target_label: jenkins_job
  - action: labeldrop
    regex: exported_job
  • Replace “Jenkins_Host” and “PORT” with the URL of your Jenkins server then restart the server.

By Dennis Otugo

Dennis Otugo is a Consultant at Bantrain, and loves all things DevOps. In his role, he enables enterprise customers in their digital transformation journey and helps architect cloud-native solutions