Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Improve coding

...

Code Block
print('Content-type: text/html\n\n')
print('<html><style><html>')
print('table<style>table, th, td { border: 1px solid black; border-collapse: collapse;}</style>')
print('<head><title>Opmantek Network Status</title></head><body><strong>Opmantekhead>')
print('<body><strong>Opmantek Network Status</strong><br><br>')
print('<table><tr><th>Group</th><th>Nodes Up</th><th>Nodes Down</th></tr>')
for k in sorted(groupStatus):
    print('<tr><td>' + k + '</td><td>&nbsp' + str(groupStatus[k]['up']) + '</td><td>&nbsp' + str(groupStatus[k]['down']) + '</td></tr>')
print('</table><br><br>')
for k in sorted(groupStatus):
    print('<strong>Group: ' + k + '</strong><br>')
    print('<table><tr><th>Node</th><th>Location</th><th>Type</th><th>Net</th><th>Role</th><th>Status</th></tr>')
    for g in sorted(groupStatus[k]['nodes']):
        print('<tr><td>' + groupStatus[k]['nodes'][g]['name'] + '</td><td>&nbsp' + groupStatus[k]['nodes'][g]['location'] + '&nbsp</td><td>&nbsp' + groupStatus[k]['nodes'][g]['type'] + '&nbsp</td><td>&nbsp' + groupStatus[k]['nodes'][g]['net'] + '&nbsp</td><td>&nbsp' + groupStatus[k]['nodes'][g]['role'] + '&nbsp</td><td>&nbsp' + groupStatus[k]['nodes'][g]['status'] + '&nbsp</td>')
    print('</table><br><br>') 
print('</body>')
print('</html>')