ntp as png
This commit is contained in:
parent
2d3eab0db8
commit
4213dc7329
18
src/run.py
18
src/run.py
@ -1,4 +1,4 @@
|
|||||||
from flask import Flask, session, g, render_template_string
|
from flask import Flask, session, g, render_template_string, Response
|
||||||
from flask_session import Session
|
from flask_session import Session
|
||||||
from flask_oidc import OpenIDConnect
|
from flask_oidc import OpenIDConnect
|
||||||
from werkzeug.middleware.proxy_fix import ProxyFix
|
from werkzeug.middleware.proxy_fix import ProxyFix
|
||||||
@ -174,8 +174,6 @@ def ntpserver():
|
|||||||
fig.add_trace(po.Scatter(x=df['bucket'], y=df['stratum'], mode='lines', name='Stratum', yaxis='y2', line=dict(color='blue')))
|
fig.add_trace(po.Scatter(x=df['bucket'], y=df['stratum'], mode='lines', name='Stratum', yaxis='y2', line=dict(color='blue')))
|
||||||
|
|
||||||
fig.update_layout(
|
fig.update_layout(
|
||||||
title='NTP Server Numbers',
|
|
||||||
|
|
||||||
# Linke Y-Achse
|
# Linke Y-Achse
|
||||||
yaxis=dict(
|
yaxis=dict(
|
||||||
title='Root Dispersion'
|
title='Root Dispersion'
|
||||||
@ -193,19 +191,9 @@ def ntpserver():
|
|||||||
legend=dict(x=0.05, y=1) # Position der Legende
|
legend=dict(x=0.05, y=1) # Position der Legende
|
||||||
)
|
)
|
||||||
|
|
||||||
|
img = fig.to_image(format='png')
|
||||||
|
return Response(img, mimetype='image/png')
|
||||||
|
|
||||||
graph_html = fig.to_html(full_html=False, default_height='30%')
|
|
||||||
|
|
||||||
return render_template_string(f"""
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title>NTP Server Numbers</title>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
{graph_html}
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
""")
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
raise Exception(f"Error when querying NTP server values: {e}")
|
raise Exception(f"Error when querying NTP server values: {e}")
|
||||||
finally:
|
finally:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user