1 Reply Latest reply on Jun 23, 2015 3:23 PM by tdanner

    SWQL and the ${NodeID} Variable in Node Detail View


      Hello all!

      I wanted to pick your brains to see if you have any thoughts on my issue. Any help would be kindly appreciated. =)


      Here's the outline of the problem:

      • My customer has a lot of remote sites, connected via encrypted tunnel interfaces back to a central data center
      • They want to have a graph that gives the usage of just these tunnel interfaces, in a stacked-area graph, over the last three days
      • I have created a new node detail view and assigned it to the routers in question
      • I have created a custom graph and a SWQL query that seemingly accomplishes this (see query below). The query leverages the ${NodeID} variable so that it will return data only in the context of the current view (the router in question).
      • Unfortunately, the query returns results from, not just the wrong nodes, but several other wrong nodes!

      Here's the query:






        DATETRUNC('HOUR', N.Interfaces.Traffic.DateTime) AS Time,

        SUM(N.Interfaces.Traffic.TotalBytes) AS TotalBytes



      FROM Orion.Nodes N




        N.NodeID = ${NodeID} AND

        N.Interfaces.InterfaceName LIKE 'Tunnel%' AND

        N.Interfaces.Traffic.DateTime >= ${FromTime} AND

        N.Interfaces.Traffic.DateTime <= ${ToTime}



      GROUP BY N.Interfaces.InterfaceName, N.NodeID, DATETRUNC('HOUR', N.Interfaces.Traffic.DateTime)


      Please note that N.NodeID, as part of the SELECT and GROUP BY commands, is temporarily in place as part of debugging this issue.

      Here's the custom-graph result of the query:

      2015-06-15 10_28_33-Router Details - Summary.jpg

      The highlight in the URL section is the ID number of the node in question. I've validated this in SWQL studio.

      The highlight below the graph contains the node IDs returned in the query.

      My guess is that the NodeID variable is returning an array of nodes, rather than just the node in this context.

      I've already reached out to support on this issue and they told me to come here. (frustrating)

      It's either a bug, not possible, or I'm doing something wrong. Any thoughts, folks?

      Thanks in advance!

        • Re: SWQL and the ${NodeID} Variable in Node Detail View

          The Custom Chart resource and the other resources based on having a reporting "data source" do not support context-aware macros like ${NodeID}. There's no way that I can see to propagate the NodeID value from the surrounding page into your custom query.


          Secondarily, we apparently have a bug in the SWIS query parser that causes it to parse "N.NodeID = ${NodeID}" the same way as "N.NodeID = NodeID". Since "NodeID=NodeID" matches everything, you are getting all 'Tunnel%' instead of the error you would syntax expect to get that would have alerted you to the fact that your ${NodeID} macro is not getting replaced.