Groovy, groovier, grooviest: Getting metrics collected by Foglight

What if you could get a list of all metrics and observations collected by Foglight, and have the ability to filter/sort by cartridge and topology type? That would be groovy.

My colleague developed the script below. To run it, navigate to Administration -> Tooling -> Script Console. Select the Scripts tab and click the Add button.

Provide a name for the script, and paste the script text into the editor. Click run, wait a few seconds, and you should have a list of metrics and observations from your Foglight environment. The Save button saves the script for easier access in the future. You will probably want to just copy the data in the Script Output tab and then paste into Excel. From there you can sort, filter, etc.

def ts = server.TopologyService
def types = ts.getTypeNames().collect{ts.getType(it)}
def obsType  = ts.getType("Observation")

def propListing = "Cartridge, TopologyType, Name, Type\n"
types.collect{ type->{prop-> == && obsType.isAssignableFrom(prop.valueType)
}.collect{ prop -> "$type.cartridgeName, $, $, $"}
}.flatten().each { propListing += "$it\n"}