NetXMS Support Forum

English Support => General Support => Topic started by: pvo on December 11, 2020, 09:59:08 AM

Title: Force DCI poll from NXSL?
Post by: pvo on December 11, 2020, 09:59:08 AM
Is it possible to force DCI poll from a NXSL script?

I collect DCI values every 15 minutes because they change rarely and have NSXL script object commands which change the monitored state (for example on/off a display screen or input source).
It would be useful to check/change the state of DCI immediately after the command execution and not to wait 15 minutes for the next polling cycle or force the DCI poll manually.
Title: Re: Force DCI poll from NXSL?
Post by: Alex Kirhenshtein on December 11, 2020, 10:43:14 AM
You can call forcePoll() method on the DCI (https://www.netxms.org/documentation/nxsl-latest/#_instance_methods_5)


dciId = FindDCIByName($node, "My.Custom.DCI");
if (dciId > 0) {
  dci = GetDCIObject($node, dciId);
  if (dci != null) {
    dci->forcePoll();
  }
}
Title: Re: Force DCI poll from NXSL?
Post by: pvo on December 11, 2020, 10:52:34 AM
Thank you.
I was probably blind that I didn't find it.