Script errors, but works?
-
The following script is erroring, but it's working. So I'm not sure what's wrong. I'm not very good at scripting, can anyone help out? Thanks!
if (($node->snmpSysName != null) && ($node->snmpSysName != "") && (($node->driver == "MIKROTIK") || ($node->driver ~= "CAMBIUM")))
{
RenameObject($node, $node->snmpSysName);
}Here's the error:
Script (Hook::ConfigurationPoll) execution error: Error 14 in line 8: Function or operation argument is not an object
-
Never mind, I figured it out. It was erroring on a device that was misconfigured to not poll SNMP.
-
No, it's still erroring. It only errors on the netxms server node.
-
Check this thread:
https://www.netxms.org/forum/general-support/script-execution-error/
-
Thanks, but that didn't fix it. It's erroring on the NetXMS server node.
-
The NetXMS server node reports the alarm, but I think it's erroring on every device. I'm at 2400 alarms since my last message.
-
I just confirmed that script doesnt work anymore. It worked 4 weeks ago when I first set it up, but it's not working now.
-
Can you show the full script. Original error message says the error is in line 8, but it's not clear what line is it.
-
Line 8 is the first line, here's the script currently after the other changes suggested above.
/* Available global variables:
* $object - current object, one of 'NetObj' subclasses
* $node - current object if it is 'Node' class
*
* Expected return value:
* none - returned value is ignored
*/
if (classof($object =="Node") && (($node->snmpSysName != null) && ($node->snmpSysName != "")) && (($node->driver == "MIKROTIK") || ($node->driver ~= "CAMBIUM")))
{
RenameObject($node, $node->snmpSysName);
} -
classof($object function should have closing bracket: classof($object). Output of this function is string which is compared to "Node"
-
Thanks, that's got it sorted out now!
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login