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.

Auto-discovery "Status & Response Time" Python SDK

We are dealing with an issue with auto-discovery where nodes are coming in as "ICMP (Ping) - Fastest" but we are configured to use SNMP. Is it possible to change the auto-discovery to specify SNMP?

Our syntax is following the standard supplied in this git repo >> orionsdk-python/discover_one_node.py at master · solarwinds/orionsdk-python · GitHub

pastedImage_0.png

  • If I understand what you're trying to accomplish, I believe you should change 'DisableIcmp': False to 'DisableIcmp': True in your Discovery profile settings.

  • Setting it to True still imports it to use ICMP. See our config below:

    discoveryProfile = {
            'Name': 'discover_one_node.py',
            'EngineID': orion_engine_id,
            'JobTimeoutSeconds': 3600,
            'SearchTimeoutMiliseconds': 5000,
            'SnmpTimeoutMiliseconds': 5000,
            'SnmpRetries': 4,
            'RepeatIntervalMiliseconds': 1800,
            'SnmpPort': 161,
            'HopCount': 0,
            'PreferredSnmpVersion': 'SNMP3',
            'DisableIcmp': 'True',
            'AllowDuplicateNodes': 'False',
            'IsAutoImport': 'True',
            'IsHidden': 'True',
            'PluginConfigurations': [
                 {'PluginConfigurationItem': corePluginConfig}
            ]
        }
  • I don't know if you can override the default on discovery stage but you could probably add a few more lines of code to change status and response time pollers on added nodes to SNMP ones.

    Here's a quick&dirty script that should enable SNMP poller and disable ICMP one for response time (the same should be done to 'N.Status.ICMP.Native' poller).

    You could probably have a more sophisticated query, to choose only nodes that you want to update...

    import itertools

    import orionsdk

    def main():

        poller_snmp = 'N.ResponseTime.SNMP.Native'

        poller_icmp = 'N.ResponseTime.ICMP.Native'

        swis = orionsdk.SwisClient("server", "user", "password")

        pollers = swis.query('SELECT PollerID, PollerType, NetObject, NetObjectType, NetObjectID, Enabled, DisplayName, Description, InstanceType, Uri, InstanceSiteId FROM Orion.Pollers WHERE NetObjectType = \'N\'')

        filtered_pollers = list(filter(

            lambda node: (node['PollerType'] == poller_snmp and node['Enabled'] == False)

                         or (node['PollerType'] == poller_icmp and node['Enabled'] == True), pollers['results']))

        grouped_pollers = itertools.groupby(filtered_pollers, lambda poller: poller['NetObject'])

        for _, g in grouped_pollers:

            group = list(g)

            if len(group) != 2:

                continue

            for poller in group:

                if poller['PollerType'] == poller_snmp:

                    swis.update(poller['Uri'], Enabled=True)

                if poller['PollerType'] == poller_icmp:

                    swis.update(poller['Uri'], Enabled=False)

    if __name__ == "__main__":

        main()

  • Anyone have any other thoughts? Not sure why its importing and using ICMP even with disabling it in the python.

  • we do Discoveries via Python regularly and have no issues with that switch. If DisableICMP is True, it never includes ICMP devices. Possibly the discoveryProfile is not being included in the discovery? Once a discovery is launched via API, that discovery will be listed in Network Discoveries in the web console. If you haven't done so already, can you edit that discovery in the web console and see if "Include devices/nodes that respond to ICMP (ping) alone" is indeed set to No?

  • Screen Shot 2019-05-16 at 9.19.38 AM.png

    Going back and reviewing it appears that it's picking up on the DisableIcmp: True setting when you look at it via the web gui.

    So really its something quite odd that's happening.

    The node adds and sits in an up status for about 30-45 seconds... Then it changes to an unmonitored after that period of time. To get it to re-monitor I have to change the "Status and Response Time" setting from ICMP to SNMP and do a re-poll. Once it has a minute to reach back out it comes back online.

  • As I understand it it will not import devices using ICMP only with the switch enable. So if device supports SNMP and ICMP it will still be added, but for some reason it will set ICMP poller for status by default.

  • I think there might be some confusion as to Polling Method -vs- Status/Response Time. I'd say that your discovery is doing exactly what it's supposed to, importing an SNMP device. You can verify that by editing the Node and seeing that SNMP is the polling method (screenshot). With SNMP nodes, when we do a List Resources, that's where the option for availability (Status & Response Time) is set. It can either be ICMP (default) or SNMP.

    pastedImage_1.png

    Although rare, we've had occasions where a device is not allowing ICMP, but does allow SNMP. This might be your scenario? When that happens, all SNMP (polling as well as Status) is good, but if ICMP is used for Status/Response Time, the node will show as down.

    Hopefully I'm not off base here. emoticons_happy.png

  • *edit, it looks like im responding to the person who made that suggestion. emoticons_happy.png

    You are correct, there is nothing built into the GUI to set the standard method of status collection to use the SNMP poller.

    It was mentioned upthread, you can script up a method to disable the ICMP status poller and enable the SNMP status poller on the orion.pollers table.

    pastedImage_0.png