node discovery poll

Started by StanHubble, June 26, 2018, 11:09:48 PM

Previous topic - Next topic

StanHubble

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.

Victor Kirhenshtein

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

StanHubble

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.

Victor Kirhenshtein

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

StanHubble

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).


Victor Kirhenshtein

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


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


Best regards,
Victor

StanHubble

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

Victor Kirhenshtein

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


Victor Kirhenshtein

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

Best regards,
Victor