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.
- data/lib/nephelae/logging.rb +16 -0
- data/lib/nephelae/plugins/redis.rb +46 -0
- data/lib/nephelae/version.rb +1 -1
- metadata +3 -1
@@ -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
|
data/lib/nephelae/version.rb
CHANGED
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.
|
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
|