sensu-plugins-cpu-checks 1.1.3 → 2.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: 91c34e6034d6578c6000cf4862fc5eb8f937d925b30486719cc3625d6046f674
4
- data.tar.gz: 2730c51bffb3ce8ab6ef22b6acd2a560b4cbd4672834ce3d0c706fedbb4a5748
3
+ metadata.gz: d427c76d9667d6680f91ba2ae0a6b799e9cf2d5764d51ae64d1c3da9dca3bddd
4
+ data.tar.gz: 57cb015d1d5b1b8df2eba0d645a6ddb530d5b66735ceba208bc4f961180facfd
5
5
  SHA512:
6
- metadata.gz: c4c95b2e1ae1b647197968f2f2de37951b5353006eb9403fcf60261a745881efe328592ffb00687733b7187bb07b9a93930f93e0ce51d9f86df8f9f1bf569233
7
- data.tar.gz: 7ae71a5b09f18275982f4ea91fef22af317d958a032b441f5cfbc6cf0943017422b1a985a01ae650c89224672345f4a7b54a2c72292a055ede6a595e1817809e
6
+ metadata.gz: 8e1f8766863d6a45b884e7a1d6207445ffc68f61c46d9f33311e95d4bd19b5189708c13f5c6247b841cc459a73b70843620ce36d70c1da5d16fd7afb5ba9fe78
7
+ data.tar.gz: 34e4c5ca4300e886ceffc58b9ad26c53826a138f28c5dee300965c7190530e44de34e3ae71456a5843f585d86318f6b6f561bbea6bacca3948bfec3dd02f2170
data/CHANGELOG.md CHANGED
@@ -5,6 +5,16 @@ This CHANGELOG follows the format listed [here](https://github.com/sensu-plugins
5
5
 
6
6
  ## [Unreleased]
7
7
 
8
+ ## [2.0.0] - 2018-03-07
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
+ ### Changed
13
+ - appeased the cops (@majormoses)
14
+
15
+ ### Breaking Changes
16
+ - removed ruby `< 2.1` support (@majormoses)
17
+
8
18
  ## [1.1.3] - 2018-01-25
9
19
  ### Added
10
20
  - ruby 2.4 testing (@majormoses)
@@ -69,7 +79,8 @@ This CHANGELOG follows the format listed [here](https://github.com/sensu-plugins
69
79
  - initial release
70
80
 
71
81
 
72
- [Unreleased]: https://github.com/sensu-plugins/sensu-plugins-cpu-checks/compare/1.1.3...HEAD
82
+ [Unreleased]: https://github.com/sensu-plugins/sensu-plugins-cpu-checks/compare/2.0.0...HEAD
83
+ [2.0.0]: https://github.com/sensu-plugins/sensu-plugins-cpu-checks/compare/1.1.3...2.0.0
73
84
  [1.1.3]: https://github.com/sensu-plugins/sensu-plugins-cpu-checks/compare/1.1.2...1.1.3
74
85
  [1.1.2]: https://github.com/sensu-plugins/sensu-plugins-cpu-checks/compare/1.1.1...1.1.2
75
86
  [1.1.1]: https://github.com/sensu-plugins/sensu-plugins-cpu-checks/compare/1.1.0...1.1.1
data/bin/check-cpu.rb CHANGED
@@ -32,7 +32,7 @@ require 'json'
32
32
  # Check CPU
33
33
  #
34
34
  class CheckCPU < Sensu::Plugin::Check::CLI
35
- CPU_METRICS = [:user, :nice, :system, :idle, :iowait, :irq, :softirq, :steal, :guest, :guest_nice].freeze
35
+ CPU_METRICS = %i[user nice system idle iowait irq softirq steal guest guest_nice].freeze
36
36
 
37
37
  option :less_than,
38
38
  description: 'Change whether value is less than check',
@@ -69,7 +69,7 @@ class CheckCPU < Sensu::Plugin::Check::CLI
69
69
  long: '--idle-metrics METRICS',
70
70
  description: 'Treat the specified metrics as idle. Defaults to idle,iowait,steal,guest,guest_nice',
71
71
  proc: proc { |x| x.split(/,/).map { |y| y.strip.to_sym } },
72
- default: [:idle, :iowait, :steal, :guest, :guest_nice]
72
+ default: %i[idle iowait steal guest guest_nice]
73
73
 
74
74
  CPU_METRICS.each do |metric|
75
75
  option metric,
@@ -1,5 +1,4 @@
1
1
  #! /usr/bin/env ruby
2
- # encoding: UTF-8
3
2
  #
4
3
  # cpu-mpstat-metrics
5
4
  #
@@ -1,5 +1,4 @@
1
1
  #! /usr/bin/env ruby
2
- # encoding: UTF-8
3
2
  #
4
3
  # cpu-pct-usage-metrics
5
4
  #
@@ -42,7 +41,7 @@ class CpuGraphite < Sensu::Plugin::Metric::CLI::Graphite
42
41
  default: '/proc'
43
42
 
44
43
  def acquire_proc_stats
45
- cpu_metrics = %w(user nice system idle iowait irq softirq steal guest)
44
+ cpu_metrics = %w[user nice system idle iowait irq softirq steal guest]
46
45
  File.open("#{config[:proc_path]}/stat", 'r').each_line do |line|
47
46
  info = line.split(/\s+/)
48
47
  next if info.empty?
@@ -59,7 +58,7 @@ class CpuGraphite < Sensu::Plugin::Metric::CLI::Graphite
59
58
 
60
59
  def sum_cpu_metrics(metrics)
61
60
  # #YELLOW
62
- metrics.values.reduce { |sum, metric| sum + metric } # rubocop:disable SingleLineBlockParams
61
+ metrics.values.reduce { |sum, metric| sum + metric }
63
62
  end
64
63
 
65
64
  def run
data/bin/metrics-cpu.rb CHANGED
@@ -1,5 +1,4 @@
1
1
  #! /usr/bin/env ruby
2
- # encoding: UTF-8
3
2
  #
4
3
  # cpu-metrics
5
4
  #
@@ -42,8 +41,8 @@ class CpuGraphite < Sensu::Plugin::Metric::CLI::Graphite
42
41
  default: '/proc'
43
42
 
44
43
  def run
45
- cpu_metrics = %w(user nice system idle iowait irq softirq steal guest guest_nice)
46
- other_metrics = %w(ctxt processes procs_running procs_blocked btime intr)
44
+ cpu_metrics = %w[user nice system idle iowait irq softirq steal guest guest_nice]
45
+ other_metrics = %w[ctxt processes procs_running procs_blocked btime intr]
47
46
  cpu_count = 0
48
47
 
49
48
  File.open("#{config[:proc_path]}/stat", 'r').each_line do |line|
@@ -66,7 +66,7 @@ class UserPercent < Sensu::Plugin::Metric::CLI::Graphite
66
66
  end
67
67
 
68
68
  if config[:ignore_inactive]
69
- users.delete_if { |_key, value| value['cpu'] == 0 }
69
+ users.delete_if { |_key, value| value['cpu'].zero? }
70
70
  end
71
71
 
72
72
  users.each do |user, h|
@@ -1,8 +1,8 @@
1
1
  module SensuPluginsCpuChecks
2
2
  module Version
3
- MAJOR = 1
4
- MINOR = 1
5
- PATCH = 3
3
+ MAJOR = 2
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-cpu-checks
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.3
4
+ version: 2.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-01-26 00:00:00.000000000 Z
11
+ date: 2018-03-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sensu-plugin
@@ -123,33 +123,33 @@ dependencies:
123
123
  - !ruby/object:Gem::Version
124
124
  version: '3.2'
125
125
  - !ruby/object:Gem::Dependency
126
- name: rubocop
126
+ name: rspec
127
127
  requirement: !ruby/object:Gem::Requirement
128
128
  requirements:
129
129
  - - "~>"
130
130
  - !ruby/object:Gem::Version
131
- version: 0.40.0
131
+ version: '3.4'
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
- version: 0.40.0
138
+ version: '3.4'
139
139
  - !ruby/object:Gem::Dependency
140
- name: rspec
140
+ name: rubocop
141
141
  requirement: !ruby/object:Gem::Requirement
142
142
  requirements:
143
143
  - - "~>"
144
144
  - !ruby/object:Gem::Version
145
- version: '3.4'
145
+ version: 0.51.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
- version: '3.4'
152
+ version: 0.51.0
153
153
  - !ruby/object:Gem::Dependency
154
154
  name: yard
155
155
  requirement: !ruby/object:Gem::Requirement
@@ -209,7 +209,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
209
209
  requirements:
210
210
  - - ">="
211
211
  - !ruby/object:Gem::Version
212
- version: 2.0.0
212
+ version: '2.1'
213
213
  required_rubygems_version: !ruby/object:Gem::Requirement
214
214
  requirements:
215
215
  - - ">="
@@ -217,7 +217,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
217
217
  version: '0'
218
218
  requirements: []
219
219
  rubyforge_project:
220
- rubygems_version: 2.7.4
220
+ rubygems_version: 2.7.6
221
221
  signing_key:
222
222
  specification_version: 4
223
223
  summary: Sensu plugins for cpu checks and metrics