NetXMS Support Forum

English Support => General Support => Topic started by: gmonk63 on June 18, 2025, 11:53:16 PM

Title: Config Poll Hook script error help
Post by: gmonk63 on June 18, 2025, 11:53:16 PM
I am using the following script to rename the node to the discovered snmp name 

9  if (($node.snmpSysName != "") and ($node.snmpSysName !=null))
10 {
11 return $object.rename($node->snmpSysName);
12 }


I always get this error and Im not sure why as it compiles and runs without issue
Script (Hook::ConfigurationPoll) execution error: Error 14 in line 9: Function or operation argument is not an object

Title: Re: Config Poll Hook script error help
Post by: Alex Kirhenshtein on June 19, 2025, 12:21:55 AM
This hook is not limited to Nodes, so $node can be null while $object is set.
If you are interested in nodes only, just check for $node:

if ($node and not $node.snmpSysName.isEmpty()) {
   $node.rename($node.snmpSysName);
}
Title: Re: Config Poll Hook script error help
Post by: gmonk63 on June 19, 2025, 12:32:11 AM
Thank you.. Is this still needed ?  I see that the server config has the following 

Objects.Nodes.ResolveNames   according to the description this resolves using DNS,SNMP system name ...
Title: Re: Config Poll Hook script error help
Post by: Filipp Sudanov on June 20, 2025, 03:15:50 PM
Objects.Nodes.ResolveNames - this works only when node is created. 
There's Objects.Nodes.SyncNamesWithDNS, but this one is taking names from DNS only (also not that activating this parameter currently requires server restart which contradicts with what UI is saying - it's a bug)