Skip to content

Jenkins

Auto-Discovery
Health Check
Metrics
Logs

To enable metric gathering, you need to configure the Jenkins URL and the credentials the agent should use to get information about the latest jobs.

To configure your service, add the following to /etc/glouton/conf.d/99-local.conf:

service:
[...]
# For a Jenkins running outside a container
- type: "jenkins"
address: "127.0.0.1"
port: 8080
# To enable metric gathering, the fields stats_url, username and password are required.
# The other fields are optional and can be omitted.
# Jenkins URL.
stats_url: "http://jenkins.example.com"
# Credentials used for authentication.
username: my_user
password: my_api_token
## TLS configurations.
ca_file: "/myca.pem"
cert_file: "/mycert.pem"
key_file: "/mykey.pem"
# Skip chain and host verification.
ssl_insecure: false
# Choose jobs to include or exclude. When using both lists, exclude has priority.
# Wildcards are supported: [ "jobA/*", "jobB/subjob1/*"]. If empty, all jobs are included.
included_items: []
excluded_items: []
# For a Jenkins running in a Docker container
- type: "jenkins"
instance: "CONTAINER_NAME"
port: 8080
stats_url: "http://jenkins.example.com"
username: my_user
password: my_api_token

When using Docker, you may use labels to set the configuration:

Terminal window
docker run --label glouton.stats_url="http://jenkins.example.com" --label glouton.username="my_user" [...]

The following metrics are gathered:

MetricDescription
service_statusStatus of Jenkins
jenkins_busy_executorsNumber of busy executors
jenkins_total_executorsTotal number of executors (both busy and idle)
jenkins_job_duration_secondsJob duration in seconds
jenkins_job_numberNumber of times this job has been run
jenkins_job_result_codeJob result code (0 = SUCCESS, 1 = FAILURE, 2 = NOT_BUILD, 3 = UNSTABLE, 4 = ABORTED)