Tagged: Bug

MDT and Webservices – Small bug

Long time no blog…

Working on a move to CM2012 from CM2007, and with that we are trying to move to Webservices instead of client side VBScript.

I found a small bug in MDT (Looked at version 2010U1 and 2012U1 and it’s the same)

You will see this bug if you have a webservice call from CustomSettings where a parameter value have a space (or any other “strange” char).
Since the script ZTIDataAccess.vbs doesn’t URL-encode the parameters some of them will get messed up…

Heres how to fix it:
Search for the text “Handle it appropriately” in ZTIDataAccess.vbs and you can replace the code with this bugfixed version:

' Handle it appropriately
If IsObject(tmpValue) then
	oLogging.CreateEntry "Only the first " & sElement & " value will be used in the web service call.", LogTypeInfo
	tmpArray = tmpValue.Keys
	If UCase(sMethod) = "REST" then
		sEnvelope = sEnvelope & sColumn & " eq '" & tmpArray(0) & "' and "
	Else
' riro Buggfix
' Org: sEnvelope = sEnvelope & sColumn & "=" & tmpArray(0) & "&"
		sEnvelope = sEnvelope & sColumn & "=" & Escape(tmpArray(0)) & "&"
	End if
Else
	If UCase(sMethod) = "REST" then
		sEnvelope = sEnvelope & sColumn & " eq '" & tmpValue & "' and "
	Else
' riro Buggfix
' Org: sEnvelope = sEnvelope & sColumn & "=" & tmpValue & "&"
		sEnvelope = sEnvelope & sColumn & "=" & Escape(tmpValue) & "&"
	End If
End If

As you can see I have just added Escape() to the values. 🙂

SCOM Alert History Grooming

Myself and Pontus Blomqvist found a small but annoying bug…

If you have an alert in SCOM that still isn’t resolved but an entry in the history is older than your grooming-settings the history-data will be groomed.

Why? If you look in to the stored procedure named p_AlertGrooming you can se that it works like this:
– Get setting for Grooming (Deleting)
– Loop thru all alerts that have resolution state = 255 (closed)
—- Groom the history-data for the alert
—- Groom the alert
– Groom all alert-history that are older than the grooming-setting (No matter what resolution state)

So the last step is not needed since the history is groomed when the resolution state is set to 255.

Workaround:
Find the delete-rows in the stored procedure named p_AlertGrooming and comment them out…

Change this 2 rows from:

DELETE dbo.AlertHistory
WHERE TimeAdded < @GroomingThresholdUTC

to:

-- Change by Rikard Ronnkvist to keep history data from being groomed
-- DELETE dbo.AlertHistory
-- WHERE TimeAdded < @GroomingThresholdUTC