Update app.py
This commit is contained in:
parent
6c68f23464
commit
e85a591f54
1 changed files with 18 additions and 1 deletions
19
app.py
19
app.py
|
|
@ -21,6 +21,8 @@ from modules.akvorado import get_widget_data
|
||||||
|
|
||||||
from modules.librenms import get_port_id, fetch_graph_base64
|
from modules.librenms import get_port_id, fetch_graph_base64
|
||||||
|
|
||||||
|
from modules.visual_route import generate_visual_route_graph
|
||||||
|
|
||||||
@app.context_processor
|
@app.context_processor
|
||||||
def inject_hostname():
|
def inject_hostname():
|
||||||
return dict(hostname=os.getenv("HOSTNAME", "unknown"))
|
return dict(hostname=os.getenv("HOSTNAME", "unknown"))
|
||||||
|
|
@ -167,4 +169,19 @@ def graph_page(interface_name):
|
||||||
weekly=weekly,
|
weekly=weekly,
|
||||||
monthly=monthly,
|
monthly=monthly,
|
||||||
error=False
|
error=False
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@app.route('/visual-route')
|
||||||
|
def visual_route_page():
|
||||||
|
return render_template("visual-route.html")
|
||||||
|
|
||||||
|
@app.route('/visual-route/graph', methods=['POST'])
|
||||||
|
def visual_route_graph():
|
||||||
|
ip_address_str = request.json.get('ip_address')
|
||||||
|
|
||||||
|
graph_data = generate_visual_route_graph(ip_address_str)
|
||||||
|
|
||||||
|
if "error" in graph_data:
|
||||||
|
return jsonify(graph_data), 400
|
||||||
|
|
||||||
|
return jsonify(graph_data)
|
||||||
Loading…
Add table
Add a link
Reference in a new issue