Closed trash-it closed 5 months ago
Thanks for filing this. Can we get a look at your borgmatic logs when run with --verbosity 2
? Thanks!
Hi, sure:
echo "Starting a backup job." curl -s -X POST https://api.telegram.org/botxxxx/sendMessage -d chat_id=-xxxx-d text="Backup Startet" BORG_EXIT_CODES=*** borg --version --debug --show-rc /etc/borgmatic.d/config.yaml: Borg 1.2.8 /etc/borgmatic.d/config.yaml: Calling apprise hook function initialize_monitor /etc/borgmatic.d/config.yaml: Calling apprise hook function ping_monitor Language set to %s backupserver: Running actions for repository /etc/borgmatic.d/config.yaml: No commands to run for pre-actions hook /etc/borgmatic.d/config.yaml: No commands to run for pre-backup hook
I deleted the hooks: part from my config file. I thought i just have to add the apprise stuff from the documentation (Native Apprise Configuration in Borgmatic 1.8.4+)
That's odd.. I would expect to see one of the following log entries after Calling apprise hook function ping_monitor
:
/etc/borgmatic.d/config.yaml: Pinging Apprise services: ...
/etc/borgmatic.d/config.yaml: No Apprise serivces to ping
And then if there were misconfigurations or errors:
Unable to import Apprise in monitoring hook
/etc/borgmatic.d/config.yaml: Error sending some Apprise notifications
You're not seeing anything like that in your logs?
No. I restartet the command with an grep and just get this:
/ # borgmatic --stats --verbosity 2 | grep apprise Starting a backup job. {"ok":true,"result":{"message_id":1081,"from":{"id":xxx,"is_bot":true,"first_name":"xxxx","username":"xxxxx"},"chat":{"id":-xxx,"title":"xxx","type":"group","all_members_are_administrators":true},"date":1713551402,"text":"Backup Startet"}} /etc/borgmatic.d/config.yaml: Calling apprise hook function initialize_monitor /etc/borgmatic.d/config.yaml: Calling apprise hook function ping_monitor Starting a backup job.
the first telegram message is my manual curl command. I removed it, because I thought it will cause problems. But nothing changed.
Can I see your full command? And what happens if you omit the grep
?
sure.
full command is: borgmatic --stats --verbosity 2
and the result is like above:
/etc/borgmatic.d/config.yaml: Running command for pre-everything hook echo "Starting a backup job." Starting a backup job. BORG_EXIT_CODES=*** borg --version --debug --show-rc /etc/borgmatic.d/config.yaml: Borg 1.2.8 /etc/borgmatic.d/config.yaml: Calling apprise hook function initialize_monitor /etc/borgmatic.d/config.yaml: Calling apprise hook function ping_monitor Language set to %s backupserver: Running actions for repository /etc/borgmatic.d/config.yaml: No commands to run for pre-actions hook /etc/borgmatic.d/config.yaml: Running command for pre-backup hook echo "Starting a backup job." Starting a backup job. backupserver: Creating archive
I think I found the problem! Your configuration doesn't have a states:
option in the apprise:
section. Here's the documentation for states:
from the borgmatic configuration reference:
# List of one or more monitoring states to ping for:
# "start", "finish", "fail", and/or "log". Defaults to
# pinging for failure only. For each selected state,
# corresponding configuration for the message title and body
# should be given. If any is left unspecified, a generic
# message is emitted instead.
Notice the "Defaults to pinging for failure only." portion of that. That means that unless you add a list of states:
to your configuration, borgmatic won't ever ping your Apprise services except in the case of borgmatic failure.
Here's an example configuration of what you could do to solve that:
apprise:
...
states:
- start
- finish
- fail
yes its working! thanks!
at my first try, I just added this block from the documentation:
` apprise: services:
url: slack://token@Txxxx/Bxxxx/Cxxxx label: slack
start: title: ⚙️ Started body: Starting backup process.
finish: title: ✅ SUCCESS body: Backups successfully made.
fail: title: ❌ FAILED body: Your backups have failed..`
that I have to create a list with states is not written on the configuration example. thanks for the hint!
solved with missing states list:
I think I found the problem! Your configuration doesn't have a
states:
option in theapprise:
section. Here's the documentation forstates:
from the borgmatic configuration reference:# List of one or more monitoring states to ping for: # "start", "finish", "fail", and/or "log". Defaults to # pinging for failure only. For each selected state, # corresponding configuration for the message title and body # should be given. If any is left unspecified, a generic # message is emitted instead.
Notice the "Defaults to pinging for failure only." portion of that. That means that unless you add a list of
states:
to your configuration, borgmatic won't ever ping your Apprise services except in the case of borgmatic failure.Here's an example configuration of what you could do to solve that:
apprise: ... states: - start - finish - fail
I'm glad to hear that did it!
I have the same error, but I do have states in my config.yaml. This my output: echo Finished a backup. Finished a backup. /etc/borgmatic/config.yaml: No commands to run for post-actions hook /etc/borgmatic/config.yaml: Calling apprise hook function ping_monitor Unable to import Apprise in monitoring hook /etc/borgmatic/config.yaml: Calling apprise hook function ping_monitor Unable to import Apprise in monitoring hook /etc/borgmatic/config.yaml: Calling apprise hook function destroy_monitor /etc/borgmatic/config.yaml: No commands to run for post-everything hook
The hint there is Unable to import Apprise in monitoring hook
. If you're using this container, are you using a new enough version such that apprise
module is included and importable? You can try exec-ing into your container and running python -c "import apprise"
to check. Either that command exits silently if Apprise is present or it errors if not.
No error when I run python3 -c "import apprise"
That's within the container? What about if you run: python3 -c "from apprise import NotifyFormat, NotifyType"
Apologies. I cam across this item because of the error. I am not running Borgmatic nor Borg in a container
In that case, all you need to do is install Apprise such that borgmatic can find it! See https://torsion.org/borgmatic/docs/how-to/monitor-your-backups/#apprise-hook for more information.
And if that doesn't fix it, please file a ticket here to discuss further: https://torsion.org/borgmatic/#support-and-contributing
Running this command fixed it pipx install --force borgmatic[Apprise]
Thanks. I overlooked it.
Awesome, glad to hear it!
Hi, Unfortunately, apprise won't send any notifications. I tried it with telegram and mail. Both won't work. If I call apprise manually, it works. Manually like this:
apprise -vv -t "Test Message Title" -b "Test Message Body" \ tgram://123456789:abcdefg_hijklmnop/12315544/
When I put it in my config file it won't work. I start borgmatic with my crontxt with:
PATH=$PATH:/usr/bin:/usr/local/bin borgmatic --stats -v 0 > /tmp/backup_run.log
I have the following Version: apprise 1.7.6 borg 1.2.8 borgmatic 1.8.10
And here is my configfile: config-git.yaml.txt