14 Replies Latest reply on Aug 3, 2015 1:50 PM by slebbon

    Using PowerShell to add dependencies in NPM



      Anyone in the community trying to use the SDK to add dependencies via PowerShell?


      Automated the device add/remove, but trying to help our network guys by automating the dependencies.


      The help and SDK really don't mention this.  Running NPM and SDK v1.7.89

      Online help - http://www.solarwinds.com/NetPerfMon/SolarWinds/wwhelp/wwhimpl/js/html/wwhelp.htm



        • Re: Using PowerShell to add dependencies in NPM



          It is not possible to add dependencies via powershell as there is no interface in SDK which allows it.

            • Re: Using PowerShell to add dependencies in NPM

              That sounds like the start of a feature request. 

                • Re: Using PowerShell to add dependencies in NPM
                  Jan Pelousek

                  Hello, please stay tuned for upcoming NPM 11.5 (currently in RC phase). The CRUD support for Dependencies handling will be available here.

                    • Re: Using PowerShell to add dependencies in NPM

                      What will the performance of dependency handling be like (I have tens of thousands of dependencies I would like to create)

                      => I think it's a good idea for the SDK to give hints about things that could cause performance issues on one's Orion installation.

                        • Re: Using PowerShell to add dependencies in NPM
                          Jan Pelousek

                          The performance effect will be the same as when you will create the dependencies manually. We just added instrumentation for scripting, which doesn't add any kind of increase on performance.

                          The hit will depend on character of the dependencies. I mean e.g. Dependency between two interfaces won't be as heavy as between two groups, so it's not easy to forecast.

                          But if the question was "Will adding of dependencies increase the load on server?" The answer is "YES".

                          • Re: Using PowerShell to add dependencies in NPM

                            Did you ever get Dependencies added via powershell?  I'm running v11.5; The CRUD support seems to be in the SDK for dependencies but the created dependencies don't work (and appear to be missing attributes when looking at the new rows in the Orion.Dependencies table in the DB)...

                              • Re: Using PowerShell to add dependencies in NPM

                                Have you enable Auto Dependency at Settings page? Auto dependency is a new feature in 11.5. http://globalconfig.net/solarwinds-npm-11-5-really-neat-features/

                                There is a checkbox to enable this feature. Then the dependencies will be automatically created based on your topology. If you don't like some of the dependencies, you can go to manage dependencies page, ignore those entries and manually add dependencies you want. Auto dependency will work with the entries you create.


                                To create the entreis via CRUD, you need to fill in all fields before calling SWIS CRUD. Some are meta data to speed up the processing.

                                  • Re: Using PowerShell to add dependencies in NPM

                                    The data structure is

                                       public class Dependency


                                            public int Id { get; set; }

                                            public string Name { get; set; }

                                            public string ParentUri { get; set; }

                                            public string ChildUri { get; set; }

                                            public DateTime LastUpdateUTC { get; set; }

                                            public bool AutoManaged { get; set; }

                                            public int EngineID { get; set; }

                                            public int Category { get; set; }

                                            public string ParentEntityType { get; set; }

                                            public int ParentNetObjectID { get; set; }

                                            public string ChildEntityType { get; set; }

                                            public int ChildNetObjectID { get; set; }



                                    Set AutoManaged = false, Category = 0, If the parent is node, set PareentEntityType = "Orion.Nodes", and ParentNetObjectID = <NodeId> (for example, if the parent Uri is swis://dev-aus-1.local/Orion/Orion.Nodes/NodeID=580, the NodeId is 580).

                                    The same thing for Child.


                                                var properties = new PropertyBag


                                                        {"Name", dependency.Name},

                                                        {"ParentUri", dependency.ParentUri},

                                                        {"ChildUri", dependency.ChildUri},

                                                        {"AutoManaged", false},

                                                        {"ParentEntityType", dependency.ParentEntityType},

                                                        {"ParentNetObjectID", dependency.ParentId},

                                                        {"ChildEntityType", dependency.ChildEntityType},

                                                        {"ChildNetObjectID", dependency.ChildId}




                                        Create("Orion.Dependencies", properties);
                                      • Re: Using PowerShell to add dependencies in NPM

                                        Thanks, but I've seen the fields in the DB.  It seems that the example originally posted elsewhere in the forums was incomplete.  See my other comment on that post here:



                                        I just wasn't entirely sure that there weren't any other tables/fields that would need to be modified in addition...

                                          • Re: Using PowerShell to add dependencies in NPM

                                            Adding new dependency with the additional fields should be sufficient for it to work.

                                              • Re: Using PowerShell to add dependencies in NPM

                                                One example is below. Please make sure the ParentNetObjectID matches the value in ParentUri


                                                New-SwisObject $swis Orion.Dependencies @{Name="test1";ParentUri='swis://tdanner-dev.swdev.local/Orion/Orion.Nodes/NodeID=1';ChildUri='swis://tdanner-dev.swdev.local/Orion/Orion.Nodes/NodeID=2';AutoManaged=$false;ParentEntityType="Orion.Nodes";ParentNetObjectID=1;ChildEntityType="Orion.Nodes";ChildNetObjectID=2}

                                                  • Re: Using PowerShell to add dependencies in NPM

                                                    I did something like this, and it seemed to work out OK:


                                                    New-SwisObject $swis "Orion.Dependencies" @{Name="$($Description)";ParentUri="$($DepParentURI)";ChildUri="$($DepChildURI)";AutoManaged=$false;ParentEntityType="Orion.Groups";ParentNetObjectID="$($DepParentURI.split('=')[1])";ChildEntityType="Orion.Nodes";ChildNetObjectID="$($DepChildURI.split('=')[1])"}


                                                    I also did try enabling auto-dependencies, but as i feared, it didn't do any more than the topology has figured out (which wasn't much), the only part semi-useful it created was the HQ LAN switch portion, with a few gaps, but at that level I'm not sure i don't want to just use dependencies between groups rather than individual switch nodes... so i'll probably turn them off again.



                                            • Re: Using PowerShell to add dependencies in NPM

                                              I haven't turned on auto-dependency, but I'm pretty sure it will not work for us.  It's based upon the NPM topology, which so far NPM is not close to getting right.  It doesn't help that many of our switches are unmonitored, mostly we have branch site routers which have one or more DMVPN links between them.  Even though the multipoint tunnel interfaces are on the same L2 broadcast domain with each other, and are eigrp peers, NPM can't figure out how they're connected.  Occasionally a few of them show up as 'peers' in the L3 topology, with interfaces on both devices 'unknown', but it's not going to work to define the dependencies this way.  Further topology is not getting the HQ switches which are monitored correct either, I think because most of the interconnects are all etherchannel trunks.


                                              Once I get all the branch site switches added to NPM, I might look at auto-dependencies to make the in-site L2 dependencies more accurate (switch c <> switch b <> switch a <> site router <> HQ Router) than our current manual dependency plan (switches <> site router <> HQ router), but for now I'm pretty sure i just have to manually define them for all the sites.

                                                • Re: Using PowerShell to add dependencies in NPM

                                                  Auto dependency can detect branch sites and build dependencies within that sites. If you find the dependency from HQ router to branch router is not right, you can add dependency manually to fix it. You can enable auto dependency and see how it goes. If not meeting your requirement, you can disable it, and all automatically created dependencies will go away.