Hello all,
I'm trying to create a custom chart based upon my custom SQL that retrieves 95th percentile traffic on business hours. I read I must implement ${FromTime} and ${ToTime}. However I do it I can't seem to get a time column that gives me data on my chart. Any help is greatly appreciated. Below is my custom SQL:
SET NOCOUNT OFF
SET ROWCOUNT 0
DECLARE @StartDate DateTime
DECLARE @EndDate DateTime
SET @StartDate = CAST((ROUND(CAST(GetDate() - 7 AS FLOAT), 0, 1)) as datetime)
SET @EndDate = GetDate()
SELECT TOP 10 Interfaces.InterfaceId,
Nodes.NodeID,
Nodes.City AS City,
Nodes.Caption AS NodeName,
Interfaces.InterfaceName AS Interface_Name,
Interfaces.CircuitID AS CircuitID,
Interfaces.LocalLoop AS LocalLoop,
Interfaces.InterfaceSpeed AS Interface_Speed,
Nodes.Vendor AS Vendor,
Interfaces.InterfaceID AS InterfaceID,
Interfaces.OutBandwidth AS Xmit_Bandwidth,
Interfaces.InBandwidth AS Recv_Bandwidth,
Maxbps_Out95,
Maxbps_In95,
Maxbps_95,
Case OutBandwidth
When 0 Then 0
Else (Maxbps_Out95/OutBandwidth)*100 End AS Util_Out95,
Case InBandwidth
When 0 Then 0
Else (Maxbps_In95/InBandwidth)*100 End AS Util_In95,
Case
When InBandwidth+OutBandwidth=0 Then 0
When InBandwidth=0 Then
(Maxbps_Out95/OutBandwidth)*100 When OutBandwidth=0 Then
(Maxbps_In95/InBandwidth)*100 Else
((Maxbps_In95/InBandwidth)+(Maxbps_Out95/OutBandwidth))*50 End AS AVERAGE_of_CircuitUtil_95RecvXmit,
(Maxbps_In95 + Maxbps_Out95)/2 AS AVERAGE_ofCircuitUtilBPS
FROM Nodes
INNER JOIN Interfaces ON Nodes.NodeID = Interfaces.NodeID
INNER JOIN (
SELECT Interfaces.InterfaceID,
dbo.GetInBps95th(Interfaces.InterfaceID, @StartDate, @EndDate) AS Maxbps_In95,
dbo.GetOutBps95th(Interfaces.InterfaceID, @StartDate, @EndDate) AS Maxbps_Out95,
dbo.GetMaxBps95th(Interfaces.InterfaceID, @StartDate, @EndDate) AS Maxbps_95
FROM InterfaceTraffic INNER JOIN Interfaces ON InterfaceTraffic.NodeID = Interfaces.NodeID
WHERE (InterfaceTraffic.DateTime >= @StartDate AND InterfaceTraffic.DateTime <= @EndDate) AND
(
(DATEPART(weekday, InterfaceTraffic.DateTime) = 2) OR
(DATEPART(weekday, InterfaceTraffic.DateTime) = 3) OR
(DATEPART(weekday, InterfaceTraffic.DateTime) = 4) OR
(DATEPART(weekday, InterfaceTraffic.DateTime) = 5) OR
(DATEPART(weekday, InterfaceTraffic.DateTime) = 6)) AND
(
(
(Interfaces.gmtOffset = 5) AND
(DatePart(Hour,InterfaceTraffic.DateTime) >= 5) AND
(DatePart(Hour,InterfaceTraffic.DateTime) <= 15)) OR
(
(Interfaces.gmtOffset = 6) AND
(DatePart(Hour,InterfaceTraffic.DateTime) >= 6) AND
(DatePart(Hour,InterfaceTraffic.DateTime) <= 16)) OR
(
(Interfaces.gmtOffset = 7) AND
(DatePart(Hour,InterfaceTraffic.DateTime) >= 7) AND
(DatePart(Hour,InterfaceTraffic.DateTime) <= 17)) OR
(
(Interfaces.gmtOffset = 8) AND
(DatePart(Hour,InterfaceTraffic.DateTime) >= 8) AND
(DatePart(Hour,InterfaceTraffic.DateTime) <= 18))
)
GROUP BY Interfaces.InterfaceID
) TrafficStat
ON Interfaces.InterfaceID = TrafficStat.InterfaceID
WHERE
(Nodes.Vendor = 'Cisco') AND
(Interfaces.CarrierName = 'CenturyLink')
ORDER BY AVERAGE_of_CircuitUtil_95RecvXmit ASC