Giter Site home page Giter Site logo

Comments (2)

AMDTonyRyzen avatar AMDTonyRyzen commented on May 31, 2024 1

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.

from uptime-kuma-api.

lucasheld avatar lucasheld commented on May 31, 2024

Here is a full example.

First you need to add the monitors themselves.
Then add a status page and save it with the publicGroupList parameter. It consists of a name (the title of the monitor section inside the status page), a weight (to define the order if you have multiple monitor sections) and a monitorList (the ids of the monitors you want to add to this status page section).

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()

from uptime-kuma-api.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.