sensu-plugins-network-checks 1.0.0 → 1.1.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 +9 -1
- data/bin/check-ping.rb +2 -2
- data/bin/metrics-netstat-tcp.rb +12 -6
- data/lib/sensu-plugins-network-checks/version.rb +1 -1
- metadata +2 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 46421c6d0dc7862d251f2700a9a4487b9f144f7a
|
4
|
+
data.tar.gz: 7131967b4d010104830c77fb483b3cbfa295ac4a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f84d7725673e378612e026fac3a2f027a2d73d2b04457947be44170fd632035b1535f08e29dc1daf9f858e9d81bb5e4b54f32ebb34b8b5a2ed54e8f7edd15a77
|
7
|
+
data.tar.gz: 92b82831b5022e73ff521be0fdb22048822ed13d643f6b80c3759994909626aed8d65b266db5d815e2859c1202c2d16b1d731f15d0cfe7a094bdbb68fddbd5be
|
data/CHANGELOG.md
CHANGED
@@ -5,6 +5,13 @@ This CHANGELOG follows the format listed at [Keep A Changelog](http://keepachang
|
|
5
5
|
|
6
6
|
## [Unreleased]
|
7
7
|
|
8
|
+
## [1.1.0] - 2016-08-07
|
9
|
+
### Added
|
10
|
+
- metrics-netstat-tcp.rb: Add IPv6 state counts (@mlf4aiur)
|
11
|
+
|
12
|
+
### Fixed
|
13
|
+
- check-ping.rb: Fix false positives (#34 via @kai101)
|
14
|
+
|
8
15
|
## [1.0.0] - 2016-06-14
|
9
16
|
### Fixed
|
10
17
|
- check-whois-domain-expiration-multi.rb: Handle whois errors better by retrying failed lookups
|
@@ -144,7 +151,8 @@ This CHANGELOG follows the format listed at [Keep A Changelog](http://keepachang
|
|
144
151
|
|
145
152
|
* initial release, same as community repo
|
146
153
|
|
147
|
-
[Unreleased]: https://github.com/sensu-plugins/sensu-plugins-network-checks/compare/1.
|
154
|
+
[Unreleased]: https://github.com/sensu-plugins/sensu-plugins-network-checks/compare/1.1.0...HEAD
|
155
|
+
[1.1.0]: https://github.com/sensu-plugins/sensu-plugins-network-checks/compare/1.0.0...1.1.0
|
148
156
|
[1.0.0]: https://github.com/sensu-plugins/sensu-plugins-network-checks/compare/0.2.4...1.0.0
|
149
157
|
[0.2.4]: https://github.com/sensu-plugins/sensu-plugins-network-checks/compare/0.1.4...0.2.4
|
150
158
|
[0.1.4]: https://github.com/sensu-plugins/sensu-plugins-network-checks/compare/0.1.3...0.1.4
|
data/bin/check-ping.rb
CHANGED
@@ -81,10 +81,10 @@ class CheckPING < Sensu::Plugin::Check::CLI
|
|
81
81
|
def run
|
82
82
|
result = []
|
83
83
|
pt = Net::Ping::External.new(config[:host], nil, config[:timeout])
|
84
|
-
|
84
|
+
|
85
85
|
config[:count].times do |i|
|
86
86
|
sleep(config[:interval]) unless i == 0
|
87
|
-
result[i] = ping
|
87
|
+
result[i] = config[:ipv6] ? pt.ping6 : pt.ping
|
88
88
|
end
|
89
89
|
|
90
90
|
successful_count = result.count(true)
|
data/bin/metrics-netstat-tcp.rb
CHANGED
@@ -76,13 +76,10 @@ class NetstatTCPMetrics < Sensu::Plugin::Metric::CLI::Graphite
|
|
76
76
|
long: '--port PORT',
|
77
77
|
proc: proc(&:to_i)
|
78
78
|
|
79
|
-
def netstat(protocol
|
80
|
-
state_counts = Hash.new(0)
|
81
|
-
TCP_STATES.each_pair { |_hex, name| state_counts[name] = 0 }
|
82
|
-
|
79
|
+
def netstat(protocol, pattern, state_counts)
|
83
80
|
File.open('/proc/net/' + protocol).each do |line|
|
84
81
|
line.strip!
|
85
|
-
if m = line.match(
|
82
|
+
if m = line.match(pattern) # rubocop:disable AssignmentInCondition
|
86
83
|
connection_state = m[5]
|
87
84
|
connection_port = m[2].to_i(16)
|
88
85
|
connection_state = TCP_STATES[connection_state]
|
@@ -98,7 +95,16 @@ class NetstatTCPMetrics < Sensu::Plugin::Metric::CLI::Graphite
|
|
98
95
|
|
99
96
|
def run
|
100
97
|
timestamp = Time.now.to_i
|
101
|
-
|
98
|
+
state_counts = Hash.new(0)
|
99
|
+
TCP_STATES.each_pair { |_hex, name| state_counts[name] = 0 }
|
100
|
+
|
101
|
+
tcp4_pattern = /^\s*\d+:\s+(.{8}):(.{4})\s+(.{8}):(.{4})\s+(.{2})/
|
102
|
+
state_counts = netstat('tcp', tcp4_pattern, state_counts)
|
103
|
+
|
104
|
+
tcp6_pattern = /^\s*\d+:\s+(.{32}):(.{4})\s+(.{32}):(.{4})\s+(.{2})/
|
105
|
+
state_counts = netstat('tcp6', tcp6_pattern, state_counts)
|
106
|
+
|
107
|
+
state_counts.each do |state, count|
|
102
108
|
graphite_name = config[:port] ? "#{config[:scheme]}.#{config[:port]}.#{state}" :
|
103
109
|
"#{config[:scheme]}.#{state}"
|
104
110
|
output graphite_name.to_s, count, timestamp
|
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: 1.
|
4
|
+
version: 1.1.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-
|
11
|
+
date: 2016-08-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: dnsbl-client
|
@@ -304,4 +304,3 @@ signing_key:
|
|
304
304
|
specification_version: 4
|
305
305
|
summary: Sensu plugins for checking network hardware, connections, and data
|
306
306
|
test_files: []
|
307
|
-
has_rdoc:
|