2011년 3월 6일 일요일

How to get KB article related an alert in OM DB and DW - Part 2

This post is the second after the first one
In the first blog, I focused on how I get Kb article related in associated with Rule. If threshold reaches criteria, OM raises an alert then we can find KB based on rule.


However, I was passing over about OM also can raise an alert from Monitor. In other words, OM can give errors from both. 


Let's look at the modified query.


Main point of this query is in the rectangle.


select alt.*, a.RuleGuid, a.RuleRowId, a.ManagementPackRowId 

from  OperationsManagerDW.dbo.vRule a with(nolock) 
            inner join OperationsManagerDW.Alert.vAlert alt 
            on (a.RuleRowId = alt.WorkflowRowId)               
where alt.MonitorAlertInd = 1                       
union all
select alt.*, b.MonitorGuid, b.MonitorRowId, b.ManagementPackRowId 
from OperationsManagerDW.dbo.Monitor b with(nolock) 
            inner join OperationsManagerDW.Alert.vAlert alt 
           on (b.MonitorRowId = alt.WorkflowRowId)                
where alt.MonitorAlertInd = 0

vAlert view has two sort of alerts comes from Rule or Monitor. This view separates two by MonitorAlertInd column. When MonitorAlertInd was 1, we knew that alert came from Rule, On the other hand, if the value was 2, this came from Monitor.
So, In order to get both cases, I wrote down two queries and use keyword Union All to put together.

댓글 없음:

댓글 쓰기