Reporting Prometheus Data to AOM
If you have deployed the open-source Prometheus, go to 3.
This section describes how to configure the access code in the Prometheus configuration file and make the configuration take effect.
Prerequisites
You have purchased an ECS.
Procedure
- Install and start Prometheus. For details, see Prometheus official documentation.
- Add an access code.
- Log in to the AOM console. In the navigation pane, choose Configuration Management > Access Management.
- Click Add AccessCode.
Figure 1 Adding an access code
- You can create up to two access codes for each project.
- An access code is an identity credential for calling APIs. Keep your access code secure.
- In the dialog box that is displayed, click OK to add the access code.
- After the access code is added, click to view it. To delete the access code, click Delete in the Operation column. Deleted access codes cannot be recovered. Exercise caution when performing this operation.
Figure 2 Viewing the access code
- Log in to the ECS and locate the Prometheus configuration file.
Run the following command:
./prometheus --config.file=prometheus.yml
Add the following configuration to the end of the prometheus.yml file:
-
remote_write: - url: 'https://aom-internal-access.{region_name}.{Site domain name suffix}:8443/v1/{project_id}/push' tls_config: insecure_skip_verify: true bearer_token: '{access_code}'
Parameter description:- region_name: domain name or IP address of the server bearing the REST service. region_name varies according to services in different regions. It can be obtained from Regions and Endpoints.
- Site domain name suffix: suffix of a site domain name, for example, myhuaweicloud.com.
- project_id: project ID, which can be viewed in the project list on the My Credentials page.
The following shows an example. You need to configure the italic part.
# my global config global: scrape_interval: 15s # Set the scrape interval to every 15 seconds. Default is every 1 minute. evaluation_interval: 15s # Evaluate rules every 15 seconds. The default is every 1 minute. # scrape_timeout is set to the global default (10s). # Alertmanager configuration alerting: alertmanagers: - static_configs: - targets: # - alertmanager:9093 # Load rules once and periodically evaluate them according to the global 'evaluation_interval'. rule_files: # - "first_rules.yml" # - "second_rules.yml" # A scrape configuration containing exactly one endpoint to scrape: # Here it's Prometheus itself. scrape_configs: # The job name is added as a label `job=<job_name>` to any timeseries scraped from this config. - job_name: 'prometheus' # metrics_path defaults to '/metrics' # scheme defaults to 'http'. static_configs: - targets: ['localhost:9090'] remote_write: - url: 'https://aom-internal-access.{region_name}.{Site domain name suffix}:8443/v1/{project_id}/push' tls_config: insecure_skip_verify: true bearer_token: 'fVkvjOqghcIARvZZEEWhwSwxesmKz5Efsx9vxZSNGCXEffcjPxxxxxx'
-
- Check the private domain name.
In the preceding example, data is reported through the intranet. Therefore, ensure that the host where Prometheus is located can resolve the private domain name. For details, see How Do I Switch to a Private DNS Server?
- Restart Prometheus.
- Check whether data can be reported to AOM by referring to Viewing Metric Data in AOM Using Grafana.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot