redmon 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +59 -6
- data/lib/redmon/app.rb +1 -1
- data/lib/redmon/helpers.rb +5 -1
- data/lib/redmon/public/redmon.js +11 -11
- data/lib/redmon/version.rb +2 -2
- data/lib/redmon/views/app.haml +47 -46
- metadata +4 -4
data/README.md
CHANGED
@@ -88,11 +88,64 @@ Redmon.configure do |config|
|
|
88
88
|
end
|
89
89
|
```
|
90
90
|
|
91
|
-
This will mount the Redmon application to the /redmon
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
based approach.
|
91
|
+
This will mount the Redmon application to the /redmon path.
|
92
|
+
|
93
|
+
### Stats worker
|
94
|
+
|
95
|
+
The worker that gathers the Redis info stats will not be started when Redmon is mounted like this. In order to get a EventMachine worker running inside your Rails app you can try this [Railtie based approach](https://github.com/steelThread/redmon/pull/19#issuecomment-7273659). If you are using a system to execute background tasks in your app (like Sidekiq, Resque, or Delayed Job), you can write your own worker to update the info stats.
|
96
|
+
|
97
|
+
A simple worker for Sidekiq looks like this:
|
98
|
+
|
99
|
+
```ruby
|
100
|
+
class RedmonWorker
|
101
|
+
include Sidekiq::Worker
|
102
|
+
|
103
|
+
def perform
|
104
|
+
Redmon::Worker.new.record_stats
|
105
|
+
ensure
|
106
|
+
self.class.perform_in Redmon.config.poll_interval.seconds
|
107
|
+
end
|
108
|
+
end
|
109
|
+
```
|
110
|
+
|
111
|
+
Once enqueued, the worker updates the stats and automatically enqueues itself to be performed again after the defined poll interval.
|
112
|
+
|
113
|
+
## Using with another Sinatra application
|
114
|
+
|
115
|
+
Create/Edit config.ru:
|
116
|
+
|
117
|
+
```ruby
|
118
|
+
require './app.rb'
|
119
|
+
require 'redmon'
|
120
|
+
|
121
|
+
map '/' do
|
122
|
+
run Sinatra::Application
|
123
|
+
end
|
124
|
+
map '/redmon' do
|
125
|
+
if EM.reactor_running?
|
126
|
+
Redmon::Worker.new.run!
|
127
|
+
else
|
128
|
+
fork do
|
129
|
+
trap('INT') { EM.stop }
|
130
|
+
trap('TERM') { EM.stop }
|
131
|
+
EM.run { Redmon::Worker.new.run! }
|
132
|
+
end
|
133
|
+
end
|
134
|
+
|
135
|
+
run Redmon::App
|
136
|
+
end
|
137
|
+
```
|
138
|
+
|
139
|
+
In order to configure Redmon use this code in your app.rb file:
|
140
|
+
|
141
|
+
```ruby
|
142
|
+
Redmon.configure do |config|
|
143
|
+
config.redis_url = 'redis://127.0.0.1:6379'
|
144
|
+
config.namespace = 'redmon'
|
145
|
+
end
|
146
|
+
```
|
147
|
+
|
148
|
+
This will mount the Redmon application to the /redmon path.
|
96
149
|
|
97
150
|
## License
|
98
151
|
|
@@ -102,4 +155,4 @@ Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
102
155
|
|
103
156
|
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
104
157
|
|
105
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
158
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/lib/redmon/app.rb
CHANGED
data/lib/redmon/helpers.rb
CHANGED
data/lib/redmon/public/redmon.js
CHANGED
@@ -30,7 +30,7 @@ var Redmon = (function() {
|
|
30
30
|
*/
|
31
31
|
function requestData(count, callback) {
|
32
32
|
$.ajax({
|
33
|
-
url: 'stats?count='+count,
|
33
|
+
url: config.absoluteUrl+'stats?count='+count,
|
34
34
|
success: function(data) {
|
35
35
|
callback(
|
36
36
|
data.map(function(info) {
|
@@ -138,7 +138,7 @@ var Redmon = (function() {
|
|
138
138
|
}
|
139
139
|
|
140
140
|
function onBtnClick(cmd) {
|
141
|
-
$.ajax({url: 'cli?command='+cmd});
|
141
|
+
$.ajax({url: config.absoluteUrl+'cli?command='+cmd});
|
142
142
|
}
|
143
143
|
|
144
144
|
return {
|
@@ -303,7 +303,7 @@ var Redmon = (function() {
|
|
303
303
|
, field = el.attr('id');
|
304
304
|
|
305
305
|
if (data[field]) {
|
306
|
-
var type = el.
|
306
|
+
var type = el.data('type')
|
307
307
|
if (type && type == 'date')
|
308
308
|
el.text(formatDate(data[field]));
|
309
309
|
else if (type && type == 'number')
|
@@ -369,13 +369,13 @@ var Redmon = (function() {
|
|
369
369
|
'appendfsync' : 'always,everysec,no'
|
370
370
|
};
|
371
371
|
|
372
|
-
function render(
|
372
|
+
function render() {
|
373
373
|
$('#config-table .editable').each(function() {
|
374
374
|
var editable = $(this)
|
375
375
|
, id = editable.attr('id');
|
376
376
|
|
377
|
-
var
|
378
|
-
url : '
|
377
|
+
var options = {
|
378
|
+
url : config.absoluteUrl+'config',
|
379
379
|
element_id : 'param',
|
380
380
|
update_value : 'value',
|
381
381
|
show_buttons : true,
|
@@ -385,11 +385,11 @@ var Redmon = (function() {
|
|
385
385
|
};
|
386
386
|
|
387
387
|
if (selects[id]) {
|
388
|
-
|
389
|
-
|
388
|
+
options.field_type = 'select';
|
389
|
+
options.select_options = selects[id];
|
390
390
|
}
|
391
391
|
|
392
|
-
editable.editInPlace(
|
392
|
+
editable.editInPlace(options);
|
393
393
|
});
|
394
394
|
}
|
395
395
|
|
@@ -425,7 +425,7 @@ var Redmon = (function() {
|
|
425
425
|
}
|
426
426
|
|
427
427
|
$.ajax({
|
428
|
-
url :
|
428
|
+
url : config.absoluteUrl+'cli?command='+command,
|
429
429
|
success : callback
|
430
430
|
});
|
431
431
|
}
|
@@ -561,4 +561,4 @@ var Redmon = (function() {
|
|
561
561
|
return {
|
562
562
|
init: init
|
563
563
|
}
|
564
|
-
})();
|
564
|
+
})();
|
data/lib/redmon/version.rb
CHANGED
@@ -1,3 +1,3 @@
|
|
1
1
|
module Redmon
|
2
|
-
VERSION = "0.0.
|
3
|
-
end
|
2
|
+
VERSION = "0.0.6"
|
3
|
+
end
|
data/lib/redmon/views/app.haml
CHANGED
@@ -3,18 +3,18 @@
|
|
3
3
|
%head
|
4
4
|
%title Redmon
|
5
5
|
|
6
|
-
%script(type=
|
7
|
-
%script(type=
|
8
|
-
%script(type=
|
9
|
-
%script(type=
|
10
|
-
%script(type=
|
11
|
-
%script(type=
|
12
|
-
%script(type=
|
13
|
-
%script(type=
|
6
|
+
%script(type='text/javascript' src='#{absolute_url('vendor/jquery-1.7.1.min.js')}')
|
7
|
+
%script(type='text/javascript' src='#{absolute_url('vendor/jquery-effects-core.min.js')}')
|
8
|
+
%script(type='text/javascript' src='#{absolute_url('vendor/jquery.editinplace.js')}')
|
9
|
+
%script(type='text/javascript' src='#{absolute_url('vendor/bootstrap-modal.js')}')
|
10
|
+
%script(type='text/javascript' src='#{absolute_url('vendor/d3.v3.min.js')}')
|
11
|
+
%script(type='text/javascript' src='#{absolute_url('vendor/nv.d3.min.js')}')
|
12
|
+
%script(type='text/javascript' src='#{absolute_url('vendor/terminal.js')}')
|
13
|
+
%script(type='text/javascript' src='#{absolute_url('redmon.js')}')
|
14
14
|
|
15
|
-
%link(type=
|
16
|
-
%link(type=
|
17
|
-
%link(type=
|
15
|
+
%link(type='text/css' rel='stylesheet' href='#{absolute_url('vendor/bootstrap.min.css')}')
|
16
|
+
%link(type='text/css' rel='stylesheet' href='#{absolute_url('vendor/nv.d3.css')}')
|
17
|
+
%link(type='text/css' rel='stylesheet' href='#{absolute_url('redmon.css')}')
|
18
18
|
|
19
19
|
%body
|
20
20
|
.topbar
|
@@ -22,17 +22,17 @@
|
|
22
22
|
.container
|
23
23
|
%a.brand Redmon
|
24
24
|
%ul.nav
|
25
|
-
%li.active
|
25
|
+
%li#dashboard.active
|
26
26
|
%a Dashboard
|
27
|
-
%li
|
27
|
+
%li#cli
|
28
28
|
%a CLI
|
29
|
-
%li
|
29
|
+
%li#config
|
30
30
|
%a Configuration
|
31
31
|
.pull-right
|
32
32
|
%a.brand #{redis_url}
|
33
33
|
.btns
|
34
|
-
%button.btn.primary
|
35
|
-
%button.btn.primary
|
34
|
+
%button#flush-btn.btn.primary Flush DB
|
35
|
+
%button#reset-btn.btn.primary Reset Statistics
|
36
36
|
|
37
37
|
.container.viewport
|
38
38
|
.dashboard
|
@@ -62,80 +62,80 @@
|
|
62
62
|
.widget
|
63
63
|
.headbar
|
64
64
|
%h2 Slow Log
|
65
|
-
%div{:style =>
|
66
|
-
%table.condensed-table
|
65
|
+
%div{:style => 'height:225px;overflow-y:scroll;'}
|
66
|
+
%table#slow-tbl.condensed-table
|
67
67
|
%tbody
|
68
68
|
|
69
69
|
.span6
|
70
70
|
.widget
|
71
71
|
.headbar
|
72
72
|
%h2 Info
|
73
|
-
%table.condensed-table
|
73
|
+
%table#info-tbl.condensed-table
|
74
74
|
%tbody
|
75
75
|
%tr
|
76
|
-
%td{:style =>
|
77
|
-
%td
|
76
|
+
%td{:style => 'width: 65%'} Version
|
77
|
+
%td#redis_version
|
78
78
|
%tr
|
79
79
|
%td Role
|
80
|
-
%td
|
80
|
+
%td#role
|
81
81
|
%tr
|
82
82
|
%td Uptime Days
|
83
|
-
%td
|
83
|
+
%td#uptime_in_days
|
84
84
|
%tr
|
85
85
|
%td Memory Used
|
86
|
-
%td
|
86
|
+
%td#used_memory_human
|
87
87
|
%tr
|
88
88
|
%td Memory Peak
|
89
|
-
%td
|
89
|
+
%td#used_memory_peak_human
|
90
90
|
%tr
|
91
91
|
%td Memory Fragmentation Ratio
|
92
|
-
%td
|
92
|
+
%td#mem_fragmentation_ratio
|
93
93
|
%tr
|
94
94
|
%td DB Size (Keys)
|
95
|
-
%td{:
|
95
|
+
%td#dbsize{:data => {:type => 'number'}}
|
96
96
|
%tr
|
97
97
|
%td Keyspace Hits
|
98
|
-
%td{:
|
98
|
+
%td#keyspace_hits{:data => {:type => 'number'}}
|
99
99
|
%tr
|
100
100
|
%td Keyspace Misses
|
101
|
-
%td{:
|
101
|
+
%td#keyspace_misses{:data => {:type => 'number'}}
|
102
102
|
%tr
|
103
103
|
%td Pub/Sub Channels
|
104
|
-
%td{:
|
104
|
+
%td#pubsub_channels{:data => {:type => 'number'}}
|
105
105
|
%tr
|
106
106
|
%td Pub/Sub Patterns
|
107
|
-
%td{:
|
107
|
+
%td#pubsub_patterns{:data => {:type => 'number'}}
|
108
108
|
%tr
|
109
109
|
%td Total Connections Received
|
110
|
-
%td{:
|
110
|
+
%td#total_connections_received{:data => {:type => 'number'}}
|
111
111
|
%tr
|
112
112
|
%td Total Commands Processed
|
113
|
-
%td{:
|
113
|
+
%td#total_commands_processed{:data => {:type => 'number'}}
|
114
114
|
%tr
|
115
115
|
%td Blocked Clients
|
116
|
-
%td{:
|
116
|
+
%td#blocked_clients{:data => {:type => 'number'}}
|
117
117
|
%tr
|
118
118
|
%td Connected Slaves
|
119
|
-
%td{:
|
119
|
+
%td#connected_slaves{:data => {:type => 'number'}}
|
120
120
|
%tr
|
121
121
|
%td Last Save
|
122
|
-
%td{:
|
122
|
+
%td#last_save_time{:data => {:type => 'date'}}
|
123
123
|
%tr
|
124
124
|
%td Changes Since Last Save
|
125
|
-
%td{:
|
125
|
+
%td#changes_since_last_save{:data => {:type => 'number'}}
|
126
126
|
%tr
|
127
127
|
%td AOF Enabled
|
128
|
-
%td
|
128
|
+
%td#aof_enabled
|
129
129
|
%tr
|
130
130
|
%td VM Enabled
|
131
|
-
%td
|
131
|
+
%td#vm_enabled
|
132
132
|
|
133
133
|
.cli.hidden
|
134
134
|
.content
|
135
135
|
.page-header
|
136
136
|
%h1 Command Line Interface
|
137
137
|
.row
|
138
|
-
.span21{:style =>
|
138
|
+
.span21{:style => 'height:620px'}
|
139
139
|
#terminal
|
140
140
|
|
141
141
|
.config.hidden
|
@@ -145,11 +145,11 @@
|
|
145
145
|
.widget
|
146
146
|
.headbar
|
147
147
|
%h2 Parameters
|
148
|
-
%table.condensed-table
|
148
|
+
%table#config-table.condensed-table
|
149
149
|
%tbody
|
150
150
|
- config.each do |k,v|
|
151
151
|
%tr
|
152
|
-
%td{:style =>
|
152
|
+
%td{:style => 'width: 20%'}= k
|
153
153
|
%td
|
154
154
|
.editable{:id => "#{k}"}= v
|
155
155
|
|
@@ -160,13 +160,14 @@
|
|
160
160
|
.modal-body
|
161
161
|
%p This action will, without a doubt, delete all the keys of the redis server.
|
162
162
|
.modal-footer
|
163
|
-
%button
|
164
|
-
%button
|
163
|
+
%button#flush-cancel-btn.btn.secondary Well On Second Thought
|
164
|
+
%button#flush-confirm-btn.btn.danger Just Do It Already!
|
165
165
|
|
166
166
|
:javascript
|
167
167
|
$(document).ready(function() {
|
168
168
|
Redmon.init({
|
169
169
|
pollInterval : #{poll_interval},
|
170
|
-
cliPrompt :
|
170
|
+
cliPrompt : '#{prompt}',
|
171
|
+
absoluteUrl : '#{absolute_url}'
|
171
172
|
});
|
172
|
-
});
|
173
|
+
});
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: redmon
|
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:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-04-03 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bson_ext
|
@@ -307,7 +307,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
307
307
|
version: '0'
|
308
308
|
segments:
|
309
309
|
- 0
|
310
|
-
hash:
|
310
|
+
hash: -912310078698028843
|
311
311
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
312
312
|
none: false
|
313
313
|
requirements:
|
@@ -316,7 +316,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
316
316
|
version: '0'
|
317
317
|
segments:
|
318
318
|
- 0
|
319
|
-
hash:
|
319
|
+
hash: -912310078698028843
|
320
320
|
requirements: []
|
321
321
|
rubyforge_project: redmon
|
322
322
|
rubygems_version: 1.8.23
|