riemann-nut 1.0.1 → 1.0.2

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: c8d999a380da9285d3c39a59292c682402d97915dbb1a306a1bc84184131356d
4
- data.tar.gz: 3d82e598d164b145d184bacd822b9a6322215d39f2cb4cd9a0e3e82d7fcf13db
3
+ metadata.gz: 38e773d99ac3d388b014f3c2bb483d4e2582f0c294b0d33e24d2a55ef20cf777
4
+ data.tar.gz: cac19ed5db214ee4f4fd999018713a6250f2dee7bdde61450590867842d817c0
5
5
  SHA512:
6
- metadata.gz: 10d8b47a8b3ee1bb77474e33002589c7e63e1b4fce440e0b4ee660f67f2b0c48a86c984d5c94473013fc16dcd3eb983cc74c9537af1e2a836fa0a135ad297d97
7
- data.tar.gz: 6a6ef233519ae9aa635094ddb17fa6dde70420eea80a5cee45b71a592908e6cba779d9caed4a8d96ef80a5697c5a28b91d695967953e4bca2a64c8965572d2b5
6
+ metadata.gz: 7d0285346f4b29052b7565e0e44cac861566ae877d958043a787b32de11f5c204deb64d542eda53728bae7be9a082908a7e6ffe7156d76e0b4d7d43320b2297c
7
+ data.tar.gz: a190a474838c2ed13e40f88944ab7762795fc9e6ee4389d92360766f783ef22fc871bca56c6e209bf60d641135f5400993a77e51ebe280c949360d05629ae2b7
@@ -10,33 +10,42 @@ on:
10
10
  - main
11
11
 
12
12
  jobs:
13
- lint:
13
+ rubocop:
14
14
  runs-on: ubuntu-latest
15
15
  steps:
16
16
  - uses: actions/checkout@v2
17
17
  - name: Setup ruby
18
18
  uses: ruby/setup-ruby@v1
19
19
  with:
20
- ruby-version: '2.7'
20
+ ruby-version: 3.0
21
21
  bundler-cache: true
22
- - name: Run rubocop
22
+ - name: Run static code analysis
23
23
  run: bundle exec rubocop
24
- test:
25
- needs: lint
24
+ unit:
26
25
  runs-on: ubuntu-latest
26
+ needs: rubocop
27
27
  strategy:
28
28
  matrix:
29
- ruby-version:
30
- - 2.6
31
- - 2.7
32
- - 3.0
33
- - 3.1
29
+ ruby:
30
+ - "2.6"
31
+ - "2.7"
32
+ - "3.0"
33
+ - "3.1"
34
+ name: Ruby ${{ matrix.ruby }}
34
35
  steps:
35
36
  - uses: actions/checkout@v2
36
- - name: Setup Ruby
37
+ - name: Setup ruby
37
38
  uses: ruby/setup-ruby@v1
38
39
  with:
39
- ruby-version: ${{ matrix.ruby-version }}
40
+ ruby-version: ${{ matrix.ruby }}
40
41
  bundler-cache: true
41
- - name: Run the test suite
42
- run: bundle exec rspec
42
+ - name: Run tests without uploading code coverage
43
+ if: ${{ matrix.ruby != '3.0' }}
44
+ run: bundle exec rake
45
+ - name: Run tests and upload coverage to Code Climate
46
+ if: ${{ matrix.ruby == '3.0' }}
47
+ uses: paambaati/codeclimate-action@v3.0.0
48
+ env:
49
+ CC_TEST_REPORTER_ID: ${{ secrets.CODECLIMATE_TOKEN }}
50
+ with:
51
+ coverageCommand: bundle exec rake
data/.rubocop.yml CHANGED
@@ -1,7 +1,13 @@
1
1
  ---
2
2
  AllCops:
3
+ TargetRubyVersion: '2.6'
4
+ AllowSymlinksInCacheRootDirectory: true
5
+ NewCops: enable
3
6
  Exclude:
4
7
  - vendor/bundle/**/*
8
+ require:
9
+ - rubocop-rake
10
+ - rubocop-rspec
5
11
  Layout/HashAlignment:
6
12
  EnforcedHashRocketStyle: table
7
13
  Layout/LineLength:
@@ -20,6 +26,12 @@ Metrics/ParameterLists:
20
26
  Enabled: false
21
27
  Metrics/PerceivedComplexity:
22
28
  Enabled: false
29
+ RSpec/ExampleLength:
30
+ Enabled: false
31
+ RSpec/NamedSubject:
32
+ Enabled: false
33
+ RSpec/SubjectStub:
34
+ Enabled: false
23
35
  Style/Documentation:
24
36
  Enabled: false
25
37
  Style/TrailingCommaInArguments:
data/.simplecov ADDED
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ # vim:set syntax=ruby:
4
+
5
+ SimpleCov.start do
6
+ add_filter '/spec/'
7
+ end
data/CHANGELOG.md CHANGED
@@ -1,8 +1,16 @@
1
1
  # Changelog
2
2
 
3
- ## [1.0.1](https://github.com/opus-codium/riemann-nut/tree/1.0.1) (2022-08-08)
3
+ ## [1.0.2](https://github.com/opus-codium/riemann-nut/tree/1.0.2) (2022-09-19)
4
4
 
