NetXMS Support Forum

English Support => General Support => Topic started by: stoffmann on March 24, 2022, 10:38:20 AM

Title: Threshold with if clause?
Post by: stoffmann on March 24, 2022, 10:38:20 AM
Hi,
I have the following problem. I need to monitor a folder for changes. I do this by using a File.Size DCI and comparing the size of the folder with the previous read size. The DCI runs every hour. If the size is the same, it's a sign that our process has a problem.
My problem now is, that the folder can be empty for long time and this is totally ok. How can I tell a threshold not to fire an alarm if the value is zero?

Regards

Stefan
Title: Re: Threshold with if clause?
Post by: lweidig on March 24, 2022, 01:53:43 PM
Assuming the GetDCIValue contains the last value until the collection is complete (need to verify this) then a simple Threshold script like the following should work:

// Empty is OK no matter what
if ($1 == 0) return false;

// Non-empty OK only if different
if ($1 != GetDCIValue($node, $dci->id)) return false;

// Not OK, trigger threshold
return true;
Title: Re: Threshold with if clause?
Post by: stoffmann on March 28, 2022, 11:35:11 AM
Thank You.