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.

Issue with adding an ICMP Only Node using python SDK

I'm currently working on adding ~200 ICMP only nodes to our Orion Platform and using python to do so. However, I am having an issue once they have been added to Orion which is that they will not poll status or response time. Below is my code for adding the node. The Node is successfully added but it remains unknown status.

def add_to_orion(ip, caption, address, office, swis):
    try:
        # Add Node
        props = {
            'IPAddress': ip,
            'Caption': caption,
            'EngineID': 1,
            'ObjectSubType': 'ICMP'
        }
        print(f"Adding node {caption} ({ip})... ", end="")
        results = swis.create('Orion.Nodes', **props)
        print("Success!")
        nodeid = search(r'(\d+)$', results).group(0)
        pollers_enabled = {
            'N.Status.ICMP.Native': True,
            'N.ResponseTime.ICMP.Native': 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(
                f"  Adding poller type: {poller['PollerType']} with"
                f" status {poller['Enabled']}... ",
                end=""
            )
            swis.create('Orion.Pollers', **poller)
            print("Success!")
        # Update Custom Properties
        print(
            "Updating Custom Properties:"
            f"\n  Address     : '{address}''"
            f"\n  Office      : '{office}'"
            f"\n  Device Type : 'TEMP'"
            f"\n  Team        : 'TEMP'"
            f"\n  Owner       : 'TEMP'"
        )
        node_cp = swis.query(
            "SELECT URI FROM Orion.NodesCustomProperties "
            f"WHERE NodeID = {nodeid}"
        )['results'][0]
        swis.update(
            node_cp['URI'],
            address=address,
            _office=office,
            _devicetype='TEMP',
            team='TEMP',
            owner='TEMP'
        )
    except Exception as e:
        print(f"ERROR:\n\t{e}")

  • Your script looks good.  I tried running it on my Orion instance (after removing the custom properties update, which included properties not found in my environment).  Immediately after running the script, the node status was Unknown.  After the polling interval elapsed, the status changed to Up.  Questions:

    • Did you wait for the polling interval to elapse before checking the status?
    • Is it a valid IP address?  (I tested, and the status will remain Unknown if the IP address is not valid.)
    • Are you confident that ICMP is enabled for the system in question?
    • If you add the IP address through the Orion GUI and enable ICMP polling manually, do you get different results than when you run the script?
  • I wanted to add that I had a similar experience as Jan, but I added lines for DNS and Sysname.

    I ran the script multiple times as is and it never so much as added the pollers, I removed the pollers section and had similar results.

    Finally, when I re-added the pollers section and the DNS and SysName sections which are in the addNode python example it worked:

    def add_to_orion(ip, caption, address, office, swis): 

        try: 

            # Add Node 

            props = { 

                'IPAddress': ip, 

                'Caption': caption, 

                'EngineID': 1, 

                'ObjectSubType': 'ICMP',

                'DNS': '',

                'SysName': '',

            } 

            print(f"Adding node {caption} ({ip})... ", end="") 

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

            print("Success!") 

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

            pollers_enabled = { 

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

                'N.ResponseTime.ICMP.Native': 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( 

                    f"  Adding poller type: {poller['PollerType']} with" 

                    f" status {poller['Enabled']}... ", 

                    end="" 

                ) 

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

                print("Success!") 

        except Exception as e: 

            print(f"ERROR:\n\t{e}") 

           

           

           

           

    add_to_orion('<IP Address>', 'Script Test', 'test','test',swis)

  • 1. Yes. I have been working on this for a couple days. I left one site and it got 1 sucessfull poll it seemed but continued to not collect data afterwards.

    2, 3, 4. Yes. If I add it manually then it works correctly.

  • I feel like I tried that but I will give it another go and check.

  • Yeah it is still not working for me. I have confirmed before that the pollers were being added in swql unless there is something I'm missing.

  • A few more questions:

    • Do you have multiple engines in your environment, where the nodes you are adding might be assigned to a different engine ID?
    • Have you tried the following troubleshooting steps for ICMP polling?

    Troubleshoot nodes and interfaces that are Unknown

    https://support.solarwinds.com/SuccessCenter/s/article/Orion-Platform-Troubleshooting-Polling?ui-force-components-controllers-recordGlobalValueProvider.RecordGvp.getRecord=1&r=4

    Perhaps those will reveal something else that the script needs to take care of for your particular environment.

  • So it seems the issue is when I use EngineID: 1. If I use 2 or 3 for our additional pollers it works correctly. Not sure why this is the case though.

  • Have you checked the license keys on engine 1?

  • Not sure what else it could be then. Are you manually running the module or feeding it values from a script? May want to make sure it's getting the right values if you're using it in the script.

    The first few times I ran it the pollers were showing up as not applicable, so I couldn't even manually enable them.

    That was the script when it finally did work, but it's possible it's a red herring and the issue is intermittent on some level.