sensu-plugins-http 2.8.0 → 2.8.1
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 +9 -1
- data/bin/check-head-redirect.rb +2 -0
- data/bin/check-http-cors.rb +3 -1
- data/bin/check-http-json.rb +4 -2
- data/bin/check-http.rb +9 -8
- data/bin/check-https-cert.rb +3 -1
- data/bin/check-last-modified.rb +2 -0
- data/bin/metrics-curl.rb +3 -1
- data/bin/metrics-http-json-deep.rb +4 -2
- data/bin/metrics-http-json.rb +4 -2
- data/lib/sensu-plugins-http.rb +2 -0
- data/lib/sensu-plugins-http/aws-v4.rb +2 -0
- data/lib/sensu-plugins-http/common.rb +7 -4
- data/lib/sensu-plugins-http/version.rb +3 -1
- metadata +43 -43
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8e03ef72ab14b7f7a93a10c52cb7ead9d2500647488d1bcc6995ce9d93e30821
|
4
|
+
data.tar.gz: 4d34a2e7756ba91bd4e12f827627e71841c4775447414c0c6d9c6945385c4844
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b90771c763a8f96302c405538017cf8e0c34dfdf8a0f5f4401700caf9b8907d5f748c2bdf608a0c4eb875a459ba8795122ced7f12d9c69cb6fe5ebe0d23e5af0
|
7
|
+
data.tar.gz: 9c1652f1423ad96a20c36c925a51719e39c96a98df649e3fd4d7fcb70a1cd37df3ff69b16f4c7adcbbfca2b754d9eda28f95555b89600581f91bdc8e2cdeb773
|
data/CHANGELOG.md
CHANGED
@@ -5,6 +5,13 @@ This CHANGELOG follows the format listed [here](https://github.com/sensu-plugins
|
|
5
5
|
|
6
6
|
## [Unreleased]
|
7
7
|
|
8
|
+
## [2.8.1] 2018-03-07
|
9
|
+
### Security
|
10
|
+
- updated rubocop dependency to `~> 0.51.0` per: https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2017-8418. (@majormoses)
|
11
|
+
|
12
|
+
### Changed
|
13
|
+
- appeased the cops, updated cop config, and created TODOs for refactoring (@majormoses)
|
14
|
+
|
8
15
|
## [2.8.0] 2018-02-17
|
9
16
|
### Added
|
10
17
|
- Add new options `--dump-json` to dump json response on failure when enable. default: false (@jplindquist)
|
@@ -163,7 +170,8 @@ This CHANGELOG follows the format listed [here](https://github.com/sensu-plugins
|
|
163
170
|
### Added
|
164
171
|
- Initial release
|
165
172
|
|
166
|
-
[Unreleased]: https://github.com/sensu-plugins/sensu-plugins-http/compare/2.8.
|
173
|
+
[Unreleased]: https://github.com/sensu-plugins/sensu-plugins-http/compare/2.8.1...HEAD
|
174
|
+
[2.8.1]: https://github.com/sensu-plugins/sensu-plugins-http/compare/2.8.0...2.8.1
|
167
175
|
[2.8.0]: https://github.com/sensu-plugins/sensu-plugins-http/compare/2.7.0...2.8.0
|
168
176
|
[2.7.0]: https://github.com/sensu-plugins/sensu-plugins-http/compare/2.6.0...2.7.0
|
169
177
|
[2.6.0]: https://github.com/sensu-plugins/sensu-plugins-http/compare/2.5.0...2.6.0
|
data/bin/check-head-redirect.rb
CHANGED
data/bin/check-http-cors.rb
CHANGED
@@ -1,4 +1,6 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
2
4
|
#
|
3
5
|
# check-http-cors
|
4
6
|
#
|
@@ -79,7 +81,7 @@ class CheckCORS < Sensu::Plugin::Check::CLI
|
|
79
81
|
end
|
80
82
|
rescue Timeout::Error
|
81
83
|
critical 'Connection timed out'
|
82
|
-
rescue => e
|
84
|
+
rescue StandardError => e
|
83
85
|
critical "Connection error: #{e.message}"
|
84
86
|
end
|
85
87
|
end
|
data/bin/check-http-json.rb
CHANGED
@@ -1,4 +1,6 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
2
4
|
#
|
3
5
|
# check-http-json
|
4
6
|
#
|
@@ -90,7 +92,7 @@ class CheckJson < Sensu::Plugin::Check::CLI
|
|
90
92
|
end
|
91
93
|
rescue Timeout::Error
|
92
94
|
critical 'Connection timed out'
|
93
|
-
rescue => e
|
95
|
+
rescue StandardError => e
|
94
96
|
critical "Connection error: #{e.message}"
|
95
97
|
end
|
96
98
|
end
|
@@ -202,7 +204,7 @@ class CheckJson < Sensu::Plugin::Check::CLI
|
|
202
204
|
end
|
203
205
|
|
204
206
|
ok message
|
205
|
-
rescue => e
|
207
|
+
rescue StandardError => e
|
206
208
|
if config[:dump_json]
|
207
209
|
json_response = config[:pretty] ? JSON.pretty_generate(json) : json
|
208
210
|
message = "key check failed: #{e}. Response: #{json_response}"
|
data/bin/check-http.rb
CHANGED
@@ -1,4 +1,6 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
2
4
|
#
|
3
5
|
# check-http
|
4
6
|
#
|
@@ -90,7 +92,7 @@ class CheckHttp < Sensu::Plugin::Check::CLI
|
|
90
92
|
short: '-m GET|POST',
|
91
93
|
long: '--method GET|POST|PUT',
|
92
94
|
description: 'Specify a GET, POST, or PUT operation; defaults to GET',
|
93
|
-
in: %w
|
95
|
+
in: %w[GET POST PUT],
|
94
96
|
default: 'GET'
|
95
97
|
|
96
98
|
option :header,
|
@@ -245,7 +247,7 @@ class CheckHttp < Sensu::Plugin::Check::CLI
|
|
245
247
|
end
|
246
248
|
rescue Timeout::Error
|
247
249
|
critical 'Request timed out'
|
248
|
-
rescue => e
|
250
|
+
rescue StandardError => e
|
249
251
|
critical "Request error: #{e.message}"
|
250
252
|
end
|
251
253
|
end
|
@@ -393,12 +395,11 @@ class CheckHttp < Sensu::Plugin::Check::CLI
|
|
393
395
|
warning(res.code + body) unless config[:response_code]
|
394
396
|
end
|
395
397
|
|
396
|
-
if config[:response_code]
|
397
|
-
|
398
|
-
|
399
|
-
|
400
|
-
|
401
|
-
end
|
398
|
+
if config[:response_code] && config[:response_code] == res.code
|
399
|
+
ok "#{res.code}, #{size} bytes" + body
|
400
|
+
|
401
|
+
else
|
402
|
+
critical res.code + body
|
402
403
|
end
|
403
404
|
end
|
404
405
|
end
|
data/bin/check-https-cert.rb
CHANGED
@@ -1,4 +1,6 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
2
4
|
#
|
3
5
|
# check-https-cert
|
4
6
|
#
|
@@ -114,7 +116,7 @@ class CheckHttpCert < Sensu::Plugin::Check::CLI
|
|
114
116
|
ok "TLS/SSL certificate expires on #{@cert.not_after} - #{days_until} days left."
|
115
117
|
end
|
116
118
|
end
|
117
|
-
rescue
|
119
|
+
rescue StandardError
|
118
120
|
critical "Could not connect to #{config[:url]}"
|
119
121
|
end
|
120
122
|
end
|
data/bin/check-last-modified.rb
CHANGED
data/bin/metrics-curl.rb
CHANGED
@@ -1,4 +1,6 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
2
4
|
#
|
3
5
|
# metrics-curl
|
4
6
|
#
|
@@ -57,7 +59,7 @@ class CurlMetrics < Sensu::Plugin::Metric::CLI::Graphite
|
|
57
59
|
|
58
60
|
def run
|
59
61
|
cmd = "curl --silent --output /dev/null #{config[:curl_args]} "
|
60
|
-
cmd += '-w
|
62
|
+
cmd += '-w %{time_total},%{time_namelookup},%{time_connect},%{time_pretransfer},%{time_redirect},%{time_starttransfer},%{http_code}" '
|
61
63
|
cmd += config[:url]
|
62
64
|
|
63
65
|
output = `#{cmd}`
|
@@ -1,4 +1,6 @@
|
|
1
1
|
#! /usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
2
4
|
#
|
3
5
|
# metrics-http-json-deep
|
4
6
|
#
|
@@ -83,7 +85,7 @@ class JsonDeepMetrics < Sensu::Plugin::Metric::CLI::Graphite
|
|
83
85
|
if value.is_a?(Hash)
|
84
86
|
deep_value(value, "#{scheme}.#{ekey}")
|
85
87
|
else
|
86
|
-
output "#{scheme}.#{ekey}", value unless config[:numonly] && !value.is_a?(
|
88
|
+
output "#{scheme}.#{ekey}", value unless config[:numonly] && !value.is_a?(Integer)
|
87
89
|
end
|
88
90
|
end
|
89
91
|
end
|
@@ -113,7 +115,7 @@ class JsonDeepMetrics < Sensu::Plugin::Metric::CLI::Graphite
|
|
113
115
|
connection.request(request)
|
114
116
|
end
|
115
117
|
end
|
116
|
-
end
|
118
|
+
end
|
117
119
|
|
118
120
|
metrics = Oj.load(response.body, mode: :compat)
|
119
121
|
deep_value(metrics[config[:root]], config[:scheme])
|
data/bin/metrics-http-json.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
#! /usr/bin/env ruby
|
2
|
-
#
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
3
4
|
# metrics-http-json.rb
|
4
5
|
#
|
5
6
|
# DESCRIPTION:
|
@@ -70,7 +71,8 @@ class HttpJsonGraphite < Sensu::Plugin::Metric::CLI::Graphite
|
|
70
71
|
if config[:object]
|
71
72
|
object = config[:object].to_s
|
72
73
|
end
|
73
|
-
|
74
|
+
# TODO: figure out what to do here
|
75
|
+
url = URI.encode(config[:url].to_s) # rubocop:disable Lint/UriEscapeUnescape
|
74
76
|
begin
|
75
77
|
r = RestClient.get url
|
76
78
|
metric_pair_array = metric_pair_input.split(/,/)
|
data/lib/sensu-plugins-http.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
|
2
3
|
module Common
|
3
4
|
def initialize
|
@@ -6,9 +7,11 @@ module Common
|
|
6
7
|
end
|
7
8
|
|
8
9
|
def aws_config
|
9
|
-
|
10
|
-
|
11
|
-
|
10
|
+
if config[:aws_access_key_id] && config[:aws_secret_access_key]
|
11
|
+
Aws.config.update(
|
12
|
+
credentials: Aws::Credentials.new(config[:aws_access_key_id], config[:aws_secret_access_key])
|
13
|
+
)
|
14
|
+
end
|
12
15
|
|
13
16
|
Aws.config.update(
|
14
17
|
region: config[:aws_region]
|
@@ -25,7 +28,7 @@ module Common
|
|
25
28
|
resp = s3.get_object(bucket: config[:s3_config_bucket], key: config[:s3_config_key])
|
26
29
|
s3_config = JSON.parse(resp.body.read, symbolize_names: true)
|
27
30
|
config.merge!(s3_config)
|
28
|
-
rescue
|
31
|
+
rescue StandardError
|
29
32
|
critical 'Error getting config file from s3'
|
30
33
|
end
|
31
34
|
end
|
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: 2.8.
|
4
|
+
version: 2.8.1
|
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: 2018-
|
11
|
+
date: 2018-03-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sensu-plugin
|
@@ -95,165 +95,165 @@ dependencies:
|
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '1.3'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
|
-
name:
|
98
|
+
name: json
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
101
|
- - "<"
|
102
102
|
- !ruby/object:Gem::Version
|
103
|
-
version: 2.
|
104
|
-
- - "~>"
|
105
|
-
- !ruby/object:Gem::Version
|
106
|
-
version: '2.2'
|
103
|
+
version: 2.0.0
|
107
104
|
type: :development
|
108
105
|
prerelease: false
|
109
106
|
version_requirements: !ruby/object:Gem::Requirement
|
110
107
|
requirements:
|
111
108
|
- - "<"
|
112
109
|
- !ruby/object:Gem::Version
|
113
|
-
version: 2.
|
114
|
-
- - "~>"
|
115
|
-
- !ruby/object:Gem::Version
|
116
|
-
version: '2.2'
|
110
|
+
version: 2.0.0
|
117
111
|
- !ruby/object:Gem::Dependency
|
118
|
-
name:
|
112
|
+
name: kitchen-localhost
|
119
113
|
requirement: !ruby/object:Gem::Requirement
|
120
114
|
requirements:
|
121
115
|
- - "~>"
|
122
116
|
- !ruby/object:Gem::Version
|
123
|
-
version: '0.
|
117
|
+
version: '0.3'
|
124
118
|
type: :development
|
125
119
|
prerelease: false
|
126
120
|
version_requirements: !ruby/object:Gem::Requirement
|
127
121
|
requirements:
|
128
122
|
- - "~>"
|
129
123
|
- !ruby/object:Gem::Version
|
130
|
-
version: '0.
|
124
|
+
version: '0.3'
|
131
125
|
- !ruby/object:Gem::Dependency
|
132
|
-
name:
|
126
|
+
name: kitchen-vagrant
|
133
127
|
requirement: !ruby/object:Gem::Requirement
|
134
128
|
requirements:
|
135
129
|
- - "~>"
|
136
130
|
- !ruby/object:Gem::Version
|
137
|
-
version: '
|
131
|
+
version: '0.19'
|
138
132
|
type: :development
|
139
133
|
prerelease: false
|
140
134
|
version_requirements: !ruby/object:Gem::Requirement
|
141
135
|
requirements:
|
142
136
|
- - "~>"
|
143
137
|
- !ruby/object:Gem::Version
|
144
|
-
version: '
|
138
|
+
version: '0.19'
|
145
139
|
- !ruby/object:Gem::Dependency
|
146
|
-
name:
|
140
|
+
name: mixlib-shellout
|
147
141
|
requirement: !ruby/object:Gem::Requirement
|
148
142
|
requirements:
|
143
|
+
- - "<"
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: 2.3.0
|
149
146
|
- - "~>"
|
150
147
|
- !ruby/object:Gem::Version
|
151
|
-
version: '
|
148
|
+
version: '2.2'
|
152
149
|
type: :development
|
153
150
|
prerelease: false
|
154
151
|
version_requirements: !ruby/object:Gem::Requirement
|
155
152
|
requirements:
|
153
|
+
- - "<"
|
154
|
+
- !ruby/object:Gem::Version
|
155
|
+
version: 2.3.0
|
156
156
|
- - "~>"
|
157
157
|
- !ruby/object:Gem::Version
|
158
|
-
version: '
|
158
|
+
version: '2.2'
|
159
159
|
- !ruby/object:Gem::Dependency
|
160
|
-
name:
|
160
|
+
name: pry
|
161
161
|
requirement: !ruby/object:Gem::Requirement
|
162
162
|
requirements:
|
163
163
|
- - "~>"
|
164
164
|
- !ruby/object:Gem::Version
|
165
|
-
version: '
|
165
|
+
version: '0.10'
|
166
166
|
type: :development
|
167
167
|
prerelease: false
|
168
168
|
version_requirements: !ruby/object:Gem::Requirement
|
169
169
|
requirements:
|
170
170
|
- - "~>"
|
171
171
|
- !ruby/object:Gem::Version
|
172
|
-
version: '
|
172
|
+
version: '0.10'
|
173
173
|
- !ruby/object:Gem::Dependency
|
174
|
-
name:
|
174
|
+
name: rake
|
175
175
|
requirement: !ruby/object:Gem::Requirement
|
176
176
|
requirements:
|
177
177
|
- - "~>"
|
178
178
|
- !ruby/object:Gem::Version
|
179
|
-
version:
|
179
|
+
version: '10.0'
|
180
180
|
type: :development
|
181
181
|
prerelease: false
|
182
182
|
version_requirements: !ruby/object:Gem::Requirement
|
183
183
|
requirements:
|
184
184
|
- - "~>"
|
185
185
|
- !ruby/object:Gem::Version
|
186
|
-
version:
|
186
|
+
version: '10.0'
|
187
187
|
- !ruby/object:Gem::Dependency
|
188
|
-
name:
|
188
|
+
name: redcarpet
|
189
189
|
requirement: !ruby/object:Gem::Requirement
|
190
190
|
requirements:
|
191
191
|
- - "~>"
|
192
192
|
- !ruby/object:Gem::Version
|
193
|
-
version: '
|
193
|
+
version: '3.2'
|
194
194
|
type: :development
|
195
195
|
prerelease: false
|
196
196
|
version_requirements: !ruby/object:Gem::Requirement
|
197
197
|
requirements:
|
198
198
|
- - "~>"
|
199
199
|
- !ruby/object:Gem::Version
|
200
|
-
version: '
|
200
|
+
version: '3.2'
|
201
201
|
- !ruby/object:Gem::Dependency
|
202
|
-
name:
|
202
|
+
name: rspec
|
203
203
|
requirement: !ruby/object:Gem::Requirement
|
204
204
|
requirements:
|
205
205
|
- - "~>"
|
206
206
|
- !ruby/object:Gem::Version
|
207
|
-
version: 1
|
207
|
+
version: '3.1'
|
208
208
|
type: :development
|
209
209
|
prerelease: false
|
210
210
|
version_requirements: !ruby/object:Gem::Requirement
|
211
211
|
requirements:
|
212
212
|
- - "~>"
|
213
213
|
- !ruby/object:Gem::Version
|
214
|
-
version: 1
|
214
|
+
version: '3.1'
|
215
215
|
- !ruby/object:Gem::Dependency
|
216
|
-
name:
|
216
|
+
name: rubocop
|
217
217
|
requirement: !ruby/object:Gem::Requirement
|
218
218
|
requirements:
|
219
219
|
- - "~>"
|
220
220
|
- !ruby/object:Gem::Version
|
221
|
-
version:
|
221
|
+
version: 0.51.0
|
222
222
|
type: :development
|
223
223
|
prerelease: false
|
224
224
|
version_requirements: !ruby/object:Gem::Requirement
|
225
225
|
requirements:
|
226
226
|
- - "~>"
|
227
227
|
- !ruby/object:Gem::Version
|
228
|
-
version:
|
228
|
+
version: 0.51.0
|
229
229
|
- !ruby/object:Gem::Dependency
|
230
|
-
name: kitchen
|
230
|
+
name: test-kitchen
|
231
231
|
requirement: !ruby/object:Gem::Requirement
|
232
232
|
requirements:
|
233
233
|
- - "~>"
|
234
234
|
- !ruby/object:Gem::Version
|
235
|
-
version:
|
235
|
+
version: 1.16.0
|
236
236
|
type: :development
|
237
237
|
prerelease: false
|
238
238
|
version_requirements: !ruby/object:Gem::Requirement
|
239
239
|
requirements:
|
240
240
|
- - "~>"
|
241
241
|
- !ruby/object:Gem::Version
|
242
|
-
version:
|
242
|
+
version: 1.16.0
|
243
243
|
- !ruby/object:Gem::Dependency
|
244
|
-
name:
|
244
|
+
name: yard
|
245
245
|
requirement: !ruby/object:Gem::Requirement
|
246
246
|
requirements:
|
247
|
-
- - "
|
247
|
+
- - "~>"
|
248
248
|
- !ruby/object:Gem::Version
|
249
|
-
version:
|
249
|
+
version: '0.8'
|
250
250
|
type: :development
|
251
251
|
prerelease: false
|
252
252
|
version_requirements: !ruby/object:Gem::Requirement
|
253
253
|
requirements:
|
254
|
-
- - "
|
254
|
+
- - "~>"
|
255
255
|
- !ruby/object:Gem::Version
|
256
|
-
version:
|
256
|
+
version: '0.8'
|
257
257
|
description: |-
|
258
258
|
This plugin provides native HTTP instrumentation
|
259
259
|
for monitoring and metrics collection, including:
|