Threshold with if clause?

Started by stoffmann, March 24, 2022, 10:38:20 AM

Previous topic - Next topic

stoffmann

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

lweidig

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;

stoffmann