Views [dbo].[NBarAlertView]
Properties
PropertyValue
ANSI Nulls OnYes
Quoted Identifier OnYes
Created11:10:09 AM Wednesday, March 07, 2007
Last Modified5:37:25 PM Monday, May 04, 2009
Columns
Name
server_addr
probe_addr
rsrcIndex
rsrcOtherIndex
rsrcName
userId
AllStatsHCInBytes
AllStatsHCOutBytes
availability
Permissions
TypeActionOwning Principal
GrantSelectuniadmin
SQL Script
CREATE VIEW NBarAlertView AS
SELECT r.server_addr
    ,r.probe_addr
    ,r.rsrcIndex
    ,r.rsrcOtherIndex
    ,r.rsrcName
    ,r.userId
    ,AllStatsHCInBytes=case WHEN a.fieldIndex=12701 THEN 100*SUM(alertDuration*severity/5.0)/(24*3600) ELSE 0 END
    ,AllStatsHCOutBytes=case WHEN a.fieldIndex=12702 THEN 100*SUM(alertDuration*severity/5.0)/(24*3600) ELSE 0 END
    ,availability=CASE WHEN a.fieldIndex =1602 THEN 100*SUM(a.alertDuration*1.0)/(24*3600) ELSE 0 END
FROM ResourceNameNBarView r, AlertView a
        WHERE r.server_addr=a.server_addr
        AND r.probe_addr=a.probe_addr
        AND r.rsrcIndex=a.rsrcIndex
        AND r.rsrcOtherIndex=a.rsrcOtherIndex
    AND a.severity > 0
    AND a.severity <=5
    AND r.monitored=1
    AND a.IntervalDateTime BETWEEN dateadd(second, -datepart(second, getdate()),
        dateadd(minute, -datepart(minute, getdate()),
        dateadd(hour, -datepart(hour, getdate()),
        dateadd(day, -1, getdate()))))
    AND dateadd(second, -datepart(second, getdate()),
        dateadd(minute, -datepart(minute, getdate()),
        dateadd(hour, -datepart(hour, getdate()),
        getdate())))
    AND a.fieldIndex/100=127
GROUP BY r.server_addr
    ,r.probe_addr
    ,r.rsrcIndex
    ,r.rsrcOtherIndex
    ,r.rsrcName
    ,r.userId
    ,a.fieldIndex
GO
GRANT SELECT ON  [dbo].[NBarAlertView] TO [uniadmin]
GO
Uses
Used By