Script for generating list of services from Uptime Kuma
This commit is contained in:
parent
786fb74190
commit
300d6589d6
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -2,5 +2,7 @@
|
||||||
|
|
||||||
!/root
|
!/root
|
||||||
!/.gitignore
|
!/.gitignore
|
||||||
|
!/uptime-kuma-homepage.py
|
||||||
|
!/example.env
|
||||||
|
|
||||||
/root/homepagehtml.html
|
/root/homepagehtml.html
|
||||||
|
|
4
example.env
Normal file
4
example.env
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
UPTIME_KUMA_ADMIN_USER='admin'
|
||||||
|
UPTIME_KUMA_ADMIN_PASSWORD='admin'
|
||||||
|
UPTIME_KUMA_URL='https://status.example.com'
|
||||||
|
UPTIME_KUMA_OUT='/path/to/file.html'
|
34
uptime-kuma-homepage.py
Executable file
34
uptime-kuma-homepage.py
Executable file
|
@ -0,0 +1,34 @@
|
||||||
|
#! /bin/python3
|
||||||
|
import json,os.environ.get
|
||||||
|
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='<a class="item" href="{link}"><div id="{item}" class="item"><h2 class="item">{item}</h2><p class="desc">{desc}</p></div></a>'
|
||||||
|
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))
|
Loading…
Reference in a new issue