Skip to content

Commit 9aa9a36

Browse files
author
rafal
committed
save
1 parent 64d0088 commit 9aa9a36

File tree

3 files changed

+25
-1211
lines changed

3 files changed

+25
-1211
lines changed

rrd_graphs/data.rrd

41.5 MB
Binary file not shown.

rrd_graphs/load_rrd.py

Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,10 @@
77
print("no args. [input] [output]");
88
exit()
99

10-
print('input file', sys.argv[1])
11-
print('out file', sys.argv[2]);
10+
#print('input file', sys.argv[1])
11+
#print('out file', sys.argv[2]);
12+
13+
maxpoints = 20
1214

1315
rrdpath = 'c:\\tools\\rrdtool\\rrdtool.exe'
1416

@@ -32,7 +34,7 @@ def statenr(c):
3234
mon = int(fn[1:3])
3335
day = int(fn[3:5])
3436

35-
print('base name', fn, mon, day)
37+
#print(';base name', fn, mon, day)
3638

3739
stm = io.open(file=sys.argv[1], mode='+rt');
3840

@@ -64,6 +66,15 @@ def statenr(c):
6466
stempl += ':' + dd[0]
6567
stempl = stempl[1:]
6668

69+
dataps = []
70+
71+
def writecmd(dps):
72+
print(rrdpath, 'update', sys.argv[2], '-t', stempl, end=' ')
73+
for p in dps:
74+
print(p, end=' ')
75+
print()
76+
77+
6778
while True:
6879
ln = stm.readline()
6980
num+=1
@@ -77,11 +88,13 @@ def statenr(c):
7788
hh = int(d0[0])
7889
mm = int(d0[1])
7990
dnow = datetime.date.today()
80-
y = dnow.year if mm < dnow.month or (mon == dnow.month and day <= dnow.day) else dnow.year - 1
91+
y = dnow.year if mon < dnow.month or (mon == dnow.month and day <= dnow.day) else dnow.year - 1
8192
tstamp = datetime.datetime(year=y, month=mon, day=day, hour=hh, minute=mm)
8293
unixts = int(tstamp.timestamp())
94+
#print(num, tstamp, unixts)
8395
#print(num, tstamp, dt[0], unixts)
8496

97+
8598
s = str(unixts)
8699
for dd in ds:
87100
ix = dd[1]
@@ -92,6 +105,12 @@ def statenr(c):
92105
s += ':'
93106
s += str(v)
94107

95-
96-
print(rrdpath, 'update ', sys.argv[2], '-t', stempl, s)
108+
dataps.append(s)
109+
110+
if len(dataps) >= maxpoints:
111+
writecmd(dataps)
112+
dataps=[]
113+
114+
if len(dataps) >= maxpoints:
115+
writecmd(dataps)
97116

0 commit comments

Comments
 (0)