sensu-checks-http-response-time 0.1.6 → 0.1.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d14fde7b3a1dd003d83b47b75f2cb2cd494ac686
4
- data.tar.gz: 57d684625342db49102de656c26967d146020266
3
+ metadata.gz: 8a1b64f03ccff1ff6c211f2836b74f30a644a3bc
4
+ data.tar.gz: 24d97ccf3ccba0252916b2d8e8613bb95d5d144c
5
5
  SHA512:
6
- metadata.gz: b3666ec52cf62872dc240cd0de797ca9345c0a7ea20c0e4e4f70e00af2a57071a37fde2b04807d6787d65c913b3677b14ea42b287aa9e6d90a1f2bdb2b1493ec
7
- data.tar.gz: 5d6f49c1b1d685c75152690f0e5f0c5a58ea3aa662c06e4498b2b121f0085d84f9a3f65bd4d05342c9030a2e9008779595fc139ea559ee21e70669154d4ffb71
6
+ metadata.gz: 1d854ec5894cfa793c8374a411b7d38eed194d4f73e4938b19b4407f0176bca6960214544a4d2c37dd1e4e0ad1dbd4fe6c45c09e945f1e09904e5a1a8c8d0bbd
7
+ data.tar.gz: 9dd0ff97a1a5285b8eed08cf53d33403210988b59b5ea912cf983b3d43038ea019df64f3bfb7f9bd3c99f5656b28cb386bce2b835ceb836711e08ee384a2bd00
@@ -26,7 +26,7 @@ class CheckHttpResponseTime < Sensu::Plugin::Check::CLI
26
26
  short: '-p PORT',
27
27
  long: '--port PORT',
28
28
  description: 'port to check on the target host, defaults to 80',
29
- default: 80
29
+ default: 443
30
30
 
31
31
  option :host,
32
32
  short: '-h HOSTNAME',
@@ -105,21 +105,14 @@ class CheckHttpResponseTime < Sensu::Plugin::Check::CLI
105
105
  # basic command
106
106
  command += "curl -sq "
107
107
 
108
- # prepare domain part
109
- domain_string = config[:address]
110
- if config[:port]
111
- config[:host] = config[:address] if !config[:host]
112
- domain_string += ":#{config[:port]}"
113
- end
114
-
115
108
  # add all headers
116
109
  config[:headers].split(',').each do |header_string|
117
110
  command += "-H \"#{header_string.gsub(/"/, '\\"')}\" "
118
111
  end
119
112
 
120
113
  # prepare optional hostname override
121
- if config[:host]
122
- command += "-H \"Host: #{config[:host]}\" "
114
+ if config[:host] && config[:address]
115
+ command += "--resolve '#{config[:host]}:#{config[:port]}:#{config[:address]}' "
123
116
  end
124
117
 
125
118
  # add body
@@ -144,6 +137,7 @@ class CheckHttpResponseTime < Sensu::Plugin::Check::CLI
144
137
  command += '-w "%{time_total}" '
145
138
 
146
139
  # add target uri
140
+ domain_string = config[:host] || config[:address]
147
141
  command += "\"#{config[:protocol]}://#{domain_string}#{config[:url]}\""
148
142
 
149
143
  # fetch stats
@@ -36,7 +36,7 @@ class MetricHttpResponseTime < Sensu::Plugin::Metric::CLI::Graphite
36
36
  short: '-p PORT',
37
37
  long: '--port PORT',
38
38
  description: 'port to check on the target host, defaults to 80',
39
- default: 80
39
+ default: 443
40
40
 
41
41
  option :host,
42
42
  short: '-h HOSTNAME',
@@ -112,21 +112,14 @@ class MetricHttpResponseTime < Sensu::Plugin::Metric::CLI::Graphite
112
112
  # basic command
113
113
  command += "curl -sq "
114
114
 
115
- # prepare domain part
116
- domain_string = config[:address]
117
- if config[:port]
118
- config[:host] = config[:address] if !config[:host]
119
- domain_string += ":#{config[:port]}"
120
- end
121
-
122
115
  # add all headers
123
116
  config[:headers].split(',').each do |header_string|
124
117
  command += "-H \"#{header_string.gsub(/"/, '\\"')}\" "
125
118
  end
126
119
 
127
120
  # prepare optional hostname override
128
- if config[:host]
129
- command += "-H \"Host: #{config[:host]}\" "
121
+ if config[:host] && config[:address]
122
+ command += "--resolve '#{config[:host]}:#{config[:port]}:#{config[:address]}' "
130
123
  end
131
124
 
132
125
  # add the selected fields
@@ -155,6 +148,7 @@ class MetricHttpResponseTime < Sensu::Plugin::Metric::CLI::Graphite
155
148
  command += '--output /dev/null '
156
149
 
157
150
  # add target uri
151
+ domain_string = config[:host] || config[:address]
158
152
  command += "\"#{config[:protocol]}://#{domain_string}#{config[:url]}\""
159
153
 
160
154
  # fetch stats
@@ -2,7 +2,7 @@ module SensuChecksHttpResponseTime
2
2
  module Version
3
3
  MAJOR = 0
4
4
  MINOR = 1
5
- PATCH = 6
5
+ PATCH = 7
6
6
 
7
7
  VER_STRING = [MAJOR, MINOR, PATCH].compact.join('.')
8
8
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sensu-checks-http-response-time
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.6
4
+ version: 0.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - vmpublishing development
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-02-23 00:00:00.000000000 Z
11
+ date: 2017-06-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sensu-plugin