diff options
| author | onefang | 2019-12-28 22:39:52 +1000 |
|---|---|---|
| committer | onefang | 2019-12-28 22:39:52 +1000 |
| commit | 6e868b6382cabbacffb1d12dc91f7eb9a8362ce2 (patch) | |
| tree | f14f68c1419053b787969fd210d903458ddde52a | |
| parent | Nagios is no longer a report type. (diff) | |
| download | apt-panopticon-6e868b6382cabbacffb1d12dc91f7eb9a8362ce2.zip apt-panopticon-6e868b6382cabbacffb1d12dc91f7eb9a8362ce2.tar.gz apt-panopticon-6e868b6382cabbacffb1d12dc91f7eb9a8362ce2.tar.bz2 apt-panopticon-6e868b6382cabbacffb1d12dc91f7eb9a8362ce2.tar.xz | |
Tweak the dumpTable() arguments a little.
Diffstat (limited to '')
| -rw-r--r-- | apt-panopticommon.lua | 16 | ||||
| -rwxr-xr-x | apt-panopticon-nagios.lua | 2 | ||||
| -rwxr-xr-x | apt-panopticon-report-email-web.lua | 4 | ||||
| -rwxr-xr-x | apt-panopticon-update-data.lua | 4 | ||||
| -rwxr-xr-x | apt-panopticon.lua | 8 |
5 files changed, 17 insertions, 17 deletions
diff --git a/apt-panopticommon.lua b/apt-panopticommon.lua index cfea728..53bd674 100644 --- a/apt-panopticommon.lua +++ b/apt-panopticommon.lua | |||
| @@ -182,8 +182,6 @@ APT.parseArgs = function(args) | |||
| 182 | return arg, sendArgs | 182 | return arg, sendArgs |
| 183 | end | 183 | end |
| 184 | 184 | ||
| 185 | --print(APT.dumpTable(APT.options, "", "options")) | ||
| 186 | |||
| 187 | 185 | ||
| 188 | 186 | ||
| 189 | --[[ Ordered table iterator, allow to iterate on the natural order of the keys of a table. | 187 | --[[ Ordered table iterator, allow to iterate on the natural order of the keys of a table. |
| @@ -232,7 +230,8 @@ function APT.orderedPairs(t) | |||
| 232 | end | 230 | end |
| 233 | 231 | ||
| 234 | -- Use this to dump a table to a string, with HTML. | 232 | -- Use this to dump a table to a string, with HTML. |
| 235 | APT.dumpTableHTML = function (table, space, name) | 233 | APT.dumpTableHTML = function (table, name, space) |
| 234 | if nil == space then space = '' end | ||
| 236 | local r = name .. "\n" | 235 | local r = name .. "\n" |
| 237 | r = r .. dumpTableHTMLSub(table, space .. " ") | 236 | r = r .. dumpTableHTMLSub(table, space .. " ") |
| 238 | r = r .. space .. "" | 237 | r = r .. space .. "" |
| @@ -243,9 +242,9 @@ dumpTableHTMLSub = function (table, space) | |||
| 243 | for k, v in APT.orderedPairs(table) do | 242 | for k, v in APT.orderedPairs(table) do |
| 244 | if type(v) == "table" then | 243 | if type(v) == "table" then |
| 245 | if " " == space then | 244 | if " " == space then |
| 246 | r = r .. space .. APT.dumpTableHTML(v, space, k .. "<ul>") .. "</ul>\n" | 245 | r = r .. space .. APT.dumpTableHTML(v, k .. "<ul>", space) .. "</ul>\n" |
| 247 | else | 246 | else |
| 248 | r = r .. "<li>" .. space .. APT.dumpTableHTML(v, space, k .. "<ul>") .. "</ul></li>\n" | 247 | r = r .. "<li>" .. space .. APT.dumpTableHTML(v, k .. "<ul>", space) .. "</ul></li>\n" |
| 249 | end | 248 | end |
| 250 | else | 249 | else |
| 251 | r = r .. space .. "<li>" .. k .. "</li>\n" | 250 | r = r .. space .. "<li>" .. k .. "</li>\n" |
| @@ -255,7 +254,8 @@ dumpTableHTMLSub = function (table, space) | |||
| 255 | end | 254 | end |
| 256 | 255 | ||
| 257 | -- Use this to dump a table to a string. | 256 | -- Use this to dump a table to a string. |
| 258 | APT.dumpTable = function (table, space, name) | 257 | APT.dumpTable = function (table, name, space) |
| 258 | if nil == space then space = '' end | ||
| 259 | local r = "" | 259 | local r = "" |
| 260 | if "" == space then r = r .. space .. name .. " =\n" else r = r .. space .. "[" .. name .. "] =\n" end | 260 | if "" == space then r = r .. space .. name .. " =\n" else r = r .. space .. "[" .. name .. "] =\n" end |
| 261 | r = r .. space .. "{\n" | 261 | r = r .. space .. "{\n" |
| @@ -268,7 +268,7 @@ dumpTableSub = function (table, space) | |||
| 268 | for k, v in pairs(table) do | 268 | for k, v in pairs(table) do |
| 269 | if type(k) == "string" then k = '"' .. k .. '"' end | 269 | if type(k) == "string" then k = '"' .. k .. '"' end |
| 270 | if type(v) == "table" then | 270 | if type(v) == "table" then |
| 271 | r = r .. APT.dumpTable(v, space, k) | 271 | r = r .. APT.dumpTable(v, k, space) |
| 272 | elseif type(v) == "string" then | 272 | elseif type(v) == "string" then |
| 273 | local bq = '"' | 273 | local bq = '"' |
| 274 | local eq = '"' | 274 | local eq = '"' |
| @@ -331,7 +331,7 @@ APT.logOpen = function(host, a2, a3) | |||
| 331 | APT.logFile:write("<html><head>\n") | 331 | APT.logFile:write("<html><head>\n") |
| 332 | APT.logFile:write("</head><body bgcolor='black' text='white' alink='red' link='blue' vlink='purple'>\n") | 332 | APT.logFile:write("</head><body bgcolor='black' text='white' alink='red' link='blue' vlink='purple'>\n") |
| 333 | APT.logFile:write("<pre>\n") | 333 | APT.logFile:write("<pre>\n") |
| 334 | APT.logFile:write(APT.dumpTable(APT.args, '', 'Arguments')) | 334 | APT.logFile:write(APT.dumpTable(APT.args, 'Arguments')) |
| 335 | APT.logFile:write("</pre>\n") | 335 | APT.logFile:write("</pre>\n") |
| 336 | else | 336 | else |
| 337 | return false | 337 | return false |
diff --git a/apt-panopticon-nagios.lua b/apt-panopticon-nagios.lua index 1cc9bbc..d50a780 100755 --- a/apt-panopticon-nagios.lua +++ b/apt-panopticon-nagios.lua | |||
| @@ -300,7 +300,7 @@ if arguments["verbose"].value > 1 then | |||
| 300 | print("\nCheckGeneric.lua arguments -") | 300 | print("\nCheckGeneric.lua arguments -") |
| 301 | for k, v in pairs(arguments) do | 301 | for k, v in pairs(arguments) do |
| 302 | if type(v.value) == "table" then | 302 | if type(v.value) == "table" then |
| 303 | APT.dumpTable(v.value, "", " --" .. k) | 303 | APT.dumpTable(v.value, " --" .. k) |
| 304 | elseif type(v.value) == "boolean" then | 304 | elseif type(v.value) == "boolean" then |
| 305 | if (v.value) then | 305 | if (v.value) then |
| 306 | printf(" --%s: true\n", k) | 306 | printf(" --%s: true\n", k) |
diff --git a/apt-panopticon-report-email-web.lua b/apt-panopticon-report-email-web.lua index 86484be..67d4d13 100755 --- a/apt-panopticon-report-email-web.lua +++ b/apt-panopticon-report-email-web.lua | |||
| @@ -517,7 +517,7 @@ if nil == web then C("opening mirrors file - " .. e) else | |||
| 517 | "pkgmaster.devuan.org is the master mirror, all the others sync to it. " .. | 517 | "pkgmaster.devuan.org is the master mirror, all the others sync to it. " .. |
| 518 | "</p>\n" | 518 | "</p>\n" |
| 519 | ) | 519 | ) |
| 520 | web:write(APT.dumpTableHTML(m, "", "")) | 520 | web:write(APT.dumpTableHTML(m, "")) |
| 521 | web:write( "\n<br>\n<br>\n<h2>==== graphs: ====</h2>\n" .. | 521 | web:write( "\n<br>\n<br>\n<h2>==== graphs: ====</h2>\n" .. |
| 522 | "<img src='speed.png'>\n<br>\n<p><a href='../apt-panopticon_cgp/'>More graphs.</a> with greater detail.</p><hr>\n\n") | 522 | "<img src='speed.png'>\n<br>\n<p><a href='../apt-panopticon_cgp/'>More graphs.</a> with greater detail.</p><hr>\n\n") |
| 523 | 523 | ||
| @@ -636,7 +636,7 @@ if nil == web then C("opening mirrors file - " .. e) else | |||
| 636 | end | 636 | end |
| 637 | m[log .. " DNS entries -" .. redirs(APT.mirrors, k)] = n | 637 | m[log .. " DNS entries -" .. redirs(APT.mirrors, k)] = n |
| 638 | end | 638 | end |
| 639 | web:write(APT.dumpTableHTML(m, "", "")) | 639 | web:write(APT.dumpTableHTML(m, "")) |
| 640 | 640 | ||
| 641 | web:write( "<hr>\n<hr>\n<p>The <a href='Report-email.txt'>email report</a>. " .. | 641 | web:write( "<hr>\n<hr>\n<p>The <a href='Report-email.txt'>email report</a>. " .. |
| 642 | "All <a href='../results'>the logs and other output</a>. " .. | 642 | "All <a href='../results'>the logs and other output</a>. " .. |
diff --git a/apt-panopticon-update-data.lua b/apt-panopticon-update-data.lua index e882c49..a26b11b 100755 --- a/apt-panopticon-update-data.lua +++ b/apt-panopticon-update-data.lua | |||
| @@ -33,7 +33,7 @@ local fixResults = function(f) | |||
| 33 | end | 33 | end |
| 34 | local rfile, e = io.open(f, "w+") | 34 | local rfile, e = io.open(f, "w+") |
| 35 | if nil == rfile then C("opening results file - " .. e) else | 35 | if nil == rfile then C("opening results file - " .. e) else |
| 36 | rfile:write(APT.dumpTable(results, "", "results") .. "\nreturn results\n") | 36 | rfile:write(APT.dumpTable(results, "results") .. "\nreturn results\n") |
| 37 | rfile:close() | 37 | rfile:close() |
| 38 | end | 38 | end |
| 39 | end | 39 | end |
| @@ -86,7 +86,7 @@ for l in files:lines() do | |||
| 86 | results['IPs'] = v.IPs | 86 | results['IPs'] = v.IPs |
| 87 | local rfile, e = io.open(f, "w+") | 87 | local rfile, e = io.open(f, "w+") |
| 88 | if nil == rfile then C("opening results file - " .. e) else | 88 | if nil == rfile then C("opening results file - " .. e) else |
| 89 | rfile:write(APT.dumpTable(results, "", "results") .. "\nreturn results\n") | 89 | rfile:write(APT.dumpTable(results, "results") .. "\nreturn results\n") |
| 90 | rfile:close() | 90 | rfile:close() |
| 91 | end | 91 | end |
| 92 | end | 92 | end |
diff --git a/apt-panopticon.lua b/apt-panopticon.lua index a97a974..c39a9b9 100755 --- a/apt-panopticon.lua +++ b/apt-panopticon.lua | |||
| @@ -624,7 +624,7 @@ local getMirrors = function () | |||
| 624 | end | 624 | end |
| 625 | local file, e = io.open("results/mirrors.lua", "w+") | 625 | local file, e = io.open("results/mirrors.lua", "w+") |
| 626 | if nil == file then C("opening mirrors file - " .. e) else | 626 | if nil == file then C("opening mirrors file - " .. e) else |
| 627 | file:write(APT.dumpTable(mirrors, "", "mirrors") .. "\nreturn mirrors\n") | 627 | file:write(APT.dumpTable(mirrors, "mirrors") .. "\nreturn mirrors\n") |
| 628 | file:close() | 628 | file:close() |
| 629 | end | 629 | end |
| 630 | return mirrors | 630 | return mirrors |
| @@ -1045,7 +1045,7 @@ if 0 < #arg then | |||
| 1045 | if "" ~= ip then f = f .. "_" .. ip end | 1045 | if "" ~= ip then f = f .. "_" .. ip end |
| 1046 | local rfile, e = io.open("results/" .. f .. ".lua", "w+") | 1046 | local rfile, e = io.open("results/" .. f .. ".lua", "w+") |
| 1047 | if nil == rfile then C("opening results file - " .. e) else | 1047 | if nil == rfile then C("opening results file - " .. e) else |
| 1048 | rfile:write(APT.dumpTable(APT.results, "", "results") .. "\nreturn results\n") | 1048 | rfile:write(APT.dumpTable(APT.results, "results") .. "\nreturn results\n") |
| 1049 | rfile:close() | 1049 | rfile:close() |
| 1050 | end | 1050 | end |
| 1051 | 1051 | ||
| @@ -1190,7 +1190,7 @@ os.execute('sleep 1') -- Wait for things to start up before checking for them. | |||
| 1190 | end | 1190 | end |
| 1191 | local file, e = io.open("results/debians.lua", "w+") | 1191 | local file, e = io.open("results/debians.lua", "w+") |
| 1192 | if nil == file then C("opening debians file - " .. e) else | 1192 | if nil == file then C("opening debians file - " .. e) else |
| 1193 | file:write(APT.dumpTable(debians, "", "debians") .. "\nreturn debians\n") | 1193 | file:write(APT.dumpTable(debians, "debians") .. "\nreturn debians\n") |
| 1194 | file:close() | 1194 | file:close() |
| 1195 | end | 1195 | end |
| 1196 | 1196 | ||
| @@ -1204,7 +1204,7 @@ os.execute('sleep 1') -- Wait for things to start up before checking for them. | |||
| 1204 | end | 1204 | end |
| 1205 | local file, e = io.open("results/mirrors.lua", "w+") | 1205 | local file, e = io.open("results/mirrors.lua", "w+") |
| 1206 | if nil == file then C("opening mirrors file - " .. e) else | 1206 | if nil == file then C("opening mirrors file - " .. e) else |
| 1207 | file:write(APT.dumpTable(APT.mirrors, "", "mirrors") .. "\nreturn mirrors\n") | 1207 | file:write(APT.dumpTable(APT.mirrors, "mirrors") .. "\nreturn mirrors\n") |
| 1208 | file:close() | 1208 | file:close() |
| 1209 | end | 1209 | end |
| 1210 | 1210 | ||
