Difference between revisions of "NXSL:FindNodeObject"

From NetXMS Wiki
Jump to navigation Jump to search
m (Text replacement - "^" to "{{deprecated}}")
 
(2 intermediate revisions by one other user not shown)
Line 1: Line 1:
__NOTOC__
{{deprecated}}__NOTOC__
Find node object by node id or node name.
Find node object by node id or node name.


Line 12: Line 12:
:{|
:{|
|-
|-
| ''node'' || [[NXSL:Node|Node]] object, you can use predefined variable $node to refer to current node. You can also use null as node if trusted nodes check is disabled (see notes for more information).
| ''node'' || [[NXSL:Node|Node]] object, you can use predefined variable $node to refer to current node. You can also use null as node if trusted nodes check is disabled (see [[SG:Security Issues|Security Issues]] for more information).
|-
|-
| ''id'' || ID or name of the node to find.
| ''id'' || ID or name of the node to find.
Line 21: Line 21:


[[NXSL:Node|Node]] object with given id or name on success or '''null''' on failure (either because node with given name/id does not exist, or access to it was denied).
[[NXSL:Node|Node]] object with given id or name on success or '''null''' on failure (either because node with given name/id does not exist, or access to it was denied).
== Remarks ==
Function's behavior depends on server's configuration parameter '''CheckTrustedNodes'''. By default access from script running for one node to another nodes are not allowed for security reasons (because if, for example, there are a user with write access to node A and no access to node B, it can create transformation script which will access node B and get information about it, thus breaking security settings). This security check can be disabled by setting server's configuration variable '''CheckTrustedNodes''' to '''0'''. Otherwise, system administrator have to maintain trusted nodes lists for each node being accessed from another node's scripts. For example, if '''$node''' in script refers to NODE1, and FindNodeObject($node, "NODE2") called, NODE1 must be added to list of trusted nodes for NODE2.





Latest revision as of 18:13, 13 September 2022

This Wiki is deprecated and we are are currrently migrating remaining pages into product documentation (Admin Guide, NXSL Guide)

Find node object by node id or node name.


Syntax

FindNodeObject(node, id);


Parameters

node Node object, you can use predefined variable $node to refer to current node. You can also use null as node if trusted nodes check is disabled (see Security Issues for more information).
id ID or name of the node to find.


Return Value

Node object with given id or name on success or null on failure (either because node with given name/id does not exist, or access to it was denied).


Examples

FindNodeObject($node, "server.netxms.org")	-> object
FindNodeObject(null, 12)			-> object
FindNodeObject($node, "bad_node_name")		-> NULL