Permalink
Browse files

minor changes

  • Loading branch information...
1 parent 9359f67 commit 3ae064bce83c599e962cb0fedbb880635a872e81 Andre Lewis committed Dec 1, 2009
Showing with 11 additions and 3 deletions.
  1. +1 −1 lib/scout/command/run.rb
  2. +10 −2 lib/scout/server.rb
View
@@ -31,7 +31,7 @@ def run
@scout.run_plugins_by_plan
@scout.save_history
else
- log.info "Not time to checkin yet. Next checkin in #{@scout.time_to_next_checkin}. Override by passing --force to the scout command" if log
+ log.info "Not time to checkin yet. Next checkin in #{@scout.next_checkin}. Override by passing --force to the scout command" if log
end
end
end
View
@@ -57,6 +57,12 @@ def initialize(server, client_key, history_file, logger = nil)
end
end
+ def run
+
+ end
+
+
+
#
# Retrieves the Plugin Plan from the server. This is the list of plugins
# to execute, along with all options.
@@ -117,7 +123,8 @@ def time_to_checkin?
return true
end
- def time_to_next_checkin
+ # returns a human-readable representation of the next checkin, i.e., 5min 30sec
+ def next_checkin
secs= @directives['interval'].to_i*60 - (Time.now.to_i - Time.at(@history['last_checkin']).to_i).abs
minutes=(secs.to_f/60).floor
secs=secs%60
@@ -246,10 +253,11 @@ def process_plugin(plugin)
# captures a list of processes running at this moment
def take_snapshot
info "Taking a process snapshot"
- ps=`ps aux`.split("\n")[1..-1].join("\n") # get rid of the header line
+ ps=%x(ps aux).split("\n")[1..-1].join("\n") # get rid of the header line
@checkin[:snapshot]=ps
rescue Exception
error "unable to capture processes on this server. #{$!.message}"
+ return nil
end
# Prepares a check-in data structure to hold Plugin generated data.

0 comments on commit 3ae064b

Please sign in to comment.