News:

We really need your input in this questionnaire

Main Menu

Config Poll Hook script error help

Started by gmonk63, June 18, 2025, 11:53:16 PM

Previous topic - Next topic

gmonk63

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


Alex Kirhenshtein

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);
}

gmonk63

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

Filipp Sudanov

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)