redis_dashboard 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 01cf7ec8c8f67551c2f395040884add013311496
4
+ data.tar.gz: 0626ab5052072ca6fb5832ee0d72a6326d486367
5
+ SHA512:
6
+ metadata.gz: 388ad209fbd8fe9541a7496a164a511fee94d0e41ddc4b5d9cbce3fbab3e3cfe6cbef9e53a6b423c95926bc1260ae09b2dc67e3b570d61d3e6a997a80ecc6177
7
+ data.tar.gz: 7ea7a11a63039d80701f45148ca3432e61f4e51a3d764e19267f2293f10a2fd05547e35447e53973a2ff73d76507b9fe9763bd76b78a2f9c0dd7930e66f4b8df
data/.gitignore ADDED
@@ -0,0 +1,2 @@
1
+ .sass-cache
2
+ **/.DS_Store
data/Gemfile ADDED
@@ -0,0 +1,5 @@
1
+ source "https://rubygems.org"
2
+
3
+ gem "sinatra"
4
+ gem "redis"
5
+ gem "sass"
data/Gemfile.lock ADDED
@@ -0,0 +1,24 @@
1
+ GEM
2
+ remote: https://rubygems.org/
3
+ specs:
4
+ rack (1.6.6)
5
+ rack-protection (1.5.3)
6
+ rack
7
+ redis (3.3.3)
8
+ sass (3.4.23)
9
+ sinatra (1.4.8)
10
+ rack (~> 1.5)
11
+ rack-protection (~> 1.4)
12
+ tilt (>= 1.3, < 3)
13
+ tilt (2.0.7)
14
+
15
+ PLATFORMS
16
+ ruby
17
+
18
+ DEPENDENCIES
19
+ redis
20
+ sass
21
+ sinatra
22
+
23
+ BUNDLED WITH
24
+ 1.15.0
data/README.md ADDED
@@ -0,0 +1,38 @@
1
+ # Redis Dashboard
2
+
3
+ It's a Sinatra web app showing monitoring informations about your Redis server.
4
+ You can run it in standalone or inside your Rails app.
5
+
6
+ ## Installation inside a Rails app
7
+
8
+ Add this line in your Gemfile:
9
+ ```ruby
10
+ gem "redis_dashboard"
11
+ ```
12
+
13
+ In your terminal run the following command:
14
+ ```shell
15
+ bundle install
16
+ ```
17
+
18
+ Then mount the app from `config/routes.rb`:
19
+ ```ruby
20
+ mount RedisDashboard::Application, at: "redis_dashboard"
21
+ ```
22
+
23
+ Specify the Redis URLs in `config/redis_dashboard.rb`:
24
+ ```ruby
25
+ RedisDashboard.urls = ["redis://localhost"]
26
+ ```
27
+
28
+ Finally visit http://localhost/redis_dashboar/.
29
+
30
+ ## Authentication
31
+
32
+ To protect your dashboard you can setup a basic HTTP authentication:
33
+
34
+ ```ruby
35
+ RedisDashboard::Application.use(Rack::Auth::Basic) do |user, password|
36
+ user == "USER" && password == "PASSWORD"
37
+ end
38
+ ```
@@ -0,0 +1,57 @@
1
+ require "sinatra/base"
2
+ require "redis"
3
+ require "uri"
4
+
5
+ class RedisDashboard::Application < Sinatra::Base
6
+ after { client.close }
7
+
8
+ get "/" do
9
+ erb(:index, locals: {clients: clients})
10
+ end
11
+
12
+ get "/info" do
13
+ erb(:info, locals: {info: client.info})
14
+ end
15
+
16
+ get "/config" do
17
+ erb(:config, locals: {config: client.config})
18
+ end
19
+
20
+ get "/clients" do
21
+ erb(:clients, locals: {clients: client.clients})
22
+ end
23
+
24
+ get "/slowlog" do
25
+ erb(:slowlog, locals: {commands: client.slow_commands})
26
+ end
27
+
28
+ get "/application.css" do
29
+ scss(:application, style: :expanded)
30
+ end
31
+
32
+ def client
33
+ @client ||= RedisDashboard::Client.new(RedisDashboard.urls[redis_id])
34
+ end
35
+
36
+ def clients
37
+ RedisDashboard.urls.map { |url| RedisDashboard::Client.new(url) }
38
+ end
39
+
40
+ helpers do
41
+ def page_title
42
+ "#{URI(client.url).host} (#{client.info["role"]})"
43
+ end
44
+
45
+ def epoch_to_short_date_time(epoch)
46
+ Time.at(epoch).strftime("%b %d %H:%M")
47
+ end
48
+
49
+ def redis_id
50
+ params[:id].to_i
51
+ end
52
+
53
+ def active_page?(path='')
54
+ request.path_info == '/' + path
55
+ end
56
+ end
57
+ end
@@ -0,0 +1,51 @@
1
+ class RedisDashboard::Client
2
+ attr_reader :url, :connection
3
+
4
+ def initialize(url)
5
+ @url = url
6
+ end
7
+
8
+ def clients
9
+ connection.client.call([:client, "list"]).split("\n").map do |line|
10
+ line.split(" ").reduce({}) do |hash, str|
11
+ pair = str.split("=")
12
+ hash[pair[0]] = pair[1]
13
+ hash
14
+ end
15
+ end
16
+ end
17
+
18
+ def config
19
+ hash = {}
20
+ array = connection.config("get", "*")
21
+ while (pair = array.slice!(0, 2)).any?
22
+ hash[pair.first] = pair.last
23
+ end
24
+ hash
25
+ end
26
+
27
+ def info
28
+ connection.info
29
+ end
30
+
31
+ def close
32
+ connection.close if connection
33
+ end
34
+
35
+ def slow_commands(length = 128) # 128 is the default slowlog-max-len
36
+ connection.slowlog("get", length).map do |entry|
37
+ cmd = RedisDashboard::Command.new
38
+ cmd.id = entry[0]
39
+ cmd.timestamp = entry[1]
40
+ cmd.microseconds = entry[2]
41
+ cmd.command = entry[3]
42
+ cmd
43
+ end.sort{ |left, right| right.microseconds <=> left.microseconds }
44
+ end
45
+
46
+ private
47
+
48
+ def connection
49
+ @connection ||= Redis.new(url: url)
50
+ end
51
+ end
@@ -0,0 +1,3 @@
1
+ class RedisDashboard::Command
2
+ attr_accessor :id, :timestamp, :microseconds, :command
3
+ end
@@ -0,0 +1,14 @@
1
+ @import "stylesheets/colors";
2
+
3
+ @import "stylesheets/normalize";
4
+
5
+
6
+
7
+ @import "stylesheets/base";
8
+ @import "stylesheets/typography";
9
+ @import "stylesheets/link";
10
+
11
+ @import "stylesheets/table";
12
+
13
+ @import "stylesheets/page";
14
+ @import "stylesheets/server-card";
@@ -0,0 +1,16 @@
1
+ <div class="table">
2
+ <table>
3
+ <thead>
4
+ <% for key in (keys = clients.first.keys) %>
5
+ <th><%= key %></th>
6
+ <% end %>
7
+ </thead>
8
+ <% for client in clients %>
9
+ <tr>
10
+ <% for key in keys %>
11
+ <td><%= client[key] %></td>
12
+ <% end %>
13
+ </tr>
14
+ <% end %>
15
+ </table>
16
+ </div>
@@ -0,0 +1,10 @@
1
+ <div class="table">
2
+ <table>
3
+ <% for (key, value) in config %>
4
+ <tr>
5
+ <td class="key"><%= key %></td>
6
+ <td><%= value %></td>
7
+ </tr>
8
+ <% end %>
9
+ </table>
10
+ </div>
@@ -0,0 +1,24 @@
1
+ <div class="server-list">
2
+ <% clients.each_with_index do |client, index| %>
3
+ <% info = client.info %>
4
+ <div class="server-card">
5
+ <div class="server-card-title">
6
+ <a href="<%= url("info?id=#{index}") %>"><%= URI(client.url).host %> (<%= info["role"] %>)</a>
7
+ </div>
8
+ <div class="server-card-content">
9
+ <div>
10
+ <span class="label">Connections</span>
11
+ <span><%= info["connected_clients"] %></span>
12
+ </div>
13
+ <div>
14
+ <span class="label">Memory</span>
15
+ <span><%= info["used_memory_human"] %></span>
16
+ </div>
17
+ <div>
18
+ <span class="label">Commands per second</span>
19
+ <span><%= info["instantaneous_ops_per_sec"] %></span>
20
+ </div>
21
+ </div>
22
+ </div>
23
+ <% end %>
24
+ </div>
@@ -0,0 +1,16 @@
1
+ <div class="table">
2
+ <table>
3
+ <% for (key,value) in info %>
4
+ <tr>
5
+ <td class="key"><%= key %></td>
6
+ <td><%= value %></td>
7
+ </tr>
8
+ <% end %>
9
+ </table>
10
+ </div>
11
+
12
+ <a href="https://redis.io/commands/info">
13
+ <svg viewBox="0 0 24 24">
14
+ <path d="M14,3V5H17.59L7.76,14.83L9.17,16.24L19,6.41V10H21V3M19,19H5V5H12V3H5C3.89,3 3,3.9 3,5V19A2,2 0 0,0 5,21H19A2,2 0 0,0 21,19V12H19V19Z" />
15
+ </svg> Redis documentation
16
+ </a>
@@ -0,0 +1,35 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>Redis Dashboard</title>
5
+ <link rel="stylesheet" href="application.css">
6
+ </head>
7
+
8
+ <body>
9
+ <div class="page">
10
+ <div class="page-header">
11
+ <h2 class="page-title">
12
+ <a href="<%= url("/") %>" class="<%= 'active' if active_page?('') %>">Redis Dashboard</a>
13
+ <% if params[:id] %>
14
+ <span><%= page_title %></span>
15
+ <% end %>
16
+ </h2>
17
+ <% if params[:id] %>
18
+ <div class="page-menu">
19
+ <a class="page-menu-item <%= 'active' if active_page?('info') %>" href="<%= url("/info?id=#{redis_id}") %>">Info</a>
20
+ <a class="page-menu-item <%= 'active' if active_page?('config') %>" href="<%= url("/config?id=#{redis_id}") %>">Config</a>
21
+ <a class="page-menu-item <%= 'active' if active_page?('clients') %>" href="<%= url("/clients?id=#{redis_id}") %>">Clients</a>
22
+ <a class="page-menu-item <%= 'active' if active_page?('slowlog') %>" href="<%= url("/slowlog?id=#{redis_id}") %>">Slowlog</a>
23
+ </div>
24
+ <% end %>
25
+ </div>
26
+ <%= yield %>
27
+ <div class="page-footer">
28
+ Made by <a href="https://basesecrete.com/en/">Base Secrète</a>. MIT License. <a href="https://github.com/BaseSecrete/redis_dashboard">Fork on GitHub</a>.
29
+ <div class="rorvswild">
30
+ Rails developer? Check out <a href="https://rorvswild.com">RoRvsWild</a>, our Ruby on Rails application monitoring tool.
31
+ </div>
32
+ </div>
33
+ </div>
34
+ </body>
35
+ </html>
@@ -0,0 +1,19 @@
1
+ <div class="table">
2
+ <table>
3
+ <thead>
4
+ <th>ID</th>
5
+ <th>At</th>
6
+ <th>Duration</th>
7
+ <th>Command</th>
8
+ </thead>
9
+
10
+ <% for cmd in commands %>
11
+ <tr>
12
+ <td><%= cmd.id %></td>
13
+ <td><%= epoch_to_short_date_time cmd.timestamp %></td>
14
+ <td><%= cmd.microseconds %></td>
15
+ <td><%= cmd.command.join(" ") %></td>
16
+ </tr>
17
+ <% end %>
18
+ </table>
19
+ </div>
@@ -0,0 +1,19 @@
1
+ html,
2
+ body {
3
+ box-sizing: border-box;
4
+ font-size: 14px;
5
+ overflow-x: hidden;
6
+ width: 100%;
7
+ }
8
+
9
+ body {
10
+ color: $color-dark;
11
+ font-family: 'Menlo', monospace;
12
+ font-size: 15px;
13
+ font-weight: 300;
14
+ letter-spacing: 0;
15
+ line-height: 24px;
16
+ padding:0;
17
+ margin:0;
18
+ background: $color-lighter;
19
+ }
@@ -0,0 +1,6 @@
1
+ $color-redis: #d82c20;
2
+ $color-redis-dark: #a41e11;
3
+ $color-dark: #574f4e;
4
+ $color-light: #f2f1f0;
5
+ $color-lighter: #f7f6f6;
6
+ $color-white: #fff;
@@ -0,0 +1,24 @@
1
+
2
+ // Link
3
+ // ––––––––––––––––––––––––––––––––––––––––––––––––––
4
+
5
+ a {
6
+ color: $color-redis;
7
+ text-decoration: none;
8
+ }
9
+ a:focus,
10
+ a:hover {
11
+ color: $color-redis-dark;
12
+ }
13
+
14
+ a svg {
15
+ width:15px;
16
+ height:15px;
17
+ fill: $color-redis;
18
+ position:
19
+ relative;
20
+ top: 3px;
21
+ }
22
+ a svg {
23
+ fill: $color-redis-dark;
24
+ }
@@ -0,0 +1,461 @@
1
+ /*! normalize.css v5.0.0 | MIT License | github.com/necolas/normalize.css */
2
+
3
+ /**
4
+ * 1. Change the default font family in all browsers (opinionated).
5
+ * 2. Correct the line height in all browsers.
6
+ * 3. Prevent adjustments of font size after orientation changes in
7
+ * IE on Windows Phone and in iOS.
8
+ */
9
+
10
+ /* Document
11
+ ========================================================================== */
12
+
13
+ html {
14
+ font-family: sans-serif; /* 1 */
15
+ line-height: 1.15; /* 2 */
16
+ -ms-text-size-adjust: 100%; /* 3 */
17
+ -webkit-text-size-adjust: 100%; /* 3 */
18
+ }
19
+
20
+ /* Sections
21
+ ========================================================================== */
22
+
23
+ /**
24
+ * Remove the margin in all browsers (opinionated).
25
+ */
26
+
27
+ body {
28
+ margin: 0;
29
+ }
30
+
31
+ /**
32
+ * Add the correct display in IE 9-.
33
+ */
34
+
35
+ article,
36
+ aside,
37
+ footer,
38
+ header,
39
+ nav,
40
+ section {
41
+ display: block;
42
+ }
43
+
44
+ /**
45
+ * Correct the font size and margin on `h1` elements within `section` and
46
+ * `article` contexts in Chrome, Firefox, and Safari.
47
+ */
48
+
49
+ h1 {
50
+ font-size: 2em;
51
+ margin: 0.67em 0;
52
+ }
53
+
54
+ /* Grouping content
55
+ ========================================================================== */
56
+
57
+ /**
58
+ * Add the correct display in IE 9-.
59
+ * 1. Add the correct display in IE.
60
+ */
61
+
62
+ figcaption,
63
+ figure,
64
+ main { /* 1 */
65
+ display: block;
66
+ }
67
+
68
+ /**
69
+ * Add the correct margin in IE 8.
70
+ */
71
+
72
+ figure {
73
+ margin: 1em 40px;
74
+ }
75
+
76
+ /**
77
+ * 1. Add the correct box sizing in Firefox.
78
+ * 2. Show the overflow in Edge and IE.
79
+ */
80
+
81
+ hr {
82
+ box-sizing: content-box; /* 1 */
83
+ height: 0; /* 1 */
84
+ overflow: visible; /* 2 */
85
+ }
86
+
87
+ /**
88
+ * 1. Correct the inheritance and scaling of font size in all browsers.
89
+ * 2. Correct the odd `em` font sizing in all browsers.
90
+ */
91
+
92
+ pre {
93
+ font-family: monospace, monospace; /* 1 */
94
+ font-size: 1em; /* 2 */
95
+ }
96
+
97
+ /* Text-level semantics
98
+ ========================================================================== */
99
+
100
+ /**
101
+ * 1. Remove the gray background on active links in IE 10.
102
+ * 2. Remove gaps in links underline in iOS 8+ and Safari 8+.
103
+ */
104
+
105
+ a {
106
+ background-color: transparent; /* 1 */
107
+ -webkit-text-decoration-skip: objects; /* 2 */
108
+ }
109
+
110
+ /**
111
+ * Remove the outline on focused links when they are also active or hovered
112
+ * in all browsers (opinionated).
113
+ */
114
+
115
+ a:active,
116
+ a:hover {
117
+ outline-width: 0;
118
+ }
119
+
120
+ /**
121
+ * 1. Remove the bottom border in Firefox 39-.
122
+ * 2. Add the correct text decoration in Chrome, Edge, IE, Opera, and Safari.
123
+ */
124
+
125
+ abbr[title] {
126
+ border-bottom: none; /* 1 */
127
+ text-decoration: underline; /* 2 */
128
+ text-decoration: underline dotted; /* 2 */
129
+ }
130
+
131
+ /**
132
+ * Prevent the duplicate application of `bolder` by the next rule in Safari 6.
133
+ */
134
+
135
+ b,
136
+ strong {
137
+ font-weight: inherit;
138
+ }
139
+
140
+ /**
141
+ * Add the correct font weight in Chrome, Edge, and Safari.
142
+ */
143
+
144
+ b,
145
+ strong {
146
+ font-weight: bolder;
147
+ }
148
+
149
+ /**
150
+ * 1. Correct the inheritance and scaling of font size in all browsers.
151
+ * 2. Correct the odd `em` font sizing in all browsers.
152
+ */
153
+
154
+ code,
155
+ kbd,
156
+ samp {
157
+ font-family: monospace, monospace; /* 1 */
158
+ font-size: 1em; /* 2 */
159
+ }
160
+
161
+ /**
162
+ * Add the correct font style in Android 4.3-.
163
+ */
164
+
165
+ dfn {
166
+ font-style: italic;
167
+ }
168
+
169
+ /**
170
+ * Add the correct background and color in IE 9-.
171
+ */
172
+
173
+ mark {
174
+ background-color: #ff0;
175
+ color: #000;
176
+ }
177
+
178
+ /**
179
+ * Add the correct font size in all browsers.
180
+ */
181
+
182
+ small {
183
+ font-size: 80%;
184
+ }
185
+
186
+ /**
187
+ * Prevent `sub` and `sup` elements from affecting the line height in
188
+ * all browsers.
189
+ */
190
+
191
+ sub,
192
+ sup {
193
+ font-size: 75%;
194
+ line-height: 0;
195
+ position: relative;
196
+ vertical-align: baseline;
197
+ }
198
+
199
+ sub {
200
+ bottom: -0.25em;
201
+ }
202
+
203
+ sup {
204
+ top: -0.5em;
205
+ }
206
+
207
+ /* Embedded content
208
+ ========================================================================== */
209
+
210
+ /**
211
+ * Add the correct display in IE 9-.
212
+ */
213
+
214
+ audio,
215
+ video {
216
+ display: inline-block;
217
+ }
218
+
219
+ /**
220
+ * Add the correct display in iOS 4-7.
221
+ */
222
+
223
+ audio:not([controls]) {
224
+ display: none;
225
+ height: 0;
226
+ }
227
+
228
+ /**
229
+ * Remove the border on images inside links in IE 10-.
230
+ */
231
+
232
+ img {
233
+ border-style: none;
234
+ }
235
+
236
+ /**
237
+ * Hide the overflow in IE.
238
+ */
239
+
240
+ svg:not(:root) {
241
+ overflow: hidden;
242
+ }
243
+
244
+ /* Forms
245
+ ========================================================================== */
246
+
247
+ /**
248
+ * 1. Change the font styles in all browsers (opinionated).
249
+ * 2. Remove the margin in Firefox and Safari.
250
+ */
251
+
252
+ button,
253
+ input,
254
+ optgroup,
255
+ select,
256
+ textarea {
257
+ font-family: sans-serif; /* 1 */
258
+ font-size: 100%; /* 1 */
259
+ line-height: 1.15; /* 1 */
260
+ margin: 0; /* 2 */
261
+ }
262
+
263
+ /**
264
+ * Show the overflow in IE.
265
+ * 1. Show the overflow in Edge.
266
+ */
267
+
268
+ button,
269
+ input { /* 1 */
270
+ overflow: visible;
271
+ }
272
+
273
+ /**
274
+ * Remove the inheritance of text transform in Edge, Firefox, and IE.
275
+ * 1. Remove the inheritance of text transform in Firefox.
276
+ */
277
+
278
+ button,
279
+ select { /* 1 */
280
+ text-transform: none;
281
+ }
282
+
283
+ /**
284
+ * 1. Prevent a WebKit bug where (2) destroys native `audio` and `video`
285
+ * controls in Android 4.
286
+ * 2. Correct the inability to style clickable types in iOS and Safari.
287
+ */
288
+
289
+ button,
290
+ html [type="button"], /* 1 */
291
+ [type="reset"],
292
+ [type="submit"] {
293
+ -webkit-appearance: button; /* 2 */
294
+ }
295
+
296
+ /**
297
+ * Remove the inner border and padding in Firefox.
298
+ */
299
+
300
+ button::-moz-focus-inner,
301
+ [type="button"]::-moz-focus-inner,
302
+ [type="reset"]::-moz-focus-inner,
303
+ [type="submit"]::-moz-focus-inner {
304
+ border-style: none;
305
+ padding: 0;
306
+ }
307
+
308
+ /**
309
+ * Restore the focus styles unset by the previous rule.
310
+ */
311
+
312
+ button:-moz-focusring,
313
+ [type="button"]:-moz-focusring,
314
+ [type="reset"]:-moz-focusring,
315
+ [type="submit"]:-moz-focusring {
316
+ outline: 1px dotted ButtonText;
317
+ }
318
+
319
+ /**
320
+ * Change the border, margin, and padding in all browsers (opinionated).
321
+ */
322
+
323
+ fieldset {
324
+ border: 1px solid #c0c0c0;
325
+ margin: 0 2px;
326
+ padding: 0.35em 0.625em 0.75em;
327
+ }
328
+
329
+ /**
330
+ * 1. Correct the text wrapping in Edge and IE.
331
+ * 2. Correct the color inheritance from `fieldset` elements in IE.
332
+ * 3. Remove the padding so developers are not caught out when they zero out
333
+ * `fieldset` elements in all browsers.
334
+ */
335
+
336
+ legend {
337
+ box-sizing: border-box; /* 1 */
338
+ color: inherit; /* 2 */
339
+ display: table; /* 1 */
340
+ max-width: 100%; /* 1 */
341
+ padding: 0; /* 3 */
342
+ white-space: normal; /* 1 */
343
+ }
344
+
345
+ /**
346
+ * 1. Add the correct display in IE 9-.
347
+ * 2. Add the correct vertical alignment in Chrome, Firefox, and Opera.
348
+ */
349
+
350
+ progress {
351
+ display: inline-block; /* 1 */
352
+ vertical-align: baseline; /* 2 */
353
+ }
354
+
355
+ /**
356
+ * Remove the default vertical scrollbar in IE.
357
+ */
358
+
359
+ textarea {
360
+ overflow: auto;
361
+ }
362
+
363
+ /**
364
+ * 1. Add the correct box sizing in IE 10-.
365
+ * 2. Remove the padding in IE 10-.
366
+ */
367
+
368
+ [type="checkbox"],
369
+ [type="radio"] {
370
+ box-sizing: border-box; /* 1 */
371
+ padding: 0; /* 2 */
372
+ }
373
+
374
+ /**
375
+ * Correct the cursor style of increment and decrement buttons in Chrome.
376
+ */
377
+
378
+ [type="number"]::-webkit-inner-spin-button,
379
+ [type="number"]::-webkit-outer-spin-button {
380
+ height: auto;
381
+ }
382
+
383
+ /**
384
+ * 1. Correct the odd appearance in Chrome and Safari.
385
+ * 2. Correct the outline style in Safari.
386
+ */
387
+
388
+ [type="search"] {
389
+ -webkit-appearance: textfield; /* 1 */
390
+ outline-offset: -2px; /* 2 */
391
+ }
392
+
393
+ /**
394
+ * Remove the inner padding and cancel buttons in Chrome and Safari on macOS.
395
+ */
396
+
397
+ [type="search"]::-webkit-search-cancel-button,
398
+ [type="search"]::-webkit-search-decoration {
399
+ -webkit-appearance: none;
400
+ }
401
+
402
+ /**
403
+ * 1. Correct the inability to style clickable types in iOS and Safari.
404
+ * 2. Change font properties to `inherit` in Safari.
405
+ */
406
+
407
+ ::-webkit-file-upload-button {
408
+ -webkit-appearance: button; /* 1 */
409
+ font: inherit; /* 2 */
410
+ }
411
+
412
+ /* Interactive
413
+ ========================================================================== */
414
+
415
+ /*
416
+ * Add the correct display in IE 9-.
417
+ * 1. Add the correct display in Edge, IE, and Firefox.
418
+ */
419
+
420
+ details, /* 1 */
421
+ menu {
422
+ display: block;
423
+ }
424
+
425
+ /*
426
+ * Add the correct display in all browsers.
427
+ */
428
+
429
+ summary {
430
+ display: list-item;
431
+ }
432
+
433
+ /* Scripting
434
+ ========================================================================== */
435
+
436
+ /**
437
+ * Add the correct display in IE 9-.
438
+ */
439
+
440
+ canvas {
441
+ display: inline-block;
442
+ }
443
+
444
+ /**
445
+ * Add the correct display in IE.
446
+ */
447
+
448
+ template {
449
+ display: none;
450
+ }
451
+
452
+ /* Hidden
453
+ ========================================================================== */
454
+
455
+ /**
456
+ * Add the correct display in IE 10-.
457
+ */
458
+
459
+ [hidden] {
460
+ display: none;
461
+ }
@@ -0,0 +1,71 @@
1
+ .page {
2
+ margin: 0px auto;
3
+ overflow-x: hidden;
4
+ max-width: 1480px;
5
+ padding: 0 24px;
6
+ }
7
+ .page-header {
8
+ display: flex;
9
+ flex-wrap: wrap;
10
+ }
11
+
12
+ .page-header a {
13
+ font-family: sans-serif;
14
+ font-size: .694rem;
15
+ font-weight: 400;
16
+ text-transform: uppercase;
17
+ letter-spacing: 2px;
18
+ padding: 0 12px;
19
+ background: $color-redis;
20
+ color: $color-white;
21
+
22
+ border-bottom: 1px solid $color-light;
23
+ }
24
+ .page-header a:hover {
25
+ background: $color-redis-dark;
26
+ }
27
+ .page-header a.active {
28
+ color: $color-redis;
29
+ background: $color-white;
30
+ font-weight: 700;
31
+ }
32
+
33
+ .page-title {
34
+ font-size: 1rem;
35
+ font-weight: 400;
36
+ margin: 0 auto 24px 0;
37
+ line-height: 48px;
38
+ padding: 0;
39
+ display: flex;
40
+ flex-wrap: wrap;
41
+ margin-right: auto;
42
+ box-shadow: 0 4px 12px 0px $color-light;
43
+ }
44
+
45
+ .page-title span {
46
+ display: inline-block;
47
+ background-color: $color-white;
48
+ padding: 0 12px;
49
+ border-bottom: 1px solid $color-light;
50
+ }
51
+
52
+ .page-menu {
53
+ display: flex;
54
+ flex-wrap: nowrap;
55
+ line-height: 48px;
56
+ margin-bottom: 24px;
57
+ box-shadow: 0 4px 12px 0px $color-light;
58
+ }
59
+
60
+ div.table {
61
+ width: 100%;
62
+ background: $color-white;
63
+ overflow-x: scroll;
64
+ margin-bottom: 24px;
65
+ box-shadow: 0 4px 12px 0px $color-light;
66
+ }
67
+
68
+ .page-footer {
69
+ margin-top: 24px;
70
+ font-size: .833rem;
71
+ }
@@ -0,0 +1,37 @@
1
+ .server-list {
2
+ display: flex;
3
+ flex-wrap: wrap;
4
+ margin: -24px 0 0 -24px;
5
+ }
6
+ .server-card {
7
+ background: $color-white;
8
+ padding: 0;
9
+ flex: 1 1 480px;
10
+ margin: 24px 0 0 24px;
11
+ box-shadow: 0 4px 12px 0px $color-light;
12
+ }
13
+ .server-card-title {
14
+ font-size: 1.2rem;
15
+ margin-right: auto;
16
+ padding: 24px;
17
+ }
18
+ .server-card-title a {
19
+ text-decoration: underline;
20
+ }
21
+ .server-card-content {
22
+ display: flex;
23
+ flex-wrap: nowrap;
24
+ }
25
+ .server-card-content > div {
26
+ margin:0;
27
+ padding: 0 24px 24px;
28
+ flex: 1;
29
+ }
30
+ .server-card-content .label {
31
+ font-family: sans-serif;
32
+ text-transform: uppercase;
33
+ font-size: .574rem;
34
+ letter-spacing: 2px;
35
+ font-weight: 400;
36
+ display: block;
37
+ }
@@ -0,0 +1,40 @@
1
+
2
+ // Table
3
+ // ––––––––––––––––––––––––––––––––––––––––––––––––––
4
+
5
+ table {
6
+ border-spacing: 0;
7
+ width: 100%;
8
+ overflow-x: scroll;
9
+ }
10
+
11
+ tr:hover {
12
+ background: $color-light;
13
+ }
14
+ thead tr:hover {
15
+ background: $color-white;
16
+ }
17
+
18
+ td,
19
+ th {
20
+ border-bottom: 1px solid $color-light;
21
+ padding: 12px 12px 11px;
22
+ text-align: left;
23
+ line-height: 24px;
24
+ }
25
+
26
+ th {
27
+ font-weight: 400;
28
+ font-family: sans-serif;
29
+ font-size: .694rem;
30
+ letter-spacing: 2px;
31
+ text-transform: uppercase;
32
+ }
33
+
34
+ td.key {
35
+ text-transform: uppercase;
36
+ font-family: sans-serif;
37
+ font-weight: 400;
38
+ font-size: .694rem;
39
+ letter-spacing: 2px;
40
+ }
@@ -0,0 +1,25 @@
1
+
2
+ // Typography
3
+ // ––––––––––––––––––––––––––––––––––––––––––––––––––
4
+
5
+ b,
6
+ strong {
7
+ font-weight: bold;
8
+ }
9
+
10
+ p {
11
+ margin-top: 0;
12
+ }
13
+
14
+ h1,
15
+ h2 {
16
+ font-weight: 300;
17
+ letter-spacing: 0;
18
+ margin-bottom: 2.0rem;
19
+ margin-top: 0;
20
+ }
21
+ h2 {
22
+ font-size: 1.728rem;
23
+ font-weight: 700;
24
+ line-height: 2;
25
+ }
@@ -0,0 +1,13 @@
1
+ module RedisDashboard
2
+ def self.urls=(array)
3
+ @urls = array
4
+ end
5
+
6
+ def self.urls
7
+ @urls ||= ["redis://localhost"]
8
+ end
9
+ end
10
+
11
+ require "redis_dashboard/client"
12
+ require "redis_dashboard/command"
13
+ require "redis_dashboard/application"
@@ -0,0 +1,20 @@
1
+ lib = File.expand_path('../lib', __FILE__)
2
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
+
4
+ Gem::Specification.new do |spec|
5
+ spec.name = "redis_dashboard"
6
+ spec.version = "0.1.0"
7
+ spec.authors = ["Alexis Bernard"]
8
+ spec.email = ["alexis@bernard.io"]
9
+ spec.summary = "Sinatra app to monitor Redis servers."
10
+ spec.description = "Sinatra app to monitor Redis servers"
11
+ spec.homepage = "https://github.com/BaseSecrete/redis_dashboard"
12
+ spec.license = "MIT"
13
+
14
+ spec.files = `git ls-files -z`.split("\x0")
15
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
16
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
17
+ spec.require_paths = ["lib"]
18
+
19
+ spec.add_runtime_dependency "sinatra"
20
+ end
data/start.rb ADDED
@@ -0,0 +1,4 @@
1
+ $LOAD_PATH << File.expand_path(File.dirname(__FILE__)) + "/lib"
2
+
3
+ require "redis_dashboard"
4
+ RedisDashboard::Application.run!
metadata ADDED
@@ -0,0 +1,84 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: redis_dashboard
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Alexis Bernard
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2017-06-06 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: sinatra
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ description: Sinatra app to monitor Redis servers
28
+ email:
29
+ - alexis@bernard.io
30
+ executables: []
31
+ extensions: []
32
+ extra_rdoc_files: []
33
+ files:
34
+ - ".gitignore"
35
+ - Gemfile
36
+ - Gemfile.lock
37
+ - README.md
38
+ - lib/redis_dashboard.rb
39
+ - lib/redis_dashboard/application.rb
40
+ - lib/redis_dashboard/client.rb
41
+ - lib/redis_dashboard/command.rb
42
+ - lib/redis_dashboard/views/application.scss
43
+ - lib/redis_dashboard/views/clients.erb
44
+ - lib/redis_dashboard/views/config.erb
45
+ - lib/redis_dashboard/views/index.erb
46
+ - lib/redis_dashboard/views/info.erb
47
+ - lib/redis_dashboard/views/layout.erb
48
+ - lib/redis_dashboard/views/slowlog.erb
49
+ - lib/redis_dashboard/views/stylesheets/base.scss
50
+ - lib/redis_dashboard/views/stylesheets/colors.scss
51
+ - lib/redis_dashboard/views/stylesheets/link.scss
52
+ - lib/redis_dashboard/views/stylesheets/normalize.scss
53
+ - lib/redis_dashboard/views/stylesheets/page.scss
54
+ - lib/redis_dashboard/views/stylesheets/server-card.scss
55
+ - lib/redis_dashboard/views/stylesheets/table.scss
56
+ - lib/redis_dashboard/views/stylesheets/typography.scss
57
+ - redis_dashboard.gemspec
58
+ - start.rb
59
+ homepage: https://github.com/BaseSecrete/redis_dashboard
60
+ licenses:
61
+ - MIT
62
+ metadata: {}
63
+ post_install_message:
64
+ rdoc_options: []
65
+ require_paths:
66
+ - lib
67
+ required_ruby_version: !ruby/object:Gem::Requirement
68
+ requirements:
69
+ - - ">="
70
+ - !ruby/object:Gem::Version
71
+ version: '0'
72
+ required_rubygems_version: !ruby/object:Gem::Requirement
73
+ requirements:
74
+ - - ">="
75
+ - !ruby/object:Gem::Version
76
+ version: '0'
77
+ requirements: []
78
+ rubyforge_project:
79
+ rubygems_version: 2.4.8
80
+ signing_key:
81
+ specification_version: 4
82
+ summary: Sinatra app to monitor Redis servers.
83
+ test_files: []
84
+ has_rdoc: