首页 > 解决方案 > 使用 create_alert_policy 方法的协议消息条件没有“conditionAbsent”字段错误

问题描述

我正在尝试在 python 中使用 Cloud Functions 创建警报策略。我有以下非常简单的警报策略:

alert_policy = {
    'combiner': 'OR',
    'conditions': [
        {
            'conditionAbsent': {
                'duration': '3900s',
                'filter': 'resource.type = "l7_lb_rule" AND metric.type = "logging.googleapis.com/user/name_stuff_here"'
            }
        }
    ]
}

运行该功能时,出现以下错误:Protocol message Condition has no "conditionAbsent" field error

我应该如何编写此警报政策?Displayname由于我已完全删除的字段,我也遇到了一些错误。是否有警报策略生成器或类似的东西可以验证警报 json?

标签: google-cloud-functionsgoogle-cloud-monitoring

解决方案


更仔细地查看我发现conditionAbsent应该传递的文档condition_absent


推荐阅读