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
All, I am looking for some SWQL/SQL code that can pull out the following information from the database.
Columns include:
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)
The JOIN was not correctly mapped, try this
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].NodeID
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 <> ''
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 <> ''
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? christopher.t.jones123 sum_giais John W Johnson
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%')
SolarWinds solutions are rooted in our deep connection to our user base in the THWACK® online community. More than 195,000 members are here to solve problems, share technology and best practices, and directly contribute to our product development process.