I've been creating a management pack, following bits of various guides and doing some stuff with the MP authoring console and some with wizards and then editing and copying the relevant XML,
Basically I am discovering the relevant machines that have a specific service running as a specific account, (there are three servers running the service, Live, System Test and Dev) Each runs using a seperate service account, so my discovery is based on a WMI query to achieve this.
Currently the Source of the alert is the service name, but I'd rather this was the server name.. Im sure its simple to sort but Im struggling now with this.. any suggestions: some snippets of code:
<EntityTypes>
<ClassTypes>
<ClassType ID="xxx.xxx.xxx.xxx.Service" Accessibility="Internal" Abstract="false" Base="Windows!Microsoft.Windows.LocalApplication" Hosted="true" Singleton="false">
<Property ID="StartName" Type="string" Key="true" CaseSensitive="false" Length="256" MinLength="0" />
</ClassType>
</ClassTypes>
</EntityTypes>
<Monitoring>
<Discoveries>
<Discovery ID="xxx.xxx.xxx.xxx.xxx.Discovery" Enabled="true" Target="Windows!Microsoft.Windows.Server.Computer" ConfirmDelivery="false" Remotable="true" Priority="Normal">
<Category>Discovery</Category>
<DiscoveryTypes>
<DiscoveryClass TypeID="xxx.xxx.xxx.xxx.Service">
<Property PropertyID="StartName" />
<Property TypeID="System!System.Entity" PropertyID="DisplayName" />
</DiscoveryClass>
</DiscoveryTypes>
<DataSource ID="DS" TypeID="Windows!Microsoft.Windows.WmiProviderWithClassSnapshotDataMapper">
<NameSpace>\\$Target/Property[Type="Windows!Microsoft.Windows.Computer"]/NetworkName$\ROOT\CIMV2</NameSpace>
<Query>Select * from Win32_Service where name= 'xxx'and StartName = xxx\\xxx_Test</Query>
<Frequency>600</Frequency>
<ClassId>$MPElement[Name="xxx.xxx.xxx.xxx.Service"]$</ClassId>
<InstanceSettings>
<Settings>
<Setting>
<Name>$MPElement[Name="Windows!Microsoft.Windows.Computer"]/PrincipalName$</Name>
<Value>$Target/Property[Type="Windows!Microsoft.Windows.Computer"]/PrincipalName$</Value>
</Setting>
<Setting>
<Name>$MPElement[Name="Callcredit.CallMonitor.AutoDelivery.Stream3.Service"]/StartName$</Name>
<Value>$Data/Property[@Name='StartName']$</Value>
</Setting>
</Settings>
</InstanceSettings>
</DataSource>
</Discovery>
</Discoveries>
I've been pissing about with startname and priciple name but still not sussed it out..
Cheers
David