Monitoring and alerting tool for Kopia

I discovered Kopia a few months ago and loved it, however there was one limitation that prevented me from switching over. I wanted to be proactively notified, by email, when something went wrong. I hoped it would be added to Kopia itself but seeing that it wasn’t I decided to write a small Python program to do exactly that. The program is designed to run on a schedule, and send an email report with all recent tasks or only with errors.

The program is creatively called kopia-mon and it has the following features:

  • Send an email status report about all the tasks that executed since the last time the program ran.
  • Option to send the email only if there was an error.
  • Monitor for inactivity, to identify cases when the backups stopped running.
  • Support for multiple repositories.

Feel free to clone it from github and give it a try: GitHub - ekutner/kopia-mon

5 Likes

Exactly like something I’m looking for! I’ll try it out with my docker kopia install

Hello, this sounds great! Is it installed in the server or the client?

It was designed to run on the client because of of its features is to only alert on missed backups if there were actually changes on the filesystem that needed to be backed up. It may work on the server too if you have the kopia profile files there but I didn’t test it for that scenario. Except for the above mentioned feature it’s just running the kopia command line and parsing the output.

Hello,
this alerting tool is something absolutely necessary for using Kopia.
Thanks for implementing it!
However, I can’t install and configure it properly.
I’ve read https://github.com/ekutner/kopia-mon/blob/master/README.md.
Then I’ve read https://github.com/ekutner/kopia-mon/issues/8, as I had a similar issue (i.e.: “error: subprocess-exited-with-error”); in my case I apparently solved this by using the following commands:
In few words, I executed:

pip install --upgrade setuptools wheel
pip cache purge
pip install --no-build-isolation -r requirements.txt

However, when I tried to execute the tool from a CMD shell, I got this error:

Can anyone help me? I’m stuck…

The error is right there, it can’t find its config file. You should either have it in the working directory or specify the path the the -c parameter. See the instructions in the README.

Thanks for your help…
Following your suggestion, now I’ve been able to launch:

python.exe kopia-mon.py

without errors.
However, no mail is sent… Simply, in the CMD window, I don’t get errors, but also I don’t get any warning of information. I attach the screenshot.
Immagine 2024-10-24 183136

Consider that:

  • I tried to send an e-mail with my mail client, putting in “From:” and in “To:” the mail addresses I put in the file “config.yaml”, and using the same password, and it worked.
  • I let the same port as in your example: 465
  • server address: smtp.gmail.com
  • I let “inactivity days” = 2, as in your example
  • I set “errors_only” = false
  • For “validate_inactivity” I tried both “true” and “false”

Have you any ideas that can help me?

Thanks in advance,
Denis

It’s better to open an issue in github (Issues · ekutner/kopia-mon · GitHub) so I can track it.
You can start by adding the --no-send-email parameter and see if you get the report in the console. If you do then it’s probably a problem with sending the email and we’ll have to troubleshoot it.