Forum Discussion

David_Bond's avatar
David_Bond
Icon for Professor rankProfessor
2 years ago

Scripted Alert Thresholds

It should be possible to groovyscript Alert Thresholds, based on (for example) ILPs and hostProperties.

I need to modify the SNMP_Network_Interfaces to vary the InDiscardPercent threshold depending on whether this is a radioMAC interface type and whether it is a given customer.

Something along the lines of:

def isRadio = instanceProps.get('auto.interface.type') == 'radioMAC';

def customerCode = hostProps.get('customer.code');

if(isRadio && customerCode == 'ACME')

{

    // No threshold

    return '';

}

// The default

return '> 10';

  • @Stuart Weenig I’ll check to see what I can find out! 

    Also, in the near future we are planning to implement an idea board that would show the status of feature requests ;)

  • Anonymous's avatar
    Anonymous

    The way LM would tell you to do this is to tune those thresholds at the group level for each datapoint.  But you cannot create instance groups dynamically or do much with them even then (e.g., instance groups are not really groups, are not matchable in alert rules and you cannot tune thresholds for instance groups). Perhaps if they fixed those issues to work as you show, then the “normal” LM way would take care of it. Great idea!

    Exciting news from v187. Not multiple thresholds, but it’s progress.

  • mray's avatar
    mray
    Icon for LM Conqueror rankLM Conqueror

    This is exactly what @mnagel was talking about not wanting to have to do

    Yeah I’m seeing that now. I do get that it can get a bit cumbersome.

  • Anonymous's avatar
    Anonymous

    As for the HTTP status codes, perhaps you can try adding in the status codes you want to alert for in as complex datapoints. Check out the complex datapoint 503_error for the ‘HTTPS-’ DataSource:

    This is exactly what @mnagel was talking about not wanting to have to do:

    It also would be nice to be allowed to set multiple thresholds for datapoints if needed rather than hacking modules to create shadow datapoints in order to do so (my go-to example for why this is desirable is interface bandwidth -- it is perfectly reasonable to care about values that are too low OR too high).

  • mray's avatar
    mray
    Icon for LM Conqueror rankLM Conqueror

    @David Bond I do agree about your overall feedback. Having the ability to reference the output of scripts for complex datapoints would solve this easily. RE: 

    https://community.logicmonitor.com/feature-requests-5/complex-groovy-datapoint-access-to-script-batchscript-output-3509?postid=11716#post11716

    As for the HTTP status codes, perhaps you can try adding in the status codes you want to alert for in as complex datapoints. Check out the complex datapoint 503_error for the ‘HTTPS-’ DataSource:

  • Judging by changes I can see going on inside the v3 API, I’m hopeful that Instance Groups are about to become first class citizens in the Resource hierarchy and not just a tag.  Yes, it would be great if you could set SDTs, Alert thresholds etc. at this level.  I’ve been asking for years though, so I won’t hold my breath.

    Frankly, the Alerting logic has always been too simplistic.  I would love to be able to use switch statements on HTTP status codes, for example.

    The whole “> 1 2 3” thing is woefully inadequate.

  • The way LM would tell you to do this is to tune those thresholds at the group level for each datapoint.  But you cannot create instance groups dynamically or do much with them even then (e.g., instance groups are not really groups, are not matchable in alert rules and you cannot tune thresholds for instance groups). Perhaps if they fixed those issues to work as you show, then the “normal” LM way would take care of it. Great idea!

    It also would be nice to be allowed to set multiple thresholds for datapoints if needed rather than hacking modules to create shadow datapoints in order to do so (my go-to example for why this is desirable is interface bandwidth -- it is perfectly reasonable to care about values that are too low OR too high). It would also be great to have actual alert templates (not unconditional token substitution for a subset of alerts), but I dream...