Skip to content

Configuration Manual for the "Huawei Cloud - Cloud Billing" Collector

Before reading this article, please first read:

Before using this collector, you must install the 'Integration Core Package' and its associated third-party dependency packages

To ensure data integrity, the billing date collected is current date - 2 days. It is recommended that this script runs once daily

The program has built-in duplicate collection prevention. When run multiple times within the same day, except for the first run on that day, subsequent executions will automatically skip

1. Configuration Structure

No configuration is required for this collector.

2. Data Reporting Format

After data synchronizes normally, it can be viewed in the 'Metrics' section of TrueWatch.

Example of reported data:

JSON
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
{
  "measurement": "cloud_bill",
  "tags": {
    "product_code": "ec2",
    "product_name": "Elastic Cloud Server",
    "account_id"  : "1e1fed98168xxxxxxxxxxxxxe285140c83",
    "account_name": "1e1fed98168xxxxxxxxxxxxxe285140c83"
  },
  "fields": {
    "amount"        : 0.39,
    "offical_amount": 0.39190277
  },
  "timestamp": 1657065600
}

Fields in tags and fields may change with subsequent updates

3. Statistical Explanation

Reported Field API Return Field Meaning of API Field Description
Product Code product_code cloud_service_type Encoding for cloud service type Extracted from cloud_service_type
For example: "hws.service.type.vpc" —> "vpc"
Product Name product_name cloud_service_type_name Name of cloud service type
Official Price official_amount official_amount The official price on Huawei Cloud's website without applying business discounts or promotional discounts. Cumulative total of official_amount
Actual Payment Amount amount amount The amount a user needs to pay after enjoying discounts, including cash vouchers, prepaid cards, and coupons, precise to two decimal places. Cumulative total of amount
Timestamp timestamp bill_date Date of resource consumption records. Format: YYYY-MM-DD. Truncated according to China Standard Time (CST).
Customer Account ID Consuming Resources account_id customer_id ID of the customer account consuming resources. If querying as a regular customer or enterprise sub-account, only your own consumption records can be queried, and this field shows your own customer ID. If querying as an enterprise main account, both your own and enterprise sub-accounts' consumption records can be queried, and this field represents the actual customer ID consuming the resources. It could be the enterprise main account ID if the consumption belongs to the main account, or the sub-account ID if it belongs to a sub-account. customer_id is the account ID; view account name, account ID, username, user ID, project name, and project ID in the "My Credentials" interface under the API credentials tab. Refer to the appendix document for more details.
Customer Account Name Consuming Resources account_name customer_id Refer to the customer account ID consuming resources

Data statistical granularity is Cloud Service Type: cloud_service_type; bill amounts for similar types are aggregated, specific comparisons can be seen below between Huawei Cloud API Raw Data and Script Aggregated Data

Huawei Cloud API refers to the 'Query Resource Consumption Records' interface address for Huawei Cloud billing management. See the appendix.

Huawei Cloud API Interface Raw Data

JSON
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
[
  {
    "bill_date"              : "2022-xx-xx",
    "bill_type"              : 5,
    "region"                 : "cn-north-4",
    "region_name"            : "North China - Beijing Four",
    "cloud_service_type"     : "hws.service.type.vpc",
    "cloud_service_type_name": "Virtual Private Cloud",
    "official_amount"        : 0.02,
    "amount"                 : 0.02,
    "customer_id"            : "1e1fed98168d4cxxxxxx0e285140c83",
    "{other fields}"             : "{omitted}"
  },
  {
    "bill_date"              : "2022-xx-xx",
    "bill_type"              : 5,
    "region"                 : "cn-north-4",
    "region_name"            : "North China - Beijing Four",
    "cloud_service_type"     : "hws.service.type.vpc",
    "cloud_service_type_name": "Virtual Private Cloud",
    "official_amount"        : 0.02,
    "amount"                 : 0.02,
    "customer_id"            : "1e1fed98168d4cxxxxxx0e285140c83",
    "{other fields}"             : "{omitted}"
  },
  {
    "bill_date"              : "2022-xx-xx",
    "bill_type"              : 5,
    "region"                 : "cn-north-4",
    "region_name"            : "North China - Beijing Four",
    "cloud_service_type"     : "hws.service.type.rds",
    "cloud_service_type_name": "Cloud Database",
    "official_amount"        : 0.18728888,
    "amount"                 : 0.18,
    "customer_id"            : "1e1fed98168d4cxxxxxx0e285140c83",
    "{other fields}"             : "{omitted}"
  }
]

Script Aggregated Data

JSON
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
[
  {
    "measurement": "cloud_bill",
    "tags": {
      "product_code": "rds",
      "product_name": "Cloud Database",
      "account_id"  : "1e1fed98168xxxxxxxxxxxxxe285140c83",
      "account_name": "1e1fed98168xxxxxxxxxxxxxe285140c83"
    },
    "fields": {
      "amount"        : 0.18,
      "offical_amount": 0.18728888
    },
    "timestamp": 1657507021
  },
  {
    "measurement": "cloud_bill",
    "tags": {
      "product_code": "vpc",
      "product_name": "Virtual Private Cloud",
      "account_id"  : "1e1fed98168xxxxxxxxxxxxxe285140c83",
      "account_name": "1e1fed98168xxxxxxxxxxxxxe285140c83"
    },
    "fields": {
      "amount"        : 0.04,
      "offical_amount": 0.04
    },
    "timestamp": 1657507021
  }
]

X. Appendix

Huawei Cloud - Billing Management « Query Resource Consumption Records »

Refer to the official Huawei Cloud documentation: