We have customs SWQL Query report for interface utilization , but need to create this report/data of Business Hour (9x6) time windows only and also on month basis (last month/this month), please suggest us what changes need to perform in below query.
------------------------------------------------
SELECT TOP 100
N.Caption,
N.IP_Address AS [Node IP],
NPMI.InBandwidth AS Bandwidth,
ROUND(AVG(nps.Inpercentutil), 2) AS AvgTxUtil,
ROUND(AVG(nps.Outpercentutil), 2) AS AvgRxUtil,
ROUND(MAX(nps.Inpercentutil), 2) AS MaxTxUtil,
ROUND(MAX(nps.Outpercentutil), 2) AS MaxRxUtil,
N.MachineType,
NIPA.IPAddress AS InterfaceIP,
NPMI.Name AS [Interface Name],
NPMI.InterfaceCaption
FROM
Orion.NodeIPAddresses NIPA
INNER JOIN Orion.NPM.Interfaces NPMI
ON NIPA.NodeID = NPMI.NodeID
AND NIPA.InterfaceIndex = NPMI.InterfaceIndex
INNER JOIN Orion.Nodes N
ON NIPA.NodeID = N.NodeID
INNER JOIN Orion.NodesCustomProperties NCP
ON N.NodeID = NCP.NodeID
INNER JOIN Orion.NPM.InterfaceTraffic nps
ON NPMI.InterfaceID = nps.InterfaceID
WHERE
N.CustomProperties.device_category LIKE 'Network'
AND NPMI.InBandwidth > 1000
AND nps.DateTime >= AddDay(-30, GETUTCDATE())
GROUP BY
N.Caption,
N.IP_Address,
NPMI.InBandwidth,
N.MachineType,
NIPA.IPAddress,
NPMI.Name,
NPMI.InterfaceCaption,
NPMI.OutBandwidth
ORDER BY
N.Caption ASC;
--------------------------------------------------