Module: Mool::Command
- Defined in:
- lib/mool/command.rb
Class Method Summary collapse
- .capacity_partition_command(path) ⇒ Object
- .cpuinfo_command ⇒ Object
- .dev_block_command ⇒ Object
- .dev_name_command(dev_entry) ⇒ Object
- .df_command ⇒ Object
- .file_system_command ⇒ Object
- .loadavg_command ⇒ Object
- .logical_name_command(path) ⇒ Object
- .meminfo_command ⇒ Object
- .mount_command ⇒ Object
- .mpstat_command ⇒ Object
- .partitions_command(path, devname) ⇒ Object
- .ps_command ⇒ Object
- .real_path_block_command(entry) ⇒ Object
- .real_path_command_exist?(real_path) ⇒ Boolean
- .slaves_command(real_path) ⇒ Object
- .swap_command(lname = nil) ⇒ Object
- .top_command ⇒ Object
- .uevent_command(path) ⇒ Object
- .uname_command ⇒ Object
- .uptime_command ⇒ Object
Class Method Details
.capacity_partition_command(path) ⇒ Object
41 42 43 |
# File 'lib/mool/command.rb', line 41 def self.capacity_partition_command(path) File.read("#{path}/size") end |
.cpuinfo_command ⇒ Object
4 5 6 |
# File 'lib/mool/command.rb', line 4 def self.cpuinfo_command File.read('/proc/cpuinfo') end |
.dev_block_command ⇒ Object
49 50 51 |
# File 'lib/mool/command.rb', line 49 def self.dev_block_command Dir.glob('/sys/dev/block/*') end |
.dev_name_command(dev_entry) ⇒ Object
16 17 18 |
# File 'lib/mool/command.rb', line 16 def self.dev_name_command(dev_entry) File.read("#{dev_entry}/dev") end |
.df_command ⇒ Object
12 13 14 |
# File 'lib/mool/command.rb', line 12 def self.df_command `POSIXLY_CORRECT=512 df` end |
.file_system_command ⇒ Object
24 25 26 |
# File 'lib/mool/command.rb', line 24 def self.file_system_command Dir.glob('/sys/fs/**/*') end |
.loadavg_command ⇒ Object
86 87 88 |
# File 'lib/mool/command.rb', line 86 def self.loadavg_command File.read('/proc/loadavg').chomp end |
.logical_name_command(path) ⇒ Object
28 29 30 |
# File 'lib/mool/command.rb', line 28 def self.logical_name_command(path) File.exist?("#{path}/dm/name") ? File.read("#{path}/dm/name").chomp : nil end |
.meminfo_command ⇒ Object
65 66 67 |
# File 'lib/mool/command.rb', line 65 def self.meminfo_command File.read('/proc/meminfo') end |
.mount_command ⇒ Object
20 21 22 |
# File 'lib/mool/command.rb', line 20 def self.mount_command File.read('/proc/mounts') end |
.mpstat_command ⇒ Object
8 9 10 |
# File 'lib/mool/command.rb', line 8 def self.mpstat_command File.read('|mpstat -P ALL 1 1') end |
.partitions_command(path, devname) ⇒ Object
45 46 47 |
# File 'lib/mool/command.rb', line 45 def self.partitions_command(path, devname) Dir.glob("#{path}/#{devname}*") end |
.ps_command ⇒ Object
69 70 71 72 |
# File 'lib/mool/command.rb', line 69 def self.ps_command # `ps --no-headers -o pid,user,pcpu,pmem,rss,priority,time,stat,nice,args -A` `ps --no-headers -o ruser,user,rgroup,group,pid,ppid,pgid,pcpu,vsz,nice,etime,time,tty,comm,args=HEADER -A` end |
.real_path_block_command(entry) ⇒ Object
53 54 55 |
# File 'lib/mool/command.rb', line 53 def self.real_path_block_command(entry) `readlink -f #{entry}`.chomp end |
.real_path_command_exist?(real_path) ⇒ Boolean
57 58 59 |
# File 'lib/mool/command.rb', line 57 def self.real_path_command_exist?(real_path) File.exist?("#{real_path}/partition") end |
.slaves_command(real_path) ⇒ Object
61 62 63 |
# File 'lib/mool/command.rb', line 61 def self.slaves_command(real_path) Dir.glob("#{real_path}/slaves/*") end |
.swap_command(lname = nil) ⇒ Object
36 37 38 39 |
# File 'lib/mool/command.rb', line 36 def self.swap_command(lname = nil) result = File.read('/proc/swaps') lname.present? ? result[/#{lname} /] : result end |
.top_command ⇒ Object
74 75 76 |
# File 'lib/mool/command.rb', line 74 def self.top_command `top -c -b -n1` end |
.uevent_command(path) ⇒ Object
32 33 34 |
# File 'lib/mool/command.rb', line 32 def self.uevent_command(path) File.read("#{path}/uevent") end |
.uname_command ⇒ Object
78 79 80 |
# File 'lib/mool/command.rb', line 78 def self.uname_command `uname -r`.chomp end |
.uptime_command ⇒ Object
82 83 84 |
# File 'lib/mool/command.rb', line 82 def self.uptime_command `cat /proc/uptime`.chomp end |