Version 3

    Version Requirements: Orion Core 2017.3 or above and Powershell (not sure of any specific PS version dependencies but it runs on every server/workstation I've used)

     

    In my day to day I do SolarWinds professional services and consulting and it is pretty common for me to get called in on server rebuilds/migrations, or cases where companies merge and want to condense their separate SolarWinds environments into one, or they run several environments and want to synchronize various things between them.

     

    As I have done these over and over I always dreamed there would be a way to just export views/dashboards from one environment to the next, up until now it has been an extremely manual job of trying to recreate whatever we saw in the old environment, sometimes having to guess at which resources were used if they had been renamed and such.  After three years of working with the database and getting deeper and deeper into the API I finally was able to build this viewmigrator tool.

     

    I typically run it from the powershell ISE on any machine with access to both the old and new servers. You can use your logged in windows credentials or specify another account to use.

     

    The parts you need to set to control the behaviors are between lines 58-66 and most of this information can be found by going to the edit page for whatever view you are working with

     

    #Name of view to migrate, use % to copy every view in a group

    $viewtitle = "%"

    #what type of view is this?

    $viewtype = "summary"

    #is this view part of a group? leave blank if no group, otherwise enter the viewgroupname

    $viewgroupname = "SW Health"

    #should the script remove all the resources already in the view to replace them if the view already exists in the new environment?

    $remove = "true"

    #should the script change the parameters of the view like the number of columns and their widths if the view already exists in the new environment?

    $changeview = "true"

     

    Specify the name of the view or tab, or use the wildcard to bring in everything from the specified group (the logic currently doesn't allow you to use wildcards for views that are not members of groups, but it could be done as long as we added in some safety checks).

     

    Specify the viewtype, figuring these out can be a little annoying because some (but not all) of them have their spaces removed from the name in the database, you can always spot check the syntax of the types by running this in the database manager:

    select distinct viewtype from views

     

    Viewgroupname should be a copy paste from the Name box on the edit page

     

    $remove will erase any resources that are already on the page, I typically have this one, but if you had some resources you wanted to keep on the view then set this any value beside true.

     

    $changeview will have the script change the parameters of the view if it already exists in the new environment, sets things such as the number of columns and their widths and what icon each tab uses.

     

     

    It has a mountain of logic to make sure things are going to the correct place, to make sure of what does and does not already exist in the new environment, and has a pretty extensive amount of comments throughout the file itself in case you do need to debug anything strange that you run into.  I've been using it myself for a while now and was able to merge 5 environments in minutes once I got it to the current state and sorted out all the edge cases I was running into.

     

    I also added in a feature to export the XML version of each view into a file and with a little massaging when I get some time I'll update it to have an option to just read the view info from those XML documents so we can basically start to do a content exchange of entire dashboards.

     

    Obviously take a backup of your databases before using this as it will potentially be making a lot of changes.

     

    One of the great things about having the API and information service so open to us is that if you get really motivated you can almost build any management feature or UX tweak you want into the tool. If I wanted to spend some more time on this you could wrap a GUI around it or even translate this into some kind of custom web page replacing the OOTB view manager to do this all directly within the web console. Of course I'm way too lazy to do that myself, but if someone with a stronger background in web dev wanted to its definitely within the realm of possibilities.

     

    If you do run into an issue definitely comment on the thread and we can try to sort it out.

     

    *July 23 edit - fixed problem with the ampersands in the titles, subtitles, also expanded on the "export" function so it names the files with a "Viewgroupname _ Viewtitle _ ResourceTitle.xml" format, should make it better when I finally build the tool to scan a directory and import those files based on the convention.

     

     

    -Marc Netterfield

        Loop1 Systems: SolarWinds Training and Professional Services