A prometheus exporter for Aliyun RDS Instance.
Just a demo!
Do not use for production!
Only RDS for MySQL has tested!
export IMAGE_NAME=my_aliyun_rds_exporter
export TAG=v0.01
docker build -t ${IMAGE_NAME}:${TAG} .
- copy configuration file
cp config/config.yaml.example config/config.yaml
-
Config your credential and interested metrics
Visit here for more metrics informations!
for Chinese Version visit here!
credential:
access_key_id: <YOUR_ACCESS_KEY_ID>
access_key_secret: <YOUR_ACCESS_KEY_SECRET>
region_id: <REGION_ID>
performance_list:
MySQL:
# Average inbound traffic to a MySQL instance per second and average outbound traffic from a MySQL instance per second. Unit: KB.
- 'MySQL_NetworkTraffic'
# Average number of SQL statement execution times per second and average number of transactions per second
- 'MySQL_QPSTPS'
docker run -d \
--restart=on-failure:5 \
-p 5234:5234 \
-v config/config.yaml:/opt/aliyun-rds-exporter/config/config.yaml \
${IMAGE_NAME}:${TAG}
curl http://localhost:5234/metrics
...
# HELP aliyun_api_request_latency_seconds CloudMonitor request latency
# TYPE aliyun_api_request_latency_seconds summary
aliyun_api_request_latency_seconds_count{api="DescribeDBInstancesRequest"} 1.0
aliyun_api_request_latency_seconds_sum{api="DescribeDBInstancesRequest"} 0.35166287422180176
aliyun_api_request_latency_seconds_count{api="DescribeDBInstancePerformanceRequest"} 17.0
aliyun_api_request_latency_seconds_sum{api="DescribeDBInstancePerformanceRequest"} 32.744452476501465
# TYPE aliyun_api_request_latency_seconds_created gauge
aliyun_api_request_latency_seconds_created{api="DescribeDBInstancesRequest"} 1.5696814557247128e+09
aliyun_api_request_latency_seconds_created{api="DescribeDBInstancePerformanceRequest"} 1.5696814559071503e+09
....
# HELP aliyun_rds_performance_MySQL_NetworkTraffic_recv_k
# TYPE aliyun_rds_performance_MySQL_NetworkTraffic_recv_k gauge
aliyun_rds_performance_MySQL_NetworkTraffic_recv_k{Unit="KB",instanceId="rm-xxxxxxxxxxxxxxxxx"} 2.6
# HELP aliyun_rds_performance_MySQL_NetworkTraffic_sent_k
# TYPE aliyun_rds_performance_MySQL_NetworkTraffic_sent_k gauge
aliyun_rds_performance_MySQL_NetworkTraffic_sent_k{Unit="KB",instanceId="rm-xxxxxxxxxxxxxxxxx"} 9.9
# HELP aliyun_rds_performance_MySQL_QPSTPS_QPS
# TYPE aliyun_rds_performance_MySQL_QPSTPS_QPS gauge
aliyun_rds_performance_MySQL_QPSTPS_QPS{Unit="int",instanceId="rm-xxxxxxxxxxxxxxxxx"} 10.25
# HELP aliyun_rds_performance_MySQL_QPSTPS_TPS
# TYPE aliyun_rds_performance_MySQL_QPSTPS_TPS gauge
aliyun_rds_performance_MySQL_QPSTPS_TPS{Unit="int",instanceId="rm-xxxxxxxxxxxxxxxxx"} 0.0
...
# HELP aliyun_rds_resource_usage_LogSize
# TYPE aliyun_rds_resource_usage_LogSize gauge
aliyun_rds_resource_usage_LogSize{Engine="MySQL",instanceId="rm-xxxxxxxxxxxxxxxxx"} 2.097152e+06
# HELP aliyun_rds_resource_usage_DataSize
# TYPE aliyun_rds_resource_usage_DataSize gauge
aliyun_rds_resource_usage_DataSize{Engine="MySQL",instanceId="rm-xxxxxxxxxxxxxxxxx"} 4.395630592e+09
# HELP aliyun_rds_resource_usage_DiskUsed
# TYPE aliyun_rds_resource_usage_DiskUsed gauge
aliyun_rds_resource_usage_DiskUsed{Engine="MySQL",instanceId="rm-xxxxxxxxxxxxxxxxx"} 4.397727744e+09
...
The metrics value will always be a float number
1.0
.Just for label RDS instance status!
# HELP aliyun_rds_status
# TYPE aliyun_rds_status gauge
aliyun_rds_status{CreateTime="2019-01-01T08:00:00Z",DBInstanceId="rm-xxxxxxxxxxxxxxxxx",DBInstanceStatus="Running",DBInstanceType="Primary",Engine="MySQL",EngineVersion="5.7",ExpireTime="2020-01-01T16:00:00Z",LockMode="Unlock",PayType="Prepaid",RegionId="cn-shenzhen"} 1.0
- edit
kubernetes/aliyun-rds-exporter-configmap.yaml
- Config your credential and interested metrics
# aliyun key_id and key_secret
credential:
access_key_id: "<Aliyun Access Key ID>"
access_key_secret: "<Aliyun Access Key Secret>"
region_id: "<Aliyun Region>"
- edit
kubernetes/aliyun-rds-exporter-deployment.yaml
- config your image
...
spec:
...
template:
...
spec:
...
containers:
...
- name: aliyun-rds-exporter
image: ${IMAGE_NAME}:${TAG}
imagePullPolicy: IfNotPresent
...
kubectl apply -f kubernetes/
JSON panel code locate in grafana/grafana-dashboard.json