diff options
Diffstat (limited to '')
-rw-r--r-- | apt-panopticommon.lua | 34 | ||||
-rwxr-xr-x | apt-panopticon-report-email-web.lua | 8 |
2 files changed, 25 insertions, 17 deletions
diff --git a/apt-panopticommon.lua b/apt-panopticommon.lua index ef622b1..9b62e9a 100644 --- a/apt-panopticommon.lua +++ b/apt-panopticommon.lua | |||
@@ -440,7 +440,7 @@ APT.padResults = function(results) | |||
440 | results[v] = tests | 440 | results[v] = tests |
441 | end | 441 | end |
442 | if nil == results.timeout then results.timeout = false end | 442 | if nil == results.timeout then results.timeout = false end |
443 | if nil == results.speed then results.speed = {min = 0; max = 0} end | 443 | if nil == results.speed then results.speed = {min = 999999999999; max = 0} end |
444 | return results | 444 | return results |
445 | end | 445 | end |
446 | 446 | ||
@@ -551,32 +551,31 @@ local RRAl2 = 'RRA:LAST:0.9:50:1210' | |||
551 | local RRAl3 = 'RRA:LAST:0.9:223:1202' | 551 | local RRAl3 = 'RRA:LAST:0.9:223:1202' |
552 | local RRAl4 = 'RRA:LAST:0.9:2635:1201' | 552 | local RRAl4 = 'RRA:LAST:0.9:2635:1201' |
553 | 553 | ||
554 | APT.createRRD = function(host, ip) | 554 | APT.createRRD = function(host, ip, o) |
555 | if nil ~= o then start = o end | ||
555 | if nil ~= ip then host = host .. '_' .. ip end | 556 | if nil ~= ip then host = host .. '_' .. ip end |
556 | for i, p in pairs(APT.protocols) do | 557 | for i, p in pairs(APT.protocols) do |
557 | os.execute( 'mkdir -p rrd/' .. host .. '/' .. p:upper()) | 558 | os.execute( 'mkdir -p rrd/' .. host .. '/' .. p:upper()) |
558 | if not APT.checkFile('rrd/' .. host .. '/' .. p:upper() .. '/Speed.rrd') then | ||
559 | D('Creating ' .. 'rrd/' .. host .. '/' .. p:upper() .. '/Speed.rrd') | ||
560 | APT.rrd.create( 'rrd/' .. host .. '/' .. p:upper() .. '/Speed.rrd', '--start', start, '--step', step, DSx, DSn, | ||
561 | RRAc0, RRAc1, RRAc2, RRAl0, RRAc3, RRAc4, RRAc5, RRAl1, RRAc6, RRAc7, RRAc8, RRAl2, RRAc9, RRAc10, RRAc11, RRAl3, RRAc12, RRAc13, RRAc14, RRAl4) | ||
562 | end | ||
563 | if not APT.checkFile('rrd/' .. host .. '/' .. p:upper() .. '/Tests.rrd') then | 559 | if not APT.checkFile('rrd/' .. host .. '/' .. p:upper() .. '/Tests.rrd') then |
564 | D('Creating ' .. 'rrd/' .. host .. '/' .. p:upper() .. '/Tests.rrd') | 560 | D('Creating ' .. 'rrd/' .. host .. '/' .. p:upper() .. '/Tests.rrd') |
565 | APT.rrd.create( 'rrd/' .. host .. '/' .. p:upper() .. '/Tests.rrd', '--start', start, '--step', step, DSIe, DSIw, DSPe, DSPw, DSUe, DSUw, DSSe, DSSw, | 561 | APT.rrd.create( 'rrd/' .. host .. '/' .. p:upper() .. '/Tests.rrd', '--start', start, '--step', step, DSIe, DSIw, DSPe, DSPw, DSUe, DSUw, DSSe, DSSw, |
566 | RRAc0, RRAc1, RRAc2, RRAl0, RRAc3, RRAc4, RRAc5, RRAl1, RRAc6, RRAc7, RRAc8, RRAl2, RRAc9, RRAc10, RRAc11, RRAl3, RRAc12, RRAc13, RRAc14, RRAl4) | 562 | RRAc0, RRAc1, RRAc2, RRAl0, RRAc3, RRAc4, RRAc5, RRAl1, RRAc6, RRAc7, RRAc8, RRAl2, RRAc9, RRAc10, RRAc11, RRAl3, RRAc12, RRAc13, RRAc14, RRAl4) |
567 | -- Start them at 0 so the average has something to work on. | 563 | -- Start them at 0 so the average has something to work on. |
568 | APT.rrd.update( 'rrd/' .. host .. '/' .. p:upper() .. '/Speed.rrd', (APT.now - 600) .. ':0:0') | ||
569 | APT.rrd.update( 'rrd/' .. host .. '/' .. p:upper() .. '/Tests.rrd', (APT.now - 600) .. ':0:0:0:0:0:0:0:0') | 564 | APT.rrd.update( 'rrd/' .. host .. '/' .. p:upper() .. '/Tests.rrd', (APT.now - 600) .. ':0:0:0:0:0:0:0:0') |
570 | end | 565 | end |
571 | end | 566 | end |
567 | os.execute( 'mkdir -p rrd/' .. host .. '/Speed') | ||
568 | if not APT.checkFile('rrd/' .. host .. '/Speed/Speed.rrd') then | ||
569 | D('Creating ' .. 'rrd/' .. host .. '/Speed/Speed.rrd') | ||
570 | APT.rrd.create( 'rrd/' .. host .. '/Speed/Speed.rrd', '--start', start, '--step', step, DSx, DSn, | ||
571 | RRAc0, RRAc1, RRAc2, RRAl0, RRAc3, RRAc4, RRAc5, RRAl1, RRAc6, RRAc7, RRAc8, RRAl2, RRAc9, RRAc10, RRAc11, RRAl3, RRAc12, RRAc13, RRAc14, RRAl4) | ||
572 | APT.rrd.update( 'rrd/' .. host .. '/Speed/Speed.rrd', (APT.now - 600) .. ':0:0') | ||
573 | end | ||
572 | end | 574 | end |
573 | 575 | ||
574 | APT.updateRRD = function(results, host, ip) | 576 | APT.updateRRD = function(results, host, ip) |
575 | if nil ~= ip then host = host .. '_' .. ip end | 577 | if nil ~= ip then host = host .. '_' .. ip end |
576 | for i, p in pairs(APT.protocols) do | 578 | for i, p in pairs(APT.protocols) do |
577 | if nil ~= results.speed then | ||
578 | APT.rrd.update( 'rrd/' .. host .. '/' .. p:upper() .. '/Speed.rrd', APT.now .. ':' .. results.speed.max .. ':' .. results.speed.min) | ||
579 | end | ||
580 | if nil ~= results[p] then | 579 | if nil ~= results[p] then |
581 | APT.rrd.update('rrd/' .. host .. '/' .. p:upper() .. '/Tests.rrd', APT.now .. ':' .. | 580 | APT.rrd.update('rrd/' .. host .. '/' .. p:upper() .. '/Tests.rrd', APT.now .. ':' .. |
582 | results[p]['Integrity'].errors .. ':' .. results[p]['Integrity'].warnings .. ':' .. | 581 | results[p]['Integrity'].errors .. ':' .. results[p]['Integrity'].warnings .. ':' .. |
@@ -587,12 +586,21 @@ APT.updateRRD = function(results, host, ip) | |||
587 | APT.rrd.update('rrd/' .. host .. '/' .. p:upper() .. '/Tests.rrd', APT.now .. ':U:U:U:U:U:U:U:U') | 586 | APT.rrd.update('rrd/' .. host .. '/' .. p:upper() .. '/Tests.rrd', APT.now .. ':U:U:U:U:U:U:U:U') |
588 | end | 587 | end |
589 | end | 588 | end |
589 | if nil ~= results.speed then | ||
590 | if 0 ~= results.speed.max then | ||
591 | APT.rrd.update('rrd/' .. host .. '/Speed/Speed.rrd', APT.now .. ':' .. results.speed.max .. ':' .. results.speed.min) | ||
592 | else | ||
593 | APT.rrd.update('rrd/' .. host .. '/Speed/Speed.rrd', APT.now .. ':U:U') | ||
594 | end | ||
595 | else | ||
596 | APT.rrd.update( 'rrd/' .. host .. '/Speed/Speed.rrd', APT.now .. ':U:U') | ||
597 | end | ||
590 | end | 598 | end |
591 | 599 | ||
592 | APT.doRRD = function(l, k, v) | 600 | APT.doRRD = function(l, k, v, o) |
593 | APT.collateAll(l, k, | 601 | APT.collateAll(l, k, |
594 | function(results, ip) | 602 | function(results, ip) |
595 | APT.createRRD(k, ip) | 603 | APT.createRRD(k, ip, o) |
596 | APT.updateRRD(results, k, ip) | 604 | APT.updateRRD(results, k, ip) |
597 | end) | 605 | end) |
598 | end | 606 | end |
diff --git a/apt-panopticon-report-email-web.lua b/apt-panopticon-report-email-web.lua index c52b6c0..5115910 100755 --- a/apt-panopticon-report-email-web.lua +++ b/apt-panopticon-report-email-web.lua | |||
@@ -282,10 +282,10 @@ for k, v in APT.orderedPairs(mirrors) do | |||
282 | local c = colours[count] | 282 | local c = colours[count] |
283 | local name = string.format('%32s', k) | 283 | local name = string.format('%32s', k) |
284 | if 'pkgmaster.devuan.org' == k then c = 'ffffff' end | 284 | if 'pkgmaster.devuan.org' == k then c = 'ffffff' end |
285 | table.insert(g, 'DEF:speedn' .. count .. '=rrd/' .. k .. '/HTTP/Speed.rrd:max:MIN') | 285 | table.insert(g, 'DEF:speedn' .. count .. '=rrd/' .. k .. '/Speed/Speed.rrd:max:MIN') |
286 | table.insert(g, 'DEF:speedx' .. count .. '=rrd/' .. k .. '/HTTP/Speed.rrd:max:MAX') | 286 | table.insert(g, 'DEF:speedx' .. count .. '=rrd/' .. k .. '/Speed/Speed.rrd:max:MAX') |
287 | table.insert(g, 'DEF:speeda' .. count .. '=rrd/' .. k .. '/HTTP/Speed.rrd:max:AVERAGE') | 287 | table.insert(g, 'DEF:speeda' .. count .. '=rrd/' .. k .. '/Speed/Speed.rrd:max:AVERAGE') |
288 | table.insert(g, 'DEF:speedl' .. count .. '=rrd/' .. k .. '/HTTP/Speed.rrd:max:LAST') | 288 | table.insert(g, 'DEF:speedl' .. count .. '=rrd/' .. k .. '/Speed/Speed.rrd:max:LAST') |
289 | table.insert(g, 'VDEF:vspeedn' .. count .. '=speedn' .. count .. ',AVERAGE') | 289 | table.insert(g, 'VDEF:vspeedn' .. count .. '=speedn' .. count .. ',AVERAGE') |
290 | table.insert(g, 'VDEF:vspeedx' .. count .. '=speedx' .. count .. ',AVERAGE') | 290 | table.insert(g, 'VDEF:vspeedx' .. count .. '=speedx' .. count .. ',AVERAGE') |
291 | table.insert(g, 'VDEF:vspeeda' .. count .. '=speeda' .. count .. ',AVERAGE') | 291 | table.insert(g, 'VDEF:vspeeda' .. count .. '=speeda' .. count .. ',AVERAGE') |