This Custom QI Time Alert is not working for me
https://cloud.commvault.com/webconsole/softwarestore/store.do#!/137/681/12839
I change the MMCONFIG_AVG_QI_TIME_LIMIT_CRITICAL_EVENT_PERCENT to trigger alert
the alert returns
Alert Rule Name : Not Applicable
SIDBStoreId : Not Applicable
SIDBStoreName : Not Applicable
StoragePolicy : Not Applicable
CopyName : Not Applicable
MediaAgent : Not Applicable
DDBPath : Not Applicable
QITimeInMilliseconds : Not Applicable
Condition Cleared: : Not Applicable
<?xml version="1.0" encoding="UTF-8"?>
<App_SetCustomRuleRequest>
<queryDetail doesQuerySupportOutputFilter="1" frequency="86400"
isDisabled="0" isOverwriteAssociationAtAlertAllowed="1"
isPrimaryKeyPresent="0" isQueryModifyEnabled="1"
isSystemCreated="0" queryCriteriaName="Custom QI Time Alert"
queryDescription="Custom QI Time Alert"
sqlQuery="DECLARE @avgQITimeLimitCriticalEventPercent INT = 0
SET @avgQITimeLimitCriticalEventPercent = ISNULL((SELECT TOP 1 value FROM MMConfigs with (readuncommitted) WHERE name = 'MMCONFIG_AVG_QI_TIME_LIMIT_CRITICAL_EVENT_PERCENT'), 90)


DECLARE @avgQITimeThreshold INT = 0
SET @avgQITimeThreshold = ISNULL((SELECT value FROM MMConfigs WITH (READUNCOMMITTED) WHERE name = 'MMCONFIG_MAX_AVGQITIME_FOR_SIDB'), 2000)

DECLARE @avgQITimeThresholdCriticalEventLimit INT = ((@avgQITimeThreshold * @avgQITimeLimitCriticalEventPercent) / 100) -- calculate @avgQITimeLimitCriticalEventPercent percent


 
DECLARE @tblLatestStoreInfo TABLE (
 SIDBStoreId INT, SubStoreId INT, SIDBStoreName VARCHAR(256), archGroupName NVARCHAR(288), archGroupCopyName NVARCHAR(128), clientId INT, clientName NVARCHAR(510), path VARCHAR(1024), CommCellId INT, latestUpdateTime INT, avgQITime INT)
 
--Get most recent modified time for each Dedupe Store partition
INSERT INTO @tblLatestStoreInfo
SELECT U.SIDBStoreId, U.SubStoreId, '', '', '', 0, '', '', U.CommCellId, max(U.ModifiedTime), 0
FROM IdxSIDBUsageHistory U WITH (READUNCOMMITTED)
 INNER JOIN archCopySIDBStore agcStore WITH (READUNCOMMITTED) ON U.SIDBStoreId = agcStore.SIDBStoreId
WHERE U.HistoryType <> 2 
GROUP BY U.SIDBStoreId, U.SubStoreId, U.CommCellId


UPDATE @tblLatestStoreInfo
SET avgQITime = dbo.GetCurrentAvgQITimeMedian(SIDBStoreId, SubStoreId , commcellId , 0)
 
DELETE FROM @tblLatestStoreInfo
WHERE avgQITime < @avgQITimeThresholdCriticalEventLimit

UPDATE T
SET SIDBStoreName = I.SIDBStoreName,
clientId = S.clientId,
path = A.path
FROM @tblLatestStoreInfo T, IdxSIDBStore I WITH (READUNCOMMITTED), IdxSIDBSubStore S WITH (READUNCOMMITTED), IdxAccessPath A WITH (READUNCOMMITTED)
WHERE T.SIDBStoreId = I.SIDBStoreId
 AND I.SIDBStoreId = S.SIDBStoreId
 AND T.SubStoreId = S.SubStoreId
 AND S.IdxAccessPathId = A.IdxAccessPathId

UPDATE T
SET clientName = A.name
FROM @tblLatestStoreInfo T, APP_Client A
WHERE T.clientId = A.id

UPDATE T
SET archGroupName = AG.name,
archGroupCopyName = AGC.name
FROM @tblLatestStoreInfo T, archGroup AG WITH (READUNCOMMITTED), archGroupCopy AGC WITH (READUNCOMMITTED)
WHERE T.SIDBStoreId = AGC.SIDBStoreId
AND AGC.archGroupId = AG.id
AND AGC.dedupeFlags & 134217728 = 0

SELECT SIDBStoreId, SIDBStoreName, archGroupName as StoragePolicy, archGroupCopyName as CopyName, clientName as MediaAgent, path as DDBPath, avgQITime as QITimeInMilliseconds
FROM @tblLatestStoreInfo

"
taskInfoXml="<?xml version='1.0' encoding='UTF-8'?><TMMsg_TaskInfo><task GUID="3d164962-c892-43d2-adb7-1cb2e747fdfa" description="" ownerId="1" runUserId="1" taskType="2" ownerName="Administrator" policyType="10" associatedObjects="0" taskName="" alertId="0" taskId="0"><securityAssociations><ownerAssociations /></securityAssociations><taskFlags isEdgeDrive="0" isEZOperation="0" forDDB="0" uninstalled="0" isSystem="0" disabled="0" /><originalCC commCellId="2" /><taskSecurity><associatedUserGroups userGroupId="1" _type_="15" userGroupName="master" /><associatedUserGroups userGroupId="3" _type_="15" userGroupName="View All" /><ownerCapabilities /></taskSecurity><task taskName="" taskId="8401" /></task><appGroup /><subTasks><subTask subTaskOrder="0" subTaskName="" subTaskType="1" flags="0" operationType="5014" subTaskId="0"><subTask subtaskId="8402" subtaskName="" /></subTask><pattern active_end_occurence="0" freq_subday_interval="0" freq_type="4" patternId="18" flags="0" description="Every day at 12:00 AM starting February 1, 2017 " active_end_time="0" active_end_date="0" skipOccurence="0" skipDayNumber="0" active_start_time="0" freq_restart_interval="0" active_start_date="1485907200" freq_interval="1" freq_relative_interval="0" name="" freq_recurrence_factor="1"><calendar calendarName="Standard" calendarId="1" /><timeZone TimeZoneID="31" /></pattern><options><backupOpts><dataOpt autoCopy="0" /></backupOpts></options></subTasks></TMMsg_TaskInfo>" visibility="0">
<creator userId="1" userName="Admin"/>
<securityAssociations>
<ownerAssociations/>
</securityAssociations>
<commcellAssociation>
<entity _type_="124" commCellId="2" srmReportSet="0"
srmReportType="0" type="0"/>
</commcellAssociation>
<additionalQueryDetails querySeverity="1">
<scriptDescription description="Custom QI Time Alert"
guid="165AB4C6-1DD8-4350-B2E4-5303E566DED0" reportName="Custom QI Time Alert"/>
</additionalQueryDetails>
<queryEntity queryId="0" queryName="Custom QI Time Alert"/>
<queryOutputColumns columnFriendlyName="SIDBStoreId"
columnName="SIDBStoreId" isColumnFilterable="0"
isPrimaryKey="0" lmDataType="0">
<columnAdditionalDetails includeInAlertOutput="1"/>
</queryOutputColumns>
<queryOutputColumns columnFriendlyName="SIDBStoreName"
columnName="SIDBStoreName" isColumnFilterable="0"
isPrimaryKey="0" lmDataType="1">
<columnAdditionalDetails includeInAlertOutput="1"/>
</queryOutputColumns>
<queryOutputColumns columnFriendlyName="StoragePolicy"
columnName="StoragePolicy" isColumnFilterable="0"
isPrimaryKey="0" lmDataType="1">
<columnAdditionalDetails includeInAlertOutput="1"/>
</queryOutputColumns>
<queryOutputColumns columnFriendlyName="CopyName"
columnName="CopyName" isColumnFilterable="0"
isPrimaryKey="0" lmDataType="1">
<columnAdditionalDetails includeInAlertOutput="1"/>
</queryOutputColumns>
<queryOutputColumns columnFriendlyName="MediaAgent"
columnName="MediaAgent" isColumnFilterable="0"
isPrimaryKey="0" lmDataType="1">
<columnAdditionalDetails includeInAlertOutput="1"/>
</queryOutputColumns>
<queryOutputColumns columnFriendlyName="DDBPath"
columnName="DDBPath" isColumnFilterable="0" isPrimaryKey="0" lmDataType="1">
<columnAdditionalDetails includeInAlertOutput="1"/>
</queryOutputColumns>
<queryOutputColumns columnFriendlyName="QITimeInMilliseconds"
columnName="QITimeInMilliseconds" isColumnFilterable="0"
isPrimaryKey="0" lmDataType="0">
<columnAdditionalDetails includeInAlertOutput="1"/>
</queryOutputColumns>
</queryDetail>
</App_SetCustomRuleRequest>