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
    “http://Jenkins_HOST:PORT/prometheus”

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/'
  static_configs:
    - targets: ['Jenkins_Host:PORT']
  metric_relabel_configs:
  - 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.
Dennis Otugo
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

Speak with an expert on our team to discuss Cloud solutions tailored to your business.

You’ll receive free recommendations tailored to your business.