Discover SQL Server Agent for a DB Engine
Microsoft.SQLServer.2012.AgentDiscovery (Discovery)
This object discovery discovers the SQL Server Agent for an instance of SQL Server 2012 DB Engine. There will always be one SQL Server Agent instance for each DB Engine instance.
Knowledge Base article: Element properties: Object Discovery Details: Member Modules:
Source Code: <Discovery ID="Microsoft.SQLServer.2012.AgentDiscovery" Target="Microsoft.SQLServer.2012.DBEngine" Enabled="true">
<Category>Discovery</Category>
<DiscoveryTypes>
<DiscoveryClass TypeID="Microsoft.SQLServer.2012.Agent">
<Property TypeID="SQL!Microsoft.SQLServer.Agent" PropertyID="ServiceName"/>
<Property TypeID="SQL!Microsoft.SQLServer.Agent" PropertyID="Account"/>
<Property TypeID="SQL!Microsoft.SQLServer.Agent" PropertyID="DisplayName"/>
</DiscoveryClass>
</DiscoveryTypes>
<DataSource ID="DS" TypeID="Windows!Microsoft.Windows.WmiProviderWithClassSnapshotDataMapper" RunAs="SQL!Microsoft.SQLServer.SQLDiscoveryAccount">
<NameSpace>\\$Target/Host/Property[Type="Windows!Microsoft.Windows.Computer"]/NetworkName$\root\Microsoft\SqlServer\ComputerManagement11</NameSpace>
<Query>SELECT ServiceName, StartName, DisplayName FROM SqlService WHERE ServiceName="$Target/Property[Type="SQL!Microsoft.SQLServer.DBEngine"]/AgentName$"</Query>
<Frequency>14400</Frequency>
<ClassId>$MPElement[Name="Microsoft.SQLServer.2012.Agent"]$</ClassId>
<InstanceSettings>
<Settings>
<Setting>
<Name>$MPElement[Name="Windows!Microsoft.Windows.Computer"]/PrincipalName$</Name>
<Value>$Target/Host/Property[Type="Windows!Microsoft.Windows.Computer"]/PrincipalName$</Value>
</Setting>
<Setting>
<Name>$MPElement[Name="SQL!Microsoft.SQLServer.ServerRole"]/InstanceName$</Name>
<Value>$Target/Property[Type="SQL!Microsoft.SQLServer.ServerRole"]/InstanceName$</Value>
</Setting>
<Setting>
<Name>$MPElement[Name="SQL!Microsoft.SQLServer.Agent"]/ServiceName$</Name>
<Value>$Data/Property[@Name='ServiceName']$</Value>
</Setting>
<Setting>
<Name>$MPElement[Name="SQL!Microsoft.SQLServer.Agent"]/Account$</Name>
<Value>$Data/Property[@Name='StartName']$</Value>
</Setting>
<Setting>
<Name>$MPElement[Name="SQL!Microsoft.SQLServer.Agent"]/DisplayName$</Name>
<Value>$Data/Property[@Name='DisplayName']$</Value>
</Setting>
</Settings>
</InstanceSettings>
</DataSource>
</Discovery>