Public Repository

Last pushed: a year ago
Short Description
Short description is empty for this repo.
Full Description

Jenkins exporter

I wrote my own jenkins exporter as none of the ones I found do what I needed.

Metrics output

The following metrics are output

# HELP jenkins_up State of jenkins
# TYPE jenkins_up gauge
jenkins_up{} 1
# HELP jenkins_num_executors Number of executors
# TYPE jenkins_num_executors gauge
jenkins_num_executors{} 2
# HELP jenkins_red_jobs Number of failed jobs
# TYPE jenkins_red_jobs gauge
jenkins_red_jobs{} 1
# HELP jenkins_green_jobs Number of successful jobs
# TYPE jenkins_green_jobs gauge
jenkins_green_jobs{} 1
# HELP jenkins_notbuilt_jobs Number of not built jobs
# TYPE jenkins_notbuilt_jobs gauge
jenkins_notbuilt_jobs{} 1
# HELP jenkins_disabled_jobs Number of disabled jobs
# TYPE jenkins_disabled_jobs gauge
jenkins_disabled_jobs{} 0
# HELP jenkins_job_state State of specific job [BLUE = 0, RED = 1, NOTBUILT = 2, DISABLED = 3]
# TYPE jenkins_job_state gauge
jenkins_job_state{name="JOB-1",url="http://localhost:8080/job/JOB-1/"} 0
jenkins_job_state{name="JOB-2",url="http://localhost:8080/job/JOB-2/"} 1
jenkins_job_state{name="JOB-3",url="http://localhost:8080/job/JOB-3/"} 2


This exporter is written in node.js.

Running is as simple as:

npm install
node index.js <optional_args>


Usage: index.js [options]

  -j, --jenkins  http(s)://<host>:<port> to jenkins instance     [default: "http://localhost:8080"]
  -p, --port     Server port                                                        [default: 9118]
  --user         Username for jenkins instance
  --pass         Password for jenkins instance
  -h, --help     Show help                                                                [boolean]

  index.js -j "http://localhost:8080"
  --user admin --pass password1234


I have built a docker image for this exporter

docker pull granra/jenkins_exporter
docker run -p 9118:9118 granra/jenkins_exporter <optional_args>

If jenkins is running on the host you should run it with:

docker run -p 9118:9118 --net=host granra/jenkins_exporter

If jenkins is running in a container called jenkins you should run it with:

docker run -p 9118:9118 --link jenkins:jenkins granra/jenkins_exporter -j http://jenkins:8080
Docker Pull Command