I'm not exactly sure who i plagiarized all this from, i think Boris, Daniel (he
did authormp.org right) and Brian amongst others but i did up an article on our
internal SharePoint on how do do something similar, a whole lot of monitoring
in a few easy steps, let me know if it is helpful, we use it all the time,
almost every application gets one of these
Abstract
Ok you have an application that has many services spread out across many
machines, We have a datasynapse computing grid and it has 158 servers in it
when i last looked, if they add more they get discovered
Each server has at least 1 service, some have several (multi instance, or
multiple instances) they can be grid engines or grid brokers but each service
contains DataSynapse in it's name somewhere so a simple WMI discovery to get
all the participating computers into a local application class would look like
this
select * from win32_service where name like '%atasynap%'
Then we build out a scripted discovery to find the services very similar to
above
1) Run the management pack creation wizard in the authoring console and create
a local application, and find any server with a grid service on it.
2) Make a reference to the NT service library
3) Create a new custom class and make it’s base class windows service (careful
there are 3 selections and only the one will work), you want to use the class
that uses a stand alone process
You can see on the monitoring tab that our new class based on a windows service
has already has a monitor and nice properties included, we will populate those
using our scripted discovery
grab the Multi Instance Service Discovery Script and edit it up to suit your
needs, should be reasonably documented with comments, do your script based
discovery, target your application class save and export then look for your
discovered inventory
-- watch out for the line feeds, just pasting the discovery script in here note
the parameters you need to pass in the script
on error resume Next
'
'paste this next line as parameters to the script
'$MPElement$ $Target/Id$
$Target/Host/Property[Type='Windows!Microsoft.Windows.Computer']/PrincipalName$
'
Dim oArgs
Set oArgs = WScript.Arguments
if oArgs.Count <> 3 Then
Wscript.Quit -1
End If
Dim SourceID, ManagedEntityId, TargetComputer
SourceId = oArgs(0)
ManagedEntityId = oArgs(1)
TargetComputer = oArgs(2)
Dim oAPI, oDiscoveryData, oInst, strComputer, objwmiservice, colitems, objItem
Set oAPI = CreateObject("MOM.ScriptAPI")
set oDiscoveryData = oAPI.CreateDiscoveryData(0, SourceId, ManagedEntityId)
logit "Discovery Start"
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * from Win32_Service where name
like 'DataSynapse%'",,48)
For Each objItem in colItems
set oInst =
oDiscoveryData.CreateClassInstance("$MPElement[Name='The.name.of.your.class.sevices']$")
call
oInst.AddProperty("$MPElement[Name='Windows!Microsoft.Windows.Computer']/PrincipalName$",
TargetComputer)
call
oInst.AddProperty("$MPElement[Name='MicrosoftSystemCenterNTServiceLibrary!Microsoft.SystemCenter.NTService']/ServiceName$",
ObjItem.name)
call
oInst.AddProperty("$MPElement[Name='MicrosoftSystemCenterNTServiceLibrary!Microsoft.SystemCenter.NTService']/ServiceProcessName$",
ObjItem.PathName)
call
oInst.AddProperty("$MPElement[Name='MicrosoftSystemCenterNTServiceLibrary!Microsoft.SystemCenter.NTService']/DisplayName$",
ObjItem.DisplayName)
call
oInst.AddProperty("$MPElement[Name='MicrosoftSystemCenterNTServiceLibrary!Microsoft.SystemCenter.NTService']/Description$",
ObjItem.Description)
call oDiscoveryData.AddInstance(oInst)
logit "Found " & ObjItem.name
Next
Call oAPI.Return(oDiscoveryData)
logit "discovery end"
sub logit(strmessage)
Call oAPI.LogScriptEvent("DiscoverServices.vbs", 335, 4, strmessage )
end sub
From: [email protected]
To: [email protected]
Subject: RE: [msmom] Better Way ?
Date: Fri, 16 Aug 2013 17:47:39 +0000
Yep – Brian’s solution is a good simple one for a bunch of service templates
with similar service names.
I documented my method in contrast here:
http://blogs.technet.com/b/kevinholman/archive/2011/01/20/how-to-monitor-a-service-with-unique-names-across-multiple-computers-using-a-wildcard.aspx
From: [email protected] [mailto:[email protected]] On
Behalf Of Thompson, Joseph W (Joe)
Sent: Friday, August 16, 2013 12:20 PM
To: [email protected]
Subject: RE: [msmom] Better Way ?
If the services have a consistent naming standard, I’ve been successful using
this.
http://blogs.technet.com/b/brianwren/archive/2008/03/07/using-wildcards-with-the-windows-service-template.aspx
If they do not have a similar name, but installed in the same directory, you
can wildcard the PathName property instead of Name
From: [email protected] [mailto:[email protected]] On
Behalf Of Dinh, Khoi
Sent: Friday, August 16, 2013 11:01 AM
To: MyITForum ([email protected])
Subject: [msmom] Better Way ?
Sorry team for not so smart question as usual…
We have a few servers to monitor its Windows Services, each server 1 special
app may have up to 12 different services… I add Monitoring Wizard in Windows
Service but can only select 1 service at a time, so I would have to manually
create it 12 times, then create 12 different Unit Monitors and I think I can
create 1 Alert Subscription for these 12 unit monitors, that is just 1 server
alone, there should be a better way to do this ?? Got to be me as usual,
thanks in advance.
*** Confidentiality Notice: This e-mail, including any associated or attached
files, is intended solely for the individual or entity to which it is
addressed. This e-mail is confidential and may well also be legally privileged.
If you have received it in error, you are on notice of its status. Please
notify the sender immediately by reply e-mail and then delete this message from
your system. Please do not copy it or use it for any purposes, or disclose its
contents to any other person. This email comes from a division of the Invensys
Group, owned by Invensys plc, which is a company registered in England and
Wales with its registered office at 3rd Floor, 40 Grosvenor Place, London, SW1X
7AW (Registered number 166023). For a list of European legal entities within
the Invensys Group, please select the Legal Entities link at invensys.com.
You may contact Invensys plc on +44 (0)20 3155 1200 or e-mail
[email protected]. This e-mail and any attachments thereto may be subject
to the terms of any agreements between Invensys (and/or its subsidiaries and
affiliates) and the recipient (and/or its subsidiaries and affiliates).
THIS E-MAIL AND ANY MATERIALS TRANSMITTED WITH IT MAY CONTAIN CONFIDENTIAL OR
PROPRIETARY MATERIAL FOR THE SOLE USE OF THE INTENDED RECIPIENT. ANY REVIEW,
USE, DISTRIBUTION OR DISCLOSURE BY OTHERS IS STRICTLY PROHIBITED. IF YOU ARE
NOT THE INTENDED RECIPIENT, OR AUTHORIZED TO RECEIVE THE INFORMATION FROM THE
RECIPIENT, PLEASE NOTIFY THE SENDER BY REPLY E-MAIL AND DELETE ALL COPIES OF
THIS MESSAGE.