categraf/inputs/aliyun/README.md

65 lines
2.9 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

1. 需要提供
- AccessKey
- AcessSecret
- Endpoint
- RegionID
其中Endpoint 与 RegionID 见 [接入地址](https://help.aliyun.com/document_detail/28616.html?spm=a2c4g.11186623.0.0.30c85d7aFf1Qzc#section-72p-xhs-6qt)
请求限制:
- Http Request Header+Query ≤ 128KB
- Http Request Body ≤ 512KB
- Http Response ≤ 2048KB
2. 凭证相关
获取凭证 https://usercenter.console.aliyun.com/#/manage/ak
RAM 用户授权。RAM 用户调用云监控 API 前,需要所属的阿里云账号将权限策略授予对应的 RAM 用户,参见 [RAM 用户权限](https://help.aliyun.com/document_detail/43170.html?spm=a2c4g.11186623.0.0.30c841feqsoAAn)。
可以在 [授权页面](https://ram.console.aliyun.com/permissions) 新增授权,选择对应的用户,授予云监控只读权限 `AliyunCloudMonitorReadOnlyAccess`, 并为授予权限的用户创建accessKey 即可。
3. 指标查询
[阿里云监控指标](https://help.aliyun.com/document_detail/163515.htm?spm=a2c4g.11186623.0.0.3ad53c60q3sQz1)
4. 配置
```toml
# # categraf采集周期阿里云指标的粒度一般是60秒建议设置不要少于60秒
# interval = 60
[[instances]]
## 阿里云资源所处的region
## endpoint region 参考 https://help.aliyun.com/document_detail/28616.html#section-72p-xhs-6qt
region="cn-beijing"
endpoint="metrics.cn-hangzhou.aliyuncs.com"
## 填入你的acces_key_id
access_key_id=""
## 填入你的access_key_secret
access_key_secret=""
## 可能无法获取当前最新指标,这个指标是指监控指标的截止时间距离现在多久
delay="50m"
## 阿里云指标的最小粒度60s 是推荐值,再小了部分指标不支持
period="60s"
## 指标所属的namespace ,为空,则表示所有空间指标都要采集
## namespace 参考 https://help.aliyun.com/document_detail/163515.htm?spm=a2c4g.11186623.0.0.44d65c58mhgNw3
namespaces=["acs_ecs_dashboard"]
## 过滤某个namespace下的一个或多个指标
## metric name 参考 https://help.aliyun.com/document_detail/163515.htm?spm=a2c4g.11186623.0.0.401d15c73Z0dZh
## 参考页面中的Metric Id 填入下面的metricName ,页面中包含中文的Metric Name对应接口中的Description
[[instances.metric_filters]]
namespace=""
metric_names=["cpu_cores","vm.TcpCount", "cpu_idle"]
# 阿里云查询指标接口的QPS是50 这里默认设置为一半
ratelimit=25
# 查询指定namesapce指标后, namespace/metric_name等meta信息会缓存起来catch_ttl 是指标的缓存时间
catch_ttl="1h"
# 每次请求阿里云endpoint的超时时间
timeout="5s"
```
5. Dashboard
- dashboard_for_redis_kvstore_standard适用于 [Redis/Tair 内存型(标准版)](https://cms.console.aliyun.com/metric-meta/acs_kvstore/kvstore_standard?spm=a2c4g.11186623.0.0.5ed876abviVWI8)
- dashboard_for_polardb_mysql适用于 [云数据库POLARDB-MySQL(新版)](https://cms.console.aliyun.com/metric-meta/acs_polardb/polardb_mysql_cluster?spm=a2c4g.11186623.0.0.1f1d76abbgD9eJ)