NetXMS Support Forum

English Support => General Support => Topic started by: DrCamel on April 30, 2015, 12:49:54 PM

Title: NXSL Script - Get DCI Comments?
Post by: DrCamel on April 30, 2015, 12:49:54 PM
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 (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 (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
Title: Re: NXSL Script - Get DCI Comments?
Post by: Victor Kirhenshtein on April 30, 2015, 02:44:54 PM
Yes, comments attribute was missing in DCI class. I've added it, will be available in 2.0-M5.

Best regards,
Victor
Title: Re: NXSL Script - Get DCI Comments?
Post by: DrCamel on April 30, 2015, 03:04:16 PM
Excellent, thanks Victor!

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

Simon
Title: Re: NXSL Script - Get DCI Comments?
Post by: Victor Kirhenshtein on April 30, 2015, 03:10:36 PM
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
Title: Re: NXSL Script - Get DCI Comments?
Post by: DrCamel on April 30, 2015, 03:19:35 PM
Ok, thanks again Victor.