How to NOT send email in self hosted Redash when status is OK

Hi friends !

I’m wondering whether there is a way for us to NOT let redash send alert email to us when the status is OK. We are currently on self hosted version 8.0.0.b32245
Screen Shot 2020-11-12 at 11.54.03 AM

This isn’t a setting in Redash. But you could probably modify this code to make it work like you want. Something like this:

def should_notify(alert, new_state):

    if new_state == models.Alert.OK_STATE:
        return False

    passed_rearm_threshold = False
    if alert.rearm and alert.last_triggered_at:
        passed_rearm_threshold = (
            alert.last_triggered_at + datetime.timedelta(seconds=alert.rearm)
            < utils.utcnow()
        )


    return new_state != alert.state or (
        alert.state == models.Alert.TRIGGERED_STATE and passed_rearm_threshold
    )

Thanks !!! @k4s1m

Do you know where I can modify this code in the self hosted package, like generally ? We are using nomad to deploy redash so I can’t seem to find a code base to modify it.