sensu-plugins-network-checks 2.3.1 → 3.0.0

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
  SHA256:
3
- metadata.gz: ad2b4d51ea5ccbd0596f33bce7406bc0eb667c29ebb6a897d677806c52b8c51d
4
- data.tar.gz: 5674a9d85e5b10f7bd89257154e4df08027e41de5523ca7216c449f7b5bbf509
3
+ metadata.gz: 657f6d68bbee8aca2ec7dc4331d727a45ea9970253c4b1d3d5f31764bd97217d
4
+ data.tar.gz: c0da8c7a1d2098e9dd61f5e73426e2c68e5d22f50ffcc6083d085ba5a0646885
5
5
  SHA512:
6
- metadata.gz: 62884a63cff4cb0d44f5efd209aebc2f89eb5fc204d351c75119642ba51df301beb512ba03b3cff0451d37a6943cf9d75a87510944ca33bfe24511bc51336ec6
7
- data.tar.gz: 831ba7fe92ed1bbb040fc6b9b1e234cc75aa8e1481dcba0097f6bd9bf92529de3dd552e34dfb0adb9eb2eb06692a1fd4d4a3e2f7143f19a7c3ea45de16bc4a56
6
+ metadata.gz: 3a36487ab0ef6fee539ea55ce28d37149e58bc223c5e32f5346b5e4a6fadf6ae930eff6174b64d6de6ccdfb58ddbc4c909a4a978c736411bb504333e9a29e90f
7
+ data.tar.gz: ecd98e5e3b7773fbfc1f3a8869e8b121a71d0d8dbb018df47ce6685c0a5021848a8261cbb1cc83ab01d8d6c6c7babf6398f48152deea3ee8042fa389e3dd58f0
data/CHANGELOG.md CHANGED
@@ -5,6 +5,16 @@ This CHANGELOG follows the format listed [here](https://github.com/sensu-plugin
5
5
 
6
6
  ## [Unreleased]
7
7
 
8
+ ## [3.0.0] - 2018-03-17
9
+ ### Security
10
+ - updated rubocop dependency to `~> 0.51.0` per: https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2017-8418. (@majormoses)
11
+
12
+ ### Breaking Changes
13
+ - removed ruby `< 2.1` support (@majormoses)
14
+
15
+ ### Changed
16
+ - appeased the cops and updated cop config (@majormoses)
17
+
8
18
  ## [2.3.1] - 2018-02-28
9
19
  ### Changed
10
20
  - update whois-parser gem dependency to version 1.0.1 (@amdprophet)
@@ -203,6 +213,7 @@ This CHANGELOG follows the format listed [here](https://github.com/sensu-plugin
203
213
  * initial release, same as community repo
204
214
 
205
215
  [Unreleased]: https://github.com/sensu-plugins/sensu-plugins-network-checks/compare/2.3.0...HEAD
216
+ [3.0.0]: https://github.com/sensu-plugins/sensu-plugins-network-checks/compare/2.3.0...3.0.0
206
217
  [2.3.1]: https://github.com/sensu-plugins/sensu-plugins-network-checks/compare/2.3.0...2.3.1
207
218
  [2.3.0]: https://github.com/sensu-plugins/sensu-plugins-network-checks/compare/2.2.0...2.3.0
208
219
  [2.2.0]: https://github.com/sensu-plugins/sensu-plugins-network-checks/compare/2.1.1...2.2.0
data/bin/check-banner.rb CHANGED
@@ -1,6 +1,7 @@
1
1
  #! /usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
2
4
  #
3
- # encoding: UTF-8
4
5
  # check-banner
5
6
  #
6
7
  # DESCRIPTION:
@@ -1,5 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
- # encoding: utf-8
2
+ # frozen_string_literal: false
3
+
3
4
  #
4
5
  # check-jsonwhois-domain-expiration
5
6
  #
@@ -72,7 +73,7 @@ class JSONWhoisDomainExpirationCheck < Sensu::Plugin::Check::CLI
72
73
  short: '-r LEVEL',
73
74
  long: '--report-errors LEVEL',
74
75
  proc: proc(&:to_sym),
75
- in: %i(unknown warning critical),
76
+ in: %i[unknown warning critical],
76
77
  default: :unknown,
77
78
  description: 'Level for reporting connection or parsing errors'
78
79
 
@@ -110,7 +111,7 @@ class JSONWhoisDomainExpirationCheck < Sensu::Plugin::Check::CLI
110
111
  else
111
112
  results[:ok][domain] = domain_result
112
113
  end
113
- rescue
114
+ rescue StandardError
114
115
  results[:unknown][domain] = 'Connection or parsing error' unless config[:'ignore-errors']
115
116
  end
116
117
  end
data/bin/check-mtu.rb CHANGED
@@ -1,4 +1,6 @@
1
1
  #! /usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
2
4
  #
3
5
  # check-mtu.rb
4
6
  #
@@ -1,4 +1,6 @@
1
1
  #! /usr/bin/env ruby
2
+ # frozen_string_literal: false
3
+
2
4
  #
3
5
  # check-multicast-groups
4
6
  #
@@ -66,7 +68,7 @@ class CheckMulticastGroups < Sensu::Plugin::Check::CLI
66
68
  critical "#{diff.size} missing multicast group(s):\n#{diff_output}"
67
69
  end
68
70
  ok
69
- rescue => ex
71
+ rescue StandardError => ex
70
72
  critical "Failed to check multicast groups: #{ex}"
71
73
  end
72
74
  end
@@ -1,6 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
2
3
 
3
- bin_dir = File.expand_path(File.dirname(__FILE__))
4
+ bin_dir = File.expand_path(__dir__)
4
5
  shell_script_path = File.join(bin_dir, File.basename($PROGRAM_NAME, '.rb') + '.sh')
5
6
 
6
7
  exec shell_script_path, *ARGV
@@ -1,4 +1,6 @@
1
1
  #! /usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
2
4
  #
3
5
  # check-netstat-tcp
4
6
  #
@@ -102,7 +104,7 @@ class CheckNetstatTCP < Sensu::Plugin::Check::CLI
102
104
  end
103
105
 
104
106
  def run
105
- state_counts = netstat(%w(tcp tcp6))
107
+ state_counts = netstat(%w[tcp tcp6])
106
108
  is_critical = false
107
109
  is_warning = false
108
110
  message = ''
data/bin/check-ping.rb CHANGED
@@ -1,4 +1,6 @@
1
1
  #! /usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
2
4
  #
3
5
  # check-ping
4
6
  #
@@ -83,7 +85,7 @@ class CheckPING < Sensu::Plugin::Check::CLI
83
85
  pt = Net::Ping::External.new(config[:host], nil, config[:timeout])
84
86
 
85
87
  config[:count].times do |i|
86
- sleep(config[:interval]) unless i == 0
88
+ sleep(config[:interval]) unless i.zero?
87
89
  result[i] = config[:ipv6] ? pt.ping6 : pt.ping
88
90
  end
89
91
 
@@ -1,6 +1,7 @@
1
1
  #! /usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
2
4
  #
3
- # encoding: UTF-8
4
5
  # check-ports-bind
5
6
  #
6
7
  # DESCRIPTION:
@@ -1,4 +1,6 @@
1
1
  #! /usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
2
4
  #
3
5
  # check-ports-nmap
4
6
  #
data/bin/check-ports.rb CHANGED
@@ -1,6 +1,7 @@
1
1
  #! /usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
2
4
  #
3
- # encoding: UTF-8
4
5
  # check-ports
5
6
  #
6
7
  # DESCRIPTION:
data/bin/check-rbl.rb CHANGED
@@ -1,4 +1,6 @@
1
1
  #! /usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
2
4
  #
3
5
  # check-rbl
4
6
  #
@@ -89,7 +91,7 @@ class RblCheck < Sensu::Plugin::Check::CLI
89
91
 
90
92
  # YELLOW
91
93
  unless msg_string.empty? # rubocop:disable UnlessElse
92
- if criticality > 0
94
+ if criticality.positive?
93
95
  critical "#{ip_add} Blacklisted in#{msg_string}"
94
96
  else
95
97
  warning "#{ip_add} Blacklisted in#{msg_string}"
data/bin/check-socat.rb CHANGED
@@ -1,4 +1,6 @@
1
1
  #! /usr/bin/env ruby
2
+ # frozen_string_literal: false
3
+
2
4
  #
3
5
  # check-socat
4
6
  #
@@ -1,5 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
- # encoding: utf-8
2
+ # frozen_string_literal: false
3
+
3
4
  #
4
5
  # check-whois-domain-expiration-multi
5
6
  #
@@ -66,7 +67,7 @@ class WhoisDomainExpirationCheck < Sensu::Plugin::Check::CLI
66
67
  short: '-r LEVEL',
67
68
  long: '--report-errors LEVEL',
68
69
  proc: proc(&:to_sym),
69
- in: %i(unknown warning critical),
70
+ in: %i[unknown warning critical],
70
71
  default: :unknown,
71
72
  description: 'Level for reporting connection or parsing errors'
72
73
 
@@ -126,7 +127,7 @@ class WhoisDomainExpirationCheck < Sensu::Plugin::Check::CLI
126
127
  else
127
128
  results[:ok][domain] = domain_result
128
129
  end
129
- rescue
130
+ rescue StandardError
130
131
  results[:unknown][domain] = 'Parsing error' unless config[:'ignore-errors']
131
132
  end
132
133
  end
@@ -1,5 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
- # encoding: utf-8
2
+ # frozen_string_literal: false
3
+
3
4
  #
4
5
  # check-whois-domain-expiration
5
6
  #
@@ -63,6 +64,7 @@ class WhoisDomainExpirationCheck < Sensu::Plugin::Check::CLI
63
64
  def run
64
65
  whois = Whois.whois(config[:domain])
65
66
 
67
+ # TODO: figure out which to use `Date` or `Time`
66
68
  expires_on = DateTime.parse(whois.parser.expires_on.to_s)
67
69
  num_days = (expires_on - DateTime.now).to_i
68
70
 
@@ -75,7 +77,7 @@ class WhoisDomainExpirationCheck < Sensu::Plugin::Check::CLI
75
77
  else
76
78
  ok
77
79
  end
78
- rescue
80
+ rescue StandardError
79
81
  unknown "#{config[:domain]} can't be checked"
80
82
  end
81
83
  end
@@ -1,5 +1,6 @@
1
1
  #! /usr/bin/env ruby
2
- # encoding: UTF-8
2
+ # frozen_string_literal: true
3
+
3
4
  #
4
5
  # interface-metrics
5
6
  #
@@ -52,7 +53,7 @@ class InterfaceGraphite < Sensu::Plugin::Metric::CLI::Graphite
52
53
  def run
53
54
  # Metrics borrowed from hoardd: https://github.com/coredump/hoardd
54
55
 
55
- metrics = %w(rxBytes
56
+ metrics = %w[rxBytes
56
57
  rxPackets
57
58
  rxErrors
58
59
  rxDrops
@@ -67,7 +68,7 @@ class InterfaceGraphite < Sensu::Plugin::Metric::CLI::Graphite
67
68
  txFifo
68
69
  txColls
69
70
  txCarrier
70
- txCompressed)
71
+ txCompressed]
71
72
 
72
73
  File.open('/proc/net/dev', 'r').each_line do |line|
73
74
  interface, stats_string = line.scan(/^\s*([^:]+):\s*(.*)$/).first
data/bin/metrics-net.rb CHANGED
@@ -1,4 +1,6 @@
1
1
  #! /usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
2
4
  #
3
5
  # metrics-net
4
6
  #
@@ -91,7 +93,7 @@ class LinuxPacketMetrics < Sensu::Plugin::Metric::CLI::Graphite
91
93
 
92
94
  begin
93
95
  if_speed = File.open(iface_path + '/speed').read.strip
94
- rescue
96
+ rescue StandardError
95
97
  if_speed = 0
96
98
  end
97
99
 
data/bin/metrics-netif.rb CHANGED
@@ -1,4 +1,6 @@
1
1
  #! /usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
2
4
  #
3
5
  # netif-metrics
4
6
  #
@@ -1,4 +1,6 @@
1
1
  #! /usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
2
4
  #
3
5
  # metrics-netstat-tcp
4
6
  #
data/bin/metrics-ping.rb CHANGED
@@ -1,4 +1,6 @@
1
1
  #! /usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
2
4
  #
3
5
  # metrics-ping
4
6
  #
@@ -69,8 +71,8 @@ class PingMetrics < Sensu::Plugin::Metric::CLI::Graphite
69
71
  long: '--timeout TIMEOUT',
70
72
  default: 5
71
73
 
72
- OVERVIEW_METRICS = [:packets_transmitted, :packets_received, :packet_loss, :time].freeze
73
- STATISTIC_METRICS = [:min, :avg, :max, :mdev].freeze
74
+ OVERVIEW_METRICS = %i[packets_transmitted packets_received packet_loss time].freeze
75
+ STATISTIC_METRICS = %i[min avg max mdev].freeze
74
76
  FLOAT = '(\d+\.\d+)'.freeze
75
77
 
76
78
  def overview
@@ -1,4 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
2
4
  #
3
5
  # metrics-sockstat
4
6
  #
@@ -54,7 +56,7 @@ class MetricsSockstat < Sensu::Plugin::Metric::CLI::Graphite
54
56
 
55
57
  def read_sockstat
56
58
  return IO.read('/proc/net/sockstat')
57
- rescue => e
59
+ rescue StandardError => e
58
60
  unknown "Failed to read /proc/net/sockstat: #{e}"
59
61
  end
60
62
 
@@ -1 +1,3 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'sensu-plugins-network-checks/version'
@@ -1,8 +1,10 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module SensuPluginsNetworkChecks
2
4
  module Version
3
- MAJOR = 2
4
- MINOR = 3
5
- PATCH = 1
5
+ MAJOR = 3
6
+ MINOR = 0
7
+ PATCH = 0
6
8
 
7
9
  VER_STRING = [MAJOR, MINOR, PATCH].compact.join('.')
8
10
  end
metadata CHANGED
@@ -1,43 +1,57 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sensu-plugins-network-checks
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.3.1
4
+ version: 3.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: 2018-02-28 00:00:00.000000000 Z
11
+ date: 2018-03-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: dnsbl-client
14
+ name: sensu-plugin
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - '='
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 1.0.2
19
+ version: '1.2'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - '='
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 1.0.2
26
+ version: '1.2'
27
27
  - !ruby/object:Gem::Dependency
28
- name: sensu-plugin
28
+ name: activesupport
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '1.2'
33
+ version: '4.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
- version: '1.2'
40
+ version: '4.2'
41
+ - !ruby/object:Gem::Dependency
42
+ name: dnsbl-client
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - '='
46
+ - !ruby/object:Gem::Version
47
+ version: 1.0.2
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - '='
53
+ - !ruby/object:Gem::Version
54
+ version: 1.0.2
41
55
  - !ruby/object:Gem::Dependency
42
56
  name: net-ping
43
57
  requirement: !ruby/object:Gem::Requirement
@@ -80,20 +94,6 @@ dependencies:
80
94
  - - "~>"
81
95
  - !ruby/object:Gem::Version
82
96
  version: 1.0.0
83
- - !ruby/object:Gem::Dependency
84
- name: activesupport
85
- requirement: !ruby/object:Gem::Requirement
86
- requirements:
87
- - - "~>"
88
- - !ruby/object:Gem::Version
89
- version: '4.2'
90
- type: :runtime
91
- prerelease: false
92
- version_requirements: !ruby/object:Gem::Requirement
93
- requirements:
94
- - - "~>"
95
- - !ruby/object:Gem::Version
96
- version: '4.2'
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: bundler
99
99
  requirement: !ruby/object:Gem::Requirement
@@ -212,14 +212,14 @@ dependencies:
212
212
  requirements:
213
213
  - - "~>"
214
214
  - !ruby/object:Gem::Version
215
- version: 0.40.0
215
+ version: 0.51.0
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
- version: 0.40.0
222
+ version: 0.51.0
223
223
  - !ruby/object:Gem::Dependency
224
224
  name: yard
225
225
  requirement: !ruby/object:Gem::Requirement
@@ -307,7 +307,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
307
307
  requirements:
308
308
  - - ">="
309
309
  - !ruby/object:Gem::Version
310
- version: 2.0.0
310
+ version: 2.1.0
311
311
  required_rubygems_version: !ruby/object:Gem::Requirement
312
312
  requirements:
313
313
  - - ">="