riemann-tools 1.11.0 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ci.yml +3 -3
  3. data/.github/workflows/codeql-analysis.yml +4 -4
  4. data/.rubocop.yml +1 -1
  5. data/CHANGELOG.md +65 -10
  6. data/Gemfile +1 -11
  7. data/README.markdown +4 -3
  8. data/lib/riemann/tools/apache_status.rb +1 -0
  9. data/lib/riemann/tools/bench.rb +6 -5
  10. data/lib/riemann/tools/cloudant.rb +1 -0
  11. data/lib/riemann/tools/haproxy.rb +1 -0
  12. data/lib/riemann/tools/health.rb +7 -5
  13. data/lib/riemann/tools/hwmon.rb +24 -7
  14. data/lib/riemann/tools/mdstat_parser.tab.rb +137 -127
  15. data/lib/riemann/tools/memcached.rb +1 -0
  16. data/lib/riemann/tools/nginx_status.rb +1 -0
  17. data/lib/riemann/tools/portcheck.rb +1 -0
  18. data/lib/riemann/tools/riemann_client_wrapper.rb +49 -6
  19. data/lib/riemann/tools/tls_check.rb +4 -2
  20. data/lib/riemann/tools/uptime_parser.tab.rb +1 -1
  21. data/lib/riemann/tools/version.rb +1 -1
  22. data/lib/riemann/tools/zookeeper.rb +1 -0
  23. data/lib/riemann/tools.rb +4 -1
  24. data/riemann-tools.gemspec +5 -4
  25. data/tools/riemann-aws/lib/riemann/tools/aws/billing.rb +1 -0
  26. data/tools/riemann-aws/lib/riemann/tools/aws/elb_metrics.rb +1 -0
  27. data/tools/riemann-aws/lib/riemann/tools/aws/rds_status.rb +1 -0
  28. data/tools/riemann-aws/lib/riemann/tools/aws/s3_list.rb +1 -0
  29. data/tools/riemann-aws/lib/riemann/tools/aws/s3_status.rb +1 -0
  30. data/tools/riemann-aws/lib/riemann/tools/aws/sqs_status.rb +1 -0
  31. data/tools/riemann-aws/lib/riemann/tools/aws/status.rb +1 -0
  32. data/tools/riemann-chronos/lib/riemann/tools/chronos.rb +4 -4
  33. data/tools/riemann-elasticsearch/lib/riemann/tools/elasticsearch.rb +3 -2
  34. data/tools/riemann-marathon/lib/riemann/tools/marathon.rb +4 -4
  35. data/tools/riemann-mesos/lib/riemann/tools/mesos.rb +4 -4
  36. data/tools/riemann-munin/lib/riemann/tools/munin.rb +1 -0
  37. data/tools/riemann-rabbitmq/lib/riemann/tools/rabbitmq.rb +3 -3
  38. data/tools/riemann-riak/lib/riemann/tools/riak.rb +3 -2
  39. metadata +18 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: aa81e2c6ea617e2450bdc8456f8665493241b19256be9a5443b6351e5d417ace
4
- data.tar.gz: 0eb2bb5e1f6caea452a2babe933acd270840a78fe15520d637b7b3eb1deeb93e
3
+ metadata.gz: c688bb624c4171f8baab09545f0be418766c717493f31ff1a13e3e9c20039786
4
+ data.tar.gz: 90d7c75b516dffb0c91201218349914cc6eb48718f99cbdc090f888a4a068d5c
5
5
  SHA512:
6
- metadata.gz: eccb9331a24c1db7812365ee6c52d811a962b681563237f1e4f196aad7ae59171daaf9548db8792ff8ab548b393a04c00078c8ba59701373f8c452077960cae6
7
- data.tar.gz: 75508745d0f31fd2b5457531ae68158f514ca5ac9fa65c64c00c9ceedf67df8644b87bd324ef0aca94527e862c51ad063702ab8be95181723b6c73fefd2c9fb9
6
+ metadata.gz: f5a1698690f11146fc1ebab73f6b5e7a6f0afcaef291eb8270032e8be142639f23a2ce34ceeb621d98a4294c083840137b2882d13cd1fc2615cd58faf2173638
7
+ data.tar.gz: 84eef56087c0d462d4f7f97f977cccb312cfcfa6431f071d2957ff0b99a471e71a208a85ee81f6ef3f4edb83eec03417eae5e20d50fbd6494cee4685dec6ed24
@@ -13,7 +13,7 @@ jobs:
13
13
  lint:
