NXSL and DCI

Started by jdl, November 09, 2010, 05:14:09 PM

Previous topic - Next topic

jdl

Hi,

I'm getting closer and closer to what I want but still there sth missing  :(
Would be glad if you help me on this one.

So I come back to my story...
I have one service server which host a logfile and an NXAgentd. There is a LOGWATCH running for this logfile. Parsing each alarm, it is possible to determine which node is impacted by the error - not the server, some other node which is not hosting any NXAgentd.

I want to have a specific DCI defined and updated according to data in the error message for each particular node.
Using NXSL I can determine the node name and use the NXPUSH command. But I'm block at the time I need to identify the DCI and get its latest value (GetDCIValue + FindDCIValue). Why? Because in the NXSL script those two functions require the first argument (node) to be an object! In my context, the $node object refers to the service server and not to the node which name can be extracted from the error message.

Is there no way to get around this problem?

One may want to consult a DCI from a node when handling events related to other nodes.

I understand from other posts that one could use the FindNodeObject function to get the node object" once we know for example its name. But I persistently get error 14, saying that my left side (objDciNode->name) of the following expression is not an object:

objDciNode = FindNodeObject($node, vDciNode);
// Some debugging trace
trace(3, "Node name = " . objDciNode->name);


Is there sth I forgot?

typeof(objDciNode) == NULL but my node exists well!

Many thanks in advance for your help
Best regards,

JDamien



Victor Kirhenshtein

Hi!

FindNodeObject can return null in two cases: if requested node was not found or access to it was denied. By default access from script running for one node to another nodes are not allowed for security reasons (because if, for example, you have 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 your security settings). You can disable this behavior completely by setting server's configuration variable CheckTrustedNodes to 0. Otherwise, you have to maintain trusted nodes lists for each node being accessed from another node's scripts. For example, if $node in your scripts refers to NODE1, and you call FindNodeObject($node, "NODE2"), NODE1 must be added to list of trusted nodes for NODE2.

Hope this helps!

Best regards,
Victor

jdl

Hi Victor,

Again, many thanks for your support and the quick answer. I very much appreciate how dynamic this forum is.

I've tried both your suggestions. Setting server's configuration variable CheckTrustedNodes to 0 (+ restarting server) solves my problem. That's a great point.

Now, if one want sto keep these security aspects that you can manage with the notion of "Trusted Node", adding the NODE1 to NODE2 list of trusted nodes does NOT work. Still same issue. You may want to have a look at this. I restarted agent: still NOK. I restarted server: still NOK. There is nothing I can report based on the log files. I also - based on what I experienced early this week- waited a while before dong anything.

In addition to this, I would highly appreciate if you could provide the list of all the functions that exist and are related to DCI, Node and Event objects. The user manual does not list them all (only DCI related). The forum provides some of the node related functions. Maybe there are more implemented but not yet known to us  :P

BTW: I have not seen any input in the logfile regarding to access right from one node to another - trusted node. Maybe it would be interesting to have some to support our troubleshooting. What do you think?

Best regards,

Jean-Damien

Victor Kirhenshtein

Hi!

I have updated NetXMS user manual. Now it contains up-to-date information about all available NXSL functions and classes (Event, Node, and DCI). Also I have implemented NXSL function PostEvent (will be included in 1.0.8 release) which could be used to generate events on behalf of any node (according to security settings, as with FindNodeObject).

Best regards,
Victor

Shin Sugita

Hi.

I downloaded the NetXMS user manual(last updated 2010-Nov-17) from Documentation web page, but it seem that users manual isn't new.(Downloaded file's version is "1.0.5".)
Please check.

download URL
https://www.netxms.org/documentation/netxms_user_manual.pdf

Sincerely.
Shin

Victor Kirhenshtein

Hi!

Fixed that, thank you!

Best regards,
Victor