Help Creating an Alert/Schedule

alert
done
low_priority
schedule
reply

(Justin Nicoara) #1

Hello, here is some background to understand my question. I have created a dimension called “delta.” Delta is simply the difference in time between the current time and the log time. I then sort the results by smallest delta (to see the most recent log) and set the max results to 1. This allows me to have a visualization of 1 number that tells me the time since the last log from that source, allowing me to monitor the health of that source. Now for the question. How do I set up an alert/schedule to email me when the “delta” value is above a certain number? If I set it as an actual filter in the look, it won’t bring up the most recent log. Is there a way you can specify Looker to “alert when delta is bigger than 100”? (again, I don’t think this works in the filter because if I put delta is greater than 100 in the filter, it’ll just find logs that are older and will always return). Thank you!


(Nicholas Wong) #2

You can always tell looker not to take past data by putting in a filter to limit the range of the dates.

Using this function, you can tell looker to send you an email if the number is higher than 100. You can write a code to tell looker to show number if higher than 100, else show 0.

Save this as a look for just alert and not a look that tells you the time difference of when the data is not updated. Hope this helps?


(Andrew Powell) #3

Hi,

I understand the issue - if you just put a filter on delta > 100 then it will just give old logs, as there is always a log with delta > 100, but you care about the most recent log, i.e. the smallest delta.

Could this be achieved by creating a measure which is min(delta)?

measure: smallest_delta {
    type: min
    sql: ${detla} ;;
}

Your look would then have smallest_delta as the only column, and you can then put a filter on smallest_delta to only show if smallest_delta > 100.

You can then use the advanced options Nicholas showed in his answer to say “If there are results then send schedule” and this will send the schedule if and only if smallest_delta > 100.

I agree with Nicholas again that if you want to do this, but still also want a look with that shows the smallest delta as a Single Value, then you’ll need to have two different looks I’m afraid.

With a schedule however you can put a message in the body of the scheduled email - in here you could put a link to the actual look you want to use for more information about the alert.

Hope this helps,
Andy