MOM 2005 SQL Query: Count alerts by server between dates

This query utilizes the SDKAlertView (SQL View) in the OnePoint Database.
This query will count the number of alerts per server for a specified period of time.

-- SQL CODE
-- Count alerts from SDKAlertView by computer name for specified period of time
Declare @StartDateTime DateTime
Declare @EndDateTime DateTime
-- >>>>>>>>>>>>>>>
SET @StartDateTime = '07/08/2007 12:00:00 PM' -- type a date time in UTC time i.e.                                                       -- 3/29/2006 12:00:00 AM
SET @EndDateTime = '07/09/2007 12:00:00 PM' -- type a date time in UTC time i.e.                                                        -- 3/30/2006 12:00:00 AM      
-- <<<<<<<<<<<<<<<

SELECT     ComputerName AS 'Computer Name', COUNT(*) AS 'Alert Count'
FROM         SDKAlertView
WHERE     (TimeOfLastEvent BETWEEN @StartDateTime AND @EndDateTime)
GROUP BY ComputerName
ORDER BY 'Alert Count' DESC
-- END of SQL CODE

 

Comments

No Comments