Change hardcoded rrd to "test.rrd" in current directory..

This commit is contained in:
2024-04-17 19:14:59 +02:00
parent 89c30c9c5a
commit 3ef6430096

View File

@ -48,7 +48,8 @@ class RequestHandler(SimpleHTTPRequestHandler):
else:
title = 'monthly'
startstr = '--start=end-1M'
data = rrdtool.graphv("-", startstr, "--title=" + title, "DEF:in=/opt/test.rrd:net_dnat:MAX", "DEF:out=/opt/test.rrd:loc-net:MAX", "CDEF:result_in=in,UN,0,in,IF", "CDEF:tmp_out=out,UN,0,out,IF", "CDEF:result_out=tmp_out,-1,*", "AREA:result_in#00ff00:in", "AREA:result_out#0000ff:out", "--width", "800", "--height", "600")
data = rrdtool.graphv("-", startstr, "--title=" + title, "DEF:in=test.rrd:net_dnat:MAX", "DEF:out=test.rrd:loc-net:MAX", "CDEF:result_in=in,UN,0,in,IF", "CDEF:tmp_out=out,UN,0,out,IF", "CDEF:result_out=tmp_out,-1,*", "AREA:result_in#00ff00:in", "AREA:result_out#0000ff:out")
#, "--width", "1024", "--height", "600"
self.wfile.write(data['image'])
break
except rrdtool.OperationalError as error:
@ -83,6 +84,7 @@ class RequestHandler(SimpleHTTPRequestHandler):
self.wfile.write("<html><body>".encode('utf-8'))
self.wfile.write('<img src="/graph/monthly">'.encode('utf-8'))
self.wfile.write('<img src="/graph/weekly">'.encode('utf-8'))
self.wfile.write('<img src="/graph/daily">'.encode('utf-8'))
self.wfile.write("</body></html>".encode('utf-8'))
def server(server_class=ThreadingHTTPServer, handler_class=RequestHandler):