NXSL Script - Get DCI Comments?

Started by DrCamel, April 30, 2015, 12:49:54 PM

Previous topic - Next topic

DrCamel

Is there a way to retrieve the "Comments" property of a DCIObject?

Essentially I'd like to add some support information to the comments section of a DCI, that is also then included in emails that are generated for alerts against that DCI.

As a test I tried the following:-


sub main() {
node = FindObject("SomeNode");
dciID = FindDCIByName(node, "SomeDCIName");
dciObj = GetDCIObject(node, dciID);
println(dciObj->name);
println(dciObj->comments);
}


However it errors on the comments attribute line, and certainly the https://wiki.netxms.org/wiki/NXSL:DCI page does not list a "comments" attribute (but there is one on the node object https://wiki.netxms.org/wiki/NXSL:Node)

I've had a look through the script reference pages, but I can't see any functions to enable me to query it - does anyone know of a way to do so?

Otherwise I guess I would need to use a custom attribute.

Simon

Victor Kirhenshtein

Yes, comments attribute was missing in DCI class. I've added it, will be available in 2.0-M5.

Best regards,
Victor

DrCamel

Excellent, thanks Victor!

Is there any work around in the meantime? aside from using custom attributes instead.

Simon

Victor Kirhenshtein

If you build server from sources, you can try replace files src/server/include/nms_dcoll.h and src/server/core/nxsl_classes.cpp with attached and recompile the server. Other than that, there are no workarounds.

Best regards,
Victor

DrCamel