sensu-plugins / sensu-plugins-jenkins

This plugin provides native Jenkins instrumentation for monitoring and metrics collection, including: health, job status, metrics via `JQS`, and others.
http://sensu-plugins.io
MIT License
9 stars 18 forks source link

Add timeout parameter and report request duration #29

Closed CoRfr closed 6 years ago

CoRfr commented 6 years ago

Jenkins stopped responding to metrics while being functional for about 1 hour one night. It was busy at that time so I wonder if by extending the request timeout it would have been able to get some data, and if so I want to be able to monitor the request duration to see what it looks like.

Pull Request Checklist

Is this in reference to an existing issue?

General

New Plugins

Purpose

Known Compatibility Issues

majormoses commented 6 years ago

Thanks for your contribution to Sensu plugins! Without people like you submitting PRs we couldn't run the project. I will review it shortly.

CoRfr commented 6 years ago

For the testing artifacts:

$ bundle exec ./bin/metrics-jenkins.rb --scheme test --server 10.1.60.1 -p 8080 -t 10
...
test.timers.jenkins.node.carmd-nr-lxcid4bed9b5f162.builds.count 98 1510730423
test.timers.jenkins.node.carmd-nr-lxcid8d385e161f8.builds.count 14 1510730423
test.timers.jenkins.node.carmd-nr-lxcif4ce4684c67c.builds.count 79 1510730423
test.request.duration 41 1510730423

$ bundle exec ./bin/metrics-jenkins.rb --scheme test --server 10.1.60.1 -p 8080 --no-report-request-duration
...
test.timers.jenkins.node.carmd-nr-lxcid4bed9b5f162.builds.count 98 1510730443
test.timers.jenkins.node.carmd-nr-lxcid8d385e161f8.builds.count 14 1510730443
test.timers.jenkins.node.carmd-nr-lxcif4ce4684c67c.builds.count 79 1510730443

# On some AWS IP that doesn't exist
$ bundle exec ./bin/metrics-jenkins.rb --scheme test --server 10.101.1.5 -p 8080 -t 1
Jenkins Connection timed out
test.request.duration 1002 1510730920

$ bundle exec ./bin/metrics-jenkins.rb --scheme test --server 10.101.1.5 -p 8080 -t 1 2>/dev/null
test.request.duration 1002 1510730926
majormoses commented 6 years ago

released: https://rubygems.org/gems/sensu-plugins-jenkins/versions/1.4.0