20 Replies Latest reply on May 5, 2016 5:01 PM by Steven Klassen

    Node created from API never gets polled

    mlrabbitt

      When I create a node and add pollers through the API, the node never seems to get polled.  The node status never changes, I don't get get descriptive information like the node's name, vendor, etc. and it doesn't collect cpu, mem, volume, or interface statistics.  If I add the node through the Solarwinds GUI, everything works as it should.

       

      I am using the Python SDK and my Orion Platform is 2015.1.2 (NPM 11.5.2).  Here is the relevant code I'm using trying to add a Cisco router.

       

      swis = SwisClient(host, user, pass)

      request =  swis.create("Orion.Nodes", IPAddress="192.168.1.1", EngineID=1, ObjectSubType="SNMP", SNMPVersion=2, Community="public")

       

      At this point, the node has been added.  I can see it in Solarwinds "Manage Nodes" but it has no name or any other information associated with it because it hasn't been polled yet.

       

      #In these queries, I'll use a hard coded NodeId just to demonstrate, assume the NodeId is 100

      request = swis.create("Orion.Pollers", NetObject="N:100", netObjectType="N", netObjectID=100, PollerType="N.Status.ICMP.Native")

      request = swis.create("Orion.Pollers", NetObject="N:100", netObjectType="N", netObjectID=100, PollerType="N.ResponseTime.ICMP.Native")

      request = swis.create("Orion.Pollers", NetObject="N:100", netObjectType="N", netObjectID=100, PollerType="N.Details.SNMP.Generic")

      request = swis.create("Orion.Pollers", NetObject="N:100", netObjectType="N", netObjectID=100, PollerType="N.Uptime.SNMP.Generic")

       

      At this point, the pollers have been successfully added but nothing else has changed, I don't see status or additional node info, etc.  I have tried doing a "Poll Now" from the Solarwinds GUI and also invoking a "PollNow" through the API but I still get nothing.  The node just shows status "Unknown".  Now, if I do a "List Resources" from the Solarwinds GUI on the node, I can see all the routing topology, interfaces, etc. (and if I add these items, I can see these pollers are getting added in the DB.  Though if I add, say an interface now, I still can't get interface statistics because the node never appears to get polled).

       

      Does anyone know what I might be doing wrong here?

        • Re: Node created from API never gets polled
          madhavan

          Hi,

           

          Some details appear after rediscovery of the node. You can check the RediscoveryInterval (which is set to 30 minutes by default) and NextRediscovery to see when the rediscovery will happen. You can also trigger Rediscovery from GUI and see the details.

           

          Also NextPoll will give you details on when is the next polling will happen (It has interval of 2 minutes by default).

           

          Check and let me know if you still face issues.

            • Re: Node created from API never gets polled
              mlrabbitt

              I appear to be getting better results with this today.  Not sure if I had typos when I was testing last week or what.  The node did eventually start getting SNMP polled but it seemed to be hours after I created it (maybe during the Rediscovery process?).

               

              In testing today, I can get the ICMP status just from creating the pollers and waiting a couple minutes.  If I then do a "Poll now" through the GUI, I am now getting all of the SNMP related info I'm looking for.  I can't seem to get the PollNow invoke verb to work though.  I'm issuing:

               

              #Using hard coded NodeId again as an example

              res = swis.invoke("Orion.Nodes", "PollNow", "N:100")

              print res

               

              Which returns "None", I assume that is fine to see in the return but the node never appears to get polled.  The "netObjectId(System.String)" is supposed to be the NodeId right?  And in "N:XXX" format?

               

              Also, is there a way to invoke rediscovery via API?  I didn't see it in the SWIS schema under Orion.Nodes.

                • Re: Node created from API never gets polled
                  madhavan

                  Hi,

                   

                  The syntax for PollNow is correct. How do you confirm that the node is not getting polled?

                   

                  Check the PollInterval, to see how what is the interval set for polling (by default it is 120 seconds, so every 2 minutes polling should happen.)

                   

                  If you want to check if the pollNow via SDK  is working, increase the polling interval to say 5 minutes (300) and invoke pollNow, you should see the NextPoll is updated to 5 minutes from the time when invoke was called. (there may be delay of few seconds as it is a background process)

                   

                  There is no verb for Rediscovery as of now.

                   

                  Thanks

                • Re: Node created from API never gets polled
                  Steven Klassen

                  I'm having the same issue but unfortunately it's not clearing up on its own like mlrabbitt's issue. Here's the test code I'm using. It creates the node without issue but then sits there as Unknown and doesn't poll. I've let it sit for hours and there's no change.

                   

                  https://gist.github.com/mrxinu/223c73c6f3636ff489a4

                   

                  --

                  Steven Klassen

                  Developer Analyst @ Loop1 Systems, Inc.

                  http://www.loop1systems.com/

                    • Re: Node created from API never gets polled
                      mlrabbitt

                      Have you tried doing a Rediscover through the GUI after creating the node?  In my case, my nodes didn't start polling correctly until the Rediscovery happened, which in my environment is 240 minutes (4 hours).

                        • Re: Node created from API never gets polled
                          Steven Klassen

                          I did and that doesn't seem to make a difference. I went ahead and created the node in the GUI, took stock of all the pollers assigned to it (and their Enabled settings) and mimicked that exactly in the code. Same result.

                           

                          https://gist.github.com/mrxinu/223c73c6f3636ff489a4/revisions

                           

                          --

                          Steven Klassen

                          Developer Analyst @ Loop1 Systems, Inc.

                          http://www.loop1systems.com/

                            • Re: Node created from API never gets polled
                              mlrabbitt

                              I ran the first script you included and it worked for me.  I'm not sure what's different about your environment.  Are you sure your IPAddress, Community, EngineID are all correct?

                               

                              Here's an alternate (probably better) way of adding a node via API that might be worth trying: Perl SDK - Start Discovery - PluginConfigurations

                                • Re: Node created from API never gets polled
                                  Steven Klassen

                                  Well that's encouraging. =) I'll check out running this against another system.

                                   

                                  --

                                  Steven Klassen

                                  Developer Analyst @ Loop1 Systems, Inc.

                                  http://www.loop1systems.com/

                                  • Re: Node created from API never gets polled
                                    Steven Klassen

                                    Quick update - it was totally the system I was running against. It worked perfectly on another system.

                                     

                                    --

                                    Steven Klassen

                                    Developer Analyst @ Loop1 Systems, Inc.

                                    http://www.loop1systems.com/

                                      • Re: Node created from API never gets polled
                                        dvanzyl

                                        any idea why it didn't work on the one system but the other system did. I'm really frustrated regarding the SDK. It worked, now it doesn't work.

                                          • Re: Node created from API never gets polled
                                            Steven Klassen

                                            For me system A was just *really* heavily messed with by our engineering group. They do like to tinker. And something I'm sure turned it sideways. It's since been refreshed and is behaving. So no idea what it was. Do you have a system that's stopped wokring?

                                              • Re: Node created from API never gets polled
                                                dvanzyl

                                                Yep, basically it worked, with python-api until created nodes was not updating their statuses. But funny enough, is that adding an interface, it's immediately green and collecting data. I wonder if there is a log file  I can tail to get information regarding the node pollers and see if indeed it's polling. Oh and as a test when I add the node manually through the interface it works and is immediately green.

                                                  • Re: Node created from API never gets polled
                                                    Steven Klassen

                                                    Hey dvanzyl - I can't tell at what point in the thread you got involved so I'm not sure if this is a silly question or not, but when you're adding a node are you also adding pollers for the node? The interfaces get added with a default set of pollers so that would explain why those go immediately green if not your nodes.

                                                     

                                                    If you want to DM me a gist to the code you're working with I can compare it to what I have.

                                                      • Re: Node created from API never gets polled
                                                        dvanzyl

                                                        Well, for some reason unknown, orion started to poll. btw, i added all required pollers

                                                         

                                                        And it be working now. Now I just want to figure out how to add volumes..

                                                          • Re: Node created from API never gets polled
                                                            Steven Klassen

                                                            Until the API has some method of discovering volumes directly (like the DiscoverInterfacesOnNode verb) you have a couple options:

                                                             

                                                            1. Go and harvest all the details required for the properties to create a new volume.
                                                            2. Create a discovery with the node(s) you want to add (it runs as soon as they're created) and then sift through the Orion.DiscoveredNodes & Orion.DiscoveredVolumes entities.

                                                             

                                                            If you go with the first option this is what I did in Python to prepare a new volume's properties:

                                                             

                                                                def _add_volumes_to_solarwinds(self):
                                                                    now = datetime.utcnow()
                                                            
                                                                    for volume in self.node.volumes:
                                                                        props = {
                                                                            'NodeID': self._nodeid,
                                                                            'Icon': 'FixedDisk.gif',
                                                                            'Index': volume['index'],
                                                                            'Caption': volume['name'],
                                                                            'StatusIcon': 'Up.gif',
                                                                            'Type': 'Fixed Disk',
                                                                            'Size': volume['size'],
                                                                            'Responding': 'Y',
                                                                            'FullName': '{}-{}'.format(self.node.sysinfo['sysname'], volume['name']),
                                                                            'VolumeDescription': volume['name'],
                                                                            'VolumePercentUsed': str(int(volume['used']) / int(volume['size']) * 100),
                                                                            'VolumeAllocationFailuresThisHour': None,
                                                                            'VolumeSpaceUsed': volume['used'],
                                                                            'VolumeAllocationFailuresToday': '',
                                                                            'VolumeSpaceAvailable': str(int(volume['size']) - int(volume['used'])),
                                                                        }
                                                            
                                                                        ret = self._swis.create('Orion.Volumes', **props)
                                                                        self._add_volume_pollers(volume['name'])
                                                            

                                                             

                                                            The last call adds the basic pollers for the volume:

                                                             

                                                                def _add_volume_pollers(self, name):
                                                                    pollers_enabled = {
                                                                        'V.Details.SNMP.Generic': True,
                                                                        'V.Statistics.SNMP.Generic': True,
                                                                        'V.Status.SNMP.Generic': True
                                                                    }
                                                            
                                                                    pollers = []
                                                                    for k in pollers_enabled:
                                                                        pollers.append(
                                                                            {
                                                                                'PollerType': k,
                                                                                'NetObject': 'V:' + self._nodeid,
                                                                                'NetObjectType': 'V',
                                                                                'NetObjectID': self._nodeid,
                                                                                'Enabled': pollers_enabled[k]
                                                                            }
                                                                        )
                                                            
                                                                    for poller in pollers:
                                                                        print("  Adding [{}] volume poller type: {} with status {}... ".\
                                                                              format(name,
                                                                                     poller['PollerType'],
                                                                                     poller['Enabled']),
                                                                              end="")
                                                                        response = self._swis.create('Orion.Pollers', **poller)
                                                                        print("DONE!")
                                                            

                                                             

                                                            If you want some more real-time help shoot me a message and maybe we can collaborate on it.