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.
Leave a Reply