14
14
  runs-on: ubuntu-latest
15
15
  steps:
16
- - uses: actions/checkout@v4
16
+ - uses: actions/checkout@v6
17
17
  - name: Setup ruby
18
18
  uses: ruby/setup-ruby@v1
19
19
  with:
@@ -27,14 +27,14 @@ jobs:
27
27
  strategy:
28
28
  matrix:
29
29
  ruby-version:
30
- - '2.6'
31
30
  - '2.7'
32
31
  - '3.0'
33
32
  - '3.1'
34
33
  - '3.2'
35
34
  - '3.3'
35
+ - '3.4'
36
36
  steps:
37
- - uses: actions/checkout@v4
37
+ - uses: actions/checkout@v6
38
38
  - name: Setup Ruby
39
39
  uses: ruby/setup-ruby@v1
40
40
  with:
@@ -38,11 +38,11 @@ jobs:
38
38
 
39
39
  steps:
40
40
  - name: Checkout repository
41
- uses: actions/checkout@v4
41
+ uses: actions/checkout@v6
42
42
 
43
43
  # Initializes the CodeQL tools for scanning.
44
44
  - name: Initialize CodeQL
45
- uses: github/codeql-action/init@v3
45
+ uses: github/codeql-action/init@v4
46
46
  with:
47
47
  languages: ${{ matrix.language }}
48
48
  # If you wish to specify custom queries, you can do so here or in a config file.
@@ -56,7 +56,7 @@ jobs:
56
56
  # Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
57
57
  # If this step fails, then you should remove it and run the build manually (see below)
58
58
  - name: Autobuild
59
- uses: github/codeql-action/autobuild@v3
59
+ uses: github/codeql-action/autobuild@v4
60
60
 
61
61
  # ℹ️ Command-line programs to run using the OS shell.
62
62
  # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
@@ -69,4 +69,4 @@ jobs:
69
69
  # ./location_of_script_within_repo/buildscript.sh
70
70
 
71
71
  - name: Perform CodeQL Analysis
72
- uses: github/codeql-action/analyze@v3
72
+ uses: github/codeql-action/analyze@v4
data/.rubocop.yml CHANGED
@@ -4,7 +4,7 @@ AllCops:
4
4
  Exclude:
5
5
  - lib/riemann/tools/*_parser.tab.rb
6
6
  - vendor/bundle/**/*
7
- require:
7
+ plugins:
8
8
  - rubocop-rake
9
9
  - rubocop-rspec
10
10
  Gemspec/RequiredRubyVersion:
data/CHANGELOG.md CHANGED
@@ -1,5 +1,46 @@
1
1
  # Changelog
2
2
 
