sensu-plugins-http 4.0.0 → 4.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +13 -1
- data/README.md +0 -2
- data/bin/check-http.rb +32 -3
- data/lib/sensu-plugins-http/version.rb +1 -1
- metadata +5 -19
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2fc8810ca0cb4a83430c6fec61fe2a3566deecce4ccc33171db3d97fcd6bf34b
|
4
|
+
data.tar.gz: b3d8e96a8fc4343291b48597685da546b838ea351815a1b2e953b69346d5d420
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 29198029e8d5a9f6d7242ed1433336fa134489f403b9eaba0000e9df132ac8e9beebbc1a74098938d783a0a2bafe735ef5996fe8c127025dbb29dd9edcb4c441
|
7
|
+
data.tar.gz: 94b0200a10ab99d668c98491f8f0517001e4c0c672d2ec011712298c59ea3d95ed8e5af00073d7207bf7dac74af6532aacb6f53fde615aeab96e9ead5e115b4a
|
data/CHANGELOG.md
CHANGED
@@ -5,6 +5,17 @@ This CHANGELOG follows the format listed [here](https://github.com/sensu-plugins
|
|
5
5
|
|
6
6
|
## [Unreleased]
|
7
7
|
|
8
|
+
## [4.1.0] - 2019-02-17
|
9
|
+
### Added
|
10
|
+
- `check-http.rb`: Add options to set `--open-timeout` and `--read-timeout` for Net:HTTP. Additionally rescue `Net::OpenTimeout` and `Net::ReadTimeout` exception classes (@johanek)
|
11
|
+
- `check-http.rb`: exposed `--dns-timeout` for Ruby DNS Resolver. (@johanek)
|
12
|
+
|
13
|
+
### Changed
|
14
|
+
- `check-http.rb`: switched to using rubies DNS resolver to allow catching DNS failures when Net::HTTP establishes connection. (@johanek)
|
15
|
+
|
16
|
+
### Removed
|
17
|
+
- removed codeclimate (@tmonk42)
|
18
|
+
|
8
19
|
## [4.0.0] - 2018-12-17
|
9
20
|
### Breaking Changes
|
10
21
|
- bumped dependency of `sensu-plugin` to `~> 3.0` (@dependabot) @majormoses
|
@@ -214,7 +225,8 @@ This CHANGELOG follows the format listed [here](https://github.com/sensu-plugins
|
|
214
225
|
### Added
|
215
226
|
- Initial release
|
216
227
|
|
217
|
-
[Unreleased]: https://github.com/sensu-plugins/sensu-plugins-http/compare/4.
|
228
|
+
[Unreleased]: https://github.com/sensu-plugins/sensu-plugins-http/compare/4.1.0...HEAD
|
229
|
+
[4.1.0]: https://github.com/sensu-plugins/sensu-plugins-http/compare/4.0.0...4.1.0
|
218
230
|
[4.0.0]: https://github.com/sensu-plugins/sensu-plugins-http/compare/3.0.1...4.0.0
|
219
231
|
[3.0.1]: https://github.com/sensu-plugins/sensu-plugins-http/compare/3.0.0...3.0.1
|
220
232
|
[3.0.0]: https://github.com/sensu-plugins/sensu-plugins-http/compare/2.11.0...3.0.0
|
data/README.md
CHANGED
@@ -2,8 +2,6 @@
|
|
2
2
|
|
3
3
|
[](https://travis-ci.org/sensu-plugins/sensu-plugins-http)
|
4
4
|
[](http://badge.fury.io/rb/sensu-plugins-http)
|
5
|
-
[](https://codeclimate.com/github/sensu-plugins/sensu-plugins-http)
|
6
|
-
[](https://codeclimate.com/github/sensu-plugins/sensu-plugins-http)
|
7
5
|
[](https://gemnasium.com/sensu-plugins/sensu-plugins-http)
|
8
6
|
|
9
7
|
## Functionality
|
data/bin/check-http.rb
CHANGED
@@ -59,6 +59,7 @@ require 'sensu-plugin/check/cli'
|
|
59
59
|
require 'net/http'
|
60
60
|
require 'net/https'
|
61
61
|
require 'digest'
|
62
|
+
require 'resolv-replace'
|
62
63
|
|
63
64
|
#
|
64
65
|
# Check HTTP
|
@@ -165,9 +166,27 @@ class CheckHttp < Sensu::Plugin::Check::CLI
|
|
165
166
|
short: '-t SECS',
|
166
167
|
long: '--timeout SECS',
|
167
168
|
proc: proc(&:to_i),
|
168
|
-
description: 'Set the timeout',
|
169
|
+
description: 'Set the total execution timeout in seconds',
|
169
170
|
default: 15
|
170
171
|
|
172
|
+
option :open_timeout,
|
173
|
+
long: '--open-timeout SECS',
|
174
|
+
proc: proc(&:to_i),
|
175
|
+
description: 'Number of seconds to wait for the connection to open',
|
176
|
+
default: 15
|
177
|
+
|
178
|
+
option :read_timeout,
|
179
|
+
long: '--read-timeout SECS',
|
180
|
+
proc: proc(&:to_i),
|
181
|
+
description: 'Number of seconds to wait for one block to be read',
|
182
|
+
default: 15
|
183
|
+
|
184
|
+
option :dns_timeout,
|
185
|
+
long: '--dns-timeout SECS',
|
186
|
+
proc: proc(&:to_f),
|
187
|
+
description: 'Number of seconds to allow for DNS resolution. Accepts decimal number.',
|
188
|
+
default: 0.8
|
189
|
+
|
171
190
|
option :redirectok,
|
172
191
|
short: '-r',
|
173
192
|
boolean: true,
|
@@ -250,10 +269,20 @@ class CheckHttp < Sensu::Plugin::Check::CLI
|
|
250
269
|
config[:port] ||= config[:ssl] ? 443 : 80
|
251
270
|
end
|
252
271
|
|
272
|
+
# Use Ruby DNS Resolver and set DNS resolution timeout to dns_timeout value
|
273
|
+
hosts_resolver = Resolv::Hosts.new
|
274
|
+
dns_resolver = Resolv::DNS.new
|
275
|
+
dns_resolver.timeouts = config[:dns_timeout]
|
276
|
+
Resolv::DefaultResolver.replace_resolvers([hosts_resolver, dns_resolver])
|
277
|
+
|
253
278
|
begin
|
254
279
|
Timeout.timeout(config[:timeout]) do
|
255
280
|
acquire_resource
|
256
281
|
end
|
282
|
+
rescue Net::OpenTimeout
|
283
|
+
critical 'Request timed out opening connection'
|
284
|
+
rescue Net::ReadTimeout
|
285
|
+
critical 'Request timed out reading data'
|
257
286
|
rescue Timeout::Error
|
258
287
|
critical 'Request timed out'
|
259
288
|
rescue StandardError => e
|
@@ -279,8 +308,8 @@ class CheckHttp < Sensu::Plugin::Check::CLI
|
|
279
308
|
else
|
280
309
|
http = Net::HTTP.new(config[:host], config[:port])
|
281
310
|
end
|
282
|
-
http.read_timeout = config[:
|
283
|
-
http.open_timeout = config[:
|
311
|
+
http.read_timeout = config[:read_timeout]
|
312
|
+
http.open_timeout = config[:open_timeout]
|
284
313
|
http.ssl_timeout = config[:timeout]
|
285
314
|
http.continue_timeout = config[:timeout]
|
286
315
|
http.keep_alive_timeout = config[:timeout]
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sensu-plugins-http
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.
|
4
|
+
version: 4.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sensu-Plugins and contributors
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-02-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sensu-plugin
|
@@ -72,20 +72,6 @@ dependencies:
|
|
72
72
|
- - "~>"
|
73
73
|
- !ruby/object:Gem::Version
|
74
74
|
version: '1.7'
|
75
|
-
- !ruby/object:Gem::Dependency
|
76
|
-
name: codeclimate-test-reporter
|
77
|
-
requirement: !ruby/object:Gem::Requirement
|
78
|
-
requirements:
|
79
|
-
- - "~>"
|
80
|
-
- !ruby/object:Gem::Version
|
81
|
-
version: '0.4'
|
82
|
-
type: :development
|
83
|
-
prerelease: false
|
84
|
-
version_requirements: !ruby/object:Gem::Requirement
|
85
|
-
requirements:
|
86
|
-
- - "~>"
|
87
|
-
- !ruby/object:Gem::Version
|
88
|
-
version: '0.4'
|
89
75
|
- !ruby/object:Gem::Dependency
|
90
76
|
name: github-markup
|
91
77
|
requirement: !ruby/object:Gem::Requirement
|
@@ -148,14 +134,14 @@ dependencies:
|
|
148
134
|
requirements:
|
149
135
|
- - "~>"
|
150
136
|
- !ruby/object:Gem::Version
|
151
|
-
version: '
|
137
|
+
version: '1.3'
|
152
138
|
type: :development
|
153
139
|
prerelease: false
|
154
140
|
version_requirements: !ruby/object:Gem::Requirement
|
155
141
|
requirements:
|
156
142
|
- - "~>"
|
157
143
|
- !ruby/object:Gem::Version
|
158
|
-
version: '
|
144
|
+
version: '1.3'
|
159
145
|
- !ruby/object:Gem::Dependency
|
160
146
|
name: pry
|
161
147
|
requirement: !ruby/object:Gem::Requirement
|
@@ -314,7 +300,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
314
300
|
- !ruby/object:Gem::Version
|
315
301
|
version: '0'
|
316
302
|
requirements: []
|
317
|
-
rubygems_version: 3.0.
|
303
|
+
rubygems_version: 3.0.2
|
318
304
|
signing_key:
|
319
305
|
specification_version: 4
|
320
306
|
summary: Sensu plugins for various http monitors and metrics
|