Module: Vmstat
- Extended by:
- Stub
- Defined in:
- lib/vmstat.rb,
lib/vmstat/cpu.rb,
lib/vmstat/disk.rb,
lib/vmstat/stub.rb,
lib/vmstat/task.rb,
lib/vmstat/memory.rb,
lib/vmstat/procfs.rb,
lib/vmstat/solaris.rb,
lib/vmstat/version.rb,
lib/vmstat/snapshot.rb,
lib/vmstat/linux_disk.rb,
lib/vmstat/netopenbsd.rb,
lib/vmstat/load_average.rb,
lib/vmstat/network_interface.rb,
ext/vmstat/vmstat.c
Overview
This is a focused and fast library to get system information like:
-
Memory (free, active, …)
-
Network Interfaces (name, in bytes, out bytes, …)
-
CPU (user, system, nice, idle)
-
Load Average
-
Disk (type, disk path, free bytes, total bytes, …)
-
Boot Time
-
Current Task (used bytes and usage time MACOSX or LINUX ONLY)
Defined Under Namespace
Modules: ProcFS, Solaris, Stub Classes: Cpu, Disk, LinuxDisk, LinuxMemory, LoadAverage, Memory, NetworkInterface, Snapshot, Task
Constant Summary collapse
- VERSION =
"2.3.1"
Class Method Summary collapse
-
.boot_time ⇒ Time
Fetches the boot time of the system.
-
.cpu ⇒ Array<Vmstat::Cpu>
Fetches the cpu statistics (usage counter for user, nice, system and idle).
-
.disk(path) ⇒ Vmstat::Disk
Fetches the usage data and other useful disk information for the given path.
-
.ethernet_devices ⇒ Array<NetworkInterface>
Filters all available ethernet devices.
- .extract_uvm_val(uvmexp, name) ⇒ Object
-
.load_average ⇒ Vmstat::LoadAverage
Fetches the load average for the current system.
-
.loopback_devices ⇒ Array<NetworkInterface>
Filters all available loopback devices.
-
.memory ⇒ Vmstat::Memory
Fetches the memory usage information.
-
.network_interfaces ⇒ Array<Vmstat::NetworkInterface>
Fetches the information for all available network devices.
-
.pagesize ⇒ Fixnum
Fetches pagesize of the current system.
-
.snapshot(paths = ["/"]) ⇒ Vmstat::Snapshot
Creates a full snapshot of the systems hardware statistics.
-
.task ⇒ Array<Vmstat::Task>
Fetches time and memory usage for the current process.
Class Method Details
.boot_time ⇒ Time
Fetches the boot time of the system.
|
# File 'lib/vmstat.rb', line 27
|
.cpu ⇒ Array<Vmstat::Cpu>
Fetches the cpu statistics (usage counter for user, nice, system and idle)
|
# File 'lib/vmstat.rb', line 33
|
.disk(path) ⇒ Vmstat::Disk
Fetches the usage data and other useful disk information for the given path.
|
# File 'lib/vmstat.rb', line 39
|
.ethernet_devices ⇒ Array<NetworkInterface>
Filters all available ethernet devices.
88 89 90 |
# File 'lib/vmstat.rb', line 88 def self.ethernet_devices network_interfaces.select(&:ethernet?) end |
.extract_uvm_val(uvmexp, name) ⇒ Object
55 56 57 58 59 60 |
# File 'lib/vmstat/netopenbsd.rb', line 55 def self.extract_uvm_val(uvmexp, name) regexp = Regexp.new('(\d+)\s' + name) uvmexp.lines.grep(regexp) do |line| return $1.to_i end end |
.load_average ⇒ Vmstat::LoadAverage
Fetches the load average for the current system.
|
# File 'lib/vmstat.rb', line 46
|
.loopback_devices ⇒ Array<NetworkInterface>
Filters all available loopback devices.
94 95 96 |
# File 'lib/vmstat.rb', line 94 def self.loopback_devices network_interfaces.select(&:loopback?) end |
.network_interfaces ⇒ Array<Vmstat::NetworkInterface>
Fetches the information for all available network devices.
|
# File 'lib/vmstat.rb', line 58
|
.pagesize ⇒ Fixnum
Fetches pagesize of the current system.
|
# File 'lib/vmstat.rb', line 64
|
.snapshot(paths = ["/"]) ⇒ Vmstat::Snapshot
Creates a full snapshot of the systems hardware statistics.
82 83 84 |
# File 'lib/vmstat.rb', line 82 def self.snapshot(paths = ["/"]) Snapshot.new(paths) end |
.task ⇒ Array<Vmstat::Task>
Currently only on Mac OS X
Fetches time and memory usage for the current process.
|
# File 'lib/vmstat.rb', line 70
|