diff options
Diffstat (limited to 'tinydns-model.lua')
-rw-r--r-- | tinydns-model.lua | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/tinydns-model.lua b/tinydns-model.lua new file mode 100644 index 0000000..176da46 --- /dev/null +++ b/tinydns-model.lua @@ -0,0 +1,50 @@ +module(..., package.seeall) + +require("procps") + +local processname = "tinydns" +local configfile = "???" + +-- ################################################################################ +-- LOCAL FUNCTIONS + +local function get_version() + local cmd = "/sbin/apk_version -vs " .. processname .." 2>/dev/null" + local f = io.popen( cmd ) + local cmd_output_result = f:read("*l") + f:close() + return cmd_output_result +end + +-- ################################################################################ +-- PUBLIC FUNCTIONS + +function getstatus() +-- local opts = getconfig() + local status = {} + status.version = cfe({ name = "version", + label="Program version", + value=get_version(), + }) + status.status = cfe({ name="status", + label="Program status", + value=procps.pidof(processname), + }) + +--[[ + if (opts["remotelogging"]) and not ((opts["remotelogging"]["value"] ~= "") and not (opts["localandnetworklog"]["value"])) then + status.logfile = cfe({ name="logfile", + label="Locally logging to", + value=opts["logfile"]["value"], + }) + end + if (opts["SYSLOGD_OPTS"]) and (opts["SYSLOGD_OPTS"]["-R"]) and (opts["SYSLOGD_OPTS"]["-R"] ~= "") then + status.remote = cfe({ name="remotelogging", + label="Remote logging to", + value=opts["SYSLOGD_OPTS"]["-R"], + }) + end +--]] + return status +end + |