[ENHANCEMENT]: call URL only if everything is ok (for Uptime Kuma)
andreapx opened this issue · 2 comments
I use Uptime Kuma that alerts me only if anything is wrong (a service is down, a backup fails, and so on).
What about integrate Uptime Kuma in the script (or just call an URL only when there are no errors/workings)?
Thanks!
I could definitely integrate Uptime Kuma. Seems to be a popular service. (I don't know or use it, for this I use Healthchecks.io)
In the meantime, you can use the "hook notification" feature. It will do the job just fine.
I could definitely integrate Uptime Kuma. Seems to be a popular service. (I don't know or use it, for this I use Healthchecks.io)
In the meantime, you can use the "hook notification" feature. It will do the job just fine.
I've tried with the hook notification putting there the URL, but it doesn't work. I've tried to create a bash script that by itself work, but when called from this script it fails saying that the URL is not valid. I'm not a developer and I'm not very familiar with scripts either, this has been created by Proximity AI.
#!/bin/bash
# Check if the required number of arguments is provided
if [ $# -ne 2 ]; then
echo "Usage: $0 <param1> <param2>"
exit 1
fi
# Store the command line arguments in variables
param1=$1
echo $param1
echo "**************************************************************************"
param2=$2
echo $param2
# URL encode the parameter values
encoded_param1=$(echo "$param1" | sed 's/ /%20/g' | sed 's/!/%21/g' | sed 's/"/%22/g' | sed 's/#/%23/g' | sed 's/\$/%24/g' | sed 's/\&/%26/g' | sed "s/'/%27/g" | sed 's/(/%28/g' | sed 's/)/%29/g' | sed 's/:/%3A/g' | sed 's/;/%3B/g' | sed 's/</%3C/g' | sed 's/=/%3D/g' | sed 's/>/%3E/g' | sed 's/?/%3F/g' | sed 's/@/%40/g' | sed 's/\[/%5B/g' | sed 's/\\/%5C/g' | sed 's/\]/%5D/g' | sed 's/\^/%5E/g' | sed 's/_/%5F/g' | sed 's/`/%60/g' | sed 's/{/%7B/g' | sed 's/|/%7C/g' | sed 's/}/%7D/g' | sed 's/~/%7E/g')
encoded_param2=$(echo "$param2" | sed 's/ /%20/g' | sed 's/!/%21/g' | sed 's/"/%22/g' | sed 's/#/%23/g' | sed 's/\$/%24/g' | sed 's/\&/%26/g' | sed "s/'/%27/g" | sed 's/(/%28/g' | sed 's/)/%29/g' | sed 's/:/%3A/g' | sed 's/;/%3B/g' | sed 's/</%3C/g' | sed 's/=/%3D/g' | sed 's/>/%3E/g' | sed 's/?/%3F/g' | sed 's/@/%40/g' | sed 's/\[/%5B/g' | sed 's/\\/%5C/g' | sed 's/\]/%5D/g' | sed 's/\^/%5E/g' | sed 's/_/%5F/g' | sed 's/`/%60/g' | sed 's/{/%7B/g' | sed 's/|/%7C/g' | sed 's/}/%7D/g' | sed 's/~/%7E/g')
encoded_param1=$(echo -n "$param1" | jq -sRr @uri)
encoded_param2=$(echo -n "$param2" | jq -sRr @uri)
echo " "
echo encoded_param1
echo "------------------------------"
echo encoded_param2
# Construct the URL with the encoded parameters
url="https://xxxxxxxxx.com/webhook-SnapRAID-script_bf2f4u9-1842FQ=gbu3&b3c8r136ifb683?param1=$encoded_param1¶m2=$encoded_param2"
# Send the GET request using curl
response=$(curl -s -X GET "$url")
# Print the response
echo "Response: $response"