aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authoronefang2019-12-10 15:49:46 +1000
committeronefang2019-12-10 15:49:46 +1000
commita676d3e273ac148616adf9c1bd187dc84fd3fb6b (patch)
treebe763ba80d038250616b27b8e5f38862bed57dc1
parentAdd stuff needed for those detailed graphs using apt-panopticon_cgp. (diff)
downloadapt-panopticon-a676d3e273ac148616adf9c1bd187dc84fd3fb6b.zip
apt-panopticon-a676d3e273ac148616adf9c1bd187dc84fd3fb6b.tar.gz
apt-panopticon-a676d3e273ac148616adf9c1bd187dc84fd3fb6b.tar.bz2
apt-panopticon-a676d3e273ac148616adf9c1bd187dc84fd3fb6b.tar.xz
A script for extracting RRD data from old results_date backups.
-rwxr-xr-xapt-panopticon-RRD-rescue.lua40
1 files changed, 40 insertions, 0 deletions
diff --git a/apt-panopticon-RRD-rescue.lua b/apt-panopticon-RRD-rescue.lua
new file mode 100755
index 0000000..8fd06c0
--- /dev/null
+++ b/apt-panopticon-RRD-rescue.lua
@@ -0,0 +1,40 @@
1#!/usr/bin/env luajit
2
3local APT = require 'apt-panopticommon'
4local D = APT.D
5local I = APT.I
6local W = APT.W
7local C = APT.C
8local arg, sendArgs = APT.parseArgs({...})
9
10
11os.execute('rm -fr rrd')
12
13local files = io.popen('ls -1 *.tar.xz')
14for l in files:lines() do
15-- print('tar -xf ' .. l)
16-- os.execute('tar -xf ' .. l)
17end
18
19local files = io.popen('ls -d1 results_*')
20for l in files:lines() do
21 if ('results_old' ~= l) and ('.tar.xz' ~= l:sub(25, -1)) then
22 if APT.checkFile(l .. '/stamp') then
23 local status, whn = APT.execute('TZ="GMT" ls -d1 --time-style="+%s" ' .. l .. ' | cut -d " " -f 6-6')
24 whn = whn:sub(2, -2)
25 local status, new = APT.execute('TZ="GMT" date -d "' .. whn:sub(9, 18) .. ' ' .. whn:sub(20, 21) .. ':' .. whn:sub(23, 24) .. '" "+%s"')
26 APT.now = tonumber("0" .. new:sub(2, -2))
27 if 0 ~= APT.now then
28 print(l .. ' -> ' .. APT.now)
29 APT.mirrors = loadfile(l .. "/mirrors.lua")()
30 for k, v in pairs(APT.mirrors) do
31 APT.doRRD(l, k, v)
32 end
33 else
34 print(l)
35 end
36 else
37 print(l)
38 end
39 end
40end