Skip to content
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

Using kuma-client to create a status page #52

Open
zodac opened this issue Jun 5, 2024 · 3 comments
Open

Using kuma-client to create a status page #52

zodac opened this issue Jun 5, 2024 · 3 comments

Comments

@zodac
Copy link

zodac commented Jun 5, 2024

I'm trying to create a script that will create a status page for me on start-up if it doesn't already exist, but I'm having trouble with the kuma-client. I tried taking the output of status-page get my-slug and using it as the input to status-page add <file>, but ran into this error:

{"error":"Server responded with an error: Cannot set properties of null (setting 'status_page_id')"}

However, when I check UptimeKuma, the status page was created, but with no monitored services. I'm not sure what the format of the input file should be, or whether I need to use a different structure?

This is my status page JSON file:

{
  "status_page_id": 99, # Also tried "id", and even removing this key completely
  "slug": "test",
  "title": "Test",
  "icon": "/icon.svg",
  "theme": "dark",
  "published": true,
  "showTags": false,
  "domainNameList": [],
  "customCSS": "body {\n  \n}\n",
  "showPoweredBy": true,
  "showCertificateExpiry": false,
  "publicGroupList": [
    {
      "id": 1,
      "name": "Services",
      "weight": 1,
      "monitorList": [
        {
          "id": 1,
          "name": "My Site",
          "type": "http"
        }
      ]
    }
  ]
}
zodac added a commit to zodac/home_theatre that referenced this issue Jun 6, 2024
@BigBoot
Copy link
Owner

BigBoot commented Oct 29, 2024

Hi, sorry for the long delay, the problem is your pass an id value for your entry in the publicGroupList, but if you create a new status-page that group (and therefore it's id) doesn't exists. And yes when you add a group you should not supply a status_page_id, though I think uptime-kuma will ignore this and assign a new id anyway.

@zodac
Copy link
Author

zodac commented Oct 29, 2024

Hey, thanks for the reply. I actually tried it with no id value too, but it didn't work. I can't remember if it had the same error, but I think it did. I can retry and confirm if needed, but it definitely didn't succeed.

@BigBoot
Copy link
Owner

BigBoot commented Oct 29, 2024

Just to make sure, I'm talking about this id specifically:

{
  "status_page_id": 99, # Also tried "id", and even removing this key completely
  "slug": "test",
  "title": "Test",
  "icon": "/icon.svg",
  "theme": "dark",
  "published": true,
  "showTags": false,
  "domainNameList": [],
  "customCSS": "body {\n  \n}\n",
  "showPoweredBy": true,
  "showCertificateExpiry": false,
  "publicGroupList": [
    {
-     "id": 1,
      "name": "Services",
      "weight": 1,
      "monitorList": [
        {
          "id": 1,
          "name": "My Site",
          "type": "http"
        }
      ]
    }
  ]
}

Additionally the status_page_id should also be removed, but I don't think it breaks anything, the monitor's id is actually required and needs to stay.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants