I have created a script which can upload OrionMap files (and thier associated images if required) to the SolarWinds database without the need for Network Atlas or ImportMapBatch as these were slow GUI applications.
The script i have created takes seconds to upload the files, so it is much quicker and means this process can be automated.
The reason i needed this automated was because i was tasked with creating a script to map our servers (which are constantly changing) in a graphical way in SolarWinds. So i created a script which can produce correct OrionMap files on-the-fly for the layout of our servers (without using Network Atlas, this was all automated based on the information it retrieves from SWIS). I needed a way of automating the import / upload to the SolarWinds Orion database, as this is where the map files are stored when they are imported with Network Atlas or ImportMapBatch.
Specifically, they are stored in the MapStudioFiles table. The actual map data is stored in the FileData column, so if you convert the MapFile or Image into a byte array, they can be uploaded to the database directly using the CRUD powershell functions.
My other problem with ImportMapBatch was if you were uploading a file which already existed (so updating a map), all of the Web UI map widget links to that map would break (as it would create a new entry in the database for the new map, and the Web UI map widget would still point to the old deleted map). My script addresses this by checking if a map with that file name already exists, saving the FileId it used, completely removing the old map, then uploading the new map with the old FileId. Which gives seamless map updates without breaking the Web UI map widgets.
I want to give a massive thankyou to KMSigma for his work on the Export map script, this helped me get the conversion to a byte array working and gave me a better understanding of the MapStudioFiles table, the link to his script is here, its very useful for backing up existing maps.
Please modify and use this script however you want, it would be especially useful if you had a task like i did where you had to automate the creation and upload of the maps, or you were just looking for a faster way of uploading the maps.
SolarWinds solutions are rooted in our deep connection to our user base in the THWACK® online community.
More than 150,000 members are here to solve problems, share technology and best practices, and directly
contribute to our product development process.
Learn more today by joining now.