Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

We’re showing branches in this repository, but you can also compare across forks.

base fork: qhoxie/prophet
base: 83c7d3b
...
head fork: mathieuravaux/prophet
compare: 2a0f750
  • 2 commits
  • 5 files changed
  • 0 commit comments
  • 1 contributor
Commits on Aug 20, 2009
Mathieu Ravaux Added a test to prevent errors on Watches that don't monitor a CPU ti…
…me or Memory usage
ea32857
Commits on Aug 21, 2009
Mathieu Ravaux Added the ability to open the god log for a watch in a new browser wi…
…ndow
2a0f750
12 application.rb
View
@@ -19,6 +19,18 @@ def no_god
end
##
+ # Streams the god log to the client
+ ##
+ def log service
+ headers['Content-Type'] = 'text/plain'
+ headers['Cache-Control'] = 'no-cache'
+ headers['Pragma'] = 'no-cache'
+ @service = service
+ @log = GOD.running_log(service, Time.at(0))
+ display @log, :layout => false
+ end
+
+ ##
# Handles control commands for services
##
def control(command, service)
6 config/init.rb
View
@@ -18,6 +18,12 @@
Merb::Router.prepare do
match('/').to(:controller => 'prophet', :action =>'index').name(:root)
match('/no_god').to(:controller => 'prophet', :action => 'no_god').name(:no_god)
+ match('/log') do
+ with(:controller => 'prophet') do
+ match('').to(:action => 'log').name(:log)
+ match('/:service').to(:action => 'log')
+ end
+ end
match('/control') do
with(:controller => 'prophet') do
match('').to(:action => 'control').name(:control)
8 public/javascripts/main.js
View
@@ -21,5 +21,13 @@ $(document).ready(function() {
$('#controls').jqmShow();
});
});
+ $('.log_td a').each(function() {
+ $(this).bind("click", function(e) {
+ console.log('e: ', e);
+ window.open(e.target.href, "_blank", "toolbar=no,menubar=no,scrollbars=yes,resizable=yes");
+ return false;
+ });
+ });
+
});
6 views/prophet/index.html.haml
View
@@ -6,14 +6,16 @@
%th CPU
%th Memory
%th Status
+ %th Log
%tbody
- @watches.keys.each do |svc|
%tr{:id => svc, :class => 'service'}
%td= svc
%td= @watches[svc].group.nil? ? "--" : @watches[svc].group
- %td= "%.2f%%" % @watches[svc].cpu_usage
- %td= @watches[svc].memory_usage.to_s + "kb"
+ %td= (@watches[svc].respond_to? "cpu_usage")? ("%.2f%%" % @watches[svc].cpu_usage) : "N/A"
+ %td= (@watches[svc].respond_to? "memory_usage")? (@watches[svc].memory_usage.to_s + "kb") : "N/A"
%td= @watches[svc].state
+ %td{:class => "log_td"}= (@watches[svc].log == "/dev/null") ? '-' : ( tag :a, @watches[svc].log, :target => "_blank", :href => "log/" + svc)
%div{:id => "controls", :class => "jqmWindow", :style => "display: none;"}
%h2#control_svc
7 views/prophet/log.html.haml
View
@@ -0,0 +1,7 @@
+!!! Strict
+%html
+ %head
+ %title= "God log for #{@service}"
+ %meta{ "http-equiv" => "refresh", :content => "1" }
+ %body
+ %pre= @log

No commit comments for this range

Something went wrong with that request. Please try again.