[英]Google Cloud Monitoring MQL: Time of Day
Is it possible to use MQL to include time of day in the alert condition?是否可以使用 MQL 在警报条件中包含一天中的时间?
Basic example in their documentation includes:他们文档中的基本示例包括:
fetch gce_instance :: compute.googleapis.com/instance/cpu/usage_time
| rate (5m)
| condition lt(val(), 0.5's{CPU}/min')
I essentially want to do this:我基本上想这样做:
fetch gce_instance :: compute.googleapis.com/instance/cpu/usage_time
| rate (5m)
| condition lt(val(), 0.5's{CPU}/min') and ( gt(end.time, '06:00:00') and lt(end.time, '18:00:00') )
Obviously that isn't valid, but I'm struggling to put the syntax together for time related functions from their documentation - does anyone know if this is possible?显然这是无效的,但我正在努力从他们的文档中将语法与时间相关的功能放在一起——有人知道这是否可能吗?
I also want this so I can silence alerts during scheduled nightly upgrades.我也想要这个,这样我就可以在预定的夜间升级期间静音警报。 I could not find a way to do it with MQL, but here are some workarounds that might help:我找不到使用 MQL 的方法,但这里有一些可能有帮助的解决方法:
I am trying the API approach.我正在尝试API方法。 The enable/disable calls can be made from my upgrade job, so I don't think I need the scheduler.启用/禁用调用可以从我的升级作业中进行,所以我认为我不需要调度程序。 Here are the steps I used to work this out:以下是我用来解决这个问题的步骤:
gcloud alpha monitoring policies list
gcloud alpha monitoring policies update projects/<project-name>/alertPolicies/<policy-id> --no-enabled # Do my upgrade... gcloud alpha monitoring policies update projects/<project-name>/alertPolicies/<policy-id> --enabled
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.