Forum Discussion

daniel_Briseno's avatar
9 years ago

Alert floor in delta

I have a datasource that monitors disk usage spikes. Currently it is set to alert if there is a change in disk usage greater than 10% in 10 minutes (polling period). It is useful to know if disk usage goes up from 80% to 88% in 10 minutes, however it is just noise for when a disk space would go from 50% to 55% in 10 minutes. It would be great to be able to add a condition where it would alert if the disk goes up 10% in 10 minutes, but only if total space used is above 70% fore example

  • Hi Daniel, you could work around this right now using a complex datapoint using an if() expression of, for example:

    if(ge(PercentUsed,70),PercentUsed,70)

    In this example, when the existing PercentUsed datapoint is returning a value of at least 70, this datapoint will return the same value; however if PercentUsed is returning a value below 70, this new complex datapoint will return a constant value of 70.

    You can then set a delta threshold on this datapoint. While ever the true PercentUsed is below 70, there will be no delta in this new datapoint value; at or above 70% usage the delta will come in to play and alert as appropriate.

    See also: http://www.logicmonitor.com/support/datasources/creating-managing-datasources/datapoint-expressions/

     

    A more complex variation:

    If a hard-coded floor value is not appropriate (as this will be a global setting within the datasource, of course), you could alternatively use a custom token in the datapoint expression, e.g.:

    if(ge(PercentUsed,##DELTAFLOOR##),PercentUsed,##DELTAFLOOR##)

    Note that in this latter case, there *MUST* be a DELTAFLOOR property, with a numeric value, set or inherited for every applicable device (i.e. you should create this token at the root level of the device tree, and then set it differently on those devices for which the global value was not appropriate). If there is no such property set, the calculation would fail due to the absent values. Therefore this version demands a little more management effort and if that property were deleted, the alerting datapoint would fail silently (although you could also set a "no data" alert on the datapoint to cover this). Note also that token use in datapoints is not an explicitly supported function at this time.

    I hope this helps.

  • Hi again Daniel,

    I spent a bit more time on this and additionally you could create a groovy scripted complex datapoint to handle the custom token or its absence.

    1. Create a complex datapoint in your datasource (or a clone of the datasource, during development), named e.g. deltaFloor

    2. For this datapoint, select the method as "Use groovy script to calculate a value".

    3. In the "Groovy source code" field, use this script (where 70 is the value above which you're interested in delta alerts):

    if ('##DELTAFLOOR##' == '') {return 70} else {return ##DELTAFLOOR##}

    4. Save the datapoint.

    5. Create another complex datapoint, named e.g. deltaFloorPercentUsed

    6. Using the "Use an expression..." method, use this expression:

    if(ge(PercentUsed,deltaFloor),PercentUsed,deltaFloor)

    7. Set your desired alerting on this latter datapoint.

    In this way, if the device has a ##DELTAFLOOR## property set, that value will be used, otherwise the value of 70 will be used; Then where the PercentUsed value for the disk in question is above the deltaFloor, your delta alerting will be active, whilst if the usage is below the floor value, the delta alerts will not trigger.

    I hope this helps, let us know how you get on!