Delete the stale objects in the Agent Manager topology by running the script below.
NOTE: Before running the script make a full backup of the Foglight Management Server and its database.
Run the script twice: once for the object type FglamClientInstance and a second time for the object type FglamAdapterInstance.
- Go to "Administration | Tooling | Script Console".
- In the lower part of the dashboard select the tab "Scripts" and click on the green "Add" icon.
- Now a popup appears where you can enter the script..
- Run the script for type FglamClientInstance.
- Now uncomment the second line of the script and set the comment signs in the first line.
- Run the script for type FglamAdapterInstance.
- The stale Agent Manager objects will be removed.
Remove staled object script:
---
def typeName = "FglamClientInstance";
//def typeName = "FglamAdapterInstance";
def staleAge = 7;
def dataSvc = server.get("DataService");
def topSvc = server.get("TopologyService");
def objects = server.get("QueryService").queryTopologyObjects(typeName);
def staleTime = System.currentTimeMillis() - (staleAge * 24 * 60 * 60 * 1000L);
def staleObjects = [];
objects.each({ if (it.lastUpdated.time < staleTime) staleObjects << it });
def output = new StringBuilder();
for (obj in staleObjects) {
output.append(obj.longName).append('\t');
output.append(obj.lastUpdated).append('\t')
output.append('\n');
}
// Delete the objects
topSvc.deleteObjects(staleObjects as Set);
output.append("Successfully deleted " + staleObjects.size() + " stale objects.");
return output.toString();
---