solarwinds / OrionSDK

SDK for the SolarWinds Orion platform, including tools, documentation, and samples in PowerShell, C#, Go, Perl, and Java.
https://thwack.com/OrionSDK
Apache License 2.0
401 stars 142 forks source link

Sum Multiple Interface Traffic. #230

Closed junaid360 closed 4 years ago

junaid360 commented 4 years ago

Hi. Im trying to sum traffic in a way where I dont have to add all the interfacesIDs. So I made a custom property and called it CarrierName and taged the interface as provider where I want to collect the traffic from. How can I add the below 2 different qrys to achieve this?

SELECT SUM(s.Traffic) AS SumOfTraffic, s.Time FROM ( SELECT MAX(i.OutMaxBps) AS Traffic, DOWNSAMPLE(i.ObservationTimestamp) AS Time, i.InterfaceID FROM Orion.NPM.InterfaceTraffic i WHERE i.ObservationTimestamp BETWEEN $from AND $to AND i.InterfaceID IN (131055, 131250) GROUP BY DOWNSAMPLE(i.ObservationTimestamp), i.InterfaceID ) s GROUP BY s.Time

And the qry the second qry is

SELECT InterfaceID, CarrierName FROM Orion.NPM.InterfacesCustomProperties WHERE CarrierName= 'Provider'

njoylif commented 4 years ago

try: SELECT SUM(s.Traffic) AS SumOfTraffic, s.Time FROM ( SELECT MAX(i.OutMaxBps) AS Traffic, DOWNSAMPLE(i.ObservationTimestamp) AS Time, i.InterfaceID FROM Orion.NPM.InterfaceTraffic i WHERE i.ObservationTimestamp BETWEEN $from AND $to AND i.InterfaceID IN ( SELECT InterfaceID FROM Orion.NPM.InterfacesCustomProperties WHERE CarrierName= 'Provider') GROUP BY DOWNSAMPLE(i.ObservationTimestamp), i.InterfaceID ) s GROUP BY s.Time

junaid360 commented 4 years ago

Worked like a charm, you are genius, thank you

On Wed, Jun 10, 2020 at 2:41 PM njoylif notifications@github.com wrote:

try: SELECT SUM(s.Traffic) AS SumOfTraffic, s.Time FROM ( SELECT MAX(i.OutMaxBps) AS Traffic, DOWNSAMPLE(i.ObservationTimestamp) AS Time, i.InterfaceID FROM Orion.NPM.InterfaceTraffic i WHERE i.ObservationTimestamp BETWEEN $from AND $to AND i.InterfaceID IN ( SELECT InterfaceID FROM Orion.NPM.InterfacesCustomProperties WHERE CarrierName= 'Provider') GROUP BY DOWNSAMPLE(i.ObservationTimestamp), i.InterfaceID ) s GROUP BY s.Time

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/solarwinds/OrionSDK/issues/230#issuecomment-641946294, or unsubscribe https://github.com/notifications/unsubscribe-auth/AMRZC46XN2ZB2RUYIU22KFTRV5WOJANCNFSM4NZYMNUA .

njoylif commented 4 years ago

glad to hear! have fun