我正在尝试使用 gcloud 命令行客户端在 Google Cloud Platform 中创建正常运行时间检查。这是一个示例:
gcloud monitoring uptime create 'example uptime check' --resource-labels=host=...,project_id=... --resource-type=uptime-url --protocol=https --port=443 "--path=..." --request-method=get --validate-ssl=true --status-codes=200 --matcher-type=contains-string "--matcher-content=..." --period=5 --timeout=30 --user-labels=instance-group=production,instance-type=authentication,monitoring-type=uptime
这通常有效,即创建了正常运行时间检查并且没有报告任何错误。但是,我的用户标签被默默忽略了。
我相信我正确地遵循了文档(https://cloud.google.com/sdk/gcloud/reference/monitoring/uptime/create):
--user-labels=[KEY=VALUE,…]
List of label KEY=VALUE pairs to add.
Keys must start with a lowercase character and contain only hyphens (-),
underscores (_), lowercase characters, and numbers. Values must contain only
hyphens (-), underscores (_), lowercase characters, and numbers.
我已成功向计算实例、磁盘等添加了非常相似的用户标签。
我也尝试通过 向现有的正常运行时间检查中添加用户标签gcloud monitoring uptime update
,但这也没有用。
更新:我已按照 Daniel t. 的建议创建了一个错误报告:https://issuetracker.google.com/issues/393989630