Permalink
Browse files

Some small UI changes, cleaning up the header portion -- putting envi…

…ronment in more visible spot.
  • Loading branch information...
TJ Koblentz authored and drudru committed Sep 12, 2011
1 parent cba465f commit dda00e394632cc6a45e3feaf6e7eb0069fc6be5c
View
@@ -4,3 +4,4 @@ queue.noindex
scheduler
.#*
log/*.log
+*.swp
View
@@ -1,4 +1,3 @@
-
include FileUtils
# Load any app level custom rakefile extensions from lib/tasks
View
@@ -5,11 +5,8 @@ require 'getoptlong'
require 'pp'
@server = "localhost"
-if ENV.has_key?"RQ_PORT"
- @port = ENV['RQ_PORT']
-else
- @port = 3333
-end
+@port = ENV.has_key?("RQ_PORT") ? ENV['RQ_PORT'] : 3333
+
# thresh [WARNING, CRITICAL, WARNING MAX, CRITICAL MAX, RELAYED WARN, RELAYED MAX]
thresh = [10, 20, 2000, 2500, 3000, 3500]
mesg = "OK: RQ is clean"
@@ -47,16 +44,16 @@ opts.each do |opt, arg|
@http = Net::HTTP.new(@server, @port)
-def rq_fetch(thepath)
+def rq_fetch(thepath)
begin
response = @http.get(thepath)
-
+
if response.code != "200"
puts "CRITICAL: Could not Fetch " + thepath
exit(2)
end
-
+
rescue Timeout::Error
puts "CRITICAL: Timed out connecting to " + @server + ":" + @port.to_s
exit(2)
@@ -67,7 +64,7 @@ def rq_fetch(thepath)
puts "CRITICAL: Could not fetch"
exit(2)
end
-
+
return(response.body)
end
@@ -88,7 +85,7 @@ end
qinfo.keys.each do |q|
-
+
if qinfo[q]["admin_status"] != "UP"
rq_errors[q] = "admin_status DOWN"
exitcode = 2
@@ -108,7 +105,7 @@ qinfo.keys.each do |q|
end
end
if qinfo[q]["err"].to_i > 0
- if rq_errors.has_key?q
+ if rq_errors.has_key? q
rq_errors[q] += " errors => #{qinfo[q]['err'].to_s}"
else
rq_errors[q] = "errors => #{qinfo[q]['err'].to_s}"
@@ -118,15 +115,15 @@ qinfo.keys.each do |q|
["done", "relayed"].each do |k|
if qinfo[q][k].to_i >= thresh[5]:
- if rq_errors.has_key?q
+ if rq_errors.has_key? q
rq_errors[q] += " #{k} => #{qinfo[q][k]}"
else
rq_errors[q] = "#{k} => #{qinfo[q][k]}"
exitcode = 2
end
exitcode = 2
elsif qinfo[q][k].to_i >= thresh[4]:
- if rq_errors.has_key?q
+ if rq_errors.has_key? q
rq_errors[q] += " #{k} => #{qinfo[q][k]}"
else
rq_errors[q] = "#{k} => #{qinfo[q][k]}"
@@ -137,7 +134,7 @@ qinfo.keys.each do |q|
end
end
end
-
+
end
if dump == 1
@@ -147,9 +144,9 @@ if dump == 1
puts "\t" + k + " -> " + qinfo[q][k]
end
end
-
+
else
-
+
if rq_errors.length == 0
puts "OK: all queue tests normal"
else
@@ -159,7 +156,7 @@ else
err_string += rq_errors[errs]
err_string += ","
end
-
+
if exitcode == 2
puts "CRITICAL: " + err_string
else
View
@@ -22,8 +22,7 @@ def self.views
end
def write_file(fname, data)
- File.open(fname + ".tmp", "w") do
- |f|
+ File.open(fname + ".tmp", "w") do |f|
f.write(data)
end
File.rename(fname + ".tmp", fname)
@@ -44,7 +43,10 @@ def write_file(fname, data)
# TODO: do error/sanity checking
# Clean up any whitespace
- prms = params['install'].keys.inject( {} ) { |acc, k| acc[k] = params['install'][k].strip; acc }
+ prms = params['install'].keys.inject({}) do |acc, k|
+ acc[k] = params['install'][k].strip
+ acc
+ end
write_file("config/config.json", prms.to_json)
View
@@ -1,5 +1,3 @@
-
-
require 'sinatra/base'
require 'erb'
load 'code/queuemgrclient.rb'
@@ -95,9 +93,7 @@ def get_queueclient(name)
# TODO: sanitize names (no dots or slashes)
qc = RQ::QueueClient.new(params[:name])
- if not qc.exists?
- throw :halt, [404, "404 - Queue not found"]
- end
+ throw :halt, [404, "404 - Queue not found"] unless qc.exists?
erb :queue
end
@@ -108,9 +104,7 @@ def get_queueclient(name)
end
qc = RQ::QueueClient.new(params[:name])
- if not qc.exists?
- throw :halt, [404, "404 - Queue not found"]
- end
+ throw :halt, [404, "404 - Queue not found"] unless qc.exists?
limit = 10
if params['limit']
@@ -125,9 +119,7 @@ def get_queueclient(name)
# TODO: sanitize names (no dots or slashes)
qc = get_queueclient(params[:name])
- if not qc.exists?
- throw :halt, [404, "404 - Queue not found"]
- end
+ throw :halt, [404, "404 - Queue not found"] unless qc.exists?
overrides = RQ::Overrides.new(params['name'])
erb :new_message, :layout => true, :locals => {:o => overrides }
@@ -181,9 +173,7 @@ def get_queueclient(name)
qc = get_queueclient(q_name)
- if not qc.exists?
- throw :halt, [404, "404 - Queue not found"]
- end
+ throw :halt, [404, "404 - Queue not found"] unless qc.exists?
if the_method == 'prep'
result = qc.prep_message(prms)
@@ -254,9 +244,7 @@ def get_queueclient(name)
qc = get_queueclient(params[:name])
- if not qc.exists?
- throw :halt, [404, "404 - Queue not found"]
- end
+ throw :halt, [404, "404 - Queue not found"] unless qc.exists?
ok, msg = qc.get_message({ 'msg_id' => msg_id })
@@ -274,9 +262,7 @@ def get_queueclient(name)
get '/q/:name/:msg_id/clone' do
qc = get_queueclient(params[:name])
- if not qc.exists?
- throw :halt, [404, "404 - Queue not found"]
- end
+ throw :halt, [404, "404 - Queue not found"] unless qc.exists?
res = qc.clone_message({ 'msg_id' => params[:msg_id] })
if not res
@@ -301,9 +287,7 @@ def get_queueclient(name)
get '/q/:name/:msg_id/run_now' do
qc = get_queueclient(params[:name])
- if not qc.exists?
- throw :halt, [404, "404 - Queue not found"]
- end
+ throw :halt, [404, "404 - Queue not found"] unless qc.exists?
res = qc.run_message({ 'msg_id' => params[:msg_id] })
View
@@ -1,4 +1,3 @@
-
.green { background-color: green; color: white; }
.red { background-color: red; color: yellow; }
.yellow { background-color: yellow; color: black; }
@@ -10,6 +9,19 @@ h1 {
font-weight: bold;
font-family: "Helvetica Neue",Helvetica,Arial,sans-serif;
color: #444;
+ display: inline;
+}
+h1 .small {font-size: 0.8em}
+
+#header {overflow: hidden}
+#header .right {
+ text-align: right;
+}
+
+h3 {margin: 20px 0 10px}
+
+.container {
+ padding-top: 20px;
}
a { color: #333; }
@@ -63,3 +75,4 @@ pre {line-height: 1.5; background: white; padding: 10px 30px; overflow: scroll}
body {margin-bottom: 100px}
html {overflow-y: scroll}
.hidden {display: none}
+p {margin-bottom: 5px}
View
@@ -18,7 +18,7 @@ def self.running?
return true
end
-
+
def self.stop!
if self.running?
pid = self.read_pid
@@ -31,11 +31,11 @@ def self.stop!
end
return false
end
-
+
def self.read_pid
File.read('config/queuemgr.pid').to_i rescue nil
end
-
+
def self.ping
client = UNIXSocket.open('config/queuemgr.sock')
client.send("ping", 0)
@@ -51,7 +51,7 @@ def self.environment
client.close
return result ? result[0] : nil
end
-
+
def self.version
client = UNIXSocket.open('config/queuemgr.sock')
client.send("version", 0)
View
@@ -23,11 +23,10 @@
<% our_env = (our_env.index('stage') == 0) ? 'stage' : our_env %>
style="background-color: <%= colors[our_env] %>">
<div class="container">
- <br />
- <%#= message[:notice] %>
- <%= yield %>
- <i><%= Time.now %>
- <br />ver: <%= VERSION_NUMBER %></i>
+ <%#= message[:notice] %>
+ <%= yield %>
+ <p><em><%= Time.now %></em></p>
+ <p><em>v<%= VERSION_NUMBER %></em></p>
</div>
</body>
</html>
Oops, something went wrong.

0 comments on commit dda00e3

Please sign in to comment.