Class: Vmstat::Snapshot
- Inherits:
-
Object
- Object
- Vmstat::Snapshot
- Defined in:
- lib/vmstat/snapshot.rb
Overview
Snapshots help to gather information about the whole system quickly.
Instance Attribute Summary collapse
-
#at ⇒ Time
the timestamp, when the snapshot was created.
-
#boot_time ⇒ Time
the timestamp, when the system booted.
-
#cpus ⇒ Array<Vmstat::Cpu>
the data of each and every cpu.
-
#disks ⇒ Array<Vmstat::Disk>
the disks that are part of the snapshot.
-
#load_average ⇒ Vmstat::LoadAverage
current load average at the time when the snapshot toke place.
-
#memory ⇒ Vmstat::Memory
the memory data snapshot.
-
#network_interfaces ⇒ Array<Vmstat::NetworkInterface>
the network interface data snapshots per network interface.
-
#task ⇒ Vmstat::Task
optionally the information for the current task.
Instance Method Summary collapse
-
#initialize(paths = []) ⇒ Snapshot
constructor
Create a new snapshot for system informations.
Constructor Details
#initialize(paths = []) ⇒ Snapshot
Create a new snapshot for system informations. The passed paths array, should contain the disk paths to create a snapshot for.
22 23 24 25 26 27 28 29 30 31 |
# File 'lib/vmstat/snapshot.rb', line 22 def initialize(paths = []) @at = Time.now @boot_time = Vmstat.boot_time @cpus = Vmstat.cpu @disks = paths.map { |path| Vmstat.disk(path) } @load_average = Vmstat.load_average @memory = Vmstat.memory @network_interfaces = Vmstat.network_interfaces @task = Vmstat.task if Vmstat.respond_to? :task end |
Instance Attribute Details
#at ⇒ Time
the timestamp, when the snapshot was created.
15 16 17 |
# File 'lib/vmstat/snapshot.rb', line 15 def at @at end |
#boot_time ⇒ Time
the timestamp, when the system booted.
15 16 17 |
# File 'lib/vmstat/snapshot.rb', line 15 def boot_time @boot_time end |
#cpus ⇒ Array<Vmstat::Cpu>
the data of each and every cpu.
15 16 17 |
# File 'lib/vmstat/snapshot.rb', line 15 def cpus @cpus end |
#disks ⇒ Array<Vmstat::Disk>
the disks that are part of the snapshot.
15 16 17 |
# File 'lib/vmstat/snapshot.rb', line 15 def disks @disks end |
#load_average ⇒ Vmstat::LoadAverage
current load average at the time when the snapshot toke place.
15 16 17 |
# File 'lib/vmstat/snapshot.rb', line 15 def load_average @load_average end |
#memory ⇒ Vmstat::Memory
the memory data snapshot.
15 16 17 |
# File 'lib/vmstat/snapshot.rb', line 15 def memory @memory end |
#network_interfaces ⇒ Array<Vmstat::NetworkInterface>
the network interface data snapshots per network interface.
15 16 17 |
# File 'lib/vmstat/snapshot.rb', line 15 def network_interfaces @network_interfaces end |
#task ⇒ Vmstat::Task
optionally the information for the current task
15 16 17 |
# File 'lib/vmstat/snapshot.rb', line 15 def task @task end |