With a min of max the opt!

New Relic : Remove all not reporting Servers

Some infrastructure which I run spins up new Instances for Jobs and removes them afterwards. Because I still want to have some insights on what happened on the machine I installed NewRelic Server monitoring on the boxes.

As those instances fade away after each run i had quite a few servers listed (around 300-400) in there and New Relic still does not support Bulk removal of servers.

Thanks to Matt Weg,  who posted following Fix in the Discussion Groups of NewRelic which features a pretty easy one-liner for solivng this issue.

curl -X GET ‘’ \ -H “X-Api-Key:${NR_API_KEY} \ | jq -r ‘.servers | .[] | select(.reporting!=true) | .id’ \ | xargs -I % curl -X DELETE \ -H “X-Api-Key:${NR_API_KEY}

To get this running on OSX i need to install jq (via Homebrew)

brew install jq

One response to “New Relic : Remove all not reporting Servers”