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.

Adding NodeNotes to a SWQL query

Dug for quite a while and I don't see a direct link to the NodeNotes, working an update dashboard with a few properties, and want to use the notes as a server purpose/description.

This is what I have so far and it pulls everything I need except the node notes, I dug through nearly every linked property but am not finding how to include the node notes....I did research a join but could not get that working.

SELECT N.DisplayName, Max(N.AssetInventory.WindowsUpdates.LastSuccessInstallTime) as [Last Update install], N.IPAddress, N.Description
FROM Orion.Nodes N
WHERE N.IsServer = True
GROUP By N.DisplayName, N.AssetInventory.WindowsUpdates.LastSuccessInstallTime, N.IPAddress, N.Description
ORDER By N.AssetInventory.WindowsUpdates.LastSuccessInstallTime DESC

Thanks for any assistance anyone can provide.
Parents
  • Node Notes are stored in the Orion.NodeNotes entity (which you seem to have discovered on your own).

    Would you only want the most recent note?  Depending on the number of notes, you might return more records than you anticipate.

  • Huh, I didn't realize that could take multiple notes, see that now, thank you.

    I was gonna hit the easy button and add a custom property since they are linked directly to the node and easy to pull. I think I'll go that route now since that'll be a single unique value.

  • Well, if you wanted the most recent note, this is your query:

    SELECT N.DisplayName
         , MAX(N.AssetInventory.WindowsUpdates.LastSuccessInstallTime) AS [Last Update install]
         , N.IPAddress
         , N.Description
         , [NN].TimeStamp AS [Note Date]
         , [NN].Note AS [Most Recent Note]
    FROM Orion.Nodes N
    LEFT JOIN (
         SELECT [NN].NodeID
              , [NN].Note
              , [NN].TimeStamp
         FROM Orion.NodeNotes AS [NN]
         WHERE [NN].TimeStamp = (
                   SELECT MAX([NNRecent].TimeStamp) AS [MostRecentTS]
                   FROM Orion.NodeNotes AS [NNRecent]
                   WHERE [NN].NodeID = [NNRecent].NodeID
                   )
         ORDER BY [NN].NodeID
              , [NN].TimeStamp
         ) AS [NN]
         ON [N].NodeID = [NN].NodeID
    WHERE N.IsServer = True
    GROUP BY N.DisplayName
         , N.AssetInventory.WindowsUpdates.LastSuccessInstallTime
         , N.IPAddress
         , N.Description
         , [NN].Note
         , [NN].TimeStamp 
    ORDER BY N.AssetInventory.WindowsUpdates.LastSuccessInstallTime DESC
    

  • That works perfect, thank you very much, there's 110% I would've never got that working.

Reply Children