This discussion has been locked. The information referenced herein may be inaccurate due to age, software updates, or external references.
You can no longer post new replies to this discussion. If you have a similar question you can start a new discussion in this forum.

How do I enable discovery of pollers for WMI nodes?

I am successfully creating new WMI nodes and setting the credentials with the API. I am also able to enable some of the pollers. However some of the pollers are discovered using the List Resources function in the front end website. 

What is the correct way to do this in the API. 

Here is my code:

#!/usr/bin/env python2

from __future__ import print_function

import re

import requests

from orionsdk import SwisClient

import sys

import argparse

parser = argparse.ArgumentParser(description='Add a host to SolarWinds')

parser.add_argument('ipaddress', metavar='i', type=str, 

                    help='The ip address of the host to add')

parser.add_argument('hostname', metavar='h', type=str, 

                    help='The hostname the host to add')

args = parser.parse_args()

def add_host(ip,hostname):

    npm_server = '*****'

    username = '*****'

    password = '*****'

    swis = SwisClient(npm_server, username, password )

    ip_address = ip

    props = {

        'IPAddress': ip_address,

        'EngineID': 1,

        'ObjectSubType': 'WMI',

        'DNS': hostname + '.INTERNAL.CNNGAD.COM',

        'SysName': hostname,

        'NodeName': hostname,

    }

    results = swis.create('Orion.Nodes', **props)

    nodeid = re.search(r'(\d+)$', results).group(0)

    wmi_creds = {

           'NodeID' : nodeid,

           'SettingName' : 'WMICredential',

           'SettingValue' : '8',

    }

    response = swis.create('Orion.NodeSettings', **wmi_creds)

    pollers_enabled = {

        'IW.Rediscovery.WMI.WinV62': True,

        'IW.StatisticsErrors.WMI.WinV62': True,

        'IW.StatisticsTraffic.WMI.WinV62': True,

        'IW.Status.WMI.WinV62': True,

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

        'N.Cpu.WMI.Windows': True,

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

        'N.Memory.WMI.Windows': True,

        'N.SRM.Topology.WMI.Disks': True,

        'N.SRM.Topology.WMI.FibreChannel': True,

        'N.SRM.Topology.WMI.SCSI': True,

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

        'V.Details.WMI.Windows': True,

        'V.Statistics.WMI.Windows': True,

        'V.Status.WMI.Windows': True,

     }

    pollers = []

    for k in pollers_enabled:

        pollers.append(

            {

                'PollerType': k,

                'NetObject': 'N:' + nodeid,

                'NetObjectType': 'N',

                'NetObjectID': nodeid,

                'Enabled': pollers_enabled[k]

            }

        )

   for poller in pollers:

        #print("  Adding poller type: {} with status {}... ".format(poller['PollerType'], poller['Enabled']), end="")

        response = swis.create('Orion.Pollers', **poller)

    regex = re.compile('swis://CUSPSOLORI01.INTERNAL.CNNGAD.COM/Orion/Orion.Nodes/NodeID=')

    if regex.search(results):

        return(0)

    else:

        return(1)

requests.packages.urllib3.disable_warnings()

if __name__ == '__main__':

    print(add_host(args.ipaddress,args.hostname))