aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/apt-panopticommon.lua
diff options
context:
space:
mode:
authoronefang2019-12-23 13:08:42 +1000
committeronefang2019-12-23 13:08:42 +1000
commit51f13c53b40edcc643cc611899954d2fcfab72ad (patch)
tree8e4f5fe5f04a0e770a4f3d73daa2f9bce76f8940 /apt-panopticommon.lua
parentPromote verbosity to become an externally visible entity. (diff)
downloadapt-panopticon-51f13c53b40edcc643cc611899954d2fcfab72ad.zip
apt-panopticon-51f13c53b40edcc643cc611899954d2fcfab72ad.tar.gz
apt-panopticon-51f13c53b40edcc643cc611899954d2fcfab72ad.tar.bz2
apt-panopticon-51f13c53b40edcc643cc611899954d2fcfab72ad.tar.xz
Speed RRD is now it's own thing, not aseparate one per protocol.
Diffstat (limited to 'apt-panopticommon.lua')
-rw-r--r--apt-panopticommon.lua34
1 files changed, 21 insertions, 13 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
445end 445end
446 446
@@ -551,32 +551,31 @@ local RRAl2 = 'RRA:LAST:0.9:50:1210'
551local RRAl3 = 'RRA:LAST:0.9:223:1202' 551local RRAl3 = 'RRA:LAST:0.9:223:1202'
552local RRAl4 = 'RRA:LAST:0.9:2635:1201' 552local RRAl4 = 'RRA:LAST:0.9:2635:1201'
553 553
554APT.createRRD = function(host, ip) 554APT.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
572end 574end
573 575
574APT.updateRRD = function(results, host, ip) 576APT.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
590end 598end
591 599
592APT.doRRD = function(l, k, v) 600APT.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)
598end 606end