Skip to content

Instantly share code, notes, and snippets.

@mattevans
Last active July 26, 2016 23:08
Show Gist options
  • Save mattevans/6bec39eb1035b48dc1a3a154c98a02ca to your computer and use it in GitHub Desktop.
Save mattevans/6bec39eb1035b48dc1a3a154c98a02ca to your computer and use it in GitHub Desktop.
Remove non-reporting NewRelic servers
# Requires curl, jq and xargs
curl -X GET 'https://api.newrelic.com/v2/servers.json' \
-H "X-Api-Key:YOUR_API_KEY_HERE" \
| jq -r '.servers | .[] | select(.reporting!=true) | .id' \
| xargs -I % curl -X DELETE https://api.newrelic.com/v2/servers/%.json \
-H "X-Api-Key:YOUR_API_KEY_HERE"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment