10 Replies Latest reply on Oct 22, 2014 1:49 PM by david.gates

    Node Details blank when adding node Via Perl SDK

    david.gates

      I'm having an issue when adding a node via SDK, the Node details show blank, the Polling Details section says simply "A Network Node was Not Selected", and I am unable to see my node under "Manage Nodes".

       

      I am using the following test code to generate the Node:

       

      my @pollers = (

          'I.Status.SNMP.IfTable',

          'I.Rediscovery.SNMP.IfTable',

          'N.Details.SNMP.Generic',

          'N.Uptime.SNMP.Generic',

          'N.Cpu.SNMP.NetSnmpSystemStats',

          'N.Memory.SNMP.NetSnmpReal',

          'N.Status.ICMP.Native',

          'N.ResponseTime.ICMP.Native',

          'N.Topology_Layer3.SNMP.ipNetToMedia',

          'N.Topology_Layer3_IpRouting.SNMP.rolesRouter',

          'N.Topology_Layer3_IpRouting.SNMP.ipCidrRouter',

          'N.ResponseTime.SNMP.Native',

          'N.Status.SNMP.Native',

          'N.Routing.SNMP.Ipv4CidrRoutingTable',

          'N.AssetInventory.Snmp.Generic',

      );

       

      my $resp = $swis->Create(

          'Orion.Nodes',

          {

              'Caption'              => 'apitest2',

              'IPAddress'            => '10.0.0.148',

              'IPAddressGUID'        => ip2guid('10.0.0.148'),

              'DynamicIP'            => 0,

              'EngineID'             => 1,

              'Status'               => 1,

              'Allow64BitCounters'   => 1,

              'ObjectSubType'        => 'SNMP',

              'EntityType'           => 'Orion.Nodes',

              'SNMPVersion'          => 2,

              'Community'            => $community,

              'MachineType'          => 'net-snmp - Linux',

              'SysObjectID'          => '1.3.6.1.4.1.8072.3.2.10',

              'UnManaged'            => 0,

              'Vendor'               => 'net-snmp',

              'VendorIcon'           => '8072.gif',

              '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'           => '',

              'RediscoveryInterval'  => 60,

              'PollInterval'         => 180,

              'StatCollection'       => 5,

          }

      );

       

      $resp =~ /NodeID=(\d+)\</;

      my $nid = $1;

      print "New node id is $nid\n";

       

       

      foreach my $poller (@pollers) {

          print "Adding $poller to NodeID $nid\n";

          $swis->Create(

              "Orion.Pollers",

              {

                  'PollerType'    => $poller,

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

                  'NetObjectType' => 'N',

                  'NetObjectID'   => $nid

              }

          );

      }

       

       

       

      I feel like I must just be missing an essential Node Property but Ive been over several other posts and can't seem to figure out what it is I'm missing. Thanks in advance.

        • Re: Node Details blank when adding node Via Perl SDK
          juniordev

          Hi david.gates,

          I send my code for adding node using C#. That code works. I realised you didn't set SysName, Location, Contact. If your real problem is not showing any values on node detail page, maybe you should to set this values to empty blank and you should control, the engine, has '1' number for id, really exist.

           

          You can take a look these topics.

           

          Add Pollers & Node Details

           

                          string uri = swis.Create("Orion.Nodes", new PropertyBag

                                                                {

                                                                    {"EntityType", "Orion.Nodes"},

                                                                    {"IPAddress", pb.IPAddress},

                                                                    {"Caption", pb.Caption},

                                                                    {"SysName", pb.SysName},

                                                                    {"DynamicIP", pb.DynamicIP},

                                                                    {"EngineID", pb.EngineID},

                                                                    {"Status", pb.Status},

                                                                    {"Allow64BitCounters", pb.Allow64BitCounters},

                                                                    {"ObjectSubType", pb.ObjectSubType},

                                                                    {"SysObjectID", pb.SysObjectID},

                                                                    {"MachineType", pb.MachineType},

                                                                    {"VendorIcon", pb.VendorIcon},

                                                                    {"Community", pb.Community},

                                                                    {"SNMPVersion", pb.SNMPVersion},

                                                                    {"MemoryUsed", pb.MemoryUsed},

                                                                    {"CPULoad", pb.CPULoad},

                                                                    {"PercentMemoryUsed", pb.PercentMemoryUsed},

                                                                    {"Contact", pb.Contact},

                                                                    {"Location", pb.Location},

                                                                    {"DNS", ""},

                                                                    {"IOSImage", ""},

                                                                    {"IOSVersion", ""}

                                                                });

            • Re: Node Details blank when adding node Via Perl SDK
              david.gates

              I've tried adding those but no luck.

               

              The Polling Engine was indeed incorrect (needed to be '2'), and after correcting that my nod now comes up under "Manage Nodes", however Node Details are still blank on creation. Also of note, if I create the node via API, the Node Details will be blank. If I then go into Manage Nodes and "Edit Properties", make no changes, and hit save, then the Node Details section will show up properly.

                • Re: Node Details blank when adding node Via Perl SDK
                  david.gates

                  I'm now very confused, as after changing a couple things trying to sort out the issue I'm now not able to add nodes at all, getting the following error:

                   

                  2014-10-17 16:57:44,442 [67] ERROR SolarWinds.InformationService.Core.InformationService - Exception caught in method Create&#xD;

                  System.ArgumentException: An item with the same key has already been added.&#xD;

                   

                  This seems very odd to me since Orion.Nodes has simply NodeID as it's primary key, which is something the API should be generating, no?

                    • Re: Node Details blank when adding node Via Perl SDK
                      tdanner

                      Could you post the code that produces that error?

                        • Re: Node Details blank when adding node Via Perl SDK
                          david.gates

                          my $swis = SW::InformationService->new();

                          $swis->outputxml("true");

                          $swis->proxy($endpoint);

                          $swis->proxy->ssl_opts( verify_hostname => 0 );

                           

                          my $resp = $swis->Create(

                              'Orion.Nodes',

                              {

                                  'SysName'              => 'apitest3',

                                  'Contact'              => 'DGATES',

                                  'Location'             => 'owb.1145.01.02',

                                  'Caption'              => 'apitest3',

                                  'IPAddress'            => '192.168.143.232',

                                  'IPAddressGUID'        => ip2guid('192.168.143.232'),

                                  'DynamicIP'            => 0,

                                  'EngineID'             => 2,

                                  'Status'               => 1,

                                  'Allow64BitCounters'   => 1,

                                  'ObjectSubType'        => 'SNMP',

                                  'EntityType'           => 'Orion.Nodes',

                                  'SNMPVersion'          => 2,

                                  'Community'            => 'tnci991145',

                                  'MachineType'          => 'net-snmp - Linux',

                                  'SysObjectID'          => '1.3.6.1.4.1.8072.3.2.10',

                                  'UnManaged'            => 0,

                                  'Vendor'               => 'net-snmp',

                                  'VendorIcon'           => '8072.gif',

                                  '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'           => '',

                                  'RediscoveryInterval'  => 60,

                                  'PollInterval'         => 180,

                                  'StatCollection'       => 5,

                                  'Description'          => 'API Test #3',

                              }

                          );

                           

                          print "Response is $resp\n";

                          $resp =~ /NodeID=(\d+)\</;

                          my $nid = $1;

                          print "New node id is $nid\n";

                           

                           

                          die "Add node failed" unless $nid =~ /\d/;

                            • Re: Node Details blank when adding node Via Perl SDK
                              juniordev

                              Hi again david.gates,

                              That error, "An item with the same key has already been added" is occured because set "Description" field. You can't set this field by create method. It's a default field.

                               

                              And I realised your first posting code something.

                               

                              That code block and the one after, whis is adding pollers is not related to each other. I don't know how to write Perl code but I think you are not passing through correctly adding poller process

                               

                              $resp =~ /NodeID=(\d+)\</;

                              my $nid = $1; //your node id is "1"

                              print "New node id is $nid\n";

                               

                              //because of your node ID is "1", pollers is added to node which have "1" node ID.

                               

                              foreach my $poller (@pollers) {

                                  print "Adding $poller to NodeID $nid\n";

                                  $swis->Create(

                                      "Orion.Pollers",

                                      {

                                          'PollerType'    => $poller,

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

                               

                              Can you check have pollers correct nodeID after adding pollers? Maybe I'm wrong but that thoughts help you.

                                • Re: Node Details blank when adding node Via Perl SDK
                                  david.gates

                                  Actually, in Perl, the $1 variable refers to the first captured match

                                  inside of the most recent regex:

                                   

                                  This...

                                  $resp =~ /NodeID=(\d+)\</;

                                   

                                  Says to run a regex on what is in the response from adding a node, match a

                                  string that has NodeID=(any number of digits). The digits that are matched

                                  are inside a parentheses, so they get gobbled up into the $1 variable,

                                  which I then assign to $nid.

                                   

                                  The code for the pollers has worked very well actually. The only problem

                                  that remains is the Node Details being blank which is still occuring.

                                   

                                  Good to know though about the description field, I will try eliminating

                                  that.

                                   

                                   

                                   

                                  On Fri, Oct 17, 2014 at 5:21 PM, juniordev <

                                    • Re: Node Details blank when adding node Via Perl SDK
                                      madhavan

                                      Hi,

                                       

                                      I tried the below script and it worked (I tried with different similar IP.) I see all the details populated in node details. There should be no much change from yours, try updating this script with your values and let me know the result.

                                       

                                      my @pollers = (

                                          'I.Status.SNMP.IfTable',

                                          'I.Rediscovery.SNMP.IfTable',

                                          'N.Details.SNMP.Generic',

                                          'N.Uptime.SNMP.Generic',

                                          'N.Cpu.SNMP.NetSnmpSystemStats',

                                          'N.Memory.SNMP.NetSnmpReal',

                                          'N.Status.ICMP.Native',

                                          'N.ResponseTime.ICMP.Native',

                                          'N.Topology_Layer3.SNMP.ipNetToMedia',

                                          'N.Topology_Layer3_IpRouting.SNMP.rolesRouter',

                                          'N.Topology_Layer3_IpRouting.SNMP.ipCidrRouter',

                                          'N.ResponseTime.SNMP.Native',

                                          'N.Status.SNMP.Native',

                                          'N.Routing.SNMP.Ipv4CidrRoutingTable',

                                          'N.AssetInventory.Snmp.Generic',

                                          'N.Cpu.SNMP.HrProcessorLoad',

                                      );

                                      # Changed Community

                                      my $resp = $swis->Create(

                                          'Orion.Nodes',

                                          {

                                              'Contact'               => 'DGATES',

                                              'Location'               => 'owb.1145.01.02',

                                              'Caption'              => 'apitest3',

                                              'IPAddress'            => '192.168.143.232',

                                              'IPAddressGUID'        => ip2guid('192.168.143.232'),

                                              'NodeDescription'       => 'API Test #3',

                                              'SysName'               => 'apitest3',

                                              'DynamicIP'            => 'false',

                                              'EngineID'             => 1,

                                              'Status'               => 1,

                                              'Allow64BitCounters'   => 'true',

                                              'ObjectSubType'        => 'SNMP',

                                              'EntityType'           => 'Orion.Nodes',

                                              'SNMPVersion'          => 2,

                                              'Community'            => 'tnci991145',

                                              'MachineType'          => 'net-snmp - Linux',

                                              'SysObjectID'          => '1.3.6.1.4.1.8072.3.2.10',

                                              'UnManaged'            => 'false',

                                              'Vendor'               => 'net-snmp',

                                              'VendorIcon'           => '8072.gif',

                                              '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'             => 'false',

                                              'DNS'                  => '',

                                              'IOSImage'             => '',

                                              'IOSVersion'           => '',

                                              'RediscoveryInterval'  => 60,

                                              'PollInterval'         => 180,

                                              'StatCollection'       => 5,

                                          }

                                      );

                                       

                                      $resp =~ /NodeID=(\d+)\</;

                                      my $nid = $1;

                                      print "New node id is $nid\n";

                                       

                                      foreach my $poller (@pollers) {

                                          print "Adding $poller to NodeID $nid\n";

                                          $swis->Create(

                                              "Orion.Pollers",

                                              {

                                                  'PollerType'    => $poller,

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

                                                  'NetObjectType' => 'N',

                                                  'NetObjectID'   => $nid

                                              }

                                          );

                                      }

                        • Re: Node Details blank when adding node Via Perl SDK
                          david.gates

                          Just figured it out, I needed to be using SWIS v2 and not v3 for some reason.