nephelae 0.0.5 → 0.0.6

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.
@@ -0,0 +1,16 @@
1
+ require 'logger'
2
+ module Nephelae
3
+ module Logging
4
+ def log
5
+ Logging.logger
6
+ end
7
+
8
+ def self.logger
9
+ @logger || Logger.new(STDOUT)
10
+ end
11
+
12
+ def self.logger=(logger)
13
+ @logger = logger
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,46 @@
1
+ module Nephelae
2
+
3
+ class RedisStatus
4
+
5
+ def initialize(params = {})
6
+ end
7
+
8
+ def command
9
+ "/usr/local/bin/redis-cli info"
10
+ end
11
+
12
+ def get_metrics
13
+ metrics = Metrics.new('Application/Redis')
14
+ output = `#{command}`
15
+
16
+ if $?.success?
17
+ stats = parse_status(output)
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'})
21
+ metrics.append_metric('ChangesSinceLastSave', stats[:changes_since_last_save], {unit: 'Count'})
22
+ metrics.append_metric('UsedMemory', stats[:used_memory], {unit: 'Bytes'})
23
+ metrics.append_metric('ConnectedSlaves', stats[:connected_slaves], {unit: 'Count'})
24
+ metrics.append_metric('ConnectedClients', stats[:connected_clients], {unit: 'Count'})
25
+ else
26
+ metrics.append_metric('Up', 0)
27
+ end
28
+
29
+ return metrics
30
+
31
+ end
32
+
33
+ private
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],
37
+ :changes_since_last_save => body.match(/changes_since_last_save:(\d+)/)[1],
38
+ :used_memory => body.match(/used_memory:(\d+)/)[1],
39
+ :connected_slaves => body.match(/connected_slaves:(\d+)/)[1],
40
+ :connected_clients => body.match(/connected_clients:(\d+)/)[1]
41
+ }
42
+ end
43
+
44
+ end
45
+
46
+ end
@@ -1,3 +1,3 @@
1
1
  module Nephelae
2
- VERSION = "0.0.5"
2
+ VERSION = "0.0.6"
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.5
4
+ version: 0.0.6
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -110,10 +110,12 @@ files:
110
110
  - lib/nephelae/cloud_watch/cloud_watch.rb
111
111
  - lib/nephelae/cloud_watch/metrics.rb
112
112
  - lib/nephelae/cloud_watch/simple_aws.rb
113
+ - lib/nephelae/logging.rb
113
114
  - lib/nephelae/plugins/disk_space.rb
114
115
  - lib/nephelae/plugins/mem_usage.rb
115
116
  - lib/nephelae/plugins/nephelae_process.rb
116
117
  - lib/nephelae/plugins/passenger_status.rb
118
+ - lib/nephelae/plugins/redis.rb
117
119
  - lib/nephelae/runner.rb
118
120
  - lib/nephelae/version.rb
119
121
  - nephelae.gemspec