beanstalkd_view 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/beanstalkd_view/resources/bootstrap/css/overrides.css +3 -0
- data/lib/beanstalkd_view/server.rb +23 -0
- data/lib/beanstalkd_view/version.rb +1 -1
- data/lib/beanstalkd_view/views/general_stats.erb +46 -42
- data/lib/beanstalkd_view/views/layout.erb +17 -2
- data/lib/beanstalkd_view/views/tube_stats.erb +24 -12
- data/lib/beanstalkd_view/views/tubes.erb +10 -15
- metadata +15 -16
- data/lib/beanstalkd_view/resources/bootstrap/css/bootstrap.css +0 -4647
- data/lib/beanstalkd_view/resources/bootstrap/js/bootstrap.js +0 -1737
@@ -2,11 +2,14 @@ module BeanstalkdView
|
|
2
2
|
|
3
3
|
class Server < Sinatra::Base
|
4
4
|
include BeanstalkdView::BeanstalkdUtils
|
5
|
+
enable :sessions
|
5
6
|
|
6
7
|
get "/" do
|
7
8
|
begin
|
8
9
|
@tubes = beanstalk.list_tubes
|
9
10
|
@stats = beanstalk.stats
|
11
|
+
@message = session[:message]
|
12
|
+
session[:message] = nil
|
10
13
|
erb :index
|
11
14
|
rescue Beanstalk::NotConnected => @error
|
12
15
|
erb :error
|
@@ -16,12 +19,32 @@ module BeanstalkdView
|
|
16
19
|
get "/tube/:tube" do
|
17
20
|
begin
|
18
21
|
@stats = beanstalk.stats_tube(params[:tube])
|
22
|
+
@message = session[:message]
|
23
|
+
session[:message] = nil
|
19
24
|
erb :tube_stats
|
20
25
|
rescue Beanstalk::NotConnected => @error
|
21
26
|
erb :error
|
22
27
|
end
|
23
28
|
end
|
24
29
|
|
30
|
+
post "/kick" do
|
31
|
+
begin
|
32
|
+
response = nil
|
33
|
+
beanstalk.on_tube(params[:tube]) do |conn|
|
34
|
+
response = conn.kick(params[:bound].to_i)
|
35
|
+
end
|
36
|
+
if response
|
37
|
+
session[:message] = "Kicked #{params[:tube]} for #{response} jobs"
|
38
|
+
redirect "/beanstalkd/tube/#{params[:tube]}"
|
39
|
+
else
|
40
|
+
session[:message] = "Error kicking #{params[:tube]}"
|
41
|
+
redirect "/beanstalkd/tube/#{params[:tube]}"
|
42
|
+
end
|
43
|
+
rescue Beanstalk::NotConnected => @error
|
44
|
+
erb :error
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
25
48
|
get "/resources/*" do |path|
|
26
49
|
file = File.expand_path(File.join('resources', path), File.dirname(__FILE__))
|
27
50
|
send_file file
|
@@ -1,5 +1,5 @@
|
|
1
1
|
<div class="row">
|
2
|
-
<div class="
|
2
|
+
<div class="span6">
|
3
3
|
|
4
4
|
<table class="table">
|
5
5
|
<thead>
|
@@ -9,23 +9,23 @@
|
|
9
9
|
</thead>
|
10
10
|
<tbody>
|
11
11
|
<tr>
|
12
|
-
<td
|
12
|
+
<td rel="tooltip" title="The number of ready jobs with priority < 1024.">Urgent</td>
|
13
13
|
<td><%= @stats["current-jobs-urgent"].inspect %></td>
|
14
14
|
</tr>
|
15
15
|
<tr>
|
16
|
-
<td
|
16
|
+
<td rel="tooltip" title="The number of jobs in the ready queue.">Ready</td>
|
17
17
|
<td><%= @stats["current-jobs-ready"].inspect %></td>
|
18
18
|
</tr>
|
19
19
|
<tr>
|
20
|
-
<td
|
20
|
+
<td rel="tooltip" title="The number of jobs reserved by all clients.">Reserved</td>
|
21
21
|
<td><%= @stats["current-jobs-reserved"].inspect %></td>
|
22
22
|
</tr>
|
23
23
|
<tr>
|
24
|
-
<td
|
24
|
+
<td rel="tooltip" title="The number of delayed jobs.">Delayed</td>
|
25
25
|
<td><%= @stats["current-jobs-delayed"].inspect %></td>
|
26
26
|
</tr>
|
27
27
|
<tr>
|
28
|
-
<td
|
28
|
+
<td rel="tooltip" title="he number of buried jobs.">Buried</td>
|
29
29
|
<td><%= @stats["current-jobs-buried"].inspect %></td>
|
30
30
|
</tr>
|
31
31
|
</tbody>
|
@@ -39,55 +39,55 @@
|
|
39
39
|
</thead>
|
40
40
|
<tbody>
|
41
41
|
<tr>
|
42
|
-
<td
|
42
|
+
<td rel="tooltip" title="The cumulative count of times a job has timed out.">Job Timeouts</td>
|
43
43
|
<td><%= @stats["job-timeouts"].inspect %></td>
|
44
44
|
</tr>
|
45
45
|
<tr>
|
46
|
-
<td
|
46
|
+
<td rel="tooltip" title="The cumulative count of jobs created.">Total Jobs</td>
|
47
47
|
<td><%= @stats["total-jobs"].inspect %></td>
|
48
48
|
</tr>
|
49
49
|
<tr>
|
50
|
-
<td
|
50
|
+
<td rel="tooltip" title="The maximum number of bytes in a job.">Max Job Size</td>
|
51
51
|
<td><%= @stats["max-job-size"].inspect %></td>
|
52
52
|
</tr>
|
53
53
|
<tr>
|
54
|
-
<td
|
54
|
+
<td rel="tooltip" title="The number of currently open connections.">Current Connections</td>
|
55
55
|
<td><%= @stats["current-connections"].inspect %></td>
|
56
56
|
</tr>
|
57
57
|
<tr>
|
58
|
-
<td
|
58
|
+
<td rel="tooltip" title="The number of open connections that have each issued at least one put command.">Current Producers</td>
|
59
59
|
<td><%= @stats["current-producers"].inspect %></td>
|
60
60
|
</tr>
|
61
61
|
<tr>
|
62
|
-
<td
|
62
|
+
<td rel="tooltip" title="The number of open connections that have each issued at least one reserve command.">Current Workers</td>
|
63
63
|
<td><%= @stats["current-workers"].inspect %></td>
|
64
64
|
</tr>
|
65
65
|
<tr>
|
66
|
-
<td
|
66
|
+
<td rel="tooltip" title="The number of open connections that have issued a reserve command but not yet received a response.">Current Waiting</td>
|
67
67
|
<td><%= @stats["current-waiting"].inspect %></td>
|
68
68
|
</tr>
|
69
69
|
<tr>
|
70
|
-
<td
|
70
|
+
<td rel="tooltip" title="The cumulative count of connections.">Total Connections</td>
|
71
71
|
<td><%= @stats["total-connections"].inspect %></td>
|
72
72
|
</tr>
|
73
73
|
<tr>
|
74
|
-
<td
|
74
|
+
<td rel="tooltip" title="The process id of the server.">pid</td>
|
75
75
|
<td><%= @stats["pid"].inspect %></td>
|
76
76
|
</tr>
|
77
77
|
<tr>
|
78
|
-
<td
|
78
|
+
<td rel="tooltip" title="The version string of the server.">Version</td>
|
79
79
|
<td><%= @stats["version"].inspect %></td>
|
80
80
|
</tr>
|
81
81
|
<tr>
|
82
|
-
<td
|
82
|
+
<td rel="tooltip" title="The accumulated user CPU time of this process in seconds and microseconds.">rusage-utime</td>
|
83
83
|
<td><%= @stats["rusage-utime"].inspect %></td>
|
84
84
|
</tr>
|
85
85
|
<tr>
|
86
|
-
<td
|
86
|
+
<td rel="tooltip" title="The accumulated system CPU time of this process in seconds and microseconds.">rusage-stime</td>
|
87
87
|
<td><%= @stats["rusage-stime"].inspect %></td>
|
88
88
|
</tr>
|
89
89
|
<tr>
|
90
|
-
<td
|
90
|
+
<td rel="tooltip" title="The number of seconds since this server started running.">Uptime</td>
|
91
91
|
<td><%= @stats["uptime"].inspect %></td>
|
92
92
|
</tr>
|
93
93
|
</tbody>
|
@@ -101,15 +101,15 @@
|
|
101
101
|
</thead>
|
102
102
|
<tbody>
|
103
103
|
<tr>
|
104
|
-
<td
|
104
|
+
<td rel="tooltip" title="The index of the oldest binlog file needed to store the current jobs.">Oldest Index</td>
|
105
105
|
<td><%= @stats["binlog-oldest-index"].inspect %></td>
|
106
106
|
</tr>
|
107
107
|
<tr>
|
108
|
-
<td
|
108
|
+
<td rel="tooltip" title="The index of the current binlog file being written to. If binlog is not active this value will be 0.">Current Index</td>
|
109
109
|
<td><%= @stats["binlog-current-index"].inspect %></td>
|
110
110
|
</tr>
|
111
111
|
<tr>
|
112
|
-
<td
|
112
|
+
<td rel="tooltip" title="The maximum size in bytes a binlog file is allowed to get before a new binlog file is opened.">Max Size</td>
|
113
113
|
<td><%= @stats["binlog-max-size"].inspect %></td>
|
114
114
|
</tr>
|
115
115
|
</tbody>
|
@@ -123,86 +123,90 @@
|
|
123
123
|
</thead>
|
124
124
|
<tbody>
|
125
125
|
<tr>
|
126
|
-
<td
|
126
|
+
<td rel="tooltip" title="The cumulative number of put commands.">put</td>
|
127
127
|
<td><%= @stats["cmd-put"].inspect %></td>
|
128
128
|
</tr>
|
129
129
|
<tr>
|
130
|
-
<td
|
130
|
+
<td rel="tooltip" title="The cumulative number of peek commands.">peek</td>
|
131
131
|
<td><%= @stats["cmd-peek"].inspect %></td>
|
132
132
|
</tr>
|
133
133
|
<tr>
|
134
|
-
<td
|
134
|
+
<td rel="tooltip" title="The cumulative number of peek-ready commands.">peek-ready</td>
|
135
135
|
<td><%= @stats["cmd-peek-ready"].inspect %></td>
|
136
136
|
</tr>
|
137
137
|
<tr>
|
138
|
-
<td
|
138
|
+
<td rel="tooltip" title="The cumulative number of peek-delayed commands.">peek-delayed</td>
|
139
139
|
<td><%= @stats["cmd-peek-delayed"].inspect %></td>
|
140
140
|
</tr>
|
141
141
|
<tr>
|
142
|
-
<td
|
142
|
+
<td rel="tooltip" title="The cumulative number of peek-buried commands.">peek-buried</td>
|
143
143
|
<td><%= @stats["cmd-peek-buried"].inspect %></td>
|
144
144
|
</tr>
|
145
145
|
<tr>
|
146
|
-
<td
|
146
|
+
<td rel="tooltip" title="The cumulative number of reserve commands.">reserve</td>
|
147
147
|
<td><%= @stats["cmd-reserve"].inspect %></td>
|
148
148
|
</tr>
|
149
149
|
<tr>
|
150
|
-
<td
|
150
|
+
<td rel="tooltip" title="The cumulative number of use commands.">use</td>
|
151
151
|
<td><%= @stats["cmd-use"].inspect %></td>
|
152
152
|
</tr>
|
153
153
|
<tr>
|
154
|
-
<td
|
154
|
+
<td rel="tooltip" title="The cumulative number of watch commands.">watch</td>
|
155
155
|
<td><%= @stats["cmd-watch"].inspect %></td>
|
156
156
|
</tr>
|
157
157
|
<tr>
|
158
|
-
<td
|
158
|
+
<td rel="tooltip" title="The cumulative number of ignore commands.">ignore</td>
|
159
159
|
<td><%= @stats["cmd-ignore"].inspect %></td>
|
160
160
|
</tr>
|
161
161
|
<tr>
|
162
|
-
<td
|
162
|
+
<td rel="tooltip" title="The cumulative number of delete commands.">delete</td>
|
163
163
|
<td><%= @stats["cmd-delete"].inspect %></td>
|
164
164
|
</tr>
|
165
165
|
<tr>
|
166
|
-
<td
|
166
|
+
<td rel="tooltip" title="The cumulative number of release commands.">release</td>
|
167
167
|
<td><%= @stats["cmd-release"].inspect %></td>
|
168
168
|
</tr>
|
169
169
|
<tr>
|
170
|
-
<td
|
170
|
+
<td rel="tooltip" title="The cumulative number of bury commands.">bury</td>
|
171
171
|
<td><%= @stats["cmd-bury"].inspect %></td>
|
172
172
|
</tr>
|
173
173
|
<tr>
|
174
|
-
<td
|
174
|
+
<td rel="tooltip" title="The cumulative number of kick commands.">kick</td>
|
175
175
|
<td><%= @stats["cmd-kick"].inspect %></td>
|
176
176
|
</tr>
|
177
177
|
<tr>
|
178
|
-
<td
|
178
|
+
<td rel="tooltip" title="The cumulative number of stats commands.">stats</td>
|
179
179
|
<td><%= @stats["cmd-stats"].inspect %></td>
|
180
180
|
</tr>
|
181
181
|
<tr>
|
182
|
-
<td
|
182
|
+
<td rel="tooltip" title="The cumulative number of stats-job commands.">stats-job</td>
|
183
183
|
<td><%= @stats["cmd-stats-job"].inspect %></td>
|
184
184
|
</tr>
|
185
185
|
<tr>
|
186
|
-
<td
|
186
|
+
<td rel="tooltip" title="The cumulative number of stats-tube commands.">stats-tube</td>
|
187
187
|
<td><%= @stats["cmd-stats-tube"].inspect %></td>
|
188
188
|
</tr>
|
189
189
|
<tr>
|
190
|
-
<td
|
190
|
+
<td rel="tooltip" title="The cumulative number of list-tubes commands.">list-tubes</td>
|
191
191
|
<td><%= @stats["cmd-list-tubes"].inspect %></td>
|
192
192
|
</tr>
|
193
193
|
<tr>
|
194
|
-
<td
|
194
|
+
<td rel="tooltip" title="The cumulative number of list-tube-used commands.">list-tube-used</td>
|
195
195
|
<td><%= @stats["cmd-list-tube-used"].inspect %></td>
|
196
196
|
</tr>
|
197
197
|
<tr>
|
198
|
-
<td
|
198
|
+
<td rel="tooltip" title="The cumulative number of list-tubes-watched commands.">list-tubes-watched</td>
|
199
199
|
<td><%= @stats["cmd-list-tubes-watched"].inspect %></td>
|
200
200
|
</tr>
|
201
201
|
<tr>
|
202
|
-
<td
|
202
|
+
<td rel="tooltip" title="The cumulative number of pause-tube commands.">pause-tube</td>
|
203
203
|
<td><%= @stats["cmd-pause-tube"].inspect %></td>
|
204
204
|
</tr>
|
205
205
|
</tbody>
|
206
206
|
</table>
|
207
207
|
</div>
|
208
|
+
|
209
|
+
<div class="span6">
|
210
|
+
</div>
|
211
|
+
|
208
212
|
</div>
|
@@ -2,8 +2,9 @@
|
|
2
2
|
|
3
3
|
<html>
|
4
4
|
<head>
|
5
|
-
<title>Beanstalkd View
|
5
|
+
<title>Beanstalkd View - <%= BeanstalkdView::VERSION %></title>
|
6
6
|
<link rel="stylesheet" type="text/css" href="<%= url('/resources/bootstrap/css/bootstrap.min.css') %>"/>
|
7
|
+
<link rel="stylesheet" type="text/css" href="<%= url('/resources/bootstrap/css/overrides.css') %>"/>
|
7
8
|
<meta http-equiv="content-type" content="text/html;charset=utf-8" />
|
8
9
|
<script type="text/javascript" src="<%= url('/resources/js/jquery-1.7.1.min.js') %>"></script>
|
9
10
|
<script type="text/javascript" src="<%= url('/resources/bootstrap/js/bootstrap.min.js') %>"></script>
|
@@ -19,12 +20,26 @@
|
|
19
20
|
<div class="navbar">
|
20
21
|
<div class="navbar-inner">
|
21
22
|
<div class="container">
|
22
|
-
<a class="brand" href="/beanstalkd">Beanstalkd View
|
23
|
+
<a class="brand" href="/beanstalkd">Beanstalkd View - <%= BeanstalkdView::VERSION %></a>
|
23
24
|
</div>
|
24
25
|
</div>
|
25
26
|
</div>
|
26
27
|
|
27
28
|
<div class="container">
|
29
|
+
|
30
|
+
<% if @message %>
|
31
|
+
<div id='flash' class='notice'>
|
32
|
+
<div class="row">
|
33
|
+
<div class="span12">
|
34
|
+
<div class="alert alert-notice">
|
35
|
+
<h4 class="alert-heading">Notice:</h4>
|
36
|
+
<%= @message %>
|
37
|
+
</div>
|
38
|
+
</div>
|
39
|
+
</div>
|
40
|
+
</div>
|
41
|
+
<% end %>
|
42
|
+
|
28
43
|
<%= yield %>
|
29
44
|
|
30
45
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
<div class="row">
|
2
|
-
<div class="
|
3
|
-
<h1
|
2
|
+
<div class="span6">
|
3
|
+
<h1>Tube: <%= @stats["name"] %></h1>
|
4
4
|
|
5
5
|
<table class="table">
|
6
6
|
<thead>
|
@@ -10,23 +10,23 @@
|
|
10
10
|
</thead>
|
11
11
|
<tbody>
|
12
12
|
<tr>
|
13
|
-
<td
|
13
|
+
<td rel="tooltip" title="The number of ready jobs with priority < 1024 in this tube.">Urgent</td>
|
14
14
|
<td><%= @stats["current-jobs-urgent"].inspect %></td>
|
15
15
|
</tr>
|
16
16
|
<tr>
|
17
|
-
<td
|
17
|
+
<td rel="tooltip" title="The number of jobs in the ready queue in this tube.">Ready</td>
|
18
18
|
<td><%= @stats["current-jobs-ready"].inspect %></td>
|
19
19
|
</tr>
|
20
20
|
<tr>
|
21
|
-
<td
|
21
|
+
<td rel="tooltip" title="The number of jobs reserved by all clients in this tube.">Reserved</td>
|
22
22
|
<td><%= @stats["current-jobs-reserved"].inspect %></td>
|
23
23
|
</tr>
|
24
24
|
<tr>
|
25
|
-
<td
|
25
|
+
<td rel="tooltip" title="The number of delayed jobs in this tube.">Delayed</td>
|
26
26
|
<td><%= @stats["current-jobs-delayed"].inspect %></td>
|
27
27
|
</tr>
|
28
28
|
<tr>
|
29
|
-
<td
|
29
|
+
<td rel="tooltip" title="The number of buried jobs in this tube.">Buried</td>
|
30
30
|
<td><%= @stats["current-jobs-buried"].inspect %></td>
|
31
31
|
</tr>
|
32
32
|
</tbody>
|
@@ -40,19 +40,19 @@
|
|
40
40
|
</thead>
|
41
41
|
<tbody>
|
42
42
|
<tr>
|
43
|
-
<td
|
43
|
+
<td rel="tooltip" title="The cumulative count of jobs created in this tube.">Total Jobs</td>
|
44
44
|
<td><%= @stats["total-jobs"].inspect %></td>
|
45
45
|
</tr>
|
46
46
|
<tr>
|
47
|
-
<td
|
47
|
+
<td rel="tooltip" title="The number of open connections that have issued a reserve command while watching this tube but not yet received a response.">Current Waiting</td>
|
48
48
|
<td><%= @stats["current-waiting"].inspect %></td>
|
49
49
|
</tr>
|
50
50
|
<tr>
|
51
|
-
<td
|
51
|
+
<td rel="tooltip" title="The number of seconds the tube has been paused for.">Time Paused</td>
|
52
52
|
<td><%= @stats["pause"].inspect %></td>
|
53
53
|
</tr>
|
54
54
|
<tr>
|
55
|
-
<td
|
55
|
+
<td rel="tooltip" title="The number of seconds until the tube is un-paused.">Pause Time Left</td>
|
56
56
|
<td><%= @stats["pause-time-left"].inspect %></td>
|
57
57
|
</tr>
|
58
58
|
</tbody>
|
@@ -66,10 +66,22 @@
|
|
66
66
|
</thead>
|
67
67
|
<tbody>
|
68
68
|
<tr>
|
69
|
-
<td
|
69
|
+
<td rel="tooltip" title="The cumulative number of pause-tube commands for this tube.">pause-tube</td>
|
70
70
|
<td><%= @stats["cmd-pause-tube"].inspect %></td>
|
71
71
|
</tr>
|
72
72
|
</tbody>
|
73
73
|
</table>
|
74
74
|
</div>
|
75
|
+
|
76
|
+
<div class="span6">
|
77
|
+
<h2>Actions</h2>
|
78
|
+
|
79
|
+
<h3>Kick Tube</h3>
|
80
|
+
<form class="well form-inline" name="pause_form" action="/beanstalkd/kick" method="POST">
|
81
|
+
<input type="hidden" name="tube" value="<%= @stats["name"] %>">
|
82
|
+
<input type="text" class="input-medium" placeholder="Number of Jobs" name="bound">
|
83
|
+
<button type="submit" class="btn">Kick</button>
|
84
|
+
</form>
|
85
|
+
|
86
|
+
</div>
|
75
87
|
</div>
|
@@ -1,5 +1,5 @@
|
|
1
1
|
<div class="row">
|
2
|
-
<div class="
|
2
|
+
<div class="span6">
|
3
3
|
<table class="table">
|
4
4
|
<thead>
|
5
5
|
<tr>
|
@@ -9,22 +9,17 @@
|
|
9
9
|
</thead>
|
10
10
|
<tbody>
|
11
11
|
<% @tubes.keys.each do |key| %>
|
12
|
-
|
12
|
+
<% @tubes[key].each do |tube| %>
|
13
|
+
<tr>
|
13
14
|
<td><%= key %></td>
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
<% @tubes[key].each do |tube| %>
|
18
|
-
<tr>
|
19
|
-
<td><a href="/beanstalkd/tube/<%= tube %>"><%= tube %></a></td>
|
20
|
-
</tr>
|
21
|
-
<% end %>
|
22
|
-
</tbody>
|
23
|
-
</table>
|
24
|
-
</td>
|
25
|
-
</tr>
|
15
|
+
<td><a href="/beanstalkd/tube/<%= tube %>"><%= tube %></a></td>
|
16
|
+
</tr>
|
17
|
+
<% end %>
|
26
18
|
<% end %>
|
27
|
-
|
19
|
+
</tbody>
|
28
20
|
</table>
|
29
21
|
</div>
|
22
|
+
|
23
|
+
<div class="span6">
|
24
|
+
</div>
|
30
25
|
</div>
|