summaryrefslogtreecommitdiffstats
path: root/health-controller.lua
blob: ef08301363c1a606c29bb68eecde57fea3d04a2d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
module (..., package.seeall)

default_action = "system"

-- Public methods

system = function (self )
	return self.model:get_system()
end

storage = function (self )
	return self.model:get_storage()
end

network = function (self )
	return self.model:get_network()
end

modules = function (self )
	return self.model:get_modules()
end

proc = function (self )
	return self.model:get_proc()
end

networkstats = function(self)
	local retval = self.model.get_networkstats()
	if self.clientdata.viewtype then
		self.conf.viewtype = "ajax"
	else
		local intf = self:new("alpine-baselayout/interfaces")
		local interfaces = intf.model.get_addresses()
		intf:destroy()
		for i,intf in ipairs(interfaces.value) do
			if retval.value[intf.interface] then
				retval.value[intf.interface].ipaddr = intf.ipaddr
			end
		end
	end
	return retval
end