# Solarwinds queries repo

Today I would like to quickly point out that I’ve started to ‘open source’ some of my Solarwinds queries. I’ve noticed a lot of people on the web struggling with getting more out of this product. I’ve added a new (public) repo under my github profile that might help fellow network admins get a bit more useful info out of their Solarwinds instances. Solarwinds is a nice tool, but it’s definitely missing some very basic info regarding network devices. Perhaps newer versions than what we’re running here will have better info, but for now, these queries might help you to get what you need.

## Queries

All queries are located in my repo. Most of the code has been completely scrubbed, but here and there it might contain some custom variables. One such example is the ‘network’ attribute in one of the customproperties:

SELECT ncp.NodeID FROM Orion.NodesCustomProperties AS ncp WHERE ncp.DeviceCategory = 'Network'


Please be aware that in some cases the queries utilize a property in the ncp.DeviceCategory. This customProperty is defined to differentiate between network device and server. Yes, it’s silly to use manual categorization, but it’s part of the process of getting a new device up and running. Sooo, why not use it?

## Export script

There is also an export script included. This scripts executes a database query and creates a CSV file that can be used for import of all devices in SecureCRT. With an environment as large as ours, it removes some manual tasks of keeping the CSV updated. Now this script is scheduled and creates a new version every night based on our monitoring database. The settings for the script are in the .yaml file.

## Documentation

Documentation is always an afterthought. The same sort of applies to this case. However, I think most queries are well readable. Use the SWQL tool from Solarwinds to browse your Solarwinds instance to get an idea of what is happening. I’ve tried to make clear per file what the intension is. Some queries contain comments that you can paste in as well. This might help for your documentation as well.

Please note that the queries might not seem like valid or efficient queries. They’re not. Solarwinds decided to implement only a subset of SQL, which means that sometimes a lot more code is needed to achieve something simple.