How to clean all objects from the Foglight Management Server if monitored host is no longer connected and no longer required.
To remove all objects from disconnected host the following script can be used:
Please note that it is necessary to replace the words "EnterHostNameHere" with the actual hostname that needs to be to deleted.
____________________________________________________________
topSvc = server.get("TopologyService");
objs = #! Host #.getTopologyObjects();
msg = new StringBuilder();
for (obj in objs) {
msg.append("Host");
msg.append(obj.get("name"));
msg.append("-->");
try{
if (obj.get("name").contains("EnterHostNameHere")){
topSvc.deleteObject(obj);
msg.append("Deleted...\n");
} else {
msg.append(" NOT Deleted...\n");
}
}catch (Exception ex){
msg.append("Exception").append(ex);
}
}
return msg.toString();
_____________________________________________________________
It is not necessary to remove historical data - the retention policy will delete data automatically.
Since the associated host would be deleted, this data will no longer queried and its cost to the DB will be negligible until it is aged out.
© 2021 Quest Software Inc. ALL RIGHTS RESERVED. Feedback Terms of Use Privacy