redis_monitor 0.3.2 → 0.3.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +17 -0
- data/Rakefile +2 -0
- data/lib/command_line_parser.rb +17 -0
- data/lib/engine/app/controllers/application_controller.rb +8 -2
- data/lib/engine/app/controllers/notifications_controller.rb +1 -1
- data/lib/engine/app/controllers/performance_controller.rb +7 -0
- data/lib/engine/app/helpers/application_helper.rb +4 -0
- data/lib/engine/app/helpers/pagination_helper.rb +1 -1
- data/lib/engine/app/lib/backend.rb +0 -2
- data/lib/engine/app/views/layouts/redis_not_available.haml +3 -0
- data/lib/engine/app/views/notifications/index.haml +2 -0
- data/lib/engine/config/initializers/configuration.rb +4 -0
- data/lib/engine/config/initializers/redis.rb +1 -0
- data/lib/engine/config/initializers/will_paginate.rb +2 -1
- data/lib/engine/db/migrate/20140118183403_create_notifications.rb +1 -1
- data/lib/engine/db/schema.rb +2 -2
- data/lib/version.rb +1 -1
- data/redis_monitor.gemspec +2 -1
- metadata +15 -14
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 35f60167efa6552a21e54a934d0fd3fc39c5593d
|
4
|
+
data.tar.gz: ebc40b4984cba2595124b25933909e23deb2b28d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e5d036c628c417d0731147c34d0f8062b570ca166397eb1734bfa3596e06e985e594bd0d1c486a5f5788db047ddf5965218c6ff3b1de252ac5d032f4efcab535
|
7
|
+
data.tar.gz: efa9bf5529f187609333e1df2b0bee8cc093339ae8fd0e3c6787c467e3c0c91ba794be1b868188c7d602db7ae09d2c69be25ca51a8d6b55fc1a61113c1046eae
|
data/README.md
CHANGED
@@ -16,6 +16,11 @@ Then browse http://localhost:http_port
|
|
16
16
|
--editable or --not-editable can be use to indicate if the user should be able to edit the database content.
|
17
17
|
--credentials user:password if only users with credentials can access the application.
|
18
18
|
|
19
|
+
If no database config is specified a sqlite3 database will be created inside the gem. To define database configuration you can use --database-adapter, --database-host, --database-port, --database-name
|
20
|
+
|
21
|
+
For example:
|
22
|
+
|
23
|
+
$ redis_monitor --database-adapter mysql2 --database-name redis_monitor --database-host localhost --database-port 3306
|
19
24
|
|
20
25
|
For more information about the parameters:
|
21
26
|
|
@@ -27,6 +32,18 @@ You can define tasks in 'Task' tab and they will be running in background. There
|
|
27
32
|
- Watch query, it will watch the query introduced in 'trigger' field and in the result of the query changes it will create a notification.
|
28
33
|
Be careful with this one, don't watch queries too generic because it can affect to the performance of your database.
|
29
34
|
|
35
|
+
## Screenshots
|
36
|
+
|
37
|
+
![](https://dl.dropboxusercontent.com/u/434578/redis_monitor_images/1.png)
|
38
|
+
|
39
|
+
![](https://dl.dropboxusercontent.com/u/434578/redis_monitor_images/2.png)
|
40
|
+
|
41
|
+
![](https://dl.dropboxusercontent.com/u/434578/redis_monitor_images/3.png)
|
42
|
+
|
43
|
+
![](https://dl.dropboxusercontent.com/u/434578/redis_monitor_images/4.png)
|
44
|
+
|
45
|
+
![](https://dl.dropboxusercontent.com/u/434578/redis_monitor_images/5.png)
|
46
|
+
|
30
47
|
## Contributing
|
31
48
|
|
32
49
|
1. Fork it
|
data/Rakefile
CHANGED
@@ -4,6 +4,8 @@ require File.expand_path('../lib/engine/config/application', __FILE__)
|
|
4
4
|
|
5
5
|
Engine::Application.load_tasks
|
6
6
|
|
7
|
+
Rake.application.instance_variable_get('@tasks').delete('spec')
|
8
|
+
|
7
9
|
RSpec::Core::RakeTask.new(:spec) do |config|
|
8
10
|
config.rspec_opts = '--default-path lib/engine/spec'
|
9
11
|
end
|
data/lib/command_line_parser.rb
CHANGED
@@ -11,6 +11,7 @@ module RedisMonitor
|
|
11
11
|
|
12
12
|
def self.parse(argv)
|
13
13
|
arguments = DEFAULTS.dup
|
14
|
+
arguments[:database] ||= {}
|
14
15
|
|
15
16
|
parser = OptionParser.new do |op|
|
16
17
|
op.on('--http-port port', 'specify http port (default is 6369)') do |val|
|
@@ -34,6 +35,22 @@ module RedisMonitor
|
|
34
35
|
user, password = val.to_s.split(':')
|
35
36
|
arguments[:credentials] = {user: user, password: password}
|
36
37
|
end
|
38
|
+
op.on('--database-adapter database-adapter', 'database adapter (mysql2, sqlite3...)') do |val|
|
39
|
+
arguments[:database][:adapter] = val
|
40
|
+
arguments[:database_config] = true
|
41
|
+
end
|
42
|
+
op.on('--database-host database-host', 'database host') do |val|
|
43
|
+
arguments[:database][:host] = val
|
44
|
+
arguments[:database_config] = true
|
45
|
+
end
|
46
|
+
op.on('--database-port database-port', 'database port') do |val|
|
47
|
+
arguments[:database][:port] = val
|
48
|
+
arguments[:database_config] = true
|
49
|
+
end
|
50
|
+
op.on('--database-name database-name', 'database name') do |val|
|
51
|
+
arguments[:database][:database] = val
|
52
|
+
arguments[:database_config] = true
|
53
|
+
end
|
37
54
|
end
|
38
55
|
parser.parse!(argv)
|
39
56
|
|
@@ -1,8 +1,10 @@
|
|
1
1
|
class ApplicationController < ActionController::Base
|
2
|
-
# Prevent CSRF attacks by raising an exception.
|
3
|
-
# For APIs, you may want to use :null_session instead.
|
4
2
|
protect_from_forgery with: :exception
|
5
3
|
|
4
|
+
rescue_from Redis::CannotConnectError, :with => :redis_not_available
|
5
|
+
|
6
|
+
helper_method :backend
|
7
|
+
|
6
8
|
if Authentication.authentication_required?
|
7
9
|
http_basic_authenticate_with name: Authentication.credentials[:user], password: Authentication.credentials[:password]
|
8
10
|
end
|
@@ -10,4 +12,8 @@ class ApplicationController < ActionController::Base
|
|
10
12
|
def backend
|
11
13
|
@backend ||= BackendConnection.build(current_database: session[:database])
|
12
14
|
end
|
15
|
+
|
16
|
+
def redis_not_available
|
17
|
+
render 'layouts/redis_not_available'
|
18
|
+
end
|
13
19
|
end
|
@@ -2,7 +2,7 @@ require 'will_paginate-bootstrap'
|
|
2
2
|
|
3
3
|
module PaginationHelper
|
4
4
|
def bootstrap_paginate(results)
|
5
|
-
will_paginate results, renderer: BootstrapPagination::Rails
|
5
|
+
will_paginate results, renderer: BootstrapPagination::Rails, previous_label: '<<', next_label: '>>'
|
6
6
|
end
|
7
7
|
end
|
8
8
|
|
@@ -5,4 +5,8 @@ if defined?(REDIS_MONITOR_OPTS)
|
|
5
5
|
end
|
6
6
|
Authorization.setup(REDIS_MONITOR_OPTS[:permissions])
|
7
7
|
Authentication.setup(REDIS_MONITOR_OPTS[:credentials])
|
8
|
+
|
9
|
+
if REDIS_MONITOR_OPTS[:database_config]
|
10
|
+
ActiveRecord::Base.establish_connection(REDIS_MONITOR_OPTS[:database])
|
11
|
+
end
|
8
12
|
end
|
@@ -0,0 +1 @@
|
|
1
|
+
require 'redis'
|
@@ -1 +1,2 @@
|
|
1
|
-
require 'will_paginate/array'
|
1
|
+
require 'will_paginate/array'
|
2
|
+
require 'will_paginate/active_record'
|
data/lib/engine/db/schema.rb
CHANGED
@@ -27,11 +27,11 @@ ActiveRecord::Schema.define(version: 20140118183403) do
|
|
27
27
|
t.datetime "updated_at"
|
28
28
|
end
|
29
29
|
|
30
|
-
add_index "delayed_jobs", ["priority", "run_at"], name: "delayed_jobs_priority"
|
30
|
+
add_index "delayed_jobs", ["priority", "run_at"], name: "delayed_jobs_priority", using: :btree
|
31
31
|
|
32
32
|
create_table "notifications", force: true do |t|
|
33
33
|
t.string "reporter", default: ""
|
34
|
-
t.text "message"
|
34
|
+
t.text "message"
|
35
35
|
t.datetime "created_at"
|
36
36
|
t.datetime "updated_at"
|
37
37
|
end
|
data/lib/version.rb
CHANGED
data/redis_monitor.gemspec
CHANGED
@@ -24,13 +24,14 @@ Gem::Specification.new do |spec|
|
|
24
24
|
|
25
25
|
if defined?(JRUBY_VERSION)
|
26
26
|
spec.add_runtime_dependency 'activerecord-jdbcsqlite3-adapter'
|
27
|
+
spec.add_runtime_dependency 'activerecord-jdbcmysql-adapter'
|
27
28
|
else
|
28
29
|
spec.add_runtime_dependency 'sqlite3'
|
30
|
+
spec.add_runtime_dependency 'mysql2'
|
29
31
|
end
|
30
32
|
|
31
33
|
spec.add_runtime_dependency 'jquery-rails'
|
32
34
|
spec.add_runtime_dependency 'haml', '~> 4.0'
|
33
|
-
spec.add_runtime_dependency 'twitter-bootstrap-rails'
|
34
35
|
spec.add_runtime_dependency 'will_paginate', '~> 3.0.5'
|
35
36
|
spec.add_runtime_dependency 'will_paginate-bootstrap'
|
36
37
|
spec.add_runtime_dependency 'delayed_job_active_record'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: redis_monitor
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Javier Jimenez
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-03-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: redis
|
@@ -53,7 +53,7 @@ dependencies:
|
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
|
-
name:
|
56
|
+
name: mysql2
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - '>='
|
@@ -67,33 +67,33 @@ dependencies:
|
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
|
-
name:
|
70
|
+
name: jquery-rails
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- -
|
73
|
+
- - '>='
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: '
|
75
|
+
version: '0'
|
76
76
|
type: :runtime
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- -
|
80
|
+
- - '>='
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: '
|
82
|
+
version: '0'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
|
-
name:
|
84
|
+
name: haml
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- -
|
87
|
+
- - ~>
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version: '0'
|
89
|
+
version: '4.0'
|
90
90
|
type: :runtime
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
|
-
- -
|
94
|
+
- - ~>
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version: '0'
|
96
|
+
version: '4.0'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: will_paginate
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
@@ -261,6 +261,7 @@ files:
|
|
261
261
|
- lib/engine/app/views/content/search.haml
|
262
262
|
- lib/engine/app/views/info/index.haml
|
263
263
|
- lib/engine/app/views/layouts/application.haml
|
264
|
+
- lib/engine/app/views/layouts/redis_not_available.haml
|
264
265
|
- lib/engine/app/views/notifications/_notification.haml
|
265
266
|
- lib/engine/app/views/notifications/index.haml
|
266
267
|
- lib/engine/app/views/performance/check.haml
|
@@ -289,6 +290,7 @@ files:
|
|
289
290
|
- lib/engine/config/initializers/haml.rb
|
290
291
|
- lib/engine/config/initializers/inflections.rb
|
291
292
|
- lib/engine/config/initializers/mime_types.rb
|
293
|
+
- lib/engine/config/initializers/redis.rb
|
292
294
|
- lib/engine/config/initializers/secret_token.rb
|
293
295
|
- lib/engine/config/initializers/session_store.rb
|
294
296
|
- lib/engine/config/initializers/will_paginate.rb
|
@@ -337,7 +339,6 @@ files:
|
|
337
339
|
- lib/engine/spec/models/watch_key_task_spec.rb
|
338
340
|
- lib/engine/spec/models/watch_query_task_spec.rb
|
339
341
|
- lib/engine/spec/spec_helper.rb
|
340
|
-
- lib/engine/tmp/.keep
|
341
342
|
- lib/engine/vendor/assets/javascripts/.keep
|
342
343
|
- lib/engine/vendor/assets/stylesheets/.keep
|
343
344
|
- lib/redis_monitor.rb
|