Alert based on count of query being at or below a value within time range

Is it possible to alert if the count value of a query where the value of the query is at or below a specific value exceeds a certain count within a time range?

I have a graph (shown below) where the values will either be 1 or 0. I want to alert if the value has been 0 10 or more times within a 10 minute time frame.

Suppose you have a datasource supporting count where values are 0 or 10 it should be fairly simple to setup the alert.