sensu-plugins-network-checks 2.1.1 → 2.2.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,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b1752cb265f34f1f3b1d614f47c4202e4aa773788b38e93d5bcc3e417c66957f
4
- data.tar.gz: bc20403de1b70657fbe3f869e5a1e64397636c29e45348bc2bcdb6b67005d348
3
+ metadata.gz: e4fe3ce670028be6e730e1dc630814320751dc37f3a463afe18c6dfe44c98bfc
4
+ data.tar.gz: 71e2789dd43b014154cc55e3e39dec64e1d4b90f208823fd2607fd6af41ff35b
5
5
  SHA512:
6
- metadata.gz: 913a0d7962d87d752be161ab10c4eb03da999d672f5e329009a5ddee398a61e458e7e656d1ab688c8a3c2c38d80834b9fba70cbe9da3e03007e64b18dc4acf36
7
- data.tar.gz: 666c2515c48bb940233629deba677d1ff367899cc0da83fd930ece618170c81d6d91b6bae22988613be2852f1b5be9046b736f56d5999646f246f164264641ee
6
+ metadata.gz: ccb6b577dd63fb7ed02813bf5059612ec5a7605eab3ec8a0e8a6e5fd640214e177a86a9910585d9045f7d423294f6fe4dd25e0e656192726405cc0c6d6e2e3c0
7
+ data.tar.gz: d7436091135499b7561d3f71ce03f4de8078a320ccd062d86be0f37e76368ec9ae82d64528ea5d7bf62346cf3ea877849c1deceda06edc4a9b592ed920d60dee
@@ -1,10 +1,17 @@
1
1
  # Change Log
