#! /bin/python3 import json,os from uptime_kuma_api import UptimeKumaApi, MonitorType descriptions = { "Jellyfin":"Jellyfin is a Free Software Media System that puts you in control of managing and streaming your media.", "Element Web":"A secure communications platform built around the Matrix protocol.", "Uptime Kuma":"Uptime Kuma is an easy-to-use self-hosted monitoring tool.", "Jellyseerr":"Jellyseerr is a free and open source software application for managing requests for your media library.", "Pixelfed":"Pixelfed is a free and open-source image sharing social network service.", "EteSync":"Secure, end-to-end encrypted, and privacy respecting sync for your contacts, calendars, tasks and notes.", "Gitea":"Gitea is a lightweight DevOps platform. It brings teams and developers high-efficiency but easy operations from planning to production.", "IPFS Gateway":""} exclude=('Synapse','Mailserver') HTMLTEMPLATE='

{item}

{desc}

' htmllist=[] htmllist.append(HTMLTEMPLATE.format(link=os.environ.get('UPTIME_KUMA_URL'),item="Uptime Kuma",desc=descriptions["Uptime Kuma"])) with UptimeKumaApi(os.environ.get('UPTIME_KUMA_URL') as api: api.login(os.environ.get('UPTIME_KUMA_ADMIN_USER'),os.environ.get('UPTIME_KUMA_ADMIN_PASSWORD')) for item in api.get_monitors(): if item["name"] in exclude or item["type"] == MonitorType.GROUP: continue print(item["name"]) # save every formatted entry in a list try: htmllist.append(HTMLTEMPLATE.format(link=item["url"],item=item["name"],desc=descriptions[item["name"]])) except Exception: htmllist.append(HTMLTEMPLATE.format(link=item["url"],item=item["name"],desc="")) with open(os.environ.get('UPTIME_KUMA_OUT'),"w") as htmlfile: htmlfile.write("\n".join(htmllist))