Reporting Prometheus Data to AOM
If you have deployed the open-source Prometheus, go to 3.
This section describes how to configure the AccessCode in the Prometheus configuration file and make the configuration take effect.
Prerequisites
You have purchased an ECS. For details, see Elastic Cloud Server Getting Started.
Procedure
- Install and start Prometheus. For details, see Prometheus official documentation.
- Add an AccessCode.
- Log in to the AOM console. In the navigation pane, choose Configuration Management > Access Management.
- On the Authentication Management tab page, click Add AccessCode. Figure 1 Clicking Add AccessCode
- You can create up to two AccessCodes for each project.
- An AccessCode is an identity credential for calling APIs. Keep your AccessCode secure.
- In the dialog box that is displayed, click OK to add the AccessCode. Figure 2 Adding an AccessCode
- After the AccessCode is added, click
to view the AccessCode on the Authentication Management tab page. To delete the AccessCode, click Delete in the Operation column. Deleted AccessCodes cannot be recovered. Exercise caution when performing this operation. Figure 3 Viewing the AccessCode
- 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}.myhuaweicloud.com: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. For example, the region_name of AOM in CN North-Beijing1 is cn-north-1.
- 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.cn-north-1.myhuaweicloud.com:8443/v1/thisisyourprojectid/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.
Last Article: Overview
Next Article: Viewing Metric Data in AOM Using Grafana
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.