2
2
  This project adheres to [Semantic Versioning](http://semver.org/).
3
3
 
4
- This CHANGELOG follows the format listed at [Keep A Changelog](http://keepachangelog.com/)
4
+ This CHANGELOG follows the format listed [here](https://github.com/sensu-plugins/community/blob/master/HOW_WE_CHANGELOG.md)
5
5
 
6
6
  ## [Unreleased]
7
7
 
8
+ ## [2.2.0] - 2018-02-02
9
+ ### Added
10
+ - check-ports.rb: support for multiple hosts (@DDSloan96)
11
+
12
+ ### Changed
13
+ - updated changelog guidelines location (@majormoses)
14
+
8
15
  ## [2.1.1] - 2018-01-06
9
16
  ### Fixed
10
17
  - check-whois-domain-expiration-multi.rb: report a `critical` error on a domain that it gets back an empty expires_on. (@edgan)
@@ -187,7 +194,8 @@ This CHANGELOG follows the format listed at [Keep A Changelog](http://keepachang
187
194
 
188
195
  * initial release, same as community repo
189
196
 
190
- [Unreleased]: https://github.com/sensu-plugins/sensu-plugins-network-checks/compare/2.1.1...HEAD
197
+ [Unreleased]: https://github.com/sensu-plugins/sensu-plugins-network-checks/compare/2.2.0...HEAD
198
+ [2.2.0]: https://github.com/sensu-plugins/sensu-plugins-network-checks/compare/2.1.1...2.2.0
191
199
  [2.1.1]: https://github.com/sensu-plugins/sensu-plugins-network-checks/compare/2.1.0...2.1.1
192
200
  [2.1.0]: https://github.com/sensu-plugins/sensu-plugins-network-checks/compare/2.0.1...2.1.0
193
201
  [2.0.1]: https://github.com/sensu-plugins/sensu-plugins-network-checks/compare/2.0.0...2.0.1
data/README.md CHANGED
@@ -33,10 +33,10 @@
33
33
  **check-ports**
34
34
  This check now uses a TCPSocket, not nmap (see next below)
35
35
  ```
36
- check-ports.rb -h 0.0.0.0 -p 22,25,3030 -t 30
36
+ check-ports.rb -h 0.0.0.0,1.2.3.4 -p 22,25,3030 -t 30
37
37
 
38
38
  Usage: bin/check-ports.rb (options)
39
- -H, --hostnames HOSTNAME Host to connect to
39
+ -H, --hostnames HOSTNAME Hosts to connect to
40
40
  -p, --ports PORTS Ports to check, comma separated
41
41
  -t, --timeout SECS Connection timeout
42
42
  ```
@@ -36,10 +36,10 @@ require 'timeout'
36
36
  # Check Banner
37
37
  #
38
38
  class CheckPort < Sensu::Plugin::Check::CLI
39
- option :host,
39
+ option :hosts,
40
40
  short: '-H HOSTNAME',
41
41
  long: '--hostname HOSTNAME',
42
- description: 'Host to connect to',
42
+ description: 'Hosts to connect to, comma separated',
43
43
  default: '0.0.0.0'
44
44
 
45
45
  option :ports,
@@ -61,18 +61,18 @@ class CheckPort < Sensu::Plugin::Check::CLI
61
61
  proc: proc(&:to_i),
62
62
  default: 30
63
63
 
64
- def check_port(port)
64
+ def check_port(port, host)
65
65
  Timeout.timeout(config[:timeout]) do
66
- config[:proto].casecmp('tcp').zero? ? TCPSocket.new(config[:host], port.to_i) : UDPSocket.open.connect(config[:host], port.to_i)
66
+ config[:proto].casecmp('tcp').zero? ? TCPSocket.new(host, port.to_i) : UDPSocket.open.connect(host, port.to_i)
67
67
  end
68
68
  rescue Errno::ECONNREFUSED
69
- critical "Connection refused by #{config[:host]}:#{port}"
69
+ critical "Connection refused by #{host}:#{port}"
70
70
  rescue Timeout::Error
71
- critical "Connection or read timed out (#{config[:host]}:#{port})"
71
+ critical "Connection or read timed out (#{host}:#{port})"
72
72
  rescue Errno::EHOSTUNREACH
73
- critical "Check failed to run: No route to host (#{config[:host]}:#{port})"
73
+ critical "Check failed to run: No route to host (#{host}:#{port})"
74
74
  rescue EOFError
75
- critical "Connection closed unexpectedly (#{config[:host]}:#{port})"
75
+ critical "Connection closed unexpectedly (#{host}:#{port})"
76
76
  end
77
77
 
78
78
  def run
@@ -86,12 +86,17 @@ class CheckPort < Sensu::Plugin::Check::CLI
86
86
  port
87
87
  end
88
88
  end
89
+
90
+ hosts = config[:hosts].split(',')
91
+
89
92
  okarray = []
90
- ports.each do |port|
91
- okarray << 'ok' if check_port port
93
+ hosts.each do |host|
94
+ ports.each do |port|
95
+ okarray << 'ok' if check_port(port, host)
96
+ end
92
97
  end
93
- if okarray.size == ports.size
94
- ok "All ports (#{config[:ports]}) are accessible for host #{config[:host]}"
98
+ if okarray.size == ports.size * hosts.size
99
+ ok "All ports (#{config[:ports]}) are accessible for hosts #{config[:hosts]}"
95
100
  else
96
101
  warning "port count or pattern #{config[:pattern]} does not match" unless config[:crit_message]
97
102
  end
@@ -1,8 +1,8 @@
1
1
  module SensuPluginsNetworkChecks
2
2
  module Version
3
3
  MAJOR = 2
4
- MINOR = 1
5
- PATCH = 1
4
+ MINOR = 2
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: 2.1.1
4
+ version: 2.2.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: 2018-01-07 00:00:00.000000000 Z
11
+ date: 2018-02-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dnsbl-client
@@ -315,7 +315,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
315
315
  version: '0'
316
316
  requirements: []
317
317
  rubyforge_project:
318
- rubygems_version: 2.7.4
318
+ rubygems_version: 2.7.5
319
319
  signing_key:
320
320
  specification_version: 4
321
321
  summary: Sensu plugins for checking network hardware, connections, and data