oracle-cloud-infrastructure - 推送自定义指标时 NotAuthorizedOrNotFound
问题描述
当我尝试使用 Oracle Cloud CLI 将自定义指标推送到 Oracle Cloud Monitoring 服务时,我收到以下错误:
ServiceError:
{
"code": "NotAuthorizedOrNotFound",
"message": "Authorization failed or requested resource not found.",
"opc-request-id": "request id",
"status": 404
}
使用管理员帐户和使用具有监视权限的实例主体时会发生这种情况。
这是我推送到监控服务的 JSON:
[
{
"namespace": "myFirstNamespace",
"compartmentId": "tenant id",
"resourceGroup": "myFirstResourceGroup",
"name": "successRate",
"dimensions": {
"resourceId": "ocid1.exampleresource.region1.phx.exampleuniqueID",
"appName": "myAppA"
},
"metadata": {
"unit": "percent",
"displayName": "MyAppA Success Rate"
},
"datapoints": [
{
"timestamp": "2021-06-01T22:19:20Z",
"value": 83.0
}
]
}
]
我正在使用的 CLI 命令是:
oci monitoring metric-data post --metric-data file://metric-data.json
解决方案
OCI CLI 命令应该是:
oci monitoring metric-data post --metric-data file://metric-data.json --endpoint https://telemetry-ingestion.{{ region }}.oraclecloud.com
替换{{ region }}
为您所在的地区。
--endpoint https://telemetry-ingestion.{{ region }}.oraclecloud.com
需要添加参数。
推荐阅读
- html - css绝对位置并继承显示break ul li换行
- javascript - JavaScript 如何使退格键在我的 keyCode 文本提示中起作用?
- c# - 怎么查号。电脑中的核心和总内存,并使用不同的技术进行处理?
- spring - 如何从 Spring 数据中的 postgres 表 ex 'pg_stat_statements' 中查询数据?
- python - 如何在python中搜索JS文件(多行)中的字符串?
- git - Jenkins 和 Docker git 签入文件和节点二进制文件
- asp.net - 为什么 'WindowsIdentity.GetCurrent().Name' 返回 IISAppPool\\[AppPoolName]
- json - 将 JSON Schema 属性的属性设置为 JSON Schema 的正确方法
- codeigniter - 当数据不再是codeigniter时如何停止无限滚动
- linux - 无法在 shell 脚本中对函数之外的值进行排列