Skip to content

Instantly share code, notes, and snippets.

Created October 18, 2021 21:55
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
A very basic status page
import os
# Very basic status page script
# * Read the blog post here:
# * You will need if you want a bit more fancy style
# List of all tests we want to run
tests = [
{"cmd": "ping", "name": "Gateway"},
{"cmd": "ping", "name": "Google DNS"},
{"cmd": "ping", "name": "UrbanHacker Website"}, ]
# Running all the tests and creating the report
html = """
color: red;
color: #418a38;
<link rel="stylesheet" href="vanilla.css">
<h1>UrbanHacker Network Status</h1>
errors = 0
test_html = ""
for test in tests:
result = os.system(test["cmd"])
if result == 0:
test_html += test["name"] + \
" <strong class='success'>Success</strong><br />"
errors += 1
test_html += test["name"] + \
" <strong class='failure'>Failure</strong><br />"
if errors > 0:
html += "<h3 class='failure'>One or more service(s) are experiencing outages</h3>"
html += "<h3 class='success'>No outages</h3>"
html += test_html
with open("report.html", "w") as report:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment