Cloudron makes it easy to run web apps like WordPress, Nextcloud, GitLab on your server. Find out more or install now.


    Cloudron Forum

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular

    Solved Cloudron Health Check Endpoint

    Uptime Kuma
    3
    9
    432
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • J
      JLX89 last edited by

      Hello All,
      Is it possible to have Uptime Kuma hit a specific endpoint for monitoring apps inside Cloudron? We'd like to use the health check service, if possible rather than hitting the DNS or IP, since we're using the same IP from most apps and using Cloudflare for DNS which both don't give accurate results.

      Is it possible to hit an endpoint such as https://app-name.domain.tld/cloudron_healthcheck or similar end point with Uptime Kuma?

      Thank you!

      fbartels 1 Reply Last reply Reply Quote 1
      • fbartels
        fbartels App Dev @JLX89 last edited by

        Hi @JLX89,

        the health status of a given app can be retrieved from the Cloudron api. See https://docs.cloudron.io/api.html#tag/Apps/paths/~1apps~1{appid}/get for the relevant request.

        You would need to add an auth header to your request. From what I can see Uptime Kuma does not have the possibility to perform operations on the json response of the api, but you could do a keyword match instead.

        J 1 Reply Last reply Reply Quote 3
        • J
          JLX89 @fbartels last edited by

          @fbartels Thank you so much -- that worked out perfectly!

          robi 1 Reply Last reply Reply Quote 4
          • robi
            robi @JLX89 last edited by

            @JLX89 Can you jot down what you did to make it work for others in the future as well?

            Life of Advanced Technology

            J 1 Reply Last reply Reply Quote 4
            • Topic has been marked as a question  nebulon nebulon 
            • Topic has been marked as solved  nebulon nebulon 
            • fbartels
              fbartels App Dev last edited by

              Since I am always missing notifications in Cloudron (don't log into the dashboard often enough) I decided to add a monitor for it to Uptime Kuma.

              • Add New Monitor
              • Monitor Type: HTTP(s) - Keyword
              • URL: https://my.domain.com/api/v1/notifications?acknowledged=false&page=1&per_page=2
              • Keyword: "notifications":[]
              • Heartbeat Interval: 360 (could be higher however, I don't need instant alerts for new notifications)

              Since the api only works with auth, we also need to send a header for this. For this paste the following in the "Headers" field:

              {
                  "authorization": "Bearer xxx"
              }
              

              The xxx needs to be replaced with a valid api token, which can be created in the user profile.

              Everything you can see on the Cloudron dashboard comes from the Cloudron api. So if further checks are needed I always recommend to pop out the network console and check which endpoints get requested for the data you need.

              1 Reply Last reply Reply Quote 7
              • J
                JLX89 @robi last edited by

                @robi So I did this slightly different than @fbartels did, which also seems to be working.

                • Add New Monitor
                • Monitor Type: HTTP(s) - Keyword
                • URL: https://my.cloudron.tld/api/v1/apps/{APP_ID}/?access_token={API_KEY}
                • Keyword: healthy
                • HTTP Options
                • Method: GET
                • Body:
                {
                    "runState": "running",
                    "health": "healthy"
                }
                

                I retrieved the AppID from going go https://my.cloudron.tld/api/v1/apps/?access_token={API_KEY}

                So far this seems to be working over the past few days.

                fbartels 1 Reply Last reply Reply Quote 4
                • fbartels
                  fbartels App Dev @JLX89 last edited by

                  Ah yes, I forgot that you can also add the api token as a url parameter

                  @JLX89 said in Cloudron Health Check Endpoint:

                  Body

                  Since this refers to the request body you could empty this field, as the value you have in there is simply the response that the Cloudron api would deliver.

                  J 1 Reply Last reply Reply Quote 0
                  • J
                    JLX89 @fbartels last edited by

                    @fbartels said in Cloudron Health Check Endpoint:

                    Ah yes, I forgot that you can also add the api token as a url parameter

                    @JLX89 said in Cloudron Health Check Endpoint:

                    Body

                    Since this refers to the request body you could empty this field, as the value you have in there is simply the response that the Cloudron api would deliver.

                    Thanks, yes -- I actually cleared that out a bit ago to see if it works. The only downfall using the method I used, is occasionally you'll get a "200 - OK, but keyword is not found", even though the app is online and functioning.

                    fbartels 1 Reply Last reply Reply Quote 1
                    • fbartels
                      fbartels App Dev @JLX89 last edited by

                      @JLX89 maybe you want to add a retry to this. So that it's only marked as down at the e.g. second failed check.

                      1 Reply Last reply Reply Quote 2
                      • First post
                        Last post
                      Powered by NodeBB