monitor #3
1 changed files with 6 additions and 6 deletions
12
app.py
12
app.py
|
@ -18,25 +18,25 @@ def homepage():
|
||||||
|
|
||||||
@app.route("/monitoring")
|
@app.route("/monitoring")
|
||||||
def monitoring():
|
def monitoring():
|
||||||
git_status = get("https://git.adrianux.net")
|
git_status = get_status("https://git.adrianux.net")
|
||||||
website_status = get("https://adrianux.net")
|
website_status = get_status("https://adrianux.net")
|
||||||
return render_template("monitoring.html", git_status = git_status, website_status = website_status )
|
return render_template("monitoring.html", git_status = git_status, website_status = website_status )
|
||||||
|
|
||||||
def get_status_code(link):
|
def get_status_code(link):
|
||||||
requested_site = requests.get(link)
|
requested_site = requests.get(link)
|
||||||
return requested_site.status_code
|
return requested_site.status_code
|
||||||
|
|
||||||
def get(link):
|
def get_status(link):
|
||||||
match get_status_code(link):
|
match get_status_code(link):
|
||||||
case 200:
|
case 200:
|
||||||
print(200)
|
print(200)
|
||||||
return "<span style=green>ONLINE</span>"
|
return "ONLINE"
|
||||||
case 500:
|
case 500:
|
||||||
print(500)
|
print(500)
|
||||||
return "<span style=orange>ERROR</span>"
|
return "ERROR"
|
||||||
case _:
|
case _:
|
||||||
print("OTHER")
|
print("OTHER")
|
||||||
return "<span style=red>OFFLINE</span>"
|
return "OFFLINE"
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
app.run(debug=True)
|
app.run(debug=True)
|
||||||
|
|
Loading…
Reference in a new issue