Module: Mastercontrol::Server
- Defined in:
- lib/mastercontrol/server.rb
Defined Under Namespace
Classes: DiskPartition, ServerHostname, ServerLoad
Class Method Summary
collapse
Class Method Details
.disk_usage ⇒ Object
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
|
# File 'lib/mastercontrol/server.rb', line 58
def self.disk_usage
url = "#{Mastercontrol.base_url}/getdiskusage?api.version=1"
response = RestClient.get url, {authorization: Mastercontrol.}
json_response = JSON.parse(response)
return_array = []
json_response["data"]["partition"].each do |part|
return_array << DiskPartition.new(part["disk"], part["filesystem"], part["mount"], part["used"], part["percentage"], part["total"], part["available"])
end
return_array
end
|
.hostname ⇒ Object
47
48
49
50
51
52
53
54
55
56
|
# File 'lib/mastercontrol/server.rb', line 47
def self.hostname
url = "#{Mastercontrol.base_url}/gethostname?api.version=1"
response = RestClient.get url, {authorization: Mastercontrol.}
json_response = JSON.parse(response)
ServerHostname.new(json_response['data']['hostname'])
end
|
.system_load_avg ⇒ Object
36
37
38
39
40
41
42
43
44
45
|
# File 'lib/mastercontrol/server.rb', line 36
def self.system_load_avg
url = "#{Mastercontrol.base_url}/systemloadavg?api.version=1"
response = RestClient.get url, {authorization: Mastercontrol.}
json_response = JSON.parse(response)
ServerLoad.new(json_response["data"]["one"], json_response["data"]["five"], json_response["data"]["fifteen"])
end
|