Menu
Grafana Cloud

Jenkins integration for Grafana Cloud

Jenkins is a free and open source automation server that helps automate the aspects of software development related to building, testing, and deploying. It’s a server-based system that runs in servlet containers such as Apache Tomcat.

The Jenkins integration for Grafana Cloud focuses on the state of the build infrastructure, as well as the duration and health of defined jobs. This enables you to monitor important cluster health, job execution, and web UI stats. Metrics are emitted by the Jenkins prometheus plugin then Grafana Cloud provides a prebuilt dashboard to help you monitor and visualize them.

Before you begin

You must install the Prometheus plugin in your Jenkins cluster to emit the metrics needed to populate the associated Grafana Cloud dashboard. Instructions on how to scrape metrics using the Grafana agent are included in this document.

If you are using a non-standard PROMETHEUS_NAMESPACE with the prometheus plugin, you can adjust the dashboard to query your metrics by changing the value of the ‘prefix’ template variable.

Install Jenkins for Grafana Cloud

  1. In your Grafana Cloud instance, click Integrations and Connections (lightning bolt icon), then search for or navigate to the Jenkins tile.
  2. Click the Jenkins tile then click Install Integration.
  3. Once the integration is installed, follow the steps on the Configuration Details page to setup Grafana Agent to automatically scrape and send Jenkins metrics to your Grafana Cloud Instance.

Post-install configuration for Jenkins integration

This integration supports metrics from Jenkins. In order to get those metrics into your Grafana Cloud instance, the Grafana agent must be pointed at your Jenkins server that exposes a /prometheus endpoint. Such as, localhost:8080 in the following example agent configuration file:

metrics:
  wal_directory: /tmp/wal
  configs:
    - name: integrations
      scrape_configs:
        - job_name: integrations/jenkins
          metrics_path: /prometheus
          static_configs:
            - targets: ['localhost:8080']
      remote_write:
        - url: http://cortex:9009/api/prom/push

Dashboards

The Jenkins integration for Grafana Cloud installs one prebuilt dashboard that allows you to view all of your Jenkins metrics in one place. This pre-built dashboard can be split into three separate sections.

The Overview section of the dashboard focuses on overall cluster and job execution health.

Jenkins overview section

The Jobs section of the dashboard provides a more granular view of the duration and health of jobs running in your Jenkins cluster.This section allows you to drill down into the details pertaining to specific jobs.

Jenkins jobs section

The Web UI section of the dashboard focuses on the duration and health of requests to the Jenkins web UI.

Jenkins web ui section

Metrics captured by the Jenkins integration for Grafana Cloud

The Grafana agent configuration provided by this integration will scrape all metrics exposed by the prometheus plugin for Jenkins.

Assuming that Jenkins is listening on port 8080 of the current host, you can see a full list of exposed metrics, with descriptions, by running the following command:

curl http://localhost:8080/prometheus/ | sed -nr 's/# HELP ([a-zA-Z0-9_]+) (.*)$/\1 \2/p'

