<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Unknown Object Attribute and Method]]></title><description><![CDATA[<p dir="auto">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:<a href="https://www.netxms.org/documentation/nxsl-latest/#_introduction" rel="nofollow ugc">https://www.netxms.org/documentation/nxsl-latest/#_introduction</a></p>
<pre><code>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-&gt;name);
9   println(node-&gt;executeSSHCommand("ip address print"));
10}
</code></pre>
<p dir="auto">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. </p>
<p dir="auto">When commenting that line out and uncommenting line 8, it says the attribute doesn't exist. <br />
However, in documentation, it does. </p>
<p dir="auto">I'm unsure at this point if I'm missing something obvious syntactically or what.</p>
<p dir="auto">Any help would be appreciated.</p>
]]></description><link>https://forum.netxms.org/topic/7644/unknown-object-attribute-and-method</link><generator>RSS for Node</generator><lastBuildDate>Fri, 13 Nov 2026 09:39:31 GMT</lastBuildDate><atom:link href="https://forum.netxms.org/topic/7644.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 13 Mar 2023 19:43:28 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Unknown Object Attribute and Method on Mon, 20 Mar 2023 16:06:54 GMT]]></title><description><![CDATA[<p dir="auto">FindNodeByIPAddress is a function, so you should not add "Objects." in front of it. Dot is string concatenation operation in NXSL (we plan to change that in 5.0, but that's another story) - so Objects . FindNodeByIPAddress concatenates null value converted to empty string from non-existent variable "Objects" with object returned by FindNodeByIPAddress converted to string - so result is a string.<br />
Correct script will be something like this:</p>
<pre><code>node = FindNodeByIPAddress($1, null);
if (node == NULL) {
   println("Error: node not found.");
   return;
}

println(node-&gt;name);
println(node-&gt;executeSSHCommand("ip address print"));
</code></pre>
<p dir="auto">Best regards,<br />
Victor</p>
]]></description><link>https://forum.netxms.org/post/32335</link><guid isPermaLink="true">https://forum.netxms.org/post/32335</guid><dc:creator><![CDATA[victor]]></dc:creator><pubDate>Mon, 20 Mar 2023 16:06:54 GMT</pubDate></item><item><title><![CDATA[Reply to Unknown Object Attribute and Method on Tue, 14 Mar 2023 14:13:46 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/johnnyva" aria-label="Profile: johnnyva">@<bdi>johnnyva</bdi></a> said in <a href="/post/32311">Unknown Object Attribute and Method</a>:</p>
<blockquote>
<p dir="auto">Hey jp,</p>
<p dir="auto">I was thinking that maybe node was null, but then I think that would give a different error.</p>
<p dir="auto">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.</p>
<p dir="auto">What server version are you running?</p>
</blockquote>
<p dir="auto">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".<br />
With this now known, I've run typeof(node) and its saying its a String.<br />
Printing this string actually prints "Node@0x7f92ac7b6170".</p>
<p dir="auto">Based on the documentation here: <a href="https://www.netxms.org/documentation/nxsl-latest/#_objects" rel="nofollow ugc">https://www.netxms.org/documentation/nxsl-latest/#_objects</a> it states</p>
<pre><code>FindNodeByIPAddress(ipaddress, currentNode) =&gt; Node

Return
Instance of Node object or null if not found or not accessible
</code></pre>
<p dir="auto">So it seems its trying to return a node object but is instead doing an internal call to a toString() method before returning it.<br />
I'm just going based on my knowledge of Java since that "Node@0x7f92ac7b6170" matches what I'm assuming exactly.</p>
<p dir="auto">Edit:</p>
<p dir="auto">I'm running the follow:</p>
<p dir="auto">Server version: 4.3.2 (build 4.3-374-g4f45f9ba5c)<br />
Java version: 11.0.10<br />
JVM: OpenJDK 64-Bit Server VM 11.0.10+9</p>
<p dir="auto">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.</p>
<p dir="auto">edit 2:</p>
<p dir="auto">I've tested each of the find functions and they are all returning the same string representation.<br />
To clarify, trusted node checks are disabled (by default) so the 2nd parameter is optional based on documentation.</p>
]]></description><link>https://forum.netxms.org/post/32315</link><guid isPermaLink="true">https://forum.netxms.org/post/32315</guid><dc:creator><![CDATA[jpaquin1106]]></dc:creator><pubDate>Tue, 14 Mar 2023 14:13:46 GMT</pubDate></item><item><title><![CDATA[Reply to Unknown Object Attribute and Method on Tue, 14 Mar 2023 04:21:08 GMT]]></title><description><![CDATA[<p dir="auto">Hey jp,</p>
<p dir="auto">I was thinking that maybe node was null, but then I think that would give a different error.</p>
<p dir="auto">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.</p>
<p dir="auto">What server version are you running?</p>
]]></description><link>https://forum.netxms.org/post/32311</link><guid isPermaLink="true">https://forum.netxms.org/post/32311</guid><dc:creator><![CDATA[johnnyva]]></dc:creator><pubDate>Tue, 14 Mar 2023 04:21:08 GMT</pubDate></item></channel></rss>