nephelae 0.0.6 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
@@ -15,7 +15,9 @@ module Nephelae
15
15
 
16
16
  if $?.success?
17
17
  stats = parse_status(output)
18
- metrics.append_metric('MemoryTotal', stats[:mem_total], {unit: 'Kilobytes'})
18
+
19
+ mem_total = stats[:mem_total]
20
+ metrics.append_metric('MemoryTotal', mem_total, {unit: 'Kilobytes'})
19
21
 
20
22
  mem_free = stats[:mem_free] + stats[:buffers] + stats[:cached]
21
23
  metrics.append_metric('MemoryFree', mem_free, {unit: 'Kilobytes'})
@@ -16,8 +16,8 @@ module Nephelae
16
16
  if $?.success?
17
17
  stats = parse_status(output)
18
18
  metrics.append_metric('Up', 1)
19
- metrics.append_metric('MasterLinkStatus', (stats[:master] == 'up' ? 1 : 0))
20
- metrics.append_metric('MasterIOSecondsAgo', stats[:master_last_io_seconds_ago], {unit: 'Seconds'})
19
+ metrics.append_metric('MasterLinkStatus', (stats[:master] == 'up' ? 1 : 0)) unless stats[:master].nil?
20
+ metrics.append_metric('MasterIOSecondsAgo', stats[:master_last_io_seconds_ago], {unit: 'Seconds'}) unless stats[:master_last_io_seconds_ago].nil?
21
21
  metrics.append_metric('ChangesSinceLastSave', stats[:changes_since_last_save], {unit: 'Count'})
22
22
  metrics.append_metric('UsedMemory', stats[:used_memory], {unit: 'Bytes'})
23
23
  metrics.append_metric('ConnectedSlaves', stats[:connected_slaves], {unit: 'Count'})
@@ -32,8 +32,14 @@ module Nephelae
32
32
 
33
33
  private
34
34
  def parse_status(body)
35
- { :master_link_status => body.match(/master_link_status:(\w+)/)[1],
36
- :master_last_io_seconds_ago => body.match(/master_last_io_seconds_ago:(\d+)/)[1],
35
+ ret = {}
36
+ mls = body.match(/master_link_status:(\w+)/)
37
+ ret[:master_link_status] = mls.nil? ? "down" : mls[1]
38
+
39
+ mlio = body.match(/master_last_io_seconds_ago:(\d+)/)
40
+ ret[:master_last_io_seconds_ago] = mlio[1] unless mlio.nil?
41
+
42
+ ret.merge {
37
43
  :changes_since_last_save => body.match(/changes_since_last_save:(\d+)/)[1],
38
44
  :used_memory => body.match(/used_memory:(\d+)/)[1],
39
45
  :connected_slaves => body.match(/connected_slaves:(\d+)/)[1],
@@ -1,3 +1,3 @@
1
1
  module Nephelae
2
- VERSION = "0.0.6"
2
+ VERSION = "0.0.7"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nephelae
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.7
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: