{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"ec2:DescribeInstances",
"ec2:DescribeRegions"
],
"Resource": [
"*"
]
}
]
}
scrape_configs:
- job_name: aws-dplwer-pro
honor_timestamps: true
scrape_interval: 30s
scrape_timeout: 10s
metrics_path: /metrics
scheme: http
ec2_sd_configs:
- port: 9100
refresh_interval: 30s
region: ap-northeast-1 # EC2实例区域
access_key: 'access_key' # access_key
secret_key: 'secret_key' # secret_key
relabel_configs:
- source_labels: [__meta_ec2_tag_Name] # 把 __meta_ec2_tag_Name 值赋予 label
separator: ':'
regex: '(.*)'
replacement: '${1}'
target_label: label
- source_labels: [__meta_ec2_public_ip] # 把 __meta_ec2_public_ip 公网IP赋值给 __address__, 默认展示内网
regex: '(.*)'
replacement: '${1}:9100'
target_label: __address__
action: replace
- source_labels: [__meta_ec2_public_ip] # 把 __meta_ec2_public_ip 公网IP赋值给 intance
regex: '(.*)'
replacement: '${1}:9100'
target_label: instance
action: replace