3
+ ## [v2.0.0](https://github.com/riemann/riemann-tools/tree/v2.0.0) (2026-05-28)
4
+
5
+ [Full Changelog](https://github.com/riemann/riemann-tools/compare/v1.12.0...v2.0.0)
6
+
7
+ **Breaking changes:**
8
+
9
+ - Drop support for Ruby \< 2.7 [\#305](https://github.com/riemann/riemann-tools/pull/305) ([smortex](https://github.com/smortex))
10
+
11
+ **Implemented enhancements:**
12
+
13
+ - Ignore null-critical value for `riemann-hwmon` [\#307](https://github.com/riemann/riemann-tools/pull/307) ([smortex](https://github.com/smortex))
14
+ - Distinguish i2c devices in `riemann-hwmon` [\#306](https://github.com/riemann/riemann-tools/pull/306) ([smortex](https://github.com/smortex))
15
+ - Ignore `efivarfs` disks in `riemann-health` checks [\#304](https://github.com/riemann/riemann-tools/pull/304) ([smortex](https://github.com/smortex))
16
+
17
+ **Fixed bugs:**
18
+
19
+ - Fix `riemann-wrapper` connection sharing [\#315](https://github.com/riemann/riemann-tools/pull/315) ([smortex](https://github.com/smortex))
20
+ - Fix reporting of free disk space [\#314](https://github.com/riemann/riemann-tools/pull/314) ([smortex](https://github.com/smortex))
21
+ - Fix `riemann-md` not recognizing mdstat `auto-read-only` mode [\#312](https://github.com/riemann/riemann-tools/pull/312) ([smortex](https://github.com/smortex))
22
+ - Ignore invalid data in `riemann-hwmon` [\#303](https://github.com/riemann/riemann-tools/pull/303) ([smortex](https://github.com/smortex))
23
+
24
+ **Closed issues:**
25
+
26
+ - RFC: retire tools that monitor Mesos and related projects [\#311](https://github.com/riemann/riemann-tools/issues/311)
27
+
28
+ **Merged pull requests:**
29
+
30
+ - Mark Mesos monitoring tools as deprecated [\#313](https://github.com/riemann/riemann-tools/pull/313) ([l2dy](https://github.com/l2dy))
31
+
32
+ ## [v1.12.0](https://github.com/riemann/riemann-tools/tree/v1.12.0) (2025-01-15)
33
+
34
+ [Full Changelog](https://github.com/riemann/riemann-tools/compare/v1.11.0...v1.12.0)
35
+
36
+ **Implemented enhancements:**
37
+
38
+ - Allow passing options to `riemann-bench` [\#300](https://github.com/riemann/riemann-tools/pull/300) ([smortex](https://github.com/smortex))
39
+
40
+ **Fixed bugs:**
41
+
42
+ - Fix support of Ruby 3.4 [\#301](https://github.com/riemann/riemann-tools/pull/301) ([smortex](https://github.com/smortex))
43
+
3
44
  ## [v1.11.0](https://github.com/riemann/riemann-tools/tree/v1.11.0) (2024-07-07)
4
45
 
5
46
  [Full Changelog](https://github.com/riemann/riemann-tools/compare/v1.10.0...v1.11.0)
@@ -399,7 +440,7 @@
399
440
 
400
441
  - Send out "expired" state when riemann-net stops seeing an interface [\#114](https://github.com/riemann/riemann-tools/pull/114) ([md5](https://github.com/md5))
401
442
  - Skip network metric comparison for newly added interfaces [\#113](https://github.com/riemann/riemann-tools/pull/113) ([md5](https://github.com/md5))
402
- - riemann-proc alerts output which processes matched [\#111](https://github.com/riemann/riemann-tools/pull/111) ([tcrayford](https://github.com/tcrayford))
443
+ - riemann-proc alerts output which processes matched [\#111](https://github.com/riemann/riemann-tools/pull/111) ([tom-pang](https://github.com/tom-pang))
403
444
  - abort if no DB specified [\#110](https://github.com/riemann/riemann-tools/pull/110) ([peterneubauer](https://github.com/peterneubauer))
404
445
  - Adding monitoring of an RDS instance [\#109](https://github.com/riemann/riemann-tools/pull/109) ([peterneubauer](https://github.com/peterneubauer))
405
446
  - Added NTP statistics collector [\#108](https://github.com/riemann/riemann-tools/pull/108) ([jamtur01](https://github.com/jamtur01))
@@ -415,7 +456,7 @@
415
456
 
416
457
  - Adding support for https connection [\#102](https://github.com/riemann/riemann-tools/pull/102) ([peterneubauer](https://github.com/peterneubauer))
417
458
  - Adds monitoring a folder based on its number of files [\#100](https://github.com/riemann/riemann-tools/pull/100) ([iramello](https://github.com/iramello))
418
- - add directory space use monitoring [\#96](https://github.com/riemann/riemann-tools/pull/96) ([tcrayford](https://github.com/tcrayford))
459
+ - add directory space use monitoring [\#96](https://github.com/riemann/riemann-tools/pull/96) ([tom-pang](https://github.com/tom-pang))
419
460
 
420
461
  ## [0.2.3](https://github.com/riemann/riemann-tools/tree/0.2.3) (2015-01-06)
421
462
 
@@ -446,19 +487,22 @@
446
487
 
447
488
  - one-character fix: Make riemann-aws-billing work again [\#85](https://github.com/riemann/riemann-tools/pull/85) ([benley](https://github.com/benley))
448
489
  - Fix for latest riemann-client changes [\#83](https://github.com/riemann/riemann-tools/pull/83) ([eric](https://github.com/eric))
449
- - riemann proc regex should quote args to grep [\#82](https://github.com/riemann/riemann-tools/pull/82) ([tcrayford](https://github.com/tcrayford))
490
+ - riemann proc regex should quote args to grep [\#82](https://github.com/riemann/riemann-tools/pull/82) ([tom-pang](https://github.com/tom-pang))
450
491
  - riemann-redis migrated to https://github.com/riemann/riemann-redis [\#81](https://github.com/riemann/riemann-tools/pull/81) ([fborgnia](https://github.com/fborgnia))
451
492
 
452
493
  ## [0.2.1](https://github.com/riemann/riemann-tools/tree/0.2.1) (2014-03-26)
453
494
 
454
495
  [Full Changelog](https://github.com/riemann/riemann-tools/compare/0.2.0...0.2.1)
455
496
 
497
+ **Implemented enhancements:**
498
+
499
+ - rieman-tools aws billing [\#74](https://github.com/riemann/riemann-tools/pull/74) ([jespada](https://github.com/jespada))
500
+
456
501
  **Merged pull requests:**
457
502
 
458
503
  - Update FreeBSD load average for 1 min [\#79](https://github.com/riemann/riemann-tools/pull/79) ([zachfi](https://github.com/zachfi))
459
504
  - Added riemann-varnish collector script [\#77](https://github.com/riemann/riemann-tools/pull/77) ([pradeepchhetri](https://github.com/pradeepchhetri))
460
505
  - allow dashes in diskstats volume names to support lvm volumes like "dm-0" [\#75](https://github.com/riemann/riemann-tools/pull/75) ([cmerrick](https://github.com/cmerrick))
461
- - rieman-tools aws billing [\#74](https://github.com/riemann/riemann-tools/pull/74) ([jespada](https://github.com/jespada))
462
506
  - Added basic metric monitoring for zookeeper [\#73](https://github.com/riemann/riemann-tools/pull/73) ([aterreno](https://github.com/aterreno))
463
507
 
464
508
  ## [0.2.0](https://github.com/riemann/riemann-tools/tree/0.2.0) (2014-01-23)
@@ -544,22 +588,31 @@
544
588
 
545
589
  [Full Changelog](https://github.com/riemann/riemann-tools/compare/0.1.2...0.1.3)
546
590
 
591
+ **Implemented enhancements:**
592
+
593
+ - Add ability to add attributes from CLI [\#38](https://github.com/riemann/riemann-tools/pull/38) ([lwf](https://github.com/lwf))
594
+
595
+ **Fixed bugs:**
596
+
597
+ - Handle timeouts [\#42](https://github.com/riemann/riemann-tools/pull/42) ([lwf](https://github.com/lwf))
598
+
547
599
  **Closed issues:**
548
600
 
549
601
  - riemann-kvminstance\(s\) duplicate scripts [\#34](https://github.com/riemann/riemann-tools/issues/34)
550
602
 
551
603
  **Merged pull requests:**
552
604
 
553
- - Remove dead code [\#43](https://github.com/riemann/riemann-tools/pull/43) ([lwf](https://github.com/lwf))
554
- - Handle timeouts [\#42](https://github.com/riemann/riemann-tools/pull/42) ([lwf](https://github.com/lwf))
555
605
  - Allow riemann resmon to use hostname or FQDN for events [\#41](https://github.com/riemann/riemann-tools/pull/41) ([gsandie](https://github.com/gsandie))
556
606
  - Remove duplicated file riemann-kvminstances. [\#39](https://github.com/riemann/riemann-tools/pull/39) ([default50](https://github.com/default50))
557
- - Add ability to add attributes from CLI [\#38](https://github.com/riemann/riemann-tools/pull/38) ([lwf](https://github.com/lwf))
558
607
 
559
608
  ## [0.1.2](https://github.com/riemann/riemann-tools/tree/0.1.2) (2013-04-30)
560
609
 
561
610
  [Full Changelog](https://github.com/riemann/riemann-tools/compare/0.0.9...0.1.2)
562
611
 
612
+ **Implemented enhancements:**
613
+
614
+ - Add riemann-aws-status [\#13](https://github.com/riemann/riemann-tools/pull/13) ([lwf](https://github.com/lwf))
615
+
563
616
  **Closed issues:**
564
617
 
565
618
  - riemann-nginx? [\#31](https://github.com/riemann/riemann-tools/issues/31)
@@ -584,18 +637,21 @@
584
637
  - Default event hostname [\#20](https://github.com/riemann/riemann-tools/pull/20) ([timshadel](https://github.com/timshadel))
585
638
  - Add memcached monitoring support for riemann-tools. [\#19](https://github.com/riemann/riemann-tools/pull/19) ([fcuny](https://github.com/fcuny))
586
639
  - Typo in rieman-riak using :servie instead of :service [\#18](https://github.com/riemann/riemann-tools/pull/18) ([dgtized](https://github.com/dgtized))
587
- - Add riemann-aws-status [\#13](https://github.com/riemann/riemann-tools/pull/13) ([lwf](https://github.com/lwf))
588
640
 
589
641
  ## [0.0.9](https://github.com/riemann/riemann-tools/tree/0.0.9) (2012-12-08)
590
642
 
591
643
  [Full Changelog](https://github.com/riemann/riemann-tools/compare/version-0.0.2...0.0.9)
592
644
 
645
+ **Implemented enhancements:**
646
+
647
+ - Add riemann-diskstats [\#12](https://github.com/riemann/riemann-tools/pull/12) ([lwf](https://github.com/lwf))
648
+ - Add --tag option to specify tags [\#2](https://github.com/riemann/riemann-tools/pull/2) ([lwf](https://github.com/lwf))
649
+
593
650
  **Merged pull requests:**
594
651
 
595
652
  - fix overflowing text from ps by swapping args for comm [\#17](https://github.com/riemann/riemann-tools/pull/17) ([dch](https://github.com/dch))
596
653
  - Fix darwin cpu usage. Show used cpu instead of idle [\#15](https://github.com/riemann/riemann-tools/pull/15) ([henrikno](https://github.com/henrikno))
597
654
  - Fix core count on darwin [\#14](https://github.com/riemann/riemann-tools/pull/14) ([henrikno](https://github.com/henrikno))
598
- - Add riemann-diskstats [\#12](https://github.com/riemann/riemann-tools/pull/12) ([lwf](https://github.com/lwf))
599
655
  - Reflect each haproxy config as its own unique status [\#11](https://github.com/riemann/riemann-tools/pull/11) ([perezd](https://github.com/perezd))
600
656
  - allow for a commandline configurable TTL. [\#10](https://github.com/riemann/riemann-tools/pull/10) ([perezd](https://github.com/perezd))
601
657
  - add host properties to cloudant, haproxy, redis. [\#8](https://github.com/riemann/riemann-tools/pull/8) ([perezd](https://github.com/perezd))
@@ -604,7 +660,6 @@
604
660
  - adds redis monitoring support to riemann-tools. [\#5](https://github.com/riemann/riemann-tools/pull/5) ([perezd](https://github.com/perezd))
605
661
  - Prevent riemann-health from failing to report memory on OpenVZ virtual machines.  [\#4](https://github.com/riemann/riemann-tools/pull/4) ([mindreframer](https://github.com/mindreframer))
606
662
  - added a script to report kvm instances running on a host [\#3](https://github.com/riemann/riemann-tools/pull/3) ([wjimenez5271](https://github.com/wjimenez5271))
607
- - Add --tag option to specify tags [\#2](https://github.com/riemann/riemann-tools/pull/2) ([lwf](https://github.com/lwf))
608
663
  - add freebsd and darwin support to riemann-health [\#1](https://github.com/riemann/riemann-tools/pull/1) ([joecaswell](https://github.com/joecaswell))
609
664
 
610
665
  ## [version-0.0.2](https://github.com/riemann/riemann-tools/tree/version-0.0.2) (2012-04-17)
data/Gemfile CHANGED
@@ -8,6 +8,7 @@ gemspec
8
8
  gem 'github_changelog_generator'
9
9
  gem 'maxmind-geoip2'
10
10
  gem 'racc'
11
+ gem 'rackup'
11
12
  gem 'rake'
12
13
  gem 'rspec'
13
14
  gem 'rubocop'
@@ -15,14 +16,3 @@ gem 'rubocop-rake'
15
16
  gem 'rubocop-rspec'
16
17
  gem 'sinatra'
17
18
  gem 'webrick'
18
-
19
- if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new('2.7.0')
20
- # XXX: Needed for Ruby 2.6 compatibility
21
- #
22
- # With Ruby 2.6 an older version of rakup is installed that cause other gems
23
- # to be installed with a legacy version.
24
- #
25
- # Because rakup is only needed when using rack 3, we can just ignore this
26
- # with Ruby 2.6.
27
- gem 'rackup'
28
- end
data/README.markdown CHANGED
@@ -56,13 +56,14 @@ gem install riemann-aws
56
56
 
57
57
  * riemann-aws - Monitor various AWS services.
58
58
  * riemann-elasticsearch - Monitor Elasticsearch.
59
- * riemann-mesos - Monitor Mesos.
60
59
  * riemann-rabbitmq - Monitor RabbitMQ.
61
60
  * riemann-docker - Monitor Docker.
62
- * riemann-marathon - Monitor Marathon.
63
61
  * riemann-munin - Monitor Munin.
64
62
  * riemann-riak - Monitor Riak.
65
- * riemann-chronos - Monitor Chronos.
63
+ * Mesos (deprecated)
64
+ * riemann-mesos - Monitor Mesos.
65
+ * riemann-marathon - Monitor Marathon.
66
+ * riemann-chronos - Monitor Chronos.
66
67
 
67
68
  There are also a number of additional, stand-alone tools, contained in
68
69
  the [Riemann GitHub account](https://github.com/riemann/).
@@ -11,6 +11,7 @@ module Riemann
11
11
  module Tools
12
12
  class ApacheStatus
13
13
  include Riemann::Tools
14
+
14
15
  require 'net/http'
15
16
  require 'uri'
16
17
 
@@ -1,14 +1,16 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'rubygems'
4
- require 'riemann/client'
3
+ require 'riemann/tools'
4
+ require 'riemann/tools/version'
5
5
 
6
6
  # Connects to a server (first arg) and populates it with a constant stream of
7
7
  # events for testing.
8
8
  module Riemann
9
9
  module Tools
10
10
  class Bench
11
- attr_accessor :client, :hosts, :services, :states
11
+ include Riemann::Tools
12
+
13
+ attr_accessor :hosts, :services, :states
12
14
 
13
15
  def initialize
14
16
  super
@@ -17,7 +19,6 @@ module Riemann
17
19
  @hosts = %w[a b c d e f g h i j]
18
20
  @services = %w[test1 test2 test3 foo bar baz xyzzy attack cat treat]
19
21
  @states = {}
20
- @client = Riemann::Client.new(host: ARGV.first || 'localhost')
21
22
  end
22
23
 
23
24
  def evolve(state)
@@ -45,7 +46,7 @@ module Riemann
45
46
  def tick
46
47
  # pp @states
47
48
  hosts.product(services).each do |id|
48
- client << (states[id] = evolve(states[id]))
49
+ report(states[id] = evolve(states[id]))
49
50
  end
50
51
  end
51
52
 
@@ -8,6 +8,7 @@ module Riemann
8
8
  module Tools
9
9
  class Cloudant
10
10
  include Riemann::Tools
11
+
11
12
  require 'net/http'
12
13
  require 'json'
13
14
 
@@ -8,6 +8,7 @@ module Riemann
8
8
  module Tools
9
9
  class Haproxy
10
10
  include Riemann::Tools
11
+
11
12
  require 'net/http'
12
13
  require 'csv'
13
14
 
@@ -21,7 +21,7 @@ module Riemann
21
21
  opt :disk_warning_leniency, 'Disk warning threshold (amount of free space)', short: :none, default: '500G'
22
22
  opt :disk_critical_leniency, 'Disk critical threshold (amount of free space)', short: :none, default: '250G'
23
23
  opt :disk_ignorefs, 'A list of filesystem types to ignore',
24
- default: %w[anon_inodefs autofs cd9660 devfs devtmpfs fdescfs iso9660 linprocfs linsysfs nfs overlay procfs squashfs tmpfs]
24
+ default: %w[anon_inodefs autofs cd9660 devfs devtmpfs efivarfs fdescfs iso9660 linprocfs linsysfs nfs overlay procfs squashfs tmpfs]
25
25
  opt :load_warning, 'Load warning threshold (load average / core)', default: 3.0
26
26
  opt :load_critical, 'Load critical threshold (load average / core)', default: 8.0
27
27
  opt :memory_warning, 'Memory warning threshold (fraction of RAM)', default: 0.85
@@ -441,9 +441,9 @@ module Riemann
441
441
  x = used.to_f / total_without_reservation
442
442
 
443
443
  if x > @limits[:disk][:critical] && available < @limits[:disk][:critical_leniency_kb]
444
- alert "disk #{f[5]}", :critical, x, "#{f[4]} used"
444
+ alert "disk #{f[5]}", :critical, x, "#{f[4]} used, #{number_to_human_size(available * 1024, :floor)} free"
445
445
  elsif x > @limits[:disk][:warning] && available < @limits[:disk][:warning_leniency_kb]
446
- alert "disk #{f[5]}", :warning, x, "#{f[4]} used"
446
+ alert "disk #{f[5]}", :warning, x, "#{f[4]} used, #{number_to_human_size(available * 1024, :floor)} free"
447
447
  else
448
448
  alert "disk #{f[5]}", :ok, x, "#{f[4]} used, #{number_to_human_size(available * 1024, :floor)} free"
449
449
  end
@@ -530,10 +530,12 @@ module Riemann
530
530
  end
531
531
 
532
532
  def number_to_human_size(value, rounding = :round)
533
- return value.to_s if value < 1024
533
+ return "#{value}B" if value.abs < 1024
534
534
 
535
+ neg = value.negative?
536
+ value = value.abs
535
537
  r = Math.log(value, 1024).floor
536
- format('%<size>.1f%<unit>ciB', size: (value.to_f / (1024**r)).send(rounding, 1), unit: SI_UNITS[r])
538
+ format('%<sign>s%<size>.1f%<unit>ciB', sign: (neg ? '-' : ''), size: (value.to_f / (1024**r)).send(rounding, 1), unit: SI_UNITS[r])
537
539
  end
538
540
 
539
541
  def tick
@@ -17,8 +17,16 @@ module Riemann
17
17
  @number = number
18
18
 
19
19
  @crit = scale(read_hwmon_i('crit'))
20
+ @crit = nil if @crit&.zero? # Some buggy drivers report a zero critical value. Ignore these
20
21
  @lcrit = scale(read_hwmon_i('lcrit'))
21
- @service = ['hwmon', read_hwmon_file('name'), read_hwmon_s('label')].compact.join(' ')
22
+ @service = ['hwmon', name, read_hwmon_s('label')].compact.join(' ')
23
+ end
24
+
25
+ def name
26
+ result = read_hwmon_file('name')
27
+ filename = File.realpath(hwmon_file_path('name'))
28
+ result.concat(' at ', Regexp.last_match[1]) if filename.match(%r{/(i2c-\d+/\d+-[[:xdigit:]]+)/hwmon/})
29
+ result
22
30
  end
23
31
 
24
32
  def input
@@ -28,14 +36,17 @@ module Riemann
28
36
  def report
29
37
  value = scale(input)
30
38
 
31
- state = :ok
32
- state = :critical if crit && value >= crit
33
- state = :critical if lcrit && value <= lcrit
39
+ state = nil
40
+ if crit || lcrit
41
+ state = :ok
42
+ state = :critical if crit && value >= crit
43
+ state = :critical if lcrit && value <= lcrit
44
+ end
34
45
  {
35
46
  service: service,
36
47
  state: state,
37
48
  metric: value,
38
- description: fromat_input(value),
49
+ description: format_input(value),
39
50
  }
40
51
  end
41
52
 
@@ -52,7 +63,7 @@ module Riemann
52
63
  end
53
64
  end
54
65
 
55
- def fromat_input(value)
66
+ def format_input(value)
56
67
  case type
57
68
  when :in then format('%<value>.3f V', { value: value })
58
69
  when :fan then "#{value} RPM"
@@ -76,10 +87,14 @@ module Riemann
76
87
  end
77
88
 
78
89
  def read_hwmon_file(file)
79
- File.read("/sys/class/hwmon/hwmon#{hwmon}/#{file}").chomp
90
+ File.read(hwmon_file_path(file)).chomp
80
91
  rescue Errno::ENOENT
81
92
  nil
82
93
  end
94
+
95
+ def hwmon_file_path(file)
96
+ "/sys/class/hwmon/hwmon#{hwmon}/#{file}"
97
+ end
83
98
  end
84
99
 
85
100
  attr_reader :devices
@@ -104,6 +119,8 @@ module Riemann
104
119
  def tick
105
120
  devices.each do |device|
106
121
  report(device.report)
122
+ rescue Errno::ENODATA
123
+ # Some sensors are buggy and cannot report properly
107
124
  end
108
125
  end
109
126
  end