Prometheus cloudeye exporter for Huaweicloud.
Note: The plug-in is applicable only to the Huaweicloud regions.
$ git clone https://github.com/huaweicloud/cloudeye-exporter
$ wget https://dl.google.com/go/go1.17.6.linux-amd64.tar.gz
$ sudo tar -C /usr/local -xzf go1.17.6.linux-amd64.tar.gz
$ export PATH=$PATH:/usr/local/go/bin # You should put in your .profile or .bashrc
$ go version # to verify it runs and version #
$ go get github.com/huaweicloud/cloudeye-exporter
$ cd ~/go/src/github.com/huaweicloud/cloudeye-exporter
$ go build
./cloudeye-exporter -config=clouds.yml
The default port is 8087, default config file location is ./clouds.yml.
Visit metrics in http://localhost:8087/metrics?services=SYS.VPC,SYS.ELB
To avoid ak&sk leaks, you can input your ak&sk through the command line with '-s' param like this
./cloudeye-exporter -s true
To startup the cloudeye-exporter using script, here is an example
#!/bin/bash
# Don't write plain text ak&sk in script.
# Encrypt the ak&sk instead and use your own decrypt function to assign the return value.
huaweiCloud_AK=your_decrypt_function("your encrypted ak")
huaweiCloud_SK=your_decrypt_function("your encrypted sk")
$(./cloudeye-exporter -s true<<EOF
$huaweiCloud_AK $huaweiCloud_SK
EOF)
Usage of ./cloudeye-exporter:
-config string
Path to the cloud configuration file (default "./clouds.yml")
The "URL" value can be get from Identity and Access Management (IAM) endpoint list (Internal) and Identity and Access Management (IAM) endpoint list (China).
global:
prefix: "huaweicloud"
port: ":8087"
metric_path: "/metrics"
scrape_batch_size: 300
resource_sync_interval_minutes: 20 # Update frequency of resource information: resource information is updated every 180 minutes by default; If this parameter is set to a value less than 10 minutes, the information is updated every 10 minutes.
ep_ids: "xxx1,xxx2" # This is optional. Filter resources by enterpries project, cloudeye-exporter will get all resources when this is empty, if you need multiple enterprise project, use comma split them.
auth:
auth_url: "https://iam.{region_id}.myhuaweicloud.com/v3"
project_name: "{project_name}"
access_key: "{access_key}"
secret_key: "{secret_key}"
region: "{region}"
European site users should configure the domain names of the rms and eps services as follows.
"rms":
"https://rms.myhuaweicloud.eu"
"eps":
"https://eps.eu-west-101.myhuaweicloud.eu"
Other site users should not configure anything in this file.
The huaweicloud exporter needs to be passed the address as a parameter, this can be done with relabelling.
Example config:
global:
scrape_interval: 1m # Set the scrape interval to every 1 minute seconds. Default is every 1 minute.
scrape_timeout: 1m
scrape_configs:
- job_name: 'huaweicloud'
static_configs:
- targets: ['10.0.0.10:8087']
params:
services: ['SYS.VPC,SYS.ELB']