Quantcast
Channel: THWACK: Message List
Viewing all articles
Browse latest Browse all 20490

Re: how to get report https availability with URL

$
0
0

If last month means last 28/30/31 days, then the query should like this:

SELECT  TOP 10000  

  cs.Value AS Name, 

  AVG(daa.PercentAvailability) AS PercentAvailability,

  ccs.Availability AS CurrentStatus

 

FROM

    APM_AlertsAndReportsData ard, 

    APM_DailyComponentAvailability daa,       

    APM_ComponentDefinition cd,

    APM_ComponentSetting cs,

    APM_CurrentComponentStatus ccs

 

WHERE

  daa.ComponentID = ard.ComponentID

  AND  ard.ComponentType = cd.ComponentType

  AND cs.ComponentID = ard.ComponentID

  AND ccs.ComponentID = ard.ComponentID

  AND cd.Name = 'HTTPS Monitor'

  AND cs.[Key] = 'Url'

  AND [DateTime] >= dateadd(m, -1, GETDATE())

GROUP BY cs.Value, ccs.Availability

 

If last month means - prior month, it should be something like this:

 

SELECT  TOP 10000  

  cs.Value AS Name, 

  dateadd(m, datediff(m, 0, [DateTime]), 0)  AS [Timestamp],

  AVG(daa.PercentAvailability) AS PercentAvailability,

  ccs.Availability AS CurrentStatus

 

FROM

    APM_AlertsAndReportsData ard, 

    APM_DailyComponentAvailability daa,       

    APM_ComponentDefinition cd,

    APM_ComponentSetting cs,

    APM_CurrentComponentStatus ccs

 

WHERE

  daa.ComponentID = ard.ComponentID

  AND  ard.ComponentType = cd.ComponentType

  AND cs.ComponentID = ard.ComponentID

  AND ccs.ComponentID = ard.ComponentID

  AND cd.Name = 'HTTPS Monitor'

  AND cs.[Key] = 'Url'

  AND [DateTime] BETWEEN dateadd(m,-1,DATEADD(mm, DATEDIFF(mm,0,getdate()  ), 0))

                        AND dateadd(ms,-3,DATEADD(mm, DATEDIFF(mm,0,getdate()  ), 0))

GROUP BY cs.Value, dateadd(m, datediff(m, 0, [DateTime]), 0),ccs.Availability


Viewing all articles
Browse latest Browse all 20490

Trending Articles