- alibaba cloud prometheus exporter 开发示例代码
- 可以基于该功能扩展其他功能
- prometheus writing_exporters
- aliyun-openapi-python-sdk
- 安装组件
pip install -r requirements.txt
- 添加 apikey
base.py
self.apikey = ''
self.secret = ''
- 启动服务
python -m flask run --host=192.168.68.244
- prometheus.yml 添加以下配置
- job_name: "test_exporter"
static_configs:
- targets: ["192.168.68.244:5000"]
- 查看 metrics
curl http://192.168.68.244/metrics
aliyun_balance 0.00
aliyun_expired_ecs_count 0
aliyun_expired_rds_count 0
代码很简洁,看一下就会二开了。