diff options
author | onefang | 2019-12-10 15:49:46 +1000 |
---|---|---|
committer | onefang | 2019-12-10 15:49:46 +1000 |
commit | a676d3e273ac148616adf9c1bd187dc84fd3fb6b (patch) | |
tree | be763ba80d038250616b27b8e5f38862bed57dc1 | |
parent | Add stuff needed for those detailed graphs using apt-panopticon_cgp. (diff) | |
download | apt-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-x | apt-panopticon-RRD-rescue.lua | 40 |
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 | |||
3 | local APT = require 'apt-panopticommon' | ||
4 | local D = APT.D | ||
5 | local I = APT.I | ||
6 | local W = APT.W | ||
7 | local C = APT.C | ||
8 | local arg, sendArgs = APT.parseArgs({...}) | ||
9 | |||
10 | |||
11 | os.execute('rm -fr rrd') | ||
12 | |||
13 | local files = io.popen('ls -1 *.tar.xz') | ||
14 | for l in files:lines() do | ||
15 | -- print('tar -xf ' .. l) | ||
16 | -- os.execute('tar -xf ' .. l) | ||
17 | end | ||
18 | |||
19 | local files = io.popen('ls -d1 results_*') | ||
20 | for 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 | ||
40 | end | ||