-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How do I add monitors to status pages? #8
Comments
Here is a full example. First you need to add the monitors themselves. from uptime_kuma_api import UptimeKumaApi, MonitorType
username = "admin"
password = "secret123"
api = UptimeKumaApi("http://127.0.0.1:3001")
if api.need_setup():
api.setup(username, password)
api.login(username, password)
monitor_id_1 = api.add_monitor(
type=MonitorType.HTTP,
url="http://127.0.0.1",
name="monitor1"
)["monitorID"]
monitor_id_2 = api.add_monitor(
type=MonitorType.HTTP,
url="http://127.0.0.2",
name="monitor2"
)["monitorID"]
slug = "statuspage1"
api.add_status_page(
slug=slug,
title="Status Page 1"
)
api.save_status_page(
slug=slug,
publicGroupList=[
{
'name': 'Services',
'weight': 1,
'monitorList': [
{
"id": monitor_id_1
},
{
"id": monitor_id_2
}
]
}
]
)
api.disconnect() |
Thank you so much for the detailed answer, at the time of receipt I still get an error, but I think I can handle it over time, I understood the main principle. By the way, if you need help writing a manual, I can help in my free time. you can infiltrate me in tg @Ynot_Frost. |
Hi, can you tell me how I can change the status_page data using the python api. Apparently, the following function save_status_page(self, slug: str, **kwargs) is used for this, but I don't quite understand how to insert data into it correctly.
print(api.save_status_page(slug="google", data={'domainNameList': ["google.com"]}))
I get html code and
requests.exceptions.JSONDecodeError: [Errno Expecting value]
The text was updated successfully, but these errors were encountered: