Skip to content

Configuration Manual for Collector "Huawei Cloud - Cloud Billing (Instance Level)"

Before reading this article, please read the following first:

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

To ensure data integrity, the billing date collected is the day before the current date. For example: 2022-07-03 00:00:00 ~ 23:59:59 during which all data collected will be from 2022-07-02

Current billing data collection only statistics for some products. Product abbreviation list: dcs, dds, ecs, elb, obs, rds, vpc

1. Configuration Structure

This collector does not require configuration.

2. Data Reporting Format

After normal data synchronization, you can view the data in the "Cloud Bill Explorer" of Guance and TrueWatch.

An example of reported data is as follows:

JSON
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
[
  {
    "measurement": "cloud_billing",
    "tags": {
      "billing_id"    : "anvxfafakjflxxxxxxx",
      "cloud_provider"      : "huaweicloud",
      "billing_date"        : "2022-xx-xx",
      "instance_id"   : "b65dd0c5e43e433xxxxxxxxxxf5e226din02",
      "region_id"   : "cn-hangzhu-1",
      "account_id"  : "1e1fed9816xxxxxxxxxxx285140c83",
      "account_name": "1e1fed9816xxxxxxxxxxx285140c83",
      "product_code": "dds",
      "product_name": "Document Database Service"
    },
    "fields": {
      "amount"        : 11.11,
      "offical_amount": 11.11468938
    },

    "timestamp": 1662957294
  }
]

Fields in tags and fields may change with subsequent updates.

3. Field Description

Reported Fields API Returned Fields Meaning of API Fields Notes
Billing ID billing_id Unique billing ID
Product Code product_code cloud_service_type Cloud service type code Extracted from cloud_service_type
For example: "hws.service.type.vpc" -> "vpc"
Product Name product_name cloud_service_type_name Cloud service type name
Official Price official_amount official_amount Official price, Huawei Cloud product sales price on the official website without applied business discounts or promotional discounts. Sum of official_amount
Paid Amount amount amount The amount users need to pay after enjoying discounts on cloud services, including cash coupons, stored value cards, and credit coupons, accurate to two decimal places. Sum of amount
Cash Payment cash_amount cash_amount Cash payment amount
Credit Payment credit_amount credit_amount Credit payment amount
Credit Coupon coupon_amount coupon_amount Credit coupon payment amount
Cash Coupon flexipurchase_coupon_amount flexipurchase_coupon_amount Cash coupon payment amount
Bonus Payment bonus_amount bonus_amount Bonus payment amount (used for rewards not fully utilized by online customers)
Stored Card stored_card_amount stored_card_amount Stored card payment amount
Unpaid Amount debt_amount debt_amount Unpaid amount
Unpaid Write-off adjustment_amount adjustment_amount Unpaid write-off amount
Billing Period billing_date bill_date Resource consumption record date. Format: YYYY-MM-DD
Region region_id region Region ID
Instance ID instance_id resource_id Instance ID
Consumer ID account_id customer_id Consumer ID of resource consumption
Consumer Name account_name customer_id Consumer ID of resource consumption

Each time the script runs, the data statistics granularity is resource (instance) id: resource_id; billing consumption amounts for the same instance will be merged, specific details can be viewed in the comparison between Huawei Cloud API raw data and data aggregated by the script below

Huawei Cloud API 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
[
  {
    "cloud_service_type_name": "Document Database Service",
    "resource_type_name"     : "DDS Cluster",
    "effective_time"         : "2022-08-11T10:00:00Z",
    "expire_time"            : "2022-08-11T10:06:05Z",
    "resource_id"            : "b65dd0c5e43e433e86d747af7f5e226din02",
    "resource_name"          : "dds-f652",
    "official_amount"        : 0.06975555,
    "amount"                 : 0.06,
    "product_id"             : "00301-327271-0--0",
    "product_name"           : "General-purpose Cluster II|config.large.2|2vCPUs|4GB On-Demand",
    "product_spec_desc"      : "General-purpose Cluster II|config.large.2|2vCPUs|4GB",
    "{other_fields}"         : "{omitted}"
  },
  {
    "cloud_service_type_name": "Document Database Service",
    "resource_type_name"     : "DDS Cluster",
    "effective_time"         : "2022-08-11T10:00:00Z",
    "expire_time"            : "2022-08-11T10:06:05Z",
    "resource_id"            : "b65dd0c5e43e433e86d747af7f5e226din02",
    "resource_name"          : "dds-f652",
    "official_amount"        : 0.11193333,
    "amount"                 : 0.11,
    "product_id"             : "00301-327217-0--0",
    "product_name"           : "General-purpose Cluster II|mongos.medium.4|1vCPUs|4GB On-Demand",
    "product_spec_desc"      : "General-purpose Cluster II|mongos.medium.4|1vCPUs|4GB",
    "{other_fields}"         : "{omitted}"
  }
]

