Sha256: a6b05cd5b5a98d5b0fe38c5476d45356dcf8620709abbbda19058fe9d65e489c
Contents?: true
Size: 1.22 KB
Versions: 24
Compression:
Stored size: 1.22 KB
Contents
class Admin::SkynetController < AdminController def index begin start_time = Time.now setup if params[:skynet_message_queue] Skynet.configure(:MYSQL_MESSAGE_QUEUE_TABLE => params[:skynet_message_queue]) do @stats = @mq.stats end else @stats = @mq.stats end @stats.merge!(Skynet::Manager.stats_for_hosts) @stats[:hosts] = @stats[:servers].size @stats[:processed_time] = Time.now - start_time rescue Exception => e logger.error "ERROR #{e.inspect} #{e.backtrace.join("\n")}" end end # plain text page that will be used by monitoring scripts def status begin setup stats = @mq.stats stats[:servers] = stats[:servers].keys.join(",") stats.each { |k,v| stats[k.to_s] = stats.delete(k) } text = stats.keys.sort.collect{ |k| "#{k}:#{stats[k]}" }.join("\n") + "\n" render :text => text, :content_type => 'text/plain' rescue Exception => e render :text => "skynet is down\n", :content_type => 'text/plain' end end private def setup @mq ||= Skynet::MessageQueue.new(Skynet::CONFIG[:MESSAGE_QUEUE_ADAPTER]) @last_updated = Time.now.strftime('%r') end end
Version data entries
24 entries across 24 versions & 3 rubygems