Package: aliyun-exporter
Prometheus Exporter for Alibaba Cloud中文FeaturesScreenshotsQuick StartInstallationUsageDocker ImageConfigurationMetrics MetaScale and HA SetupContributeThis Prometheus exporter collects metrics from theCloudMonitor APIof Alibaba Cloud. It can help you:integrate CloudMonitor to your Monitoring System.leverage the power of PromQL, Alertmanager and Grafana(seeScreenshots).analyze metrics however you want.save money. Api invocation is far cheaper than other services provided by CloudMonitor.This project also provides an out-of-box solution for full-stack monitoring of Alibaba Cloud, including dashboards, alerting and diagnosing.Screenshotsmore screenshots hereQuick StartA docker-compose stack is provided to launch the entire monitoring stack with Aliyun-Exporter, Prometheus, Grafana and Alertmanager.Pre-requisites: docker 1.17+gitclonegit@github.com:aylei/aliyun-exporter.gitcddocker-composeALIYUN_ACCESS_ID=YOUR_ACCESS_IDALIYUN_ACCESS_SECRET=YOUR_ACCESS_KEYdocker-composeupInvestigate dashboards inlocalhost:3000(the default credential for Grafana is admin:admin).For more details, seeDocker Compose.InstallationPython 3.5+ is required.pip3installaliyun-exporterUsageConfig your credential and interested metrics:credential:access_key_id:<YOUR_ACCESS_KEY_ID>access_key_secret:<YOUR_ACCESS_KEY_SECRET>region_id:<REGION_ID>metrics:acs_cdn:-name:QPSacs_mongodb:-name:CPUUtilizationperiod:300Run the exporter:>aliyun-exporter-p9525-caliyun-exporter.ymlThe default port is 9525, default config file location is./aliyun-exporter.yml.Visit metrics inlocalhost:9525/metricsDocker ImageInstalldockerpullaylei/aliyun-exporter:0.3.0To run the container, external configuration file is required:dockerrun-p9525:9525-v$(pwd)/aliyun-exporter.yml:$(pwd)/aliyun-exporter.ymlaylei/aliyun-exporter:0.3.0-c$(pwd)/aliyun-exporter.ymlConfigurationrate_limit:5# request rate limit per second. default: 10credential:access_key_id:<YOUR_ACCESS_KEY_ID># requiredaccess_key_secret:<YOUR_ACCESS_KEY_SECRET># requiredregion_id:<REGION_ID># default: 'cn-hangzhou'metrics:# required, metrics specificationsacs_cdn:# required, Project Name of CloudMonitor-name:QPS# required, Metric Name of CloudMonitor, belongs to a certain Projectrename:qps# rename the related prometheus metric. default: same as the 'name'period:60# query period. default: 60measure:Average# measure field in the response. default: Averageinfo_metrics:-ecs-rds-redisNotes:Find your target metrics usingMetrics MetaCloudMonitor API has an rate limit, tuning therate_limitconfiguration if the requests are rejected.CloudMonitor API also has an monthly quota for invocations (AFAIK, 5,000,000 invocations / month for free). Plan your usage in advance.Given that you have 50 metrics to scrape with 60s scrape interval, about 2,160,000 requests will be sent by the exporter for 30 days.Special ProjectSome metrics are not included in the Cloud Monitor API. For these metrics, we keep the configuration abstraction consistent by defining special projects.Special Projects:rds_performance: RDS performance metrics, available metric names:Performance parameter tableAn example configuration file of special project is provided asspecial-projects.ymlNote: special projects invokes different API with ordinary metrics, so it will not consume your Cloud Monitor API invocation quota. But the API of special projects could be slow, so it is recommended to separate special projects into a standalone exporter instance.Metrics Metaaliyun-exportershipped with a simple site hosting the metrics meta from the CloudMonitor API. You can visit the metric meta inlocalhost:9525after launching the exporter.host:portwill host all the available monitor projectshost:port/projects/{project}will host the metrics meta of a certain projecthost:port/yaml/{project}will host a config YAML of the project's metricsyou can easily navigate in this pages by hyperlink.Docker ComposeFrom0.3.0, we provide a docker-compose stack to help users building monitoring stack from scratch. The stack contains:aliyun-exporter (this project): Retrieving metrics (and instance information) from Alibaba Cloud.Prometheus: Metric storage and alerting calculation.Alertmanager: Alert routing and notifying.Grafana: Dashboards.prometheus-webhook-dingtalk: DingTalk (a.k.a. DingDing) notification integrating.Here's a detailed launch guide:# config prometheus external hostexportPROMETHEUS_HOST=YOUR_PUBLIC_IP_OR_HOSTNAME# config dingtalk robot tokenexportDINGTALK_TOKEN=YOUR_DINGTALK_ROBOT_TOEKN# config aliyun-exporter credentialexportALIYUN_REGION=YOUR_REGIONexportALIYUN_ACCESS_ID=YOUR_IDexportALIYUN_ACCESS_SECRET=YOUR_SECRET
docker-composeup-dAfter launching, you can access:grafana:http://localhost:3000prometheus:http://localhost:9090alertmanager:http://localhost:9093You may customize the configuration of this components by editing the configuration files in./docker-compose/{component}TelemetryRequest success summary and failure summary are exposed incloudmonitor_request_latency_secondsandcloudmonitor_failed_request_latency_seconds.EachProject-Metricpair will have a corresponding metric namedaliyun_{project}_{metric}_up, which indicates whether this metric are successfully scraped.Scale and HA SetupThe CloudMonitor API could be slow if you have large amount of resources. You can separate metrics over multiple exporter instances to scale.For HA setup, simply duplicate your deployments: 2 * prometheus, and 2 * exporter for each prometheus.HA Setup will double your requests, which may run out your quota.ContributeFeel free to open issues and pull requests, any feedback will be highly appreciated!Please check thehelp wantedlabel to find issues that are good for getting started.Besides, contributing to newalert rules, newdashboardsis also welcomed!