Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - jpaquin1106

#1
Quote from: johnnyva on March 14, 2023, 06:21:08 AMHey jp,

I was thinking that maybe node was null, but then I think that would give a different error.

What comes back if you print classof(node)?  I'm expecting it to be Node, but maybe its actually coming back as something else and not returning a node like the docs say.

What server version are you running?


Okay so after doing a classof(node) call its coming back with "Error 14 in line 8: Function or operation argument is not an object".
With this now known, I've run typeof(node) and its saying its a String.
Printing this string actually prints "Node@0x7f92ac7b6170".

Based on the documentation here: https://www.netxms.org/documentation/nxsl-latest/#_objects it states

FindNodeByIPAddress(ipaddress, currentNode) => Node

Return
Instance of Node object or null if not found or not accessible

So it seems its trying to return a node object but is instead doing an internal call to a toString() method before returning it.
I'm just going based on my knowledge of Java since that "Node@0x7f92ac7b6170" matches what I'm assuming exactly.


Edit:

I'm running the follow:

Server version: 4.3.2 (build 4.3-374-g4f45f9ba5c)
Java version: 11.0.10
JVM: OpenJDK 64-Bit Server VM 11.0.10+9


I've seen rare issues occur when running later versions of OpenJDK but documentation says the latest minimal version is 11 so I should be alright.

edit 2:

I've tested each of the find functions and they are all returning the same string representation.
To clarify, trusted node checks are disabled (by default) so the 2nd parameter is optional based on documentation.
#2
I'm currently learning NXSL to write scripts for executing ssh commands to nodes but have immediatelly run into issues that i'm unable to pinpoint the issue based on their documentation here:https://www.netxms.org/documentation/nxsl-latest/#_introduction

1 sub main() {
2 node = Objects.FindNodeByIPAddress($1, null);
3
4 if (node == NULL) {
5 println("Error: node not found.");
6    }
7
8 //println(node->name);
9   println(node->executeSSHCommand("ip address print"));
10}

When I try to execute the code above, it says "Error 30 in line 9: Unknown object's method" claiming the executeSSHCommand method doesn't exist, yet based on Node documentation is does. 

When commenting that line out and uncommenting line 8, it says the attribute doesn't exist. 
However, in documentation, it does. 

I'm unsure at this point if I'm missing something obvious syntactically or what.

Any help would be appreciated.