summaryrefslogtreecommitdiffstats
path: root/health-model.lua
diff options
context:
space:
mode:
Diffstat (limited to 'health-model.lua')
-rw-r--r--health-model.lua14
1 files changed, 8 insertions, 6 deletions
diff --git a/health-model.lua b/health-model.lua
index 50c61f2..424a0e4 100644
--- a/health-model.lua
+++ b/health-model.lua
@@ -1,5 +1,5 @@
-- acf model for displaying logfiles recusivly
-module (..., package.seeall)
+local mymodule = {}
fs = require("acf.fs")
date = require("acf.date")
@@ -52,7 +52,7 @@ end
-- ###############################################################
-- Public functions
-get_system = function (self)
+mymodule.get_system = function (self)
local system = {}
local meminfo = memusage()
system.uptime = cfe({ value=querycmd("uptime"), label="Uptime" })
@@ -68,7 +68,7 @@ get_system = function (self)
return cfe({ type="group", value=system })
end
-get_storage = function (self)
+mymodule.get_storage = function (self)
local storage = {}
local disk = diskfree() .. "\n"
local other = {}
@@ -108,7 +108,7 @@ get_storage = function (self)
return cfe({ type="group", value=storage })
end
-get_network = function (self)
+mymodule.get_network = function (self)
local network = {}
network.interfaces = cfe({ value=querycmd("ip addr"), label="Interfaces" })
network.routes = cfe({ value=querycmd("ip route"), label="Routes" })
@@ -116,14 +116,14 @@ get_network = function (self)
return cfe({ type="group", value=network })
end
-get_proc = function (self)
+mymodule.get_proc = function (self)
local proc = {}
proc.processor = cfe({ value=fs.read_file("/proc/cpuinfo") or "", label="Processor" })
proc.memory = cfe({ value=fs.read_file("/proc/meminfo") or "", label="Memory" })
return cfe({ type="group", value=proc })
end
-get_networkstats = function ()
+mymodule.get_networkstats = function ()
local stats = cfe({ type="structure", value={}, label="Network Stats", timestamp=os.time() })
local result = fs.read_file("/proc/net/dev") or ""
-- parse the result
@@ -144,3 +144,5 @@ get_networkstats = function ()
end
return stats
end
+
+return mymodule