sensu-plugins-network-checks 2.1.1 → 2.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +10 -2
- data/README.md +2 -2
- data/bin/check-ports.rb +17 -12
- data/lib/sensu-plugins-network-checks/version.rb +2 -2
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e4fe3ce670028be6e730e1dc630814320751dc37f3a463afe18c6dfe44c98bfc
|
4
|
+
data.tar.gz: 71e2789dd43b014154cc55e3e39dec64e1d4b90f208823fd2607fd6af41ff35b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ccb6b577dd63fb7ed02813bf5059612ec5a7605eab3ec8a0e8a6e5fd640214e177a86a9910585d9045f7d423294f6fe4dd25e0e656192726405cc0c6d6e2e3c0
|
7
|
+
data.tar.gz: d7436091135499b7561d3f71ce03f4de8078a320ccd062d86be0f37e76368ec9ae82d64528ea5d7bf62346cf3ea877849c1deceda06edc4a9b592ed920d60dee
|
data/CHANGELOG.md
CHANGED
@@ -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
|
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.
|
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
|
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
|
```
|
data/bin/check-ports.rb
CHANGED
@@ -36,10 +36,10 @@ require 'timeout'
|
|
36
36
|
# Check Banner
|
37
37
|
#
|
38
38
|
class CheckPort < Sensu::Plugin::Check::CLI
|
39
|
-
option :
|
39
|
+
option :hosts,
|
40
40
|
short: '-H HOSTNAME',
|
41
41
|
long: '--hostname HOSTNAME',
|
42
|
-
description: '
|
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(
|
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 #{
|
69
|
+
critical "Connection refused by #{host}:#{port}"
|
70
70
|
rescue Timeout::Error
|
71
|
-
critical "Connection or read timed out (#{
|
71
|
+
critical "Connection or read timed out (#{host}:#{port})"
|
72
72
|
rescue Errno::EHOSTUNREACH
|
73
|
-
critical "Check failed to run: No route to host (#{
|
73
|
+
critical "Check failed to run: No route to host (#{host}:#{port})"
|
74
74
|
rescue EOFError
|
75
|
-
critical "Connection closed unexpectedly (#{
|
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
|
-
|
91
|
-
|
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
|
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
|
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.
|
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-
|
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.
|
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
|