4 Replies Latest reply on Feb 23, 2017 2:40 AM by tomas.vrabel

    Adding node with DNS instead of IP

    crutchas24

      Searched around the forums and google for a bit and not coming up with an answer as to why this might not be working for me. How do I add nodes that use DHCP instead of a static IP? Below is a snippet of the code i'm using, but when I go into NCM/NPM the node shows as unknown and it's polling IP is always 0.0.0.0. It's like it's not even attempting to resolve the FQDN and start walking the device.

       

          orion_props = {

           'DynamicIP': True,

           'EngineID': 1,

           'ObjectSubType': 'SNMP',

           'SNMPVersion': 2,

           'DNS': device,

           'Community': 'read-only-SNMP',

           'NodeName': device}

       

       

          node_uri = conn.create('Orion.Nodes', **orion_props)

       

       

          # Verify unicode string result return, otherwise there was a problem

          if isinstance(node_uri, dict):

              raise RuntimeError('Node add failed: {0}'.format(node_uri['ExceptionType']))

          else:

              node_id = re.search('(\d+)$', node_uri).group(0)

       

       

          pollers_enabled = {

              'N.Status.ICMP.Native': True,

              'N.Status.SNMP.Native': False,

              'N.ResponseTime.ICMP.Native': True,

              'N.ResponseTime.SNMP.Native': False,

              'N.Details.SNMP.Generic': True,

              'N.Uptime.SNMP.Generic': True,

              'N.Cpu.SNMP.HrProcessorLoad': True,

              'N.Memory.SNMP.NetSnmpReal': True,

              'N.AssetInventory.Snmp.Generic': True,

              'N.Topology_Layer3.SNMP.ipNetToMedia': False,

              'N.Routing.SNMP.Ipv4CidrRoutingTable': False}

       

       

          pollers = []

          for k in pollers_enabled:

              pollers.append({

                  'PollerType': k,

                  'NetObject': 'N:' + node_id,

                  'NetObjectType': 'N',

                  'NetObjectID': node_id,

                  'Enabled': pollers_enabled[k]})

       

       

          for p in pollers:

              response = conn.create('Orion.Pollers', **p)

              pprint(response)