Return `/alive` response in JSON format

Hello everyone,

I would like to monitor my Vaultwarden instance via Uptime Kuma. As I understand the /alive endpoint, it should return a JSON, but actually it’s missing the enclosing curly brackets {} around the DateTime and it has no key. This makes it impossible to use it in the Uptime Kuma JSON query check.

Screenshot Uptime Kuma:

I would suggest to let /api/alive, /api/now and /api/version return valid JSON arrays with keys.

Thanks a lot for your work!

Just tested with https://vault.bitwarden.com/api/alive (which returns the same format) and if I use Monitor Type HTTP(s) it just works. If you want to query the version using a application/json, you could use https://vault.bitwarden.com/api/config.

Of course I can just use the HTTP(s) monitor. But this only checks that the status code is between 200-299. As I understand it, the /api/alive endpoint also checks the database connection and other things.

Do you know if an unhealthy service always returns an appropriate status code?

Nextcloud, for example, does not. It responds with 200, even if the drive where the data is located is unmounted :roll_eyes: and the service stops working. There I have to explicitly call the serverinfo api with Uptime Kuma and look for "status" = "ok".

When the database is down, I think we return a 503 (Service Unavailable) or 500 (Internal Server Error):

1 Like

Okay, thank you very much. Then it should currently work for me.

I will leave this request open, as I think it is still reasonable to return a valid JSON array at an endpoint that declares to return content as “application/json”.

According to javascript - Is this simple string considered valid JSON? - Stack Overflow a string is valid JSON return type and testing your query with https://try.jsonata.org it also works with just "2023-09-09T16:10:35.6474556Z" as input so the issue probably lies in Uptime Kuma itself?

Oh, okay, didn’t know that a simple string is a valid JSON nowadays. I saw that the expression works on https://try.jsonata.org/, but it doesn’t work in Uptime Kuma. But that’s their problem then, I guess, and I should report it there.

Thanks for your help, @stefan0xC!

1 Like