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->
type.properties.findAll{prop->
  prop.containingType.name == type.name && obsType.isAssignableFrom(prop.valueType)
}.collect{ prop -> "$type.cartridgeName, $prop.containingType.name, $prop.name, $prop.valueType.name"}
}.flatten().each { propListing += "$it\n"}

propListing

Anonymous
Related Content