Hello guys,
could I please get some help with http-notifications text format?
I would like Duplicate to send notifications to ntfy.sh. Settings are send-http-result-output-format=Duplicati
Unfortunately, the form url encoded body of the message is displayed by ntfy.sh like this:
(How) do I change this? Ive read the docs, but there doesn’t seem to be an easy answer. Just changing the above output format to json doesn’t work, Im getting back an error from ntfy.sh then.
Has anyone solved this before?
Thanks , JAN
Thank you very much I feel like Im almost there:
I am running Duplicati from a Docker container which has no curl installed. So I installed it inside that container and I can now send curl messages to ntfy.sh BUT the script is not outputting anything from the if/then/elif/else statements?
#! /bin/bash
curl -d "Test!" ntfy.sh/raspi5
if [ "$EVENTNAME" == "AFTER" ]; then
if [ "$OPERATIONNAME" == "Backup" ]; then
if ["$DUPLICATI__PARSED_RESULT" == "Success"]; then
# Notify success
curl -H tags:success -H prio:low -d "Backup '$DUPLICATI__backup_name' completed successfully" ntfy.sh/raspi5
elif [ "$DUPLICATI__PARSED_RESULT" == "Warning" ]; then
# Notify warning
curl -H tags:warning -H prio:medium -d "Backup '$DUPLICATI__backup_name' completed with warnings" ntfy.sh/raspi5
else
# Notify failure
curl -H tags:error -H prio:high -d "Backup '$DUPLICATI__backup_name' failed with status: $DUPLICATI__PARSED_RESULT" ntfy.sh/raspi5
fi
fi
fi
To try to explain some of this (unfortunately not yet all), Duplicati assumes that output on stderr is something like a warning or error from whatever you ran, so passes it on to you.
Unfortunately curl puts its progress message on stderr, so that’s why you get the warning.
curl is maybe the man page for your OS (if you know otherwise, see your own man page).
-s, --silent
Silent or quiet mode. Do not show progress meter or error messages. Makes Curl mute. It will still output the data you ask for, potentially even to the terminal/stdout unless you redirect it.
Use -S, --show-error in addition to this option to disable progress meter but still show error messages.
is a combination that might work to suppress unwanted info while allowing errors through.
--no-progress-meter
Option to switch off the progress meter output without muting or otherwise affecting warning and informational messages like -s, --silent does.
might also work, and might let warnings (not just errors) come through to you using stderr.
You need to use something like this on each curl use. Result says maybe you didn’t do so.
["$DUPLICATI__PARSED_RESULT" == "Success"] is apparently invalid syntax, as a space needs to go after the [ and another before the ]. Bash is picky. Other lines have spaces.
If you like, you can debug this at shell prompt by setting up the environment variables, e.g.
export EVENTNAME=AFTER and so on. You can even bash -x <script> to see execution.
Sadly, things are not working out for me. I have tried all curl options -s -S --no-progress-meter in various settings and I still can’t get rid of Duplicati reporting some curl status output as an error.
And I have fixed the script error, but still its not working and not outputting any backup result.
So Im giving up on this. Too much hassle for a backup notification.
It would be nice though if future versions of Duplicati would support ntfy.sh as a notification service for its send-http-url option.