riemann-tools 0.2.9 → 0.2.10

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 (3) hide show
  1. checksums.yaml +4 -4
  2. data/bin/riemann-health +12 -6
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 028a34582916278f0704c6830fb1accc1fe940e9
4
- data.tar.gz: 995651768195d973c5be15c0998e3c2e0be52237
3
+ metadata.gz: a836eaa2ae5d0547934c781aeeb0534b608ad953
4
+ data.tar.gz: 987188b8b7cccf081f0916c0538a83bdf72d0510
5
5
  SHA512:
6
- metadata.gz: 1271ec7e1c3269784a68cf39c64dbe55a5a845c82a06c8fe6afe5a1377a115df023ee248882a33db26642e0fd0e7406126db49b36797ec5914b26a041869f1ab
7
- data.tar.gz: 009f079f02ed9e54f57adf2940b710e7c1905c53f99c8704e9647bcddde4aa890944d4c8c92b4bb091da39ad07b4d09aa61865dfc53deb0f7aa17f5a40faac21
6
+ metadata.gz: d3e486b8ef26b755020a1276e6a7b403448515c82aa4739a196e0cebf38244e15c74240c18c3627288723c1bf2ee07be1c6a99b1dfb36f2932e445d41e7a082c
7
+ data.tar.gz: c2efb17d675954ea1c1c3c93243f3a4c1690b1a451da7c50c87c8e9f78d05be67cf8107b23c040408ed8dd2c752143956c2f38ad58e1d376ff542a7c5be840bd
@@ -24,10 +24,9 @@ class Riemann::Tools::Health
24
24
  :load => {:critical => opts[:load_critical], :warning => opts[:load_warning]},
25
25
  :memory => {:critical => opts[:memory_critical], :warning => opts[:memory_warning]}
26
26
  }
27
- case (ostype = `uname -s`.chomp.downcase)
27
+ case (@ostype = `uname -s`.chomp.downcase)
28
28
  when 'darwin'
29
29
  @cores = `sysctl -n hw.ncpu`.to_i
30
- @df = `df -P -t noiso9660`
31
30
  @cpu = method :darwin_cpu
32
31
  @disk = method :disk
33
32
  @load = method :darwin_load
@@ -35,15 +34,13 @@ class Riemann::Tools::Health
35
34
  darwin_top
36
35
  when 'freebsd'
37
36
  @cores = `sysctl -n hw.ncpu`.to_i
38
- @df = `df -P -t noiso9660`
39
37
  @cpu = method :freebsd_cpu
40
38
  @disk = method :disk
41
39
  @load = method :freebsd_load
42
40
  @memory = method :freebsd_memory
43
41
  else
44
42
  @cores = cores
45
- @df = `df -P --exclude-type=iso9660`
46
- puts "WARNING: OS '#{ostype}' not explicitly supported. Falling back to Linux" unless ostype == "linux"
43
+ puts "WARNING: OS '#{@ostype}' not explicitly supported. Falling back to Linux" unless @ostype == "linux"
47
44
  @cpu = method :linux_cpu
48
45
  @disk = method :disk
49
46
  @load = method :linux_load
@@ -245,8 +242,17 @@ class Riemann::Tools::Health
245
242
  report_pct :memory, @topdata[:memory], "usage\n\n#{`ps -eo pmem,pid,comm | sort -nrb -k1 | head -10`.chomp}"
246
243
  end
247
244
 
245
+ def df
246
+ case @ostype
247
+ when 'darwin', 'freebsd'
248
+ `df -P -t noiso9660`
249
+ else
250
+ `df -P --exclude-type=iso9660`
251
+ end
252
+ end
253
+
248
254
  def disk
249
- @df.split(/\n/).each do |r|
255
+ df.split(/\n/).each do |r|
250
256
  f = r.split(/\s+/)
251
257
  next if f[0] == 'Filesystem'
252
258
  next unless f[0] =~ /\// # Needs at least one slash in the mount path
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: riemann-tools
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.9
4
+ version: 0.2.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kyle Kingsbury
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-02-20 00:00:00.000000000 Z
11
+ date: 2016-03-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: riemann-client