2020-08-12 04:10:41 +08:00
# Jenkins Input Plugin
2018-11-06 06:19:08 +08:00
2022-06-08 05:37:08 +08:00
The jenkins plugin gathers information about the nodes and jobs running in a
jenkins instance.
2018-11-06 06:19:08 +08:00
2022-06-08 05:37:08 +08:00
This plugin does not require a plugin on jenkins and it makes use of Jenkins API
to retrieve all the information needed.
2018-11-06 06:19:08 +08:00
2022-10-27 03:58:36 +08:00
## Global configuration options <!-- @/docs/includes/plugin_config.md -->
In addition to the plugin-specific configuration settings, plugins support
additional global and plugin configuration settings. These settings are used to
modify metrics, tags, and field or create aliases and configure ordering, etc.
See the [CONFIGURATION.md][CONFIGURATION.md] for more details.
2023-01-12 23:55:21 +08:00
[CONFIGURATION.md]: ../../../docs/CONFIGURATION.md#plugins
2022-10-27 03:58:36 +08:00
2021-11-25 03:18:53 +08:00
## Configuration
2018-11-06 06:19:08 +08:00
2022-05-24 21:49:47 +08:00
```toml @sample .conf
2022-04-08 06:01:21 +08:00
# Read jobs and cluster metrics from Jenkins instances
2019-08-24 12:57:52 +08:00
[[inputs.jenkins]]
2019-11-14 05:38:33 +08:00
## The Jenkins URL in the format "schema://host:port"
2018-11-06 06:19:08 +08:00
url = "http://my-jenkins-instance:8080"
2019-01-24 06:17:57 +08:00
# username = "admin"
# password = "admin"
2018-11-06 06:19:08 +08:00
## Set response_timeout
response_timeout = "5s"
2019-01-24 06:17:57 +08:00
## Optional TLS Config
# tls_ca = "/etc/telegraf/ca.pem"
# tls_cert = "/etc/telegraf/cert.pem"
# tls_key = "/etc/telegraf/key.pem"
2018-11-06 06:19:08 +08:00
## Use SSL but skip chain & host verification
2019-01-24 06:17:57 +08:00
# insecure_skip_verify = false
2018-11-06 06:19:08 +08:00
## Optional Max Job Build Age filter
## Default 1 hour, ignore builds older than max_build_age
2019-01-24 06:17:57 +08:00
# max_build_age = "1h"
2018-11-06 06:19:08 +08:00
## 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
2019-01-24 06:17:57 +08:00
# max_subjob_depth = 0
2018-11-06 06:19:08 +08:00
## 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
2019-01-24 06:17:57 +08:00
# max_subjob_per_layer = 10
2018-11-06 06:19:08 +08:00
2020-12-23 23:21:38 +08:00
## 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 = [ ]
2018-11-06 06:19:08 +08:00
2021-07-02 04:54:53 +08:00
## Nodes to include or exclude from gathering
## When using both lists, node_exclude has priority.
# node_include = [ "*" ]
2020-12-23 23:21:38 +08:00
# node_exclude = [ ]
2018-11-06 06:19:08 +08:00
## Worker pool for jenkins plugin only
## Empty this field will use default value 5
2019-01-24 06:17:57 +08:00
# max_connections = 5
2023-07-28 21:23:53 +08:00
2023-11-29 21:47:39 +08:00
## When set to true will add node labels as a comma-separated tag. If none,
2023-07-28 21:23:53 +08:00
## are found, then a tag with the value of 'none' is used. Finally, if a
2023-11-29 21:47:39 +08:00
## label contains a comma it is replaced with an underscore.
2023-07-28 21:23:53 +08:00
# node_labels_as_tag = false
2018-11-06 06:19:08 +08:00
```
2021-11-25 03:18:53 +08:00
## Metrics
2018-11-06 06:19:08 +08:00
2021-09-21 00:10:36 +08:00
- jenkins
2020-02-15 07:36:58 +08:00
- tags:
- source
- port
- fields:
- busy_executors
- total_executors
2021-11-25 03:18:53 +08:00
- jenkins_node
2018-11-06 06:19:08 +08:00
- tags:
- arch
- disk_path
- temp_path
- node_name
- status ("online", "offline")
2019-11-14 05:38:33 +08:00
- source
2020-01-10 09:52:26 +08:00
- port
2018-11-06 06:19:08 +08:00
- fields:
2020-01-10 09:52:26 +08:00
- disk_available (Bytes)
- temp_available (Bytes)
- memory_available (Bytes)
- memory_total (Bytes)
- swap_available (Bytes)
- swap_total (Bytes)
- response_time (ms)
2019-11-13 03:59:11 +08:00
- num_executors
2018-11-06 06:19:08 +08:00
- jenkins_job
- tags:
- name
- parents
- result
2019-11-14 05:38:33 +08:00
- source
2020-01-10 09:52:26 +08:00
- port
2018-11-06 06:19:08 +08:00
- fields:
2020-01-10 09:52:26 +08:00
- duration (ms)
2020-12-11 01:02:07 +08:00
- number
2018-11-06 06:19:08 +08:00
- result_code (0 = SUCCESS, 1 = FAILURE, 2 = NOT_BUILD, 3 = UNSTABLE, 4 = ABORTED)
2021-11-25 03:18:53 +08:00
## Sample Queries
2018-11-06 06:19:08 +08:00
2021-11-25 03:18:53 +08:00
```sql
2018-11-06 06:19:08 +08:00
SELECT mean("memory_available") AS "mean_memory_available", mean("memory_total") AS "mean_memory_total", mean("temp_available") AS "mean_temp_available" FROM "jenkins_node" WHERE time > now() - 15m GROUP BY time(:interval:) FILL(null)
```
2021-11-25 03:18:53 +08:00
```sql
2018-11-06 06:19:08 +08:00
SELECT mean("duration") AS "mean_duration" FROM "jenkins_job" WHERE time > now() - 24h GROUP BY time(:interval:) FILL(null)
```
2021-11-25 03:18:53 +08:00
## Example Output
2018-11-06 06:19:08 +08:00
2023-04-04 19:43:49 +08:00
```text
2020-02-15 06:04:54 +08:00
jenkins,host=myhost,port=80,source=my-jenkins-instance busy_executors=4i,total_executors=8i 1580418261000000000
2020-01-10 09:52:26 +08:00
jenkins_node,arch=Linux\ (amd64),disk_path=/var/jenkins_home,temp_path=/tmp,host=myhost,node_name=master,source=my-jenkins-instance,port=8080 swap_total=4294963200,memory_available=586711040,memory_total=6089498624,status=online,response_time=1000i,disk_available=152392036352,temp_available=152392036352,swap_available=3503263744,num_executors=2i 1516031535000000000
jenkins_job,host=myhost,name=JOB1,parents=apps/br1,result=SUCCESS,source=my-jenkins-instance,port=8080 duration=2831i,result_code=0i 1516026630000000000
jenkins_job,host=myhost,name=JOB2,parents=apps/br2,result=SUCCESS,source=my-jenkins-instance,port=8080 duration=2285i,result_code=0i 1516027230000000000
2019-01-24 06:17:57 +08:00
```