9 Replies Latest reply on May 9, 2017 12:12 PM by m-milligan

    Automating node additions e2e: including Hardware Health Sensors




      I've been working on automating the addition of nodes to Solarwinds, and I had assumed that would be a routine and well documented task.  However I have struggled to find consolidated documentation that walks through the process definitively in any way.  Usually when this happens I assume PEBCAK as a) I'm new to Solarwinds so I'm probably doing something wrong, b) I'm a SysEngineer and not a networking guy so much is unfamiliar, and c) sometimes I don't know the right questions to ask.  So if this question is malformed or otherwise ignorant I apologize, but I need some help.


      I have gotten relatively far using the examples from PowerOrion and from this forum.  Currently I can get a node added, set properties both standard and custom, configure interfaces, and add pollers (enabling things like Routing, CPU&Memory, VLAN, Topology, etc. monitoring).

      However I am stuck at that last tick box of enabling Hardware Health Sensors.  I have found this conversation Adding Hardware Health Details , in which tdanner posted on 7/7/15:

      It is still not possible to add just the hardware health polling, but you can use the discovery API to add everything for a node, including hardware health. See this post for details: Re: Re: How do we programmatically discover the non-interface properties [in Orion] and enable them"

      I can follow the sample script in that post to discover my node rather than add it, and it comes in fine.  However, I still see the same behavior as when I add the node directly in that the Hardware Health Sensors resource is not selected.  This is the part where I assume I must be doing something wrong.  tdanner says it works; I do not experience it working....


      I did not see any specific flag in the sample XML for discovery that stood out to me as a "Turn Health Sensors ON" attribute.  Did I miss something?  Is there one to add?  Do I need to change the default discovery settings in Orion?


      When I run Network Sonar Discovery against my discovery IP (which is IPv6 if that matters) I find the node fine, it adds, and Health Hardware Sensors is enabled by default.

      Why isn't the scripted discovery also enabling HHS by default?


      And to significantly truncate my rant: Adding nodes via script should already be simple.  I think many people would want to do this.  I had hoped it would be a well documented process.  Please consider improvements to this process for the next release.


      Thanks for any input and feedback.


        • Re: Automating node additions e2e: including Hardware Health Sensors

          We're looking into the hardware health issue and will respond when we have a more complete answer for you.


          Regarding the need for a straightforward and complete way to add nodes via the API - I agree. We are not there yet, but it is high on my list.

            • Re: Automating node additions e2e: including Hardware Health Sensors

              Thank you for your response, I look forward to more information about adding hardware health.


              I found that adding nodes using properties hash tables with New-SwisObject and Set-SwisObject was relatively easy (and easier for me to grok setting the parameters) than the discovery process.  Are the XML parameters for discovery documented somewhere that I can translate my properties hash tables into those parameters?  Right now I'm running the discovery then using my hash tables to set the properties on the object created by the discovery, which seems to work OK, but I wouldn't mind understanding the XML parameters better as well....


              I was able to use the discovery process, but since it doesn't seem to add the HHS right now for me is there any advantage to me sticking with that process, or would it be all the same if I go back to New-* and Set-*?  Will the HHS issue be resolved in either case, or should I pick one and stick with it?  I want to focus my efforts correctly. 


              Thanks again for your help.

                • Re: Automating node additions e2e: including Hardware Health Sensors

                  I would recommend sticking with the discovery API - it will take care of a bunch of details that require more node-type-specific code when you use the New-SwisObject method. The hardware health stuff was added correctly when we tried it. We'll follow up with some troubleshooting steps.


                  No, unfortunately we don't have a document describing the discovery XML elements.

                    • Re: Automating node additions e2e: including Hardware Health Sensors

                      Thank you, I'll stick with discovery then.


                      For reference, here's the code I'm running for the discovery.  I discover the node, but I don't even get a 'list resources' button on the node details page after.  I copied your code and removed what I thought was safe in terms of multiple credentials and I'm only discovering a single unit for my test.  (likely I'll add additional nodes when I read in from csv later, or just run a loop, unless there's a different element that I should be using for single systems?).  So I only have one IPAddress element in the BulkList node, no IPRanges elements, and no subnets elements.  Maybe I pulled something out I shouldn't have?  But pretty much I just left what you wrote alone.


                      (sorry, I pasted plain text b/c formatting was dropping info):



                      #Step 1) Create Core plugin Configuration - IP ranges, subnets, IP bulk list, credentials
                      # You can provide the desired IPs or IP Ranges or Subnets as in the UI with already configured credentials.
                      # Query Orion.Credential to get the desired Credential ID


                      $xmlParam = ([xml]"
                      <CorePluginConfigurationContext xmlns:i='http://www.w3.org/2001/XMLSchema-instance' xmlns='http://schemas.solarwinds.com/2012/Orion/Core'>

                      $coreCfg = Invoke-SwisVerb $swis "Orion.Discovery" "CreateCorePluginConfiguration" @($xmlParam)
                      $coreCfgText = $coreCfg.InnerXml


                      #Step 2) Create VIM plugin Configuration

                      $vimParam = ([xml]"
                          <VimPluginConfigurationContext xmlns:i='http://www.w3.org/2001/XMLSchema-instance' xmlns='http://schemas.solarwinds.com/2012/Orion/VIM'>

                      $vimCfg = Invoke-SwisVerb $swis "Orion.VIM.Discovery" "CreateVimPluginConfiguration" @($vimParam)
                      $vimCfgText = $vimCfg.InnerXml


                      #Step 3) Create Discovery Configuration
                      # You can modify various parameters like Engine ID, SNMPPort,.. based on your environment

                      $startDiscoveryParam = ([xml]@("
                      <StartDiscoveryContext xmlns:i='http://www.w3.org/2001/XMLSchema-instance' xmlns='http://schemas.solarwinds.com/2012/Orion/Core'>




                      $NewNodeDiscovery = Invoke-SwisVerb $swis "Orion.Discovery" "StartDiscovery" @($startDiscoveryParam)

                      • Re: Automating node additions e2e: including Hardware Health Sensors

                        I had a large number of Cisco devices that needed hardware sensors enabled, so I did a bulk insert:


                        INSERT INTO dbo.[NodeSettings] (NodeID, SettingName, SettingValue)


                            SELECT NodeID, 'NeedsInventory','HWH'

                            FROM NodesData

                            where Vendor like '%Cisco%'

                            and ObjectSubType='SNMP'

                            and NodeID not in


                                select NodeID from




                    • Re: Automating node additions e2e: including Hardware Health Sensors

                      RichardLetts pointed me in a direction that works using SQL update directly.  Would love to hear more about how to skip this completely so I'm not going to mark answered yet, but I'm unblocked for now.


                      I dislike putting passwords over the wire or having to run in trusted mode, so I'm hopeful discovery will end up working out down the line.

                      In the time being:

                      Invoke-Sqlcmd -ServerInstance $DatabaseServerName `


                      -Database $DatabaseName -Username $UserName -Password $SqlPwd `


                      -Query "INSERT INTO dbo.[NodeSettings] (NodeID, SettingName, SettingValue) SELECT n.NodeID, 'NeedsInventory','HWH' FROM Nodes n LEFT JOIN APM_HardwareInfo hw ON (n.NodeID = hw.NodeID) WHERE n.NodeID = '$NodeID'"


                        • Re: Automating node additions e2e: including Hardware Health Sensors

                          I am really wanting to add new devices via the API.

                          I have a functioning script, however I have not been able to figure out how to add the hardware health checkbox.

                          I'm can run a select query, but I don't understand the insert part of your previous message.


                          SELECT n.Caption, n.NodeID, hw.NodeID AS HWNodeID FROM Orion.Nodes n LEFT JOIN Orion.HardwareHealth.HardwareInfo hw ON (n.NodeID = hw.NodeID) WHERE n.Vendor LIKE 'Cisco%' AND hw.NodeID IS NULL;


                          what is dbo.[NodeSettings] ?


                          Please let me know if there is a solution for adding the hardware health.

                            • Re: Automating node additions e2e: including Hardware Health Sensors

                              dbo.[NodeSettings] is the table that holds miscellaneous information related to the configuration of a node. This includes things like which template should be used when displaying node details, the node's polling frequency, the SSH port to use with this node, etc.


                              The query posted by danabrash will add a setting to this table for each of your nodes. The setting will be called "NeedsInventory" and its value will be "HWH". This will trigger Solarwinds to add hardware inventory to the information it collects for the node.

                        • Re: Automating node additions e2e: including Hardware Health Sensors

                          I've also spent a lot of time automating Orion additions in Python, the lack of a number of helpers (like adding volumes) or requiring to know information on the node (like it's type) and then add the right pollers (with Interfaces it's just calling `AddDefaultPollers`) is rather annoying.