NetXMS Support Forum

English Support => General Support => Topic started by: cserzs on November 13, 2014, 01:06:24 PM

Title: Threshold script
Post by: cserzs on November 13, 2014, 01:06:24 PM
Hi,

Could you send me a sample threshold function script for the following situation:

The configured activation event will be started if the last polled value more than 0 and less than 1

Thank you in advance and best regards,
Zsolt
Title: Re: Threshold script
Post by: multix on November 16, 2014, 12:23:28 PM
Hi
in treshold section, you must select "script" from function, samples=1, activation event and deactivation event as your choice.

Press Script Button and write :

dcival=GetDCIValue($node, FindDCIByName($node, "Status")); (Status=your DCI name)
if (dcival>0 && decimal <1) return true;
return false;
Title: Re: Threshold script
Post by: cserzs on November 17, 2014, 06:42:48 PM
Hi,

Thank you very much for your answer. I have tested your script but I found that the value of dcival in each case were "(null)". Please find the details in the attachment. However the dci value was about 2.8

What could be the problem?

BR,
Zsolt
Title: Re: Threshold script
Post by: Alex Kirhenshtein on November 17, 2014, 07:10:01 PM
There is a space in DCI name, please verify that you have space in configuration too.
Title: Re: Threshold script
Post by: cserzs on November 17, 2014, 10:44:40 PM
Hello,

Yes, in the DCI name also exist the space character before "(A)" substring. However I modified the DCI name to "MUXD_CurrentPA" and I checked the script with this name as well. The result was also the "(null)" value.

BR,
Zsolt
Title: Re: Threshold script
Post by: Victor Kirhenshtein on November 18, 2014, 11:45:53 PM
Hi,

can you show a screenshot of DCI "MUXD_CurrentPA" configuration?

Best regards,
Victor
Title: Re: Threshold script
Post by: cserzs on November 19, 2014, 04:58:36 PM
Hi,

Please find in the attachement.

BR,
Zsolt
Title: Re: Threshold script
Post by: tomaskir on November 19, 2014, 05:29:51 PM
Use FindDCIByDescription.

The field you are searching for is the description, not the name.
Title: Re: Threshold script
Post by: cserzs on November 19, 2014, 11:18:35 PM
Hi,

Thank you very much it is works well.

Regards,
Zsolt
Title: Re: Threshold script
Post by: KjellO on November 28, 2014, 06:20:45 PM
In transformation and threshold scripts, think you can simply use the "$1" to get last collected value.

dcival = $1;


If you wish to process values from another DCI you must of course use the FindDCI* methods, but here it looks like you are interested in the value from this particular DCI itself.

Best regards,
Kjell
Title: Re: Threshold script
Post by: cserzs on November 29, 2014, 03:31:12 PM
Hi,

Yes you're right, this is a useful advice.

thanks a lot,
Zsolt