I'm new to Prometheus so apologies if this is covered somewhere. Basically, I have a success timestamp metric with one dimension (the name of the task), so if I look at my metric in the console it looks like:
success_timestamp
success_timestamp{task="a"} 1458075306
success_timestamp{task="b"} 1458075309
I'm trying to set up an alert that fires if any timestamp in the metric is older than a certain time, but I only want the alert to fire between certain hours of the day. I thought I could accomplish that with something like:
IF (time() - success_timestamp > 300) AND ((time() % 86400000) / 3600000 > 10) AND ((time() % 86400000) / 3600000 < 18)
but I get an error message "comparisons between scalars must use BOOL modifier".
I had a look at the documentation on operators and tried a few different permutations using the bool cast and "==", but I haven't managed to get it working yet.
Is there some way to accomplish this?
Thanks,
Eoin.
Thanks,
Eoin.
--
You received this message because you are subscribed to the Google Groups "Prometheus Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to prometheus-devel...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
On 15 March 2016 at 21:36, Eoin Gillen <eoing...@gmail.com> wrote:Hi all,
I'm new to Prometheus so apologies if this is covered somewhere. Basically, I have a success timestamp metric with one dimension (the name of the task), so if I look at my metric in the console it looks like:
success_timestamp
success_timestamp{task="a"} 1458075306
success_timestamp{task="b"} 1458075309
I'm trying to set up an alert that fires if any timestamp in the metric is older than a certain time, but I only want the alert to fire between certain hours of the day. I thought I could accomplish that with something like:
IF (time() - success_timestamp > 300) AND ((time() % 86400000) / 3600000 > 10) AND ((time() % 86400000) / 3600000 < 18)
but I get an error message "comparisons between scalars must use BOOL modifier".
I had a look at the documentation on operators and tried a few different permutations using the bool cast and "==", but I haven't managed to get it working yet.
Is there some way to accomplish this?You're looking for the vector() function. Also, time() returns a value in seconds.Brian
Thanks,
Eoin.
--
You received this message because you are subscribed to the Google Groups "Prometheus Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to prometheus-developers+unsub...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
On Tuesday, March 15, 2016 at 9:46:08 PM UTC, Brian Brazil wrote:On 15 March 2016 at 21:36, Eoin Gillen <eoing...@gmail.com> wrote:Hi all,
I'm new to Prometheus so apologies if this is covered somewhere. Basically, I have a success timestamp metric with one dimension (the name of the task), so if I look at my metric in the console it looks like:
success_timestamp
success_timestamp{task="a"} 1458075306
success_timestamp{task="b"} 1458075309
I'm trying to set up an alert that fires if any timestamp in the metric is older than a certain time, but I only want the alert to fire between certain hours of the day. I thought I could accomplish that with something like:
IF (time() - success_timestamp > 300) AND ((time() % 86400000) / 3600000 > 10) AND ((time() % 86400000) / 3600000 < 18)
but I get an error message "comparisons between scalars must use BOOL modifier".
I had a look at the documentation on operators and tried a few different permutations using the bool cast and "==", but I haven't managed to get it working yet.
Is there some way to accomplish this?You're looking for the vector() function. Also, time() returns a value in seconds.BrianHey, thanks for the response. Just had a go at it there and I think I've managed to get it working. The task names (i.e. the values of the "task" label) were something I couldn't know apriori in Prometheus, so I couldn't get AND between two vectors working (without getting rid of the task names), but I think I've got it working with:IF (time() - success_timestamp > 300) * ((time() % 86400 / 3600 > bool 9) == bool (time() % 86400 / 3600 < bool 18))which is currently returning me elements with some nonzero value if today's hour is between 9 and 18, and elements with 0 otherwise. Going to try it with an alert now...
Thanks,
Eoin.
--
You received this message because you are subscribed to the Google Groups "Prometheus Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to prometheus-devel...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "Prometheus Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to prometheus-devel...@googlegroups.com.
On 16 March 2016 at 11:01, Eoin Gillen <eoing...@gmail.com> wrote:
On Tuesday, March 15, 2016 at 9:46:08 PM UTC, Brian Brazil wrote:On 15 March 2016 at 21:36, Eoin Gillen <eoing...@gmail.com> wrote:Hi all,
I'm new to Prometheus so apologies if this is covered somewhere. Basically, I have a success timestamp metric with one dimension (the name of the task), so if I look at my metric in the console it looks like:
success_timestamp
success_timestamp{task="a"} 1458075306
success_timestamp{task="b"} 1458075309
I'm trying to set up an alert that fires if any timestamp in the metric is older than a certain time, but I only want the alert to fire between certain hours of the day. I thought I could accomplish that with something like:
IF (time() - success_timestamp > 300) AND ((time() % 86400000) / 3600000 > 10) AND ((time() % 86400000) / 3600000 < 18)
but I get an error message "comparisons between scalars must use BOOL modifier".
I had a look at the documentation on operators and tried a few different permutations using the bool cast and "==", but I haven't managed to get it working yet.
Is there some way to accomplish this?You're looking for the vector() function. Also, time() returns a value in seconds.BrianHey, thanks for the response. Just had a go at it there and I think I've managed to get it working. The task names (i.e. the values of the "task" label) were something I couldn't know apriori in Prometheus, so I couldn't get AND between two vectors working (without getting rid of the task names), but I think I've got it working with:IF (time() - success_timestamp > 300) * ((time() % 86400 / 3600 > bool 9) == bool (time() % 86400 / 3600 < bool 18))which is currently returning me elements with some nonzero value if today's hour is between 9 and 18, and elements with 0 otherwise. Going to try it with an alert now...That'll just multiply it by 0 or 1 depending on if it's in the right timeframe.(time() - success_timestamp > 300) AND ON (dummy) (vector(time() % 86400 / 3600) > 9 < 18)should do the trick, but seems not to. This looks to be a bug in promql.Brian
Thanks,
Eoin.
--
You received this message because you are subscribed to the Google Groups "Prometheus Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to prometheus-developers+unsub...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "Prometheus Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to prometheus-developers+unsub...@googlegroups.com.
On 16 March 2016 at 11:01, Eoin Gillen <eoing...@gmail.com> wrote:
On Tuesday, March 15, 2016 at 9:46:08 PM UTC, Brian Brazil wrote:On 15 March 2016 at 21:36, Eoin Gillen <eoing...@gmail.com> wrote:Hi all,
I'm new to Prometheus so apologies if this is covered somewhere. Basically, I have a success timestamp metric with one dimension (the name of the task), so if I look at my metric in the console it looks like:
success_timestamp
success_timestamp{task="a"} 1458075306
success_timestamp{task="b"} 1458075309
I'm trying to set up an alert that fires if any timestamp in the metric is older than a certain time, but I only want the alert to fire between certain hours of the day. I thought I could accomplish that with something like:
IF (time() - success_timestamp > 300) AND ((time() % 86400000) / 3600000 > 10) AND ((time() % 86400000) / 3600000 < 18)
but I get an error message "comparisons between scalars must use BOOL modifier".
I had a look at the documentation on operators and tried a few different permutations using the bool cast and "==", but I haven't managed to get it working yet.
Is there some way to accomplish this?You're looking for the vector() function. Also, time() returns a value in seconds.BrianHey, thanks for the response. Just had a go at it there and I think I've managed to get it working. The task names (i.e. the values of the "task" label) were something I couldn't know apriori in Prometheus, so I couldn't get AND between two vectors working (without getting rid of the task names), but I think I've got it working with:IF (time() - success_timestamp > 300) * ((time() % 86400 / 3600 > bool 9) == bool (time() % 86400 / 3600 < bool 18))which is currently returning me elements with some nonzero value if today's hour is between 9 and 18, and elements with 0 otherwise. Going to try it with an alert now...That'll just multiply it by 0 or 1 depending on if it's in the right timeframe.(time() - success_timestamp > 300) AND ON (dummy) (vector(time() % 86400 / 3600) > 9 < 18)should do the trick, but seems not to. This looks to be a bug in promql.
Brian
Thanks,
Eoin.
--
You received this message because you are subscribed to the Google Groups "Prometheus Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to prometheus-devel...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--Brian Brazil--
You received this message because you are subscribed to the Google Groups "Prometheus Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to prometheus-devel...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--Brian Brazil