Added Slack Integration
This commit is contained in:
parent
d151789229
commit
6ae5bd5c44
|
@ -8,6 +8,9 @@ zone_identifier="" # Can be found in the "Overvi
|
||||||
record_name="" # Which record you want to be synced
|
record_name="" # Which record you want to be synced
|
||||||
ttl="3600" # Set the DNS TTL (seconds)
|
ttl="3600" # Set the DNS TTL (seconds)
|
||||||
proxy=false # Set the proxy to true or false
|
proxy=false # Set the proxy to true or false
|
||||||
|
slacksitename="" # Title of site "Example Site"
|
||||||
|
slackchannel="" # Slack Channel #example
|
||||||
|
slackuri="" # URI for Slack WebHook "https://hooks.slack.com/services/xxxxx"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -78,8 +81,18 @@ update=$(curl -s -X PATCH "https://api.cloudflare.com/client/v4/zones/$zone_iden
|
||||||
case "$update" in
|
case "$update" in
|
||||||
*"\"success\":false"*)
|
*"\"success\":false"*)
|
||||||
logger -s "DDNS Updater: $ip $record_name DDNS failed for $record_identifier ($ip). DUMPING RESULTS:\n$update"
|
logger -s "DDNS Updater: $ip $record_name DDNS failed for $record_identifier ($ip). DUMPING RESULTS:\n$update"
|
||||||
|
curl -L -X POST $slackuri \
|
||||||
|
--data-raw '{
|
||||||
|
"channel": "'$slackchannel'",
|
||||||
|
"text" : "'"$slacksitename"' DDNS Update Failed: '$record_name': '$record_identifier' ('$ip')."
|
||||||
|
}'
|
||||||
exit 1;;
|
exit 1;;
|
||||||
*)
|
*)
|
||||||
logger "DDNS Updater: $ip $record_name DDNS updated."
|
logger "DDNS Updater: $ip $record_name DDNS updated."
|
||||||
|
curl -L -X POST $slackuri \
|
||||||
|
--data-raw '{
|
||||||
|
"channel": "'$slackchannel'",
|
||||||
|
"text" : "'"$slacksitename"' Updated: '$record_name''"'"'s'""' new IP Address is '$ip'"
|
||||||
|
}'
|
||||||
exit 0;;
|
exit 0;;
|
||||||
esac
|
esac
|
||||||
|
|
Loading…
Reference in New Issue