Class: TyrantManager::Commands::Stats

Inherits:
TyrantManager::Command show all
Defined in:
lib/tyrant_manager/commands/stats.rb

Overview

List the stats about one or more instances

Instance Attribute Summary

Attributes inherited from TyrantManager::Command

#manager, #options

Instance Method Summary collapse

Methods inherited from TyrantManager::Command

#after, #before, #command_name, command_name, #error, find, inherited, #initialize, list, #logger

Constructor Details

This class inherits a constructor from TyrantManager::Command

Instance Method Details

#runObject



8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/tyrant_manager/commands/stats.rb', line 8

def run
  manager.each_instance do |instance|
    ilist = options['instances']
    if ilist  == %w[ all ] or ilist.include?( instance.name ) then
      puts "Instance #{instance.name} at #{instance.home_dir}"
      stats = instance.stat
      stats.keys.sort.each do |k|
        lhs = k.ljust(10, ".")
        puts "    #{lhs} #{stats[k]}"
      end
      puts
    end
  end
end