How to monitor Kopia jobs using Kuma - FYI

Hi all!

Randomly posting as an FYI on how I monitor my Kopia server and the backup jobs, using kuma

I run one rather straightforward job to ensure that my server is up and responding. I also run jobs to ensure the freshness on my backup jobs by using the Http JSON query job type in Kuma.

For that we can query the API like this
http://kopia-host/api/v1/sources (Don’t forget your credentials in your query to the server/API.)

The query then can look like

$millis() - $toMillis(sources[source[path="/local/appdata"]].lastSnapshot.endTime) <= (1000 * 60 * 60 * 24 * 2)

Which then would return false if this particular job would have not been run in the last 48 hours. As you might realize, this does not check for the successful execution of that job afaik. To test for that I am using:

$distinct(tasks.[status="SUCCESS" or status="RUNNING"])

on the url http://kopia-host/api/v1/tasks which (hopefully) would yield a false on any job returned that is not of status SUCCESS or RUNNING

In general, I would highly recommend Kuma as means to monitor things in your home lab.