How to calculate availability from Sensu monitoring event data

Hi,

I'm trying to use event data generated by a Sensu monitoring server to calculate environment availability. I've used a date histogram to place the events into 1 minute buckets which seems to work as expected. I'm struggling with the last piece of the Jigsaw to count the number of buckets created, giving me my total minutes downtime.

Unless I'm missing something, I'd need to use the pipeline aggregations in 2.0 to do any kind of calculation across buckets but from what I can see even they don't provide a method of counting buckets. I'm new to elasticsearch so I may be missing something obvious.

Can anybody make any suggestions?

Thanks,
Andi

If you're counting buckets aren't you just counting how many minutes there are in your given timeframe?

Or am I missing something?

Sensu only creates an event when a check fails and I believe the default behaviour is to only create buckets when there is at least 1 document in the bucket. So if I have 3 events, each at 5 minute check intervals and I use a date histogram with 1 minute intervals, I'll get 15 buckets. I think :smile:

Obviously the whole strategy fails because I can't find a way to count the buckets without writing some code to do it.