Creating a Performance Rule to collect SCCM SQL Service Broker Queue
Hi everyone!
Sometimes we need get some information that SCOM don't collect for us natively. The SCCM Broker queue is an example.
I'll show you with few steps how to create a view like this:
The first step is create a script to get all information that you need. The script below need some changes, please pay attention to change all BOLD values.
Dim objCN Dim strConnection Dim oAPI, oBag Set oAPI = CreateObject("MOM.ScriptAPI") Set oBag = oAPI.CreatePropertyBag() Set objCN = CreateObject("ADODB.Connection") strConnection = "Driver={SQL Server};Server=SQLSERVERNAME\INSTANCE;Database=DATABASENAME;Trusted_Connection=TRUE" objCN.Open strConnection Dim strSQLQuery strSQLQuery = "SELECT COUNT(*) as value FROM [dbo].[ConfigMgrDRSQueue] WITH(NOLOCK)" Dim objRS Set objRS=CreateObject("ADODB.Recordset") Set objRS = objCN.Execute(strSQLQuery) valor = objRS.Fields("value") Call oBag.AddValue("PerfValue",CDbl(valor)) Call oAPI.Return(oBag)
The second step is create a Collection Rule to get the values of each queue.
Go to Authoring > Management Pack Objects > Rules, and select the template Probe Based > Script (Performance) , like the picture below:
Select the destination Management Pack and click Next.
Give a name to the Rule and choose the target the Windows Computer Class. VERY IMPORTANT: Uncheck the "Rule is enable".
Give a name to the script. Don't forget the " .vbs" in the end. Paste the script with all needed alterations and click Next.
In performance mapping information put your values but don't change the last item $Data/Property[@Name='PerfValue']$. Save the Rule.
The third step is create a Override to enable the Rule to the Windows Computer of the SQL Server that have the SCCM Broker.
The last step is create a Performance View and select all Rule that you have created with the steps above.
Enjoy!!!