sensu-plugins-network-checks 0.2.4 → 1.0.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 CHANGED
@@ -1,15 +1,7 @@
1
1
  ---
2
- !binary "U0hBMQ==":
3
- metadata.gz: !binary |-
4
- MWVlMjgyYjZhNjBhZWU5Njc4YjFlYWNiNTk1Yjg5NGNiYjRlOWE4Mw==
5
- data.tar.gz: !binary |-
6
- NzA1MDA2ZWM2NDg3NzRlNjVjMDJmM2FhNzEzN2M3NDM2ZjYxMjVkMQ==
2
+ SHA1:
3
+ metadata.gz: edab660709634d98ae04bed1fb56a3cd591a9411
4
+ data.tar.gz: f2a95aae97c17f26bf0011227643cf5f42c51cef
7
5
  SHA512:
8
- metadata.gz: !binary |-
9
- NmE4ZDdjYTBlODZkMmI5ZmE5MGJmMmIyMDE2ZjgxOTNmZmRlODI2YWJmNjE2
10
- NzdmOTcxMGFiNTYzMjY4M2NlZWEyYzcyYzdlNTQ3NjRkYTk0NmViYmExMTc5
11
- MzgxMmVjMzQ2NmVkZmJjMDIxYzE3NDlhNGNiYWQ0MmU2ZDU5ZWQ=
12
- data.tar.gz: !binary |-
13
- ZTQ3MzIxNTM2ODM2NTg3OTRhM2Q0YWUxODhlZjI0YzEyOTIyNTYzOTE1Mjdm
14
- M2RkMTJjODExYWE5MjBkZjhkZDVjMTM2MjZmMGQzNTk1YjY5NmQ1ZjIwZDg4
15
- OWJjOTI3ZDE4YmQ0MWY4MjVkMTM1Zjk1NjVkYzlhZjBlYWEzNGU=
6
+ metadata.gz: f3e9d9e983c27373ae5962282a0a58d728edbd552cd697bcfadc279dd4e34ec5cedb9a2ad6e5f307416e60341000c3c031ca8bbb7ede720a06bb3be8f48c0736
7
+ data.tar.gz: b9346418cd3eaa831990bbedcb5d6fbccf6e9c8d51226c8a5f54433cc7c7cfe4110a7cda0d8b51d3f268f543f85444ddaba58a29b06ce32053dce12a16dda20f
data/CHANGELOG.md CHANGED
@@ -5,6 +5,21 @@ This CHANGELOG follows the format listed at [Keep A Changelog](http://keepachang
5
5
 
6
6
  ## [Unreleased]
7
7
 
8
+ ## [1.0.0] - 2016-06-14
9
+ ### Fixed
10
+ - check-whois-domain-expiration-multi.rb: Handle whois errors better by retrying failed lookups
11
+ - Use Timeout.timeout not deprecated Object#timeout
12
+
13
+ ### Added
14
+ - check-whois-domain-expiration-multi.rb: Add timeout option
15
+ - Support for Ruby 2.3.0
16
+
17
+ ### Removed
18
+ - Support for Ruby 1.9.3
19
+
20
+ ### Changed
21
+ - Update to Rubocop 0.40 and cleanup
22
+
8
23
  ## [0.2.4] - 2016-04-02
9
24
  ### Fixed
10
25
  - metrics-ping.rb: Fix error when a host can't be pinged. Convert to a proper metrics check.
@@ -129,7 +144,8 @@ This CHANGELOG follows the format listed at [Keep A Changelog](http://keepachang
129
144
 
130
145
  * initial release, same as community repo
131
146
 
132
- [Unreleased]: https://github.com/sensu-plugins/sensu-plugins-network-checks/compare/0.2.4...HEAD
147
+ [Unreleased]: https://github.com/sensu-plugins/sensu-plugins-network-checks/compare/1.0.0...HEAD
148
+ [1.0.0]: https://github.com/sensu-plugins/sensu-plugins-network-checks/compare/0.2.4...1.0.0
133
149
  [0.2.4]: https://github.com/sensu-plugins/sensu-plugins-network-checks/compare/0.1.4...0.2.4
134
150
  [0.1.4]: https://github.com/sensu-plugins/sensu-plugins-network-checks/compare/0.1.3...0.1.4
135
151
  [0.1.3]: https://github.com/sensu-plugins/sensu-plugins-network-checks/compare/0.1.2...0.1.3
data/bin/check-banner.rb CHANGED
@@ -102,7 +102,7 @@ class CheckBanner < Sensu::Plugin::Check::CLI
102
102
  description: 'Custom critical message to send'
103
103
 
104
104
  def acquire_banner(host)
105
- timeout(config[:timeout]) do
105
+ Timeout.timeout(config[:timeout]) do
106
106
  sock = TCPSocket.new(host, config[:port])
107
107
  if config[:write]
108
108
  sock.write config[:write]
@@ -125,7 +125,7 @@ class CheckBanner < Sensu::Plugin::Check::CLI
125
125
  end
126
126
 
127
127
  def acquire_no_banner(host)
128
- timeout(config[:timeout]) do
128
+ Timeout.timeout(config[:timeout]) do
129
129
  TCPSocket.new(host, config[:port])
130
130
  end
131
131
  rescue Errno::ECONNREFUSED
data/bin/check-ports.rb CHANGED
@@ -62,7 +62,7 @@ class CheckPort < Sensu::Plugin::Check::CLI
62
62
  default: 30
63
63
 
64
64
  def check_port(port)
65
- timeout(config[:timeout]) do
65
+ Timeout.timeout(config[:timeout]) do
66
66
  config[:proto].casecmp('tcp').zero? ? TCPSocket.new(config[:host], port.to_i) : UDPSocket.open.connect(config[:host], port.to_i)
67
67
  end
68
68
  rescue Errno::ECONNREFUSED
@@ -52,6 +52,12 @@ class WhoisDomainExpirationCheck < Sensu::Plugin::Check::CLI
52
52
  default: 7,
53
53
  description: 'Critical if fewer than DAYS away'
54
54
 
55
+ option :timeout,
56
+ short: '-t SECONDS',
57
+ long: '--timeout SECONDS',
58
+ default: 10,
59
+ description: 'Timeout for whois lookup'
60
+
55
61
  option :help,
56
62
  short: '-h',
57
63
  long: '--help',
@@ -71,16 +77,27 @@ class WhoisDomainExpirationCheck < Sensu::Plugin::Check::CLI
71
77
  results['critical'] = {}
72
78
  results['warning'] = {}
73
79
  results['ok'] = {}
80
+ max_retries = 4
74
81
 
75
82
  domains.each do |domain|
76
- whois = Whois.whois(domain)
77
- domain_result = (DateTime.parse(whois.expires_on.to_s) - DateTime.now).to_i
78
- if domain_result <= critical_days
79
- results['critical'][domain] = domain_result
80
- elsif domain_result <= warning_days
81
- results['warning'][domain] = domain_result
82
- else
83
- results['ok'] = domain_result
83
+ whois = Whois::Client.new(timeout: config[:timeout])
84
+ begin
85
+ tries ||= 0
86
+ whois_result = whois.lookup(domain)
87
+ rescue Timeout::Error, Errno::ECONNRESET, Whois::ConnectionError
88
+ tries += 1
89
+ tries < max_retries ? retry : next
90
+ end
91
+
92
+ unless whois_result.expires_on.nil?
93
+ domain_result = (DateTime.parse(whois_result.expires_on.to_s) - DateTime.now).to_i
94
+ if domain_result <= critical_days
95
+ results['critical'][domain] = domain_result
96
+ elsif domain_result <= warning_days
97
+ results['warning'][domain] = domain_result
98
+ else
99
+ results['ok'] = domain_result
100
+ end
84
101
  end
85
102
  end
86
103
  results
@@ -62,10 +62,9 @@ class WhoisDomainExpirationCheck < Sensu::Plugin::Check::CLI
62
62
  def check_days(num_days,
63
63
  warning_days = config[:warning].to_i,
64
64
  critical_days = config[:critical].to_i)
65
- case
66
- when num_days <= critical_days
65
+ if num_days <= critical_days
67
66
  critical
68
- when num_days <= warning_days
67
+ elsif num_days <= warning_days
69
68
  warning
70
69
  else
71
70
  ok
@@ -1,8 +1,8 @@
1
1
  module SensuPluginsNetworkChecks
2
2
  module Version
3
- MAJOR = 0
4
- MINOR = 2
5
- PATCH = 4
3
+ MAJOR = 1
4
+ MINOR = 0
5
+ PATCH = 0
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-plugins-network-checks
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.4
4
+ version: 1.0.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: 2016-04-03 00:00:00.000000000 Z
11
+ date: 2016-06-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dnsbl-client
@@ -28,14 +28,14 @@ dependencies:
28
28
  name: sensu-plugin
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ~>
31
+ - - "~>"
32
32
  - !ruby/object:Gem::Version
33
33
  version: '1.2'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ~>
38
+ - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: '1.2'
41
41
  - !ruby/object:Gem::Dependency
@@ -84,146 +84,147 @@ dependencies:
84
84
  name: bundler
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - ~>
87
+ - - "~>"
88
88
  - !ruby/object:Gem::Version
89
89
  version: '1.7'
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - ~>
94
+ - - "~>"
95
95
  - !ruby/object:Gem::Version
96
96
  version: '1.7'
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: codeclimate-test-reporter
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
- - - ~>
101
+ - - "~>"
102
102
  - !ruby/object:Gem::Version
103
103
  version: '0.4'
104
104
  type: :development
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
- - - ~>
108
+ - - "~>"
109
109
  - !ruby/object:Gem::Version
110
110
  version: '0.4'
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: github-markup
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
- - - ~>
115
+ - - "~>"
116
116
  - !ruby/object:Gem::Version
117
117
  version: '1.3'
118
118
  type: :development
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
- - - ~>
122
+ - - "~>"
123
123
  - !ruby/object:Gem::Version
124
124
  version: '1.3'
125
125
  - !ruby/object:Gem::Dependency
126
126
  name: pry
127
127
  requirement: !ruby/object:Gem::Requirement
128
128
  requirements:
129
- - - ~>
129
+ - - "~>"
130
130
  - !ruby/object:Gem::Version
131
131
  version: '0.10'
132
132
  type: :development
133
133
  prerelease: false
134
134
  version_requirements: !ruby/object:Gem::Requirement
135
135
  requirements:
136
- - - ~>
136
+ - - "~>"
137
137
  - !ruby/object:Gem::Version
138
138
  version: '0.10'
139
139
  - !ruby/object:Gem::Dependency
140
140
  name: rake
141
141
  requirement: !ruby/object:Gem::Requirement
142
142
  requirements:
143
- - - ~>
143
+ - - "~>"
144
144
  - !ruby/object:Gem::Version
145
145
  version: '10.0'
146
146
  type: :development
147
147
  prerelease: false
148
148
  version_requirements: !ruby/object:Gem::Requirement
149
149
  requirements:
150
- - - ~>
150
+ - - "~>"
151
151
  - !ruby/object:Gem::Version
152
152
  version: '10.0'
153
153
  - !ruby/object:Gem::Dependency
154
154
  name: rdoc
155
155
  requirement: !ruby/object:Gem::Requirement
156
156
  requirements:
157
- - - ~>
157
+ - - "~>"
158
158
  - !ruby/object:Gem::Version
159
159
  version: 4.2.1
160
160
  type: :development
161
161
  prerelease: false
162
162
  version_requirements: !ruby/object:Gem::Requirement
163
163
  requirements:
164
- - - ~>
164
+ - - "~>"
165
165
  - !ruby/object:Gem::Version
166
166
  version: 4.2.1
167
167
  - !ruby/object:Gem::Dependency
168
168
  name: redcarpet
169
169
  requirement: !ruby/object:Gem::Requirement
170
170
  requirements:
171
- - - ~>
171
+ - - "~>"
172
172
  - !ruby/object:Gem::Version
173
173
  version: '3.2'
174
174
  type: :development
175
175
  prerelease: false
176
176
  version_requirements: !ruby/object:Gem::Requirement
177
177
  requirements:
178
- - - ~>
178
+ - - "~>"
179
179
  - !ruby/object:Gem::Version
180
180
  version: '3.2'
181
181
  - !ruby/object:Gem::Dependency
182
182
  name: rspec
183
183
  requirement: !ruby/object:Gem::Requirement
184
184
  requirements:
185
- - - ~>
185
+ - - "~>"
186
186
  - !ruby/object:Gem::Version
187
187
  version: '3.1'
188
188
  type: :development
189
189
  prerelease: false
190
190
  version_requirements: !ruby/object:Gem::Requirement
191
191
  requirements:
192
- - - ~>
192
+ - - "~>"
193
193
  - !ruby/object:Gem::Version
194
194
  version: '3.1'
195
195
  - !ruby/object:Gem::Dependency
196
196
  name: rubocop
197
197
  requirement: !ruby/object:Gem::Requirement
198
198
  requirements:
199
- - - ~>
199
+ - - "~>"
200
200
  - !ruby/object:Gem::Version
201
- version: '0.37'
201
+ version: 0.40.0
202
202
  type: :development
203
203
  prerelease: false
204
204
  version_requirements: !ruby/object:Gem::Requirement
205
205
  requirements:
206
- - - ~>
206
+ - - "~>"
207
207
  - !ruby/object:Gem::Version
208
- version: '0.37'
208
+ version: 0.40.0
209
209
  - !ruby/object:Gem::Dependency
210
210
  name: yard
211
211
  requirement: !ruby/object:Gem::Requirement
212
212
  requirements:
213
- - - ~>
213
+ - - "~>"
214
214
  - !ruby/object:Gem::Version
215
215
  version: '0.8'
216
216
  type: :development
217
217
  prerelease: false
218
218
  version_requirements: !ruby/object:Gem::Requirement
219
219
  requirements:
220
- - - ~>
220
+ - - "~>"
221
221
  - !ruby/object:Gem::Version
222
222
  version: '0.8'
223
- description: ! "This plugin provides native network instrumentation\n for
224
- monitoring and metrics collection, including:\n hardware,
225
- TCP response, RBLs, whois, port status, and more"
226
- email: <sensu-users@googlegroups.com>
223
+ description: |-
224
+ This plugin provides native network instrumentation
225
+ for monitoring and metrics collection, including:
226
+ hardware, TCP response, RBLs, whois, port status, and more
227
+ email: "<sensu-users@googlegroups.com>"
227
228
  executables:
228
229
  - check-banner.rb
229
230
  - check-jsonwhois-domain-expiration.rb
@@ -276,7 +277,7 @@ homepage: https://github.com/sensu-plugins/sensu-plugins-network-checks
276
277
  licenses:
277
278
  - MIT
278
279
  metadata:
279
- maintainer: ! '@rmc3'
280
+ maintainer: sensu-plugin
280
281
  development_status: active
281
282
  production_status: unstable - testing recommended
282
283
  release_draft: 'false'
@@ -288,18 +289,19 @@ require_paths:
288
289
  - lib
289
290
  required_ruby_version: !ruby/object:Gem::Requirement
290
291
  requirements:
291
- - - ! '>='
292
+ - - ">="
292
293
  - !ruby/object:Gem::Version
293
- version: 1.9.3
294
+ version: 2.0.0
294
295
  required_rubygems_version: !ruby/object:Gem::Requirement
295
296
  requirements:
296
- - - ! '>='
297
+ - - ">="
297
298
  - !ruby/object:Gem::Version
298
299
  version: '0'
299
300
  requirements: []
300
301
  rubyforge_project:
301
- rubygems_version: 2.4.5
302
+ rubygems_version: 2.5.1
302
303
  signing_key:
303
304
  specification_version: 4
304
305
  summary: Sensu plugins for checking network hardware, connections, and data
305
306
  test_files: []
307
+ has_rdoc: