code-dumps/cloudflare/add-site-monitoring.sh

10 lines
414 B
Bash
Raw Normal View History

2022-09-07 10:31:34 +08:00
#!/bin/bash
# this script requires httpie and cfcli
#
cfcli zones -f json | jq -cr '.[] | .name,.id' | paste - - | awk '{print $1,$2}' | while read d k; do
cfcli ls -d $d -f json | jq -cr '.[] | select(.type == "A") | .name' | while read s; do
cat template.json | sed s/REPLACE_ME/$s/g | http https://api.cloudflare.com/client/v4/zones/$k/healthchecks \
X-Auth-Email:ken.fong@rackspace.com \
X-Auth-Key:xxx
done