5
- [Full Changelog](https://github.com/opus-codium/riemann-nut/compare/v1.0.0...1.0.1)
5
+ [Full Changelog](https://github.com/opus-codium/riemann-nut/compare/v1.0.1...1.0.2)
6
+
7
+ **Fixed bugs:**
8
+
9
+ - Do not report missing metrics as critical [\#3](https://github.com/opus-codium/riemann-nut/pull/3) ([smortex](https://github.com/smortex))
10
+
11
+ ## [v1.0.1](https://github.com/opus-codium/riemann-nut/tree/v1.0.1) (2022-08-08)
12
+
13
+ [Full Changelog](https://github.com/opus-codium/riemann-nut/compare/v1.0.0...v1.0.1)
6
14
 
7
15
  **Fixed bugs:**
8
16
 
data/Rakefile CHANGED
@@ -3,6 +3,11 @@
3
3
  require 'riemann/tools/nut/version'
4
4
 
5
5
  require 'bundler/gem_tasks'
6
+ require 'rspec/core/rake_task'
7
+
8
+ RSpec::Core::RakeTask.new(:spec)
9
+
10
+ task default: :spec
6
11
 
7
12
  require 'github_changelog_generator/task'
8
13
 
@@ -3,7 +3,7 @@
3
3
  module Riemann
4
4
  module Tools # :nodoc:
5
5
  class Nut
6
- VERSION = '1.0.1'
6
+ VERSION = '1.0.2'
7
7
  end
8
8
  end
9
9
  end
@@ -82,6 +82,8 @@ module Riemann
82
82
 
83
83
  def report_battery_voltage
84
84
  opts[:ups].each do |ups|
85
+ next unless upsc[ups]['battery.voltage']
86
+
85
87
  service = "#{ups} battery voltage"
86
88
  battery_voltage = Float(upsc[ups]['battery.voltage'])
87
89
 
@@ -91,16 +93,19 @@ module Riemann
91
93
  state: 'ok',
92
94
  description: "#{battery_voltage} V",
93
95
  )
94
- rescue TypeError
96
+ rescue TypeError => e
95
97
  report(
96
98
  service: service,
97
99
  state: 'critical',
100
+ description: e.message,
98
101
  )
99
102
  end
100
103
  end
101
104
 
102
105
  def report_input_voltage
103
106
  opts[:ups].each do |ups|
107
+ next unless upsc[ups]['input.voltage']
108
+
104
109
  service = "#{ups} input voltage"
105
110
  input_voltage = Float(upsc[ups]['input.voltage'])
106
111
 
@@ -110,10 +115,11 @@ module Riemann
110
115
  state: 'ok',
111
116
  description: "#{input_voltage} V",
112
117
  )
113
- rescue TypeError
118
+ rescue TypeError => e
114
119
  report(
115
120
  service: service,
116
121
  state: 'critical',
122
+ description: e.message,
117
123
  )
118
124
  end
119
125
  end
@@ -148,10 +154,11 @@ module Riemann
148
154
  state: ups_state,
149
155
  description: "#{ups_load} W",
150
156
  )
151
- rescue TypeError
157
+ rescue TypeError => e
152
158
  report(
153
159
  service: service,
154
160
  state: 'critical',
161
+ description: e.message,
155
162
  )
156
163
  end
157
164
  end
data/riemann-nut.gemspec CHANGED
@@ -19,6 +19,8 @@ Gem::Specification.new do |spec|
19
19
  spec.metadata['source_code_uri'] = spec.homepage
20
20
  spec.metadata['changelog_uri'] = spec.homepage
21
21
 
22
+ spec.metadata['rubygems_mfa_required'] = 'true'
23
+
22
24
  # Specify which files should be added to the gem when it is released.
23
25
  # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
24
26
  spec.files = Dir.chdir(File.expand_path(__dir__)) do
@@ -36,4 +38,5 @@ Gem::Specification.new do |spec|
36
38
  spec.add_development_dependency 'rubocop'
37
39
  spec.add_development_dependency 'rubocop-rake'
38
40
  spec.add_development_dependency 'rubocop-rspec'
41
+ spec.add_development_dependency 'simplecov'
39
42
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: riemann-nut
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Romain Tartière
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-08-08 00:00:00.000000000 Z
11
+ date: 2022-09-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: riemann-tools
@@ -108,6 +108,20 @@ dependencies:
108
108
  - - ">="
109
109
  - !ruby/object:Gem::Version
110
110
  version: '0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: simplecov
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
111
125
  description:
112
126
  email:
113
127
  - romain@blogreen.org
@@ -121,6 +135,7 @@ files:
121
135
  - ".gitignore"
122
136
  - ".rspec"
123
137
  - ".rubocop.yml"
138
+ - ".simplecov"
124
139
  - CHANGELOG.md
125
140
  - Gemfile
126
141
  - README.md
@@ -137,6 +152,7 @@ metadata:
137
152
  homepage_uri: https://github.com/opus-codium/riemann-nut
138
153
  source_code_uri: https://github.com/opus-codium/riemann-nut
139
154
  changelog_uri: https://github.com/opus-codium/riemann-nut
155
+ rubygems_mfa_required: 'true'
140
156
  post_install_message:
141
157
  rdoc_options: []
142
158
  require_paths:
@@ -152,7 +168,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
152
168
  - !ruby/object:Gem::Version
153
169
  version: '0'
154
170
  requirements: []
155
- rubygems_version: 3.3.19
171
+ rubygems_version: 3.3.22
156
172
  signing_key:
157
173
  specification_version: 4
158
174
  summary: Submits nut information to riemann