NetXMS Support Forum

Please login or register.

Login with username, password and session length

Author Topic: node discovery poll  (Read 2117 times)

StanHubble

  • Newbie
  • *
  • Posts: 42
    • View Profile
node discovery poll
« on: June 26, 2018, 11:09:48 pm »

would it be possible to add a manual discovery poll on a subnet? similar to a manual node poll?
i.e. (EntireNetwork->(zoneUIN)->subnet/mask) rightclick -> poll -> discovery

Along with a Hook::DiscoveryPoll script that could be called even if no new nodes are added.  This way a subnet-customattribute could be updated with a last run date/time similar to Alex's configuration poll example.

Thx.
Logged

Victor Kirhenshtein

  • Lead Developer
  • Administrator
  • Hero Member
  • *****
  • Posts: 6365
    • View Profile
Re: node discovery poll
« Reply #1 on: June 28, 2018, 10:24:50 am »

All polls run on a node level. It is possible to add discovery poll menu on subnet object, but all it can do is to start discovery polls on each node within subnet.
When exactly you want discovery poll hook to be called?

Best regards,
Victor
Logged

StanHubble

  • Newbie
  • *
  • Posts: 42
    • View Profile
Re: node discovery poll
« Reply #2 on: June 29, 2018, 06:31:24 pm »

Since the subnet doesn't show up unless there is a node in it, that means there is a node to do the discovery on.  I assume it then looks at the arp table , fdb, cdp, or lldp,  of the existing nodes for new nodes. 

As to when to do the hook, either at the beginning of the process or the end, i guess it doesn't matter.  what i would be looking to do is set a custom attribute with a last run date/time, whether or not it found anything new.
Logged

Victor Kirhenshtein

  • Lead Developer
  • Administrator
  • Hero Member
  • *****
  • Posts: 6365
    • View Profile
Re: node discovery poll
« Reply #3 on: July 18, 2018, 03:19:56 pm »

I'm a bit lost - are we talking about hook script or about manually starting discovery poll? Hook script already exist - you can use it to update attributes on all subnets where current node belongs.

Best regards,
Victor
Logged

StanHubble

  • Newbie
  • *
  • Posts: 42
    • View Profile
Re: node discovery poll
« Reply #4 on: July 18, 2018, 06:29:09 pm »

Manually Starting a Discovery Poll on a subnet. 

As far as existing hook scripts ...I don't see one that would have access to the subnet object (at least not in the comments).

Logged

Victor Kirhenshtein

  • Lead Developer
  • Administrator
  • Hero Member
  • *****
  • Posts: 6365
    • View Profile
Re: node discovery poll
« Reply #5 on: July 18, 2018, 07:09:04 pm »

This is simple hook script that sets attribute "lastDiscoveryPoll" to current time for all node's subnets:

Code: [Select]
for(o : GetObjectParents($node))
{
   if (o->type == 1)
   {
      SetCustomAttribute(o, "lastDiscoveryPoll", time());
   }
}

Best regards,
Victor
Logged

StanHubble

  • Newbie
  • *
  • Posts: 42
    • View Profile
Re: node discovery poll
« Reply #6 on: July 18, 2018, 08:31:55 pm »

Thx.

I maybe a little thick......would i create a new script called Hook::DiscoveryPoll or add that into one of the existing Hook:: scripts?

I currently have:
11 - Hook::StatusPoil
12 - Hook::ConfigurationPoll
13 - Hook::InstancePoll
15 - Hook::CreateInterface
16 - Hook::AcceptNewNode
Logged

Victor Kirhenshtein

  • Lead Developer
  • Administrator
  • Hero Member
  • *****
  • Posts: 6365
    • View Profile
Re: node discovery poll
« Reply #7 on: July 18, 2018, 09:18:56 pm »

Actually, I made a mistake here. There are hook for topology poll (it's not created by default for some reason, should be called Hook::TopologyPoll), but not for discovery poll. I'll add discovery poll hook in next release.

Best regards,
Victor

Logged

Victor Kirhenshtein

  • Lead Developer
  • Administrator
  • Hero Member
  • *****
  • Posts: 6365
    • View Profile
Re: node discovery poll
« Reply #8 on: July 19, 2018, 10:45:38 am »

Just added new hook "DiscoveryPoll" - it will be available in 2.2.8.

Best regards,
Victor
Logged