I'm running bosun
to alert against an elasticsearch
data set.
The scenario is that there's a number of cron jobs that do various things. If these execute successfully, they will log a success message. If they die / fail to run for whatever reason and fail to log the success message, we need to know about it.
My question is how to get a 0
result if no record is found, rather than null
. Here's the basic query:
nv(sum(escount(esls("logs"), "context.taskname", esand(esgte("context.elapsed_time", 0), esor(esquery("context.taskname", "Task1 or Task2 or Task3 or Task4"))), "360m", "360m", "")), 0)
If a given task has run in the interval specified, the query should return a non-zero value for the number of success messages the task has logged.
This works, but I want the alert to fire ONLY if the task hasn't run. The problem is that if Task1
hasn't run and logged a completion message, it's just dropped from the final grouping rather than returning a 0
count.
Is there a way to ensure that each task in the esor
returns something, even if it's a zero value?