Skip to content

Instantly share code, notes, and snippets.

@Jlaird
Created March 15, 2019 16:48
Show Gist options
  • Save Jlaird/0552cc184b8a1b7764a57ae579e7f6a9 to your computer and use it in GitHub Desktop.
Save Jlaird/0552cc184b8a1b7764a57ae579e7f6a9 to your computer and use it in GitHub Desktop.
Adds domains into Newrelic Synthetics, just set your api key
#!/bin/bash
domains=(
"https://www.waterworld.com/industrial-water.html"
"https://www.waterworld.com/index.html"
"https://www.waterworld.com/water-and-wastewater-international.html"
"https://www.utilityproducts.com/index.html"
"https://www.dentaleconomics.com/index.html"
"https://www.dentistryiq.com/index.html"
"https://www.perioimplantadvisory.com/index.html"
"https://www.rdhmag.com/index.html"
"https://www.bioopticsworld.com/index.html"
"https://www.broadbandtechreport.com/index.html"
"https://www.cablinginstall.com/index.html"
"https://www.industrial-lasers.com/index.html"
"https://www.intelligent-aerospace.com/index.html"
"https://www.laserfocusworld.com/index.html"
"https://www.ledsmagazine.com/index.html"
"https://www.lightwaveonline.com/index.html"
"https://www.militaryaerospace.com/index.html"
"https://www.strategies-u.com/index.html"
"https://www.vision-systems.com/index.html"
"https://www.offshore-mag.com/index.html"
"https://www.ogj.com/index.html"
"https://www.dentalacademyofce.com/"
"https://www.rdhunderoneroof.com/index.html"
"https://www.principlesofpracticemgmt.com/index.html"
"https://www.offshore-event.com/index.html"
"https://www.offshorewindsummit.com/index.html"
"https://www.pnecconferences.com/index.html"
"https://www.subseatiebackforum.com/index.html"
"https://www.marketplaceseminar.com/index.html"
"https://www.strategiesinlight.com/index.html"
"https://www.mapsearch.com/index.html"
"https://www.transmissionhub.com/index.html"
)
for domain in ${domains[@]}; do
regex="www.(.*).com"
if [[ $domain =~ $regex ]]; then
name=${BASH_REMATCH[1]}
fi
data="{ \"name\" : \"${name}\", \"frequency\" : 5, \"uri\" : \"${domain}\", \"locations\" : [ \"AWS_US_EAST_1\" ], \"type\" : \"SIMPLE\", \"status\" : \"enabled\", \"slaThreshold\" : \"1.0\"}"
curl -v \
-X POST -H 'X-Api-Key:api_key' \
-H 'Content-Type: application/json' https://synthetics.newrelic.com/synthetics/api/v3/monitors \
-d "$data"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment