SWQL query to pull SAM Components

I am trying to get a list of how many SQL experience monitors we have and what the SQL command are associated with them. Is there a SWQL query I can use or build to get this. 

  • Cooked this SWQL query up in my lab just now

    SELECT 
    c.Application.Node.Caption as Node
    , c.Application.Name as App
    , c.Name as Component
    , cs.[Key] as [key]
    , es.Setting as script
    FROM Orion.APM.ExternalSetting es
    join orion.apm.ComponentSetting cs on cs.Value = es.id and cs.[key] = 'ScriptBody'
    join orion.apm.Component c on c.ComponentID = cs.ComponentID