The following metrics are utilized for the Jenkins prebuilt dashboard:

  • http_requests Generated from Dropwizard metric import (metric=http.requests, type=com.codahale.metrics.Timer)

  • http_responseCodes_badRequest_total Generated from Dropwizard metric import (metric=http.responseCodes.badRequest, type=com.codahale.metrics.Meter)

  • http_responseCodes_created_total Generated from Dropwizard metric import (metric=http.responseCodes.created, type=com.codahale.metrics.Meter)

  • http_responseCodes_forbidden_total Generated from Dropwizard metric import (metric=http.responseCodes.forbidden, type=com.codahale.metrics.Meter)

  • http_responseCodes_noContent_total Generated from Dropwizard metric import (metric=http.responseCodes.noContent, type=com.codahale.metrics.Meter)

  • http_responseCodes_notFound_total Generated from Dropwizard metric import (metric=http.responseCodes.notFound, type=com.codahale.metrics.Meter)

  • http_responseCodes_notModified_total Generated from Dropwizard metric import (metric=http.responseCodes.notModified, type=com.codahale.metrics.Meter)

  • http_responseCodes_ok_total Generated from Dropwizard metric import (metric=http.responseCodes.ok, type=com.codahale.metrics.Meter)

  • http_responseCodes_other_total Generated from Dropwizard metric import (metric=http.responseCodes.other, type=com.codahale.metrics.Meter) http_responseCodes_serverError_total Generated from Dropwizard metric import (metric=http.responseCodes.serverError, type=com.codahale.metrics.Meter)

  • http_responseCodes_serviceUnavailable_total Generated from Dropwizard metric import (metric=http.responseCodes.serviceUnavailable, type=com.codahale.metrics.Meter)

  • jenkins_executor_count_value Generated from Dropwizard metric import (metric=jenkins.executor.count.value, type=jenkins.metrics.impl.JenkinsMetricProviderImpl$12)

  • jenkins_node_count_value Generated from Dropwizard metric import (metric=jenkins.node.count.value, type=jenkins.metrics.impl.JenkinsMetricProviderImpl$9)

  • jenkins_node_online_value Generated from Dropwizard metric import (metric=jenkins.node.online.value, type=jenkins.metrics.impl.JenkinsMetricProviderImpl$10)

  • jenkins_plugins_active Generated from Dropwizard metric import (metric=jenkins.plugins.active, type=jenkins.metrics.impl.JenkinsMetricProviderImpl$20)

  • jenkins_plugins_failed Generated from Dropwizard metric import (metric=jenkins.plugins.failed, type=jenkins.metrics.impl.JenkinsMetricProviderImpl$22)

  • jenkins_plugins_inactive Generated from Dropwizard metric import (metric=jenkins.plugins.inactive, type=jenkins.metrics.impl.JenkinsMetricProviderImpl$21)

  • jenkins_plugins_withUpdate Generated from Dropwizard metric import (metric=jenkins.plugins.withUpdate, type=jenkins.metrics.impl.JenkinsMetricProviderImpl$23)

  • jenkins_queue_blocked_value Generated from Dropwizard metric import (metric=jenkins.queue.blocked.value, type=jenkins.metrics.impl.JenkinsMetricProviderImpl$5)

  • jenkins_queue_buildable_value Generated from Dropwizard metric import (metric=jenkins.queue.buildable.value, type=jenkins.metrics.impl.JenkinsMetricProviderImpl$6)

  • jenkins_queue_pending_value Generated from Dropwizard metric import (metric=jenkins.queue.pending.value, type=jenkins.metrics.impl.JenkinsMetricProviderImpl$8)

  • jenkins_queue_stuck_value Generated from Dropwizard metric import (metric=jenkins.queue.stuck.value, type=jenkins.metrics.impl.JenkinsMetricProviderImpl$7)

  • jenkins_runs_failure_total Generated from Dropwizard metric import (metric=jenkins.runs.failure, type=com.codahale.metrics.Meter)

  • jenkins_runs_success_total Generated from Dropwizard metric import (metric=jenkins.runs.success, type=com.codahale.metrics.Meter)

  • vm_uptime_milliseconds Generated from Dropwizard metric import (metric=vm.uptime.milliseconds, type=jenkins.metrics.impl.VMMetricProviderImpl$2)

  • default_jenkins_up Is Jenkins ready to receive requests

  • default_jenkins_uptime Time since Jenkins machine was initialized

  • jvm_memory_pool_allocated_bytes_total Total bytes allocated in a given JVM memory pool. Only updated after GC, not continuously.

Cost

By connecting your Jenkins instance to Grafana Cloud you might incur charges. For more information, use the following links:

For an increase in the number of active series that your Grafana Cloud account uses for metrics included in each Cloud tier, see Active series and dpm usage and Cloud tier pricing.