将 MQL 与 Google 云监控 (Stackdriver) 警报策略结合使用
Using MQL with Google Cloud Monitoring (Stackdriver) Alerting Policy
我已经使用 MQL 在 Google Cloud Monitoring 中创建了两个指标比率的图表。
我想创建一个基于 MQL 的警报策略,但 Cloud Console 中的 UI 没有查询编辑器,就像它在 Metrics Explorer 中一样。
在使用 Google 云监控 (Stackdriver) 定义警报策略条件时,是否可以使用 MQL?
引用 c69:
There is a Feature Request for MQL-based alerts in issuetracker.google.com/157770220
截至本文发布之日 post,不支持基于 MQL 的警报。
我不确定这是否有帮助,但您可以创建自定义服务,然后使用两个指标的比率为其定义 SLO。然后,您可以创建错误预算消耗警报。
"requestBased": {
"goodTotalRatio": {
"totalServiceFilter": "metric.type=\"appengine.googleapis.com/http/server/response_count\" resource.type=\"gae_app\" resource.label.\"module_id\"=\"default\"",
"goodServiceFilter": "metric.type=\"appengine.googleapis.com/http/server/response_count\" resource.type=\"gae_app\" resource.label.\"module_id\"=\"default\" metric.label.\"response_code\"=\"200\"",
}
}
https://medium.com/google-cloud/slos-with-stackdriver-service-monitoring-62f193147b3f
现在支持使用 MQL 创建警报 :) UI 和 API。
要创建有效的警报 - 管道 condition
or absent_for
keyword* at the end of your query. See https://cloud.google.com/monitoring/mql/alerts 以获取文档。
对于比率警报,请遵循常规比率查询的提示
https://cloud.google.com/monitoring/mql/examples#qlx-ratio-ratio
与仪表板相比有两个主要区别 - 所有 MQL 警报都必须保存在 strict-form 中,并且大多数条件都需要指定 units-of-measure。参见 https://cloud.google.com/monitoring/mql/qn-from-api#ql-alert-condition
) * - 它们在技术上是“table 运算符”,而不是“关键字”。
我已经使用 MQL 在 Google Cloud Monitoring 中创建了两个指标比率的图表。
我想创建一个基于 MQL 的警报策略,但 Cloud Console 中的 UI 没有查询编辑器,就像它在 Metrics Explorer 中一样。
在使用 Google 云监控 (Stackdriver) 定义警报策略条件时,是否可以使用 MQL?
引用 c69:
There is a Feature Request for MQL-based alerts in issuetracker.google.com/157770220
截至本文发布之日 post,不支持基于 MQL 的警报。
我不确定这是否有帮助,但您可以创建自定义服务,然后使用两个指标的比率为其定义 SLO。然后,您可以创建错误预算消耗警报。
"requestBased": {
"goodTotalRatio": {
"totalServiceFilter": "metric.type=\"appengine.googleapis.com/http/server/response_count\" resource.type=\"gae_app\" resource.label.\"module_id\"=\"default\"",
"goodServiceFilter": "metric.type=\"appengine.googleapis.com/http/server/response_count\" resource.type=\"gae_app\" resource.label.\"module_id\"=\"default\" metric.label.\"response_code\"=\"200\"",
}
}
https://medium.com/google-cloud/slos-with-stackdriver-service-monitoring-62f193147b3f
现在支持使用 MQL 创建警报 :) UI 和 API。
要创建有效的警报 - 管道
condition
orabsent_for
keyword* at the end of your query. See https://cloud.google.com/monitoring/mql/alerts 以获取文档。对于比率警报,请遵循常规比率查询的提示 https://cloud.google.com/monitoring/mql/examples#qlx-ratio-ratio
与仪表板相比有两个主要区别 - 所有 MQL 警报都必须保存在 strict-form 中,并且大多数条件都需要指定 units-of-measure。参见 https://cloud.google.com/monitoring/mql/qn-from-api#ql-alert-condition
) * - 它们在技术上是“table 运算符”,而不是“关键字”。