Script Aggregation

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
 {
    "category": "cloud_billing",
    "fields": {
      "adjustment_amount": 0.0,
      "amount": 105.0,
      "bonus_amount": 0.0,
      "cash_amount": 105.0,
      "coupon_amount": 0.0,
      "credit_amount": 0.0,
      "debt_amount": 0.0,
      "flexipurchase_coupon_amount": 0.0,
      "message": "{\"adjustment_amount\": null, \"az_code_infos\": [], \"bill_date\": null, \"bill_type\": 8, \"bonus_amount\": 0.0, \"cash_amount\": 105.0, \"charge_mode\": 1, \"cloud_service_type\": \"hws.service.type.elb\", \"cloud_service_type_name\": \"\\u5f39\\u6027\\u8d1f\\u8f7d\\u5747\\u8861\", \"consume_amount\": 105.0, \"coupon_amount\": 0.0, \"credit_amount\": 0.0, \"customer_id\": \"f000ee4d7327428da2f53a081e7109bd\", \"cycle\": \"2024-11\", \"debt_amount\": 0.0, \"discount_amount\": 45.0, \"effective_time\": null, \"enterprise_project_id\": \"0\", \"enterprise_project_name\": \"default\", \"expire_time\": null, \"flexipurchase_coupon_amount\": 0.0, \"id\": \"68caa614-409e-4147-ae5b-a412ace1d49c_1\", \"measure_id\": 1, \"official_amount\": 150.0, \"parent_resource_id\": null, \"payer_account_id\": \"f000ee4d7327428da2f53a081e7109bd\", \"period_type\": 20, \"pre_order_id\": null, \"product_spec_desc\": \"\\u5171\\u4eab\\u578b\\u5b9e\\u4f8b\\u6027\\u80fd\\u4fdd\\u969c\\u6a21\\u5f0f\", \"region\": \"cn-south-1\", \"region_name\": \"\\u534e\\u5357-\\u5e7f\\u5dde\", \"res_instance_id\": \"574387b2-fd11-4459-b966-54a7420d9ffb\", \"resource_Type_code\": \"hws.resource.type.elbv2\", \"resource_name\": \"kodo-nginx-elb\", \"resource_tag\": null, \"resource_type_name\": \"\\u5171\\u4eab\\u578b\\u8d1f\\u8f7d\\u5747\\u8861\", \"root_resource_id\": null, \"sku_code\": \"elbv2.basic.default\", \"stored_card_amount\": 0.0, \"sub_resource_id\": null, \"sub_resource_name\": null, \"sub_resource_type_code\": null, \"sub_resource_type_name\": null, \"sub_service_type_code\": null, \"sub_service_type_name\": null, \"trade_id\": \"CS2411070420BE132\"}",
      "offical_amount": 150.0,
      "stored_card_amount": 0.0
    },
    "measurement": "cloud_billing",
    "tags": {
      "account_id": "f000ee4d7327428da2f53a081e7109bd",
      "account_name": "f000ee4d7327428da2f53a081e7109bd",
      "billing_date": "2024-11-06",
      "billing_id": "8746f092d7353a56e987ac44abdc26655eed751296bd6361bf8e0a40977e5178",
      "billing_timestamp": "1730908799",
      "instance_id": "574387b2-fd11-4459-b966-54a7420d9ffb",
      "name": "574387b2-fd11-4459-b966-54a7420d9ffb",
      "product_code": "elb",
      "product_name": "Elastic Load Balancer",
      "region_id": "cn-south-1",
      "region_name": "South China-Guangzhou"
    },
    "timestamp": 1730908799
  }

4. Linkage with Custom Object Collectors

When other custom object collectors (such as EC2, RDS) are running within the same DataFlux Func, this collector automatically attempts to match the resource_id field returned by the bill with the tags.name field of custom objects. Assuming the original data collected by the billing data is as follows:

JSON
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
{
  "measurement": "cloud_billing",
  "tags": {
    "instance_id": "i-001",
    "{other_fields}" : "{omitted}"
  },
  "fields": {
    "{metrics}": "{metric_values}"
  }
}

At the same time, the custom object data collected by the Huawei Cloud EC2 collector is as follows:

JSON
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
{
  "measurement": "huaweicloud_ec2",
  "tags": {
    "name"       : "i-001",
    "instance_id": "i-001",
    "region_id"  : "xxxxx",
    "{other_fields}" : "{omitted}"
  },
  "fields": {
    "{other_fields}": "{omitted}"
  }
}

Upon successful matching, fields from the matched custom object tags except name will be added to the tags of the billing data. Thus, the final reported billing data is as follows:

JSON
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
{
  "measurement": "cloud_billing",
  "tags": {
    "instance_id": "i-001",
    "region_id"  : "xxxxx",
    "{other_fields}" : "{omitted}"
  },
  "fields": {
    "{metrics}": "{metric_values}"
  }
}

X. Appendix

Huawei Cloud - Billing Management "Query Resource Consumption Records"

Please refer to the Huawei Cloud official documentation: