夜莺-Nightingale
夜莺V6
项目介绍 架构介绍
快速开始
黄埔营
安装部署
升级
采集器
使用手册
API
数据库表结构
FAQ
夜莺专业版
开源生态
Prometheus
版权声明
第1章:天降奇兵
第2章:探索PromQL
第3章:Prometheus告警处理
第4章:Exporter详解
第5章:数据与可视化
第6章:集群与高可用
第7章:Prometheus服务发现
第8章:监控Kubernetes
第9章:Prometheus Operator
参考资料

aliyun指标采集插件

请使用 v0.2.33 及以上版本的categraf

  1. 访问阿里云需要提供以下凭证信息
  • AccessKey
  • AcessSecret
  • Endpoint
  • RegionID

其中,Endpoint 与 RegionID 见 接入地址

请求限制:

  • Http Request Header+Query ≤ 128KB
  • Http Request Body ≤ 512KB
  • Http Response ≤ 2048KB
  1. 凭证配置
  • RAM 用户授权。 RAM 用户调用云监控 API 前,需要所属的阿里云账号将权限策略授予对应的 RAM 用户,参见 RAM 用户权限。 可以在 授权页面 新增授权,选择对应的用户,授予云监控只读权限 AliyunCloudMonitorReadOnlyAccess, 并为授予权限的用户创建AccessKey即可。
  • 为用户创建AccessKey
  • RAM用户获取AccessKey信息 https://usercenter.console.aliyun.com/#/manage/ak
  1. 指标查询 可以通过 阿里云监控指标查询指标名称、指标所属的namespace等

  2. region/endpoint查询 可以通过区域/接入信息查询region/endpoint

  3. 配置 配置文件位于conf/input.aliyun/aliyun.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="2m"
## 阿里云指标的最小粒度,60s 是推荐值,再小了部分指标不支持
period="60s"

# 阿里云查询指标接口的QPS是50, 这里默认设置为一半
ratelimit=25
# 查询指定namesapce指标后, namespace/metric_name等meta信息会缓存起来,catch_ttl 是指标的缓存时间
catch_ttl="1h"
# 每次请求阿里云endpoint的超时时间
timeout="5s"

## 如果是采集ecs指标,会自动附件ecs的hostname标签
## 如果想指定hostname标签的key,那可以通过以下配置实现
## 默认是agent_hostname 
# ecs_host_tag="agent_hostname"

## 指标所属的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"]

过滤示例: 只想要输出acs_vpc_eip acs_ecs_dashboard 两个namespace下以下指标

VPC_PublicIP_InternetInRate
VPC_PublicIP_InternetOutRate
VPC_PublicIP_InternetOutRate_Percent

CPUUtilization

可以用配置

[[instances]]
region="cn-hangzhou"
endpoint="metrics.cn-hangzhou.aliyuncs.com"
access_key_id="xxx"
access_key_secret="xxxx"
delay="5m"
period="60s"
namespaces=["acs_vpc_eip"]
ratelimit=25
batch_size=500
timeout="5s"
[[instances.metric_filters]]
namespaces=["acs_vpc_eip"]
metric_names=["VPC_PublicIP_InternetInRate","VPC_PublicIP_InternetOutRate","VPC_PublicIP_InternetOutRate_Percent"]

[[instances]]
region="cn-hangzhou"
endpoint="metrics.cn-hangzhou.aliyuncs.com"
access_key_id="xxx"
access_key_secret="xxxx"
delay="5m"
period="60s"
namespaces=["acs_ecs_dashboard"]
ratelimit=25
batch_size=500
timeout="5s"
[[instances.metric_filters]]
namespaces=["acs_ecs_dashboard"]
metric_names=["CPUUtilization"]

也可以用配置

[[instances]]
region="cn-hangzhou"
endpoint="metrics.cn-hangzhou.aliyuncs.com"
access_key_id="xxxx"
access_key_secret="xxx"
delay="5m"
period="60s"
namespaces=["acs_vpc_eip", "acs_ecs_dashboard"]
ratelimit=25
batch_size=500
timeout="5s"
[[instances.metric_filters]]
#namespaces=["acs_ecs_dashboard","acs_vpc_eip"]
metric_names=["VPC_PublicIP_InternetInRate","VPC_PublicIP_InternetOutRate","VPC_PublicIP_InternetOutRate_Percent","CPUUtilization"]

当然一个instance ,拆成两个instances.metric_filter 也可以。

  1. Dashboard
开源版
Flashcat
Flashduty