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/version.rb,
lib/vmstat/snapshot.rb,
lib/vmstat/linux_disk.rb,
lib/vmstat/load_average.rb,
lib/vmstat/network_interface.rb,
ext/vmstat/vmstat.c

Defined Under Namespace

Modules: ProcFS, Stub Classes: Cpu, Disk, LinuxDisk, LoadAverage, Memory, NetworkInterface, Snapshot, Task

Constant Summary collapse

VERSION =
"1.1.0"

Class Method Summary collapse

Class Method Details

.boot_timeTime

Fetches the boot time of the system.

Examples:

Vmstat.boot_time # => 2012-10-09 18:42:37 +0200

Returns:

  • (Time)

    the boot time as regular time object.



# File 'lib/vmstat.rb', line 16

.cpuArray<Vmstat::Cpu>

Fetches the cpu statistics (usage counter for user, nice, system and idle)

Examples:

Vmstat.cpu # => [#<struct Vmstat::Cpu ...>, #<struct Vmstat::Cpu ...>]

Returns:



# File 'lib/vmstat.rb', line 22

.disk(path) ⇒ Vmstat::Disk

Fetches the usage data and other useful disk information for the given path.

Examples:

Vmstat.disk("/") # => #<struct Vmstat::Disk type=:hfs, ...>

Parameters:

  • path (String)

    the path (mount point or device path) to the disk

Returns:



# File 'lib/vmstat.rb', line 28

.ethernet_devicesArray<NetworkInterface>

Filters all available ethernet devices.

Returns:



77
78
79
# File 'lib/vmstat.rb', line 77

def self.ethernet_devices
  network_interfaces.select(&:ethernet?)
end

.load_averageVmstat::LoadAverage

Fetches the load average for the current system.

Examples:

Vmstat.load_average # => #<struct Vmstat::LoadAverage one_minute=...>

Returns:



# File 'lib/vmstat.rb', line 35

.loopback_devicesArray<NetworkInterface>

Filters all available loopback devices.

Returns:



83
84
85
# File 'lib/vmstat.rb', line 83

def self.loopback_devices
  network_interfaces.select(&:loopback?)
end

.memoryVmstat::Memory

Fetches the memory usage information.

Examples:

Vmstat.memory # => #<struct Vmstat::Memory ...>

Returns:



# File 'lib/vmstat.rb', line 41

.network_interfacesArray<Vmstat::NetworkInterface>

Fetches the information for all available network devices.

Examples:

Vmstat.network_interfaces # => [#<struct Vmstat::NetworkInterface ...>, ...]

Returns:



# File 'lib/vmstat.rb', line 47

.pagesizeFixnum

Fetches pagesize of the current system.

Examples:

Vmstat.pagesize # => 4096

Returns:

  • (Fixnum)

    the pagesize of the current system in bytes.



# File 'lib/vmstat.rb', line 53

.snapshot(paths = ["/"]) ⇒ Vmstat::Snapshot

Creates a full snapshot of the systems hardware statistics.

Examples:

Vmstat.snapshot # => #<struct Vmstat::Snapshot ...>

Parameters:

  • the (Array<String>)

    paths to the disks to snapshot.

Returns:



71
72
73
# File 'lib/vmstat.rb', line 71

def self.snapshot(paths = ["/"])
  Snapshot.new(paths)
end

.taskArray<Vmstat::Task>

Note:

Currently only on Mac OS X

Fetches time and memory usage for the current process.

Examples:

Vmstat.task # => #<struct Vmstat::Task ...>

Returns:



# File 'lib/vmstat.rb', line 59