Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save SerCeMan/7818905 to your computer and use it in GitHub Desktop.
Save SerCeMan/7818905 to your computer and use it in GitHub Desktop.
JS script, which helps delete all inactive (gray) applications from NewRelic. Run script in JS console in Application view.
var yourId = 357957
var table = document.getElementById('apptable');
var rowLength = table.rows.length;
for(var i=1; i<rowLength; i+=1){
var row = table.rows[i];
var cellLength = row.cells.length;
if(row.cells[0].childNodes[0].getAttribute('alt') === 'Unavailable') {
var id = row.getAttribute('id').substring(12)
$.post('https://rpm.newrelic.com/accounts/'+yourId+'/applications/'+id, {'_method':'delete', 'format':'json'})
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment