Class: BlackStack::LocalHost
- Inherits:
-
Object
- Object
- BlackStack::LocalHost
show all
- Includes:
- BaseHost
- Defined in:
- lib/localhost.rb
Instance Method Summary
collapse
Methods included from BaseHost
descriptor_validation_details, #poll, #push, #to_hash, valid_descriptor?, #windows_os?
Instance Method Details
#disk_load ⇒ Object
56
57
58
|
# File 'lib/localhost.rb', line 56
def disk_load
100.to_f*(self.disk_total.to_f - self.disk_free.to_f) / self.disk_total.to_f
end
|
#mem_load ⇒ Object
51
52
53
|
# File 'lib/localhost.rb', line 51
def mem_load
100.to_f*(self.mem_total.to_f - self.mem_free.to_f) / self.mem_total.to_f
end
|
#parse(h) ⇒ Object
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
# File 'lib/localhost.rb', line 11
def parse(h)
self.cpu_architecture = h[:cpu_architecture]
self.cpu_speed = h[:cpu_speed]
self.cpu_load_average = h[:cpu_load_average]
self.cpu_model = h[:cpu_model]
self.cpu_type = h[:cpu_type]
self.cpu_number = h[:cpu_number]
self.mem_total = h[:mem_total]
self.mem_free = h[:mem_free]
self.disk_total = h[:disk_total]
self.disk_free = h[:disk_free]
self.net_hostname = h[:net_hostname]
self.net_mac_address = h[:net_mac_address]
end
|
#track ⇒ Object
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
# File 'lib/localhost.rb', line 29
def track
h = LocalHostHistory.new
h.id = guid()
h.id_host = self.id
h.create_time = now()
h.cpu_architecture = self.cpu_architecture
h.cpu_speed = self.cpu_speed
h.cpu_load_average = self.cpu_load_average
h.cpu_model = self.cpu_model
h.cpu_type = self.cpu_type
h.cpu_number = self.cpu_number
h.mem_total = self.mem_total
h.mem_free = self.mem_free
h.disk_total = self.disk_total
h.disk_free = self.disk_free
h.net_hostname = self.net_hostname
h.net_remote_ip = self.net_remote_ip
h.net_mac_address = self.net_mac_address
h.save
end
|