Jenkins Metrics

Ship your Jenkins Metrics via Telegraf to your Logit.io Stack

Configure Telegraf to ship Jenkins metrics to your Logit.io stacks via Logstash.

Install Integration

Please click on the Install Integration button to configure your stack for this source.

Install Telegraf

This integration allows you to configure a Telegraf agent to send your metrics, in multiple formats, to Logit.io.

Choose the installation method for your operating system:

When you paste the command below into Powershell it will download the Telegraf zip file. Once that is complete, press Enter again and the zip file will be extracted into C:\Program Files\InfluxData\telegraf\telegraf-1.31.2.

wget https://dl.influxdata.com/telegraf/releases/telegraf-1.31.2_windows_amd64.zip -UseBasicParsing -OutFile telegraf-1.31.2_windows_amd64.zip 
Expand-Archive .\telegraf-1.31.2_windows_amd64.zip -DestinationPath 'C:\Program Files\InfluxData\telegraf'

Configure the Telegraf input plugin

The configuration file below is pre-configured to scrape the system metrics from your hosts, add the following code to the configuration file /etc/telegraf/telegraf.conf from the previous step.

# Read jobs and cluster metrics from Jenkins instances
[[inputs.jenkins]]
  ## The Jenkins URL in the format "schema://host:port"
  url = "http://my-jenkins-instance:8080"
  # username = "admin"
  # password = "admin"
 
  ## Set response_timeout
  response_timeout = "5s"
 
  ## Optional TLS Config
  # tls_ca = "/etc/telegraf/ca.pem"
  # tls_cert = "/etc/telegraf/cert.pem"
  # tls_key = "/etc/telegraf/key.pem"
  ## Use SSL but skip chain & host verification
  # insecure_skip_verify = false
 
  ## Optional Max Job Build Age filter
  ## Default 1 hour, ignore builds older than max_build_age
  # max_build_age = "1h"
 
  ## Optional Sub Job Depth filter
  ## Jenkins can have unlimited layer of sub jobs
  ## This config will limit the layers of pulling, default value 0 means
  ## unlimited pulling until no more sub jobs
  # max_subjob_depth = 0
 
  ## Optional Sub Job Per Layer
  ## In workflow-multibranch-plugin, each branch will be created as a sub job.
  ## This config will limit to call only the lasted branches in each layer,
  ## empty will use default value 10
  # max_subjob_per_layer = 10
 
  ## Jobs to include or exclude from gathering
  ## When using both lists, job_exclude has priority.
  ## Wildcards are supported: [ "jobA/*", "jobB/subjob1/*"]
  # job_include = [ "*" ]
  # job_exclude = [ ]
 
  ## Nodes to include or exclude from gathering
  ## When using both lists, node_exclude has priority.
  # node_include = [ "*" ]
  # node_exclude = [ ]
 
  ## Worker pool for jenkins plugin only
  ## Empty this field will use default value 5
  # max_connections = 5

Read more about how to configure data scraping and configuration options for Jenkins (opens in a new tab)

Configure The Output plugin

Once you have generated the configuration file, you need to set up the output plug-in to allow Telegraf to transmit your data to Logit.io in Prometheus format. This can be accomplished by incorporating the following code into your configuration file:

[[outputs.http]]
  url = "https://@metricsUsername:@metricsPassword@@metrics_id-vm.logit.io:@vmAgentPort/api/v1/write"
  data_format = "prometheusremotewrite"
 
  [outputs.http.headers]
    Content-Type = "application/x-protobuf"
    Content-Encoding = "snappy"

Start Telegraf

From the location where Telegraf was installed (C:\Program Files\InfluxData\telegraf\telegraf-1.31.2) run the program providing the chosen configuration file as a parameter:

.\telegraf.exe --config telegraf-demo.conf

Once Telegraf is running you should see output similar to the following, which confirms the inputs, output and basic configuration the application has been started with: Powershell Telegraf information

View your metrics

Data should now have been sent to your Stack.

View My Data

If you don't see take a look at How to diagnose no data in Stack below for how to diagnose common issues.

How to diagnose no data in Stack

If you don't see data appearing in your Stack after following the steps, visit the Help Centre guide for steps to diagnose no data appearing in your Stack or Chat to support now.

Telegraf Jenkins metrics Overview

Jenkins is a robust continuous integration/continuous delivery (CI/CD) tool that's vital for streamlining and automating software development rocesses. To maximize its capabilities, effective Jenkins monitoring and analysis are paramount. This is where Telegraf, the open-source server monitoring agent, comes into play. Telegraf is ideal for collecting Jenkins metrics and data across various sources, including the Jenkins server, operating systems, and databases.

Telegraf's diverse range of plugins allows for comprehensive Jenkins monitoring. It collects a broad scope of Jenkins metrics, such as build times, job statuses, and queue lengths. These metrics are invaluable in gaining insight into Jenkins server health and performance, enabling organizations to enhance their CI/CD pipeline management.

Prometheus, an advanced open-source monitoring and alerting toolkit, is the go-to choice for storing and analyzing the collected Jenkins metrics. With its flexible query language and data visualization capabilities, Prometheus facilitates deep insights into Jenkins CI/CD pipelines. Configuring Telegraf to convert Jenkins metrics into the Prometheus format, and setting up Prometheus to scrape these metrics from the Telegraf server, ensures seamless integration.

By using Telegraf for Jenkins monitoring and shipping those metrics to Prometheus, businesses establish a reliable and efficient CI/CD metrics management solution. This process empowers them to closely monitor Jenkins performance, optimize their software delivery pipelines, and make informed, data-driven decisions to guarantee optimal system health and performance.

If you need any further assistance with shipping your log data to Logit.io we're here to help you get started. Feel free to get in contact with our support team by sending us a message via live chat & we'll be happy to assist.