mirror of
https://github.com/eduardogsilva/wireguard_webadmin.git
synced 2025-04-19 08:55:12 +00:00
Update graph period handling to support dynamic input
This commit is contained in:
parent
11f0a30cf1
commit
804a5e90fb
@ -38,19 +38,13 @@ def view_rrd_graph(request):
|
|||||||
|
|
||||||
with tempfile.NamedTemporaryFile(suffix='.png', delete=False) as tmp_file:
|
with tempfile.NamedTemporaryFile(suffix='.png', delete=False) as tmp_file:
|
||||||
graph_file = tmp_file.name
|
graph_file = tmp_file.name
|
||||||
#command = [
|
|
||||||
# "rrdtool", "graph", graph_file,
|
period = request.GET.get('period', '6h')
|
||||||
# "--start", "-6h",
|
if not (period[:-1].isdigit() and period[-1] in ['h', 'd']):
|
||||||
# "--title", "RRD Data Graph",
|
period = '6h'
|
||||||
# "--vertical-label", "Value",
|
|
||||||
# f"DEF:txdata={rrd_file_path}:tx:AVERAGE",
|
|
||||||
# f"DEF:rxdata={rrd_file_path}:rx:AVERAGE",
|
|
||||||
# "LINE1:txdata#FF0000:Transmitted",
|
|
||||||
# "LINE1:rxdata#0000FF:Received"
|
|
||||||
#]
|
|
||||||
command = [
|
command = [
|
||||||
"rrdtool", "graph", graph_file,
|
"rrdtool", "graph", graph_file,
|
||||||
"--start", "-6h",
|
"--start", f"-{period}",
|
||||||
"--title", "RRD Data Graph",
|
"--title", "RRD Data Graph",
|
||||||
"--vertical-label", "Value",
|
"--vertical-label", "Value",
|
||||||
f"DEF:txdata={rrd_file_path}:tx:AVERAGE",
|
f"DEF:txdata={rrd_file_path}:tx:AVERAGE",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user