Actions and notifications

I discovered Kopia today and so far, I’m impressed (I’m using restic and a variety of other backup approaches for quite some time). With restic not having a UI, I intentionally started looking at Kopia “through the UI” and not the CLI for now.

What I miss though (or probably don’t understand) is how to monitor success/failure of tasks through some kind of notification mechanism. (I’ve had other commercial backup solutions failing silently for some time, so this is kind of important for me).

So I understand there are actions, which are defined as part of a policy (if enabled) but they don’t appear to be configurable in the WebUI? Sure, I can switch to cron jobs and script everything, but how does that relate to the scheduling in the UI? Can I use the WebUI to change/inspect/restore cron scheduled tasks?

I guess the relation between the Web UI and the plain CLI approach is kind of unclear to me so far…

I guess that currently the best way to get something like that would be to use the actions Kopia offers before or after a snapshot. However, this also requires some involvement in getting and parsing the Kopia logs, which may be a bit too much for an average user, who is not familiar with scripting. Since you’ve been using restic already, I am assuming, that this doesn’t apply to you.

I have just kicked this idea around in my head and came up with something like this:

  • have a script ready which scans/parses the cli-log and/or content log which will send its output via mail
  • create a --after-snapshot-root-action and have the check script executed

For the script which checks the logs, this will probably suffer as a first step:

cat latest.log | grep error | grep -v null | awk '{print $1" "$2" "$3" "$4" "$5}'

If there are errors in the content log, it will give you something like this:

2022-01-13T03:03:55.613769Z ContentInfo("f0655c87b38feebb6a8a6e28bc6e938e") - error content
2022-01-13T03:03:55.615383Z ContentInfo("02cb8650b26cd41880dde1281346b567") - error content
2022-01-13T03:03:55.736149Z ContentInfo("k6107c35c51b77fb0c07f00ba1bec164c") - error content

If there are errors in the cli-log, it may show something along these lines:

2022-01-11T05:16:32.434402Z ERROR cache error during
2022-01-11T05:17:32.439252Z ERROR cache error during
2022-01-12T14:27:58.131156Z ERROR kopia/server error encoding
2022-01-12T14:27:58.131156Z ERROR kopia/server error encoding

At least you will get enough information to go and check out, what has happened.

Ok, that helps a bit. I assume a failed job will return some error code which I can check in the calling shell?

However, I will then need to run everything from cron, right? I’m still unclear how cron backup jobs and the kopia server (UI) “mix”, but we’ll see…

Finally, coming back to this:

The one thing I’m still confused about is the definition of actions. So far, I’ve been configuring my policies exclusively through the UI. But I can’t find and place in the policy editor to define actions? Is this indeed not (yet?) possible through the web UI?

I’m starting kopia with kopia server --enable-actions

Ui for actions is not available yes. PRs to add it are welcome.

Add actions to WebUI policy editor · Issue #1 · arminus/htmlui · GitHub - not quite PR ready I guess, but what do you think?