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.

Inventory EOS and EOL Custom Table

All,  I am looking for some SWQL/SQL code that can pull out the following information from the database. 

Columns include:

  • Device Name
  • IP Address
  • Make
  • Model
  • Serial Number
  • IOS Version
  • End Of Software Maintenance
  • End of Life
Parents
  • Isn't almost all of that information in Cirrus.Nodes?

    SELECT [Nodes].NodeCaption
          , [Nodes].AgentIP
          , [Nodes].Vendor
          , [Nodes].MachineType
          , [Nodes].OSImage
          , [Nodes].OSVersion
          , [Nodes].EndOfSupport
          , [Nodes].EndOfSales
          , [Nodes].EndOfSoftware
          , [Device].Serial
    FROM Cirrus.Nodes AS [Nodes]
    LEFT JOIN Cirrus.EntityPhysical AS [Device]
          ON [Nodes].NodeID = [Device].Serial
    

  • I am getting an error when I cut and paste into a Custom Query. (SWQL)

  • thanks, sample output.  It will list the device several times.  

  • I didn't look at the output or what you were trying to do, just fix the query to allow it to output.

    If you look at the Cirrus.EntityPhysical entity, you will see there are multiple rows for each of the physical elements on the node. Therefore, you simply need to add a WHERE clause to restrict what you actually want to see. For example, you may only be interested in the Chassis, in which case the clause would be

    WHERE [Device].EntityClass LIKE '%chassis%'

    More likely, just interested in devices and the elements that have serial numbers, so this would be 

    WHERE [Device].Serial <> ''
    For this I would also add the following to the SELECT, so you can see what these elements are
    SELECT [Nodes].NodeCaption
          , [Nodes].AgentIP
          , [Nodes].Vendor
          , [Nodes].MachineType
          , [Nodes].OSImage
          , [Nodes].OSVersion
          , [Nodes].EndOfSupport
          , [Nodes].EndOfSales
          , [Nodes].EndOfSoftware
          , [Device].Name
          , [Device].Serial
    FROM Cirrus.Nodes AS [Nodes]
    RIGHT JOIN Cirrus.EntityPhysical AS [Device]
          ON [Nodes].NodeID = [Device].NodeID
    WHERE [Device].Serial <> ''

     

  • Thanks .  That was obviously a bad edit considering I don't have any matching data at all in my lab and I was trying to remember the linkages.

  • Thanks, Works like a champ. 

  • Sidebar: You might want to change the WHERE clause (to trap for NULLs).  It's generally best practices because NULL is not the same as an empty string ('').

    WHERE [Device].Serial <> ''

    to

    WHERE IsNull([Device].Serial, '') <> ''

  • I have a variation on the code here I would like to make but have trouble sorting out the AND's and NOT's.  

    I was able to do this on a per site basis, but still need a full list.  Because I have so many devices the list only include something like the first 100 devices and does not provide any additional data.  I though if I pulled out my core site, then I could do two separate lists.  Datacenter and remote offices.  Thoughts? 

    SELECT [Nodes].NodeCaption
          , [Nodes].AgentIP
          , [Nodes].Vendor
          , [Nodes].MachineType
          , [Nodes].OSImage
          , [Nodes].OSVersion
          , [Nodes].EndOfSupport
          , [Nodes].EndOfSales
          , [Nodes].EndOfSoftware
          , [Device].Serial
    FROM Cirrus.Nodes AS [Nodes]
    RIGHT JOIN Cirrus.EntityPhysical AS [Device]
          ON [Nodes].NodeID = [Device].NodeID
    WHERE [Device].EntityClass LIKE '%chassis%' AND (NOT [Nodes].NodeCaption = '%ENAU%') 

  • Hello , here's an adjusted query with I believe the appropriate statements at the end that you were looking for. Give it a go and see.

    SELECT 
            [Nodes].NodeCaption
          , [Nodes].AgentIP
          , [Nodes].Vendor
          , [Nodes].MachineType
          , [Nodes].OSImage
          , [Nodes].OSVersion
          , [Nodes].EndOfSupport
          , [Nodes].EndOfSales
          , [Nodes].EndOfSoftware
          , [Device].Serial
    FROM Cirrus.Nodes AS [Nodes]
    RIGHT JOIN Cirrus.EntityPhysical AS [Device]
          ON [Nodes].NodeID = [Device].NodeID AND [Device].EntityClass LIKE '%chassis%'
    WHERE [Nodes].NodeCaption NOT LIKE '%ENAU%'

  • You guys are awesome.  Wish I could transfer points to guys as a thank you.  

  • This is why I have Venmo. (just kidding - I do it for the fake internet points)

Reply Children
No Data