Run query at specific time

116 views Asked by At

I need to execute the query below in Grafana and filter the returned data at a specific time, starting at 8 in the morning and ending at 11 at night every day.

Query:

sum(
  avg_over_time(
    probe_success{
      job=~"Blackbox GETs Middleware Disponibilidade|Blackbox GETs Middleware VerificarPrimeiraCompra"
    }[$__range]
  ) * 100
)/2

Example of probe_success returns:

1 @1691361852.361
1 @1691361972.361
1 @1691362092.361

I tried to run it this way:

sum(
  avg_over_time(
    probe_success{
      job=~"Blackbox GETs Middleware Disponibilidade|Blackbox GETs Middleware VerificarPrimeiraCompra"
    }[15h] offset 8h
  )
) * 100 / 2

and

(
  probe_success {job=~"Blackbox GETs Middleware Disponibilidade|Blackbox GETs Middleware VerificarPrimeiraCompra"} == 0
    and on()
  (hour() >= 9 and hour() <= 17)
)[1d:1m]
0

There are 0 answers