13 Replies Latest reply on Nov 27, 2013 10:27 PM by alexnguyen

    Orion SDK --Perl -- Add node issue

    alexnguyen

      Using below Perl code against our standalone NCM setup, I can create new node and attach "SNMP" pollers to it. I can see, through querying SWQL, that the software (NCM 7.2.1) populate node data in Orion.Nodes (vendor, vendor icon, systemoid, location..) but only when it due for next discovery (30mins), I dont see the software discover it at first place after added. Also when drilling into node detail page, all the information under Node details are suppressed. Checking the Orion.DiscoveredPoller and DiscoverNodes, I could not see my new node in either of them, Am i missing anything?

       

       

       

      ***** extracted code ****

       

      my $AddedNode = $swis->Create('Orion.Nodes',

          {

          IPAddress=> $ip,

          IPAddressGUID=>ip2guid($ip),

          EntityType=>'Orion.Nodes',

          Caption=>$node_name,

          DynamicIP=>$False,

          EngineID=>$True,

          Status=>$True,

          UnManaged=>$False,

          Allow64BitCounters=>$True,

          External=>$False,

          ObjectSubType=>"SNMP",

          Community=>"xxxxxxxx",

          SNMPVersion=>2,

          Comments=>"added by script",

          });

       

      $swis->Create("Orion.Pollers", {

                  'PollerType'=>$poller,

                  'NetObject'=>"N:$node",

                  'NetObjectType'=>'N',

                  'NetObjectID'=>$node

                  });

        • Re: Orion SDK --Perl -- Add node issue
          tom.rybka

          Hi, according to the SDK's Technical Reference section "Examples of CRUD Operations/Required Properties by Protocol", there are three properties required to initialize in the Create operation as well:

          • SysObjectID
          • MachineType
          • VendorIcon

          All the three should be initialized to an empty string.

           

          Also, I'd recommend to initialize the RediscoveryInterval property to a reasonable value, the interval you set means that in this period you should get the node first re-discovered.

          • Re: Orion SDK --Perl -- Add node issue
            RichardLetts

            here is what I have discovered as the minimum to get a node added in perl. The SDK may show minimums, but the webUI needs more than those to prevent giving errors in random places [aside: these should really have been put into the database as defaults]

             

                    my $AddedNode=$swis->Create('Orion.Nodes',
                            {'Caption'=>$ip,
                            'IPAddress'=>$ip,
                            'IPAddressguid' => ip2guid($ip),
                            'DynamicIP'=>0,
                            'UnManaged'=>0,
                            'EngineID'=>1,
                            'Status'=>1,
                            'Allow64BitCounters'=>1,
                            'ObjectSubType'=>'SNMP',
                            'SNMPVersion'=>2,
                            'Community'=>$rocid,
                            'Comments'=>'Added by noc',
                            'SysObjectID'=>$oid,
                            'MachineType'=>$MachineType,
                            'Vendor'=>$Vendor,
                            'VendorIcon'=>$VendorIcon,
                            'BufferNoMemThisHour'=>-2,
                            'BufferNoMemToday'=>-2,
                            'BufferSmMissThisHour'=>-2,
                            'BufferSmMissToday'=>-2,
                            'BufferMdMissThisHour'=>-2,
                            'BufferMdMissToday'=>-2,
                            'BufferBgMissThisHour'=>-2,
                            'BufferBgMissToday'=>-2,
                            'BufferLgMissThisHour'=>-2,
                            'BufferLgMissToday'=>-2,
                            'BufferHgMissThisHour'=>-2,
                            'BufferHgMissToday'=>-2,
                            'PercentMemoryUsed'=>-2,
                            'TotalMemory'=>-2,
                            'SNMPV2Only'=>0,
                            'External'=>0,
                            'DNS'=>'',
                            'IOSImage'=>'',
                            'IOSVersion'=>''
            
            • Re: Orion SDK --Perl -- Add node issue
              alexnguyen

              Hi all,

               

              Thanks for the reply.

              I have tried both suggestions, Richard's solution does help to show pop-up menu, which I did not get it with my code.

              I was not able to drill into node page with Tom's suggestion,got this error

              Till I manually initiate re-discovery throught the WebUI, I can get into the node detail. What is the script to initiate re-discovery? Keep in mind that I only have standalone NCM and does not have NPM module in my environment. I have actually tried to invoke DiscoverInterfaceOnNode in Orion.Interfaces Class with no luck

               

              I am still not able to see data under Node detail as reported orignally. When attempting to download config, the added node does not shown up in the config management page. When trying to sync node (in Orion database) to NCM database, the new added node does not get synced.

               

              Richard, I am curious to know if you could download config or see the new added node under config managemenet page?

                • Re: Orion SDK --Perl -- Add node issue
                  tdanner

                  Alex, could on that error page, please click "Save Error Report Locally". You'll get a text file containing the exception stack trace and some more details. Attach it to this thread and I should be able to figure out what is going wrong here.

                    • Re: Orion SDK --Perl -- Add node issue
                      alexnguyen

                      hi Tdanner,

                      See below is the trace of the error. Looks to me that it is resulted of init of empty string of the Machine type

                      ==================================================================================

                      Time: 11/25/2013 08:37:26.7946

                      Server: Microsoft-IIS/7.0

                      Pipeline: Integrated

                      User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; WOW64; Trident/4.0; SLCC1; .NET CLR 2.0.50727; .NET4.0C; .NET4.0E; .NET CLR 3.0.30618; .NET CLR 3.5.30729)

                      Error Instance: c9b86935ddcb49e0ae494f3be57543ca

                      User: Admin

                      URL: http://10.241.1.10:80/Orion/NetPerfMon/NodeDetails.aspx?NetObject=N:87

                      Referrer: http://10.241.1.10:80/Orion/NetPerfMon/NodeDetails.aspx?NetObject=N:87

                      Message: Unable to cast object of type 'System.DBNull' to type 'System.String'.

                      ErrorSite: NetPerfMonWeb.Node.get_MachineType

                      ErrorType: System.InvalidCastException

                      Stack:

                      at SolarWinds.Orion.NPM.Web.Node.get_MachineType()

                      at Orion_NetPerfMon_NodeDetails.GetViewForDeviceType()

                      at SolarWinds.Orion.Web.UI.OrionView.SelectView()

                      at SolarWinds.Orion.Web.UI.OrionView.OnPreInit(EventArgs e)

                      at System.Web.UI.Page.PerformPreInit()

                      at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

                      Assemblies:

                      Version          Assembly

                      ---------------- ------------------------------------------

                      3.1.0.39271,     Antlr3.Runtime

                      8.2.20082.1000,  Infragistics2.WebUI.Shared.v8.2

                      8.2.20082.1000,  Infragistics2.WebUI.UltraWebChart.v8.2

                      8.2.20082.1000,  Infragistics2.WebUI.UltraWebGauge.v8.2

                      8.2.20082.1000,  Infragistics2.WebUI.UltraWebNavigator.v8.2

                      4.0.0.0,         Accessibility

                      4.0.0.0,         g3ihfde1

                      12.1.20121.2038, Infragistics4.Documents.Excel.v12.1

                      4.0.0.0,         Microsoft.Build.Framework

                      4.0.0.0,         Microsoft.Build.Utilities.v4.0

                      4.0.0.0,         Microsoft.CSharp

                      10.0.0.0,        Microsoft.JScript

                      10.0.0.0,        Microsoft.VisualBasic.Activities.Compiler

                      10.0.0.0,        Microsoft.VisualC

                      4.0.0.0,         mscorlib

                      4.0.0.0,         SMDiagnostics

                      4.0.0.0,         System

                      4.0.0.0,         System.Activities

                      4.0.0.0,         System.ComponentModel.Composition

                      4.0.0.0,         System.ComponentModel.DataAnnotations

                      4.0.0.0,         System.Configuration

                      4.0.0.0,         System.Configuration.Install

                      4.0.0.0,         System.Core

                      4.0.0.0,         System.Data

                      4.0.0.0,         System.Data.DataSetExtensions

                      4.0.0.0,         System.Data.SqlXml

                      4.0.0.0,         System.Design

                      4.0.0.0,         System.DirectoryServices

                      4.0.0.0,         System.DirectoryServices.AccountManagement

                      4.0.0.0,         System.Drawing

                      4.0.0.0,         System.Drawing.Design

                      4.0.0.0,         System.EnterpriseServices

                      4.0.0.0,         System.IdentityModel

                      4.0.0.0,         System.IdentityModel.Selectors

                      4.0.0.0,         System.Management

                      4.0.0.0,         System.Numerics

                      4.0.0.0,         System.Runtime.Caching

                      4.0.0.0,         System.Runtime.DurableInstancing

                      4.0.0.0,         System.Runtime.Serialization

                      4.0.0.0,         System.Security

                      4.0.0.0,         System.ServiceModel

                      4.0.0.0,         System.ServiceModel.Activation

                      4.0.0.0,         System.ServiceModel.Activities

                      4.0.0.0,         System.ServiceModel.Channels

                      4.0.0.0,         System.ServiceModel.Discovery

                      4.0.0.0,         System.ServiceModel.Routing

                      4.0.0.0,         System.ServiceModel.Web

                      4.0.0.0,         System.Transactions

                      4.0.0.0,         System.Web

                      4.0.0.0,         System.Web.ApplicationServices

                      4.0.0.0,         System.Web.DynamicData

                      4.0.0.0,         System.Web.Extensions

                      4.0.0.0,         System.Web.Extensions.Design

                      4.0.0.0,         System.Web.Mobile

                      4.0.0.0,         System.Web.RegularExpressions

                      4.0.0.0,         System.Web.Services

                      4.0.0.0,         System.Windows.Forms

                      4.0.0.0,         System.Workflow.Activities

                      4.0.0.0,         System.Workflow.ComponentModel

                      4.0.0.0,         System.Workflow.Runtime

                      4.0.0.0,         System.WorkflowServices

                      4.0.0.0,         System.Xaml

                      4.0.0.0,         System.Xaml.Hosting

                      4.0.0.0,         System.Xml

                      4.0.0.0,         System.Xml.Linq

                      4.1.50927.0,     AjaxControlToolkit

                      4.2.0.0,         AntiXssLibrary

                      1.8.0.0,         AspNet.ScriptManager.jQuery

                      1.0.0.0,         AxInterop.C1Query80

                      5.5.0.0,         AxTomSawyer

                      3.0.104.2,       EO.Pdf

                      1.0.1.6,         FiftyOne.Foundation

                      1.4.0.0,         HtmlAgilityPack

                      4.2.0.0,         HtmlSanitizationLibrary

                      1.0.0.0,         Interop.C1Query80

                      2.0.0.0,         Interop.stdole

                      1.2.10.0,        log4net

                      1.0.0.0,         Microsoft.AspNet.SignalR.Client

                      1.0.0.0,         Microsoft.AspNet.SignalR.Core

                      1.0.0.0,         Microsoft.AspNet.SignalR.Owin

                      1.0.0.0,         Microsoft.AspNet.SignalR.SystemWeb

                      1.0.0.0,         Microsoft.Owin.Host.SystemWeb

                      1.0.0.0,         Microsoft.Practices.ServiceLocation

                      2.1.505.0,       Microsoft.Practices.Unity

                      1.0.0.0,         Microsoft.Web.Infrastructure

                      3.0.0.0,         Microsoft.Web.Services3

                      2.0.0.0,         MiniProfiler

                      7.0.3300.0,      MSDATASRC

                      2013.1.4.1011,   NetPerfMonWeb

                      4.5.0.0,         Newtonsoft.Json

                      2013.1.4.1011,   OrionWeb

                      1.0.0.0,         Owin

                      2.0.0.0,         SmartThreadPool

                      7.2.11.49,       SolarWinds.Cirrus.IS.Client

                      7.2.11.49,       SolarWinds.Cirrus.OrionLayer

                      7.2.11.49,       SolarWinds.Cirrus.Web

                      2013.1.4.1011,   SolarWinds.Common

                      7.2.11.49,       SolarWinds.ConfigManagement.Core

                      1.0.0.0,         SolarWinds.Data

                      2011.5.0.130,    SolarWinds.Data.Entity

                      2011.5.0.130,    SolarWinds.InformationService.Addons

                      1.0.0.0,         SolarWinds.InformationService.Contract

                      2013.1.0.130,    SolarWinds.InformationService.Contract2

                      2013.1.4.1011,   SolarWinds.Internationalization

                      1.6.0.28,        SolarWinds.JobEngine.Contract

                      2.5.0.16,        SolarWinds.JobEngine.Contract2

                      3.0.0.470,       SolarWinds.Licensing.Framework

                      2.0.0.0,         SolarWinds.Logging

                      1.9.0.11,        SolarWinds.MapEngine

                      1.9.0.11,        SolarWinds.MapStudio.Strings

                      1.9.0.11,        SolarWinds.MapStudio.Web

                      7.2.11.49,       SolarWinds.NCM.Contracts

                      1.0.0.0,         SolarWinds.NCM.NodeManagement

                      7.2.11.49,       SolarWinds.NCM.Strings

                      1.0.0.0,         SolarWinds.NCMModule.Web.Inventory

                      7.2.11.49,       SolarWinds.NCMModule.Web.Resources

                      7.2.11.49,       SolarWinds.NCMModule.Web.Search

                      2013.1.4.1011,   SolarWinds.Net.ICMP

                      2013.1.4.1011,   SolarWinds.Net.SNMP

                      2013.1.4.1011,   SolarWinds.Net.WMI

                      1.0.0.0,         SolarWinds.NPM.Web.Gauge.V1

                      2.0.0.0,         SolarWinds.Orion.Common

                      2013.1.4.1011,   SolarWinds.Orion.Core.Common

                      2013.1.4.1011,   SolarWinds.Orion.Core.Data

                      2013.1.4.1011,   SolarWinds.Orion.Core.Jobs

                      2013.1.4.1011,   SolarWinds.Orion.Core.Models

                      2013.1.4.1011,   SolarWinds.Orion.Core.Reporting

                      2013.1.4.1011,   SolarWinds.Orion.Core.SharedCredentials

                      2013.1.0.0,      SolarWinds.Orion.Core.Strings

                      2013.1.0.0,      SolarWinds.Orion.Core.Web

                      2013.1.4.1011,   SolarWinds.Orion.Discovery.Contract

                      2013.1.4.1011,   SolarWinds.Orion.Pollers.Framework

                      2013.1.4.1011,   SolarWinds.Orion.Security

                      2013.1.4.1011,   SolarWinds.Reporting

                      2013.1.4.1011,   SolarWinds.Shared

                      1.0.0.0,         SWPicExtFactoryLib

                      5.5.0.0,         TomSawyer

                      5.5.0.0,         TSEDefaultExtFactoryLib

                      0.0.0.0,         App_Code.so1p8jgk

                      0.0.0.0,         App_global.asax.xrairt9c

                      0.0.0.0,         App_GlobalResources.iqnnc8n_

                      0.0.0.0,         App_Web_0waz1cxo

                      0.0.0.0,         App_Web_3bf4qsbm

                      0.0.0.0,         App_Web_43d0hn5g

                      0.0.0.0,         App_Web_51jd4gey

                      0.0.0.0,         App_Web_5l304q43

                      0.0.0.0,         App_Web_awav0h0j

                      0.0.0.0,         App_Web_ddai5ypd

                      0.0.0.0,         App_Web_doczlwtr

                      0.0.0.0,         App_Web_ecohr5om

                      0.0.0.0,         App_Web_f44x3ggy

                      0.0.0.0,         App_Web_gpgtlhxa

                      0.0.0.0,         App_Web_ia5znu1i

                      0.0.0.0,         App_Web_jpbbrwbp

                      0.0.0.0,         App_Web_k1ektuid

                      0.0.0.0,         App_Web_mem1kbyc

                      0.0.0.0,         App_Web_no3lxbfv

                      0.0.0.0,         App_Web_nqm3hcxw

                      0.0.0.0,         App_Web_sr3jxng2

                      0.0.0.0,         App_Web_szgwjgua

                      0.0.0.0,         App_Web_tc1et53w

                      0.0.0.0,         App_Web_twcts5xk

                      0.0.0.0,         App_Web_v1t0aad3

                      0.0.0.0,         App_Web_v2dwfbpa

                      0.0.0.0,         App_Web_xhe3hzor

                      0.0.0.0,         App_Web_xltfrjtz

                      0.0.0.0,         App_Web_y4wgrdkn

                      0.0.0.0,         App_Web_yevpkdw0

                      0.0.0.0,         App_Web_zf01zwh1

                      0.0.0.0,         App_Web_zpkvo4my

                      0.0.0.0,         A_c27acc3d_2a38_4739_aff6_9553311bd353

                      0.0.0.0,         Anonymously Hosted DynamicMethods Assembly

                        • Re: Orion SDK --Perl -- Add node issue
                          tom.rybka

                          This error indicates that the MachineType contains a NULL value instead of a string value, scripts should always initialize this property to an empty string. Are you sure that your script initializes it properly?

                            • Re: Orion SDK --Perl -- Add node issue
                              RichardLetts

                              gripe:

                              a) if NULLS are not supported in the database then do not allow them to be inserted; I mean you're literally allowing trouble to the stored for the future.

                               

                              b) if you don't want to do that then default them to a sensible value; e.g. if setting an unknown machinetype to '' is the right thing for the program inserting data to do, then help out the programmer by making the database do this for you.

                               

                              so many of the UI glitches and niggles would be fixed by adding not null with default to the schema (which is what setting all of those values to '-2' is for -- so the darned popover widget works.)

                                • Re: Orion SDK --Perl -- Add node issue
                                  tom.rybka

                                  I agree and we are aware of the fact that the API is not robust enough, however we are working on improvements in this area.

                                  • Re: Orion SDK --Perl -- Add node issue
                                    alexnguyen

                                    Tom, I did init the SysObjectID, MachineType & Vendor icon as your suggestion and got that error. (see below for my code)

                                    ****************************************************************************

                                    my $AddedNode = $swis->Create('Orion.Nodes',

                                        {

                                        IPAddress=> $ip,

                                        IPAddressGUID=>ip2guid($ip),

                                        EntityType=>'Orion.Nodes',

                                        Caption=>$node_name,

                                        DynamicIP=>$False,

                                        EngineID=>$True,

                                        Status=>$True,

                                        UnManaged=>$False,

                                        Allow64BitCounters=>$True,

                                        External=>$False,

                                        ObjectSubType=>"SNMP",

                                        Community=>"XXXXXXXXXXX",

                                        SNMPVersion=>2,

                                        Comments=>"added by script",

                                        SysObjectID=>"",

                                        MachineType=>"",

                                        VendorIcon=>""

                                         });

                                    ****************************************************************************

                                    If i comment out the last three lines, the error disappear and i can drill into Node detail page.

                                    I am still not able to see "Node Details" info under Manage Nodes, The added node does not get synced to NCM database in which I can confirm through License details page.

                                      • Re: Orion SDK --Perl -- Add node issue
                                        RichardLetts

                                        In order to the added node to get synced through to the NCM database you need to have an additional step:

                                         

                                        $swis->Invoke('Cirrus.Nodes', 'AddNodeToNCM', [$nodeid]);


                                        where $nodeid is the node id returned from the create step above.


                                        see:SDK 1.5 invoke with Perl ?


                                        ** note **

                                        you might need to get the sysobjectID for the node and fill it in correctly -- I have found that the NCM product never resyncs the sysObjectID after the node has been created, so if someone replaces your (say) HP switch with a Juniper switch NCM will try to use the HP methods


                                        /RjL

                                        1 of 1 people found this helpful
                                          • Re: Orion SDK --Perl -- Add node issue
                                            alexnguyen

                                            Richard,

                                            My invoke function return nothing, hence it does not add the node to NCM database as it should. I have tried with the updated InformationService.pm but no luck. However, if I try manually add (to NCM) via webUI, the new node get synced fine and i can see the node detail data under node detail page. I have also found that I need to provide the machinetype and vendor property along with the sysobjectID to be able to add node to Orion database properly.

                                             

                                            What is the returne result of your invoke command?

                                              • Re: Orion SDK --Perl -- Add node issue
                                                alexnguyen

                                                turned on XML output and received this error when calling invoke function to sync node from Orion into NCM database.Any idea?

                                                 

                                                2013-11-28 13:49:12,503 [23] ERROR SolarWinds.InformationService.Core.InformationService - Exception caught in method Invoke

                                                SolarWinds.InformationService.Verb.VerbExecutorException: Verb Cirrus.Nodes.AddNodeToNCM: Cannot find assembly

                                                   at SolarWinds.InformationService.Verb.VerbExecutor.EnsureCached(VerbExecutorContext verbExecContext)

                                                   at SolarWinds.InformationService.Verb.VerbCache.GetVerbContext(String entity, String verb, VerbExecutor& executor, VerbExecutorContext& context)

                                                   at SolarWinds.InformationService.Core.InformationService.InvokeInternal[T](String entity, String verb, Action`1 setupParameters, Func`2 extractReturnValue)

                                                   at SolarWinds.InformationService.Core.InformationService.Invoke(String entity, String verb, XmlElement[] parameters)

                                                </log></s:Header><s:Body><s:Fault><faultcode>s:Client</faultcode><faultstring xml:lang="en-US">Invoke failed, check fault information.</faultstring><detail><InformationServiceFaultContract xmlns="http://schemas.solarwinds.com/2007/08/inform

                                                ionservice" xmlns:i="http://www.w3.org/2001/XMLSchema-instance"><Message>Verb Cirrus.Nodes.AddNodeToNCM: Cannot find assembly</Message></InformationServiceFaultContract></detail></s:Fault></s:Body></s:Envelope>