changed from env to python file
This commit is contained in:
parent
2d23c6cffc
commit
9c9c0b53c1
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -3,6 +3,6 @@
|
||||||
!/root
|
!/root
|
||||||
!/.gitignore
|
!/.gitignore
|
||||||
!/uptime-kuma-homepage.py
|
!/uptime-kuma-homepage.py
|
||||||
!/example.env
|
!/example.env.py
|
||||||
|
|
||||||
/root/homepagehtml.html
|
/root/homepagehtml.html
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#! /bin/python3
|
#! /bin/python3
|
||||||
import json,os
|
import json,env
|
||||||
from uptime_kuma_api import UptimeKumaApi, MonitorType
|
from uptime_kuma_api import UptimeKumaApi, MonitorType
|
||||||
|
|
||||||
descriptions = {
|
descriptions = {
|
||||||
|
@ -16,10 +16,10 @@ descriptions = {
|
||||||
exclude=('Synapse','Mailserver')
|
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>'
|
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=[]
|
||||||
htmllist.append(HTMLTEMPLATE.format(link=os.environ.get('UPTIME_KUMA_URL'),item="Uptime Kuma",desc=descriptions["Uptime Kuma"]))
|
htmllist.append(HTMLTEMPLATE.format(link=UPTIME_KUMA_URL,item="Uptime Kuma",desc=descriptions["Uptime Kuma"]))
|
||||||
|
|
||||||
with UptimeKumaApi(os.environ.get('UPTIME_KUMA_URL')) as api:
|
with UptimeKumaApi(UPTIME_KUMA_URL) as api:
|
||||||
api.login(os.environ.get('UPTIME_KUMA_ADMIN_USER'),os.environ.get('UPTIME_KUMA_ADMIN_PASSWORD'))
|
api.login(UPTIME_KUMA_ADMIN_USER,UPTIME_KUMA_ADMIN_PASSWORD)
|
||||||
for item in api.get_monitors():
|
for item in api.get_monitors():
|
||||||
if item["name"] in exclude or item["type"] == MonitorType.GROUP:
|
if item["name"] in exclude or item["type"] == MonitorType.GROUP:
|
||||||
continue
|
continue
|
||||||
|
@ -31,5 +31,5 @@ with UptimeKumaApi(os.environ.get('UPTIME_KUMA_URL')) as api:
|
||||||
htmllist.append(HTMLTEMPLATE.format(link=item["url"],item=item["name"],desc=""))
|
htmllist.append(HTMLTEMPLATE.format(link=item["url"],item=item["name"],desc=""))
|
||||||
|
|
||||||
|
|
||||||
with open(os.environ.get('UPTIME_KUMA_OUT'),"w") as htmlfile:
|
with open(UPTIME_KUMA_OUT,"w") as htmlfile:
|
||||||
htmlfile.write("\n".join(htmllist))
|
htmlfile.write("\n".join(htmllist))
|
||||||
|
|
Loading…
Reference in a new issue