This discussion has been locked. The information referenced herein may be inaccurate due to age, software updates, or external references.
You can no longer post new replies to this discussion. If you have a similar question you can start a new discussion in this forum.

Interface Utilization for Multiple Interfaces

I need to add 18 interfaces to this query: 9056 works

DECLARE @StartDate DateTime
        DECLARE @EndDate DateTime

        SET @StartDate = ${FromTime}
        SET @EndDate = ${ToTime}

        SELECT Interfaces.InterfaceId,
        Nodes.NodeID,
        Nodes.Caption AS NodeName,
        Interfaces.Caption AS Interface_Caption,
                Maxbps_In95,
        Maxbps_Out95,
        Maxbps_In99,
        Maxbps_Out99
        FROM Nodes
        INNER JOIN Interfaces ON Nodes.NodeID = Interfaces.NodeID
        INNER JOIN (
       SELECT InterfaceID = 9056,
      
        dbo.GetInBpsPercentile(InterfaceID, @StartDate, @EndDate,95) AS Maxbps_In95,
        dbo.GetOutBpsPercentile(InterfaceID, @StartDate, @EndDate,95) AS Maxbps_Out95,
        dbo.GetInBpsPercentile(InterfaceID, @StartDate, @EndDate,99) AS Maxbps_In99,
        dbo.GetOutBpsPercentile(InterfaceID, @StartDate, @EndDate,99) AS Maxbps_Out99
        FROM InterfaceTraffic
        WHERE InterfaceTraffic.DateTime >= @StartDate AND InterfaceTraffic.DateTime <= @EndDate
        GROUP BY InterfaceID
        ) TrafficStat
        ON Interfaces.InterfaceID = TrafficStat.InterfaceID
     

  • Hi Joseph, you can achieve this by using the IN statement. No comma after your last ID.

          

    SELECT InterfaceID IN ('9056','9057','9058',ect)

  • It would be beneficial to group your interfaces with a interface custom property something like where 'i_type' equals 'wan' this would save you time re-editing the same report over and over again will also help to add interfaces in ad-hoc

  • I wrote SELECT InterfaceID In ('9058','8116')

    it said

    QUERY is not valid

  • You will want to add the the Select InterfaceID in to the where statement, like this:

    DECLARE @StartDate DateTime
            DECLARE @EndDate DateTime

            SET @StartDate = ${FromTime}
            SET @EndDate = ${ToTime}

            SELECT Interfaces.InterfaceId,
            Nodes.NodeID,
            Nodes.Caption AS NodeName,
            Interfaces.Caption AS Interface_Caption,
                    Maxbps_In95,
            Maxbps_Out95,
            Maxbps_In99,
            Maxbps_Out99
            FROM Nodes
            INNER JOIN Interfaces ON Nodes.NodeID = Interfaces.NodeID
            INNER JOIN (
           SELECT InterfaceID,
          
            dbo.GetInBpsPercentile(InterfaceID, @StartDate, @EndDate,95) AS Maxbps_In95,
            dbo.GetOutBpsPercentile(InterfaceID, @StartDate, @EndDate,95) AS Maxbps_Out95,
            dbo.GetInBpsPercentile(InterfaceID, @StartDate, @EndDate,99) AS Maxbps_In99,
            dbo.GetOutBpsPercentile(InterfaceID, @StartDate, @EndDate,99) AS Maxbps_Out99
            FROM InterfaceTraffic
            WHERE InterfaceTraffic.DateTime >= @StartDate AND InterfaceTraffic.DateTime <= @EndDate

              AND InterfaceID in ('9058', '9056')
            GROUP BY InterfaceID
            ) TrafficStat
            ON Interfaces.InterfaceID = TrafficStat.InterfaceID

    Hope this helps!

    -ChrystalT

    Loop1 Systems: SolarWinds Training and Professional Services