Skip to content

Configuration Manual for the "Alibaba Cloud - Billing" Collector

Before reading this, please first read:

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

To ensure data completeness, the billing date collected is current date - 2 days, i.e.: 2022-07-03 00:00:00 ~ 23:59:59 during which all data collected pertains to 2022-07-01. It is recommended that this script runs once daily.

The program has built-in duplicate collection prevention handling; when run repeatedly within the same day, except for the first run of the day, subsequent executions will automatically skip.

1. Configuration Structure

No configuration is required for this collector.

2. Data Reporting Format

After normal data synchronization, the data can be viewed in the 'Metrics' section of TrueWatch.

An example of the reported data is as follows:

JSON
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
{
  "measurement": "cloud_bill",
  "tags": {
    "product_code": "ecs",
    "product_name": "Elastic Compute Service ECS",
    "account_id"  : "1234xxxxxx999",
    "account_name": "xxxxx",
  },
  "fields": {
    "amount"        : 9419.23,
    "offical_amount": 18843.258604
  },
  "timestamp": 1657507021
}

Fields in tags and fields may change with subsequent updates

3. Statistical Explanation

Field Reported Field Alibaba Cloud API Return Field Description
Product Code product_code ProductCode
Product Name product_name ProductName
Account Name account_name AccountName
Account ID account_id AccountID
Original Price offical_amount PretaxGrossAmount Sum of PretaxGrossAmount for the same product code
Payable Amount amount PretaxAmount Sum of PretaxAmount for the same product code
Billing Date timestamp BillingDate

Data statistical granularity is Product Code: ProductCode; amounts for the same type of bill consumption are combined, refer specifically to the comparison between the Alibaba Cloud API raw data and the data aggregated by the script

To ensure complete data reporting, the collector collects data from two days ago, for example, if the collector runs on 2022-07-03, it collects data for 2022-07-01

For the Alibaba Cloud API interface, see the 'Query Resource Consumption Records' interface address under the Alibaba Cloud - Billing Management section in the appendix

Raw Alibaba Cloud Billing 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
[
  {
    "BillingDate"      : "2022-xx-xx",
    "ProductCode"      : "oss",
    "ProductName"      : "Block Storage",
    "PretaxAmount"     : 0.12,
    "PretaxGrossAmount": 0.22,
    "account_id"       : "1234xxxxxx999",
    "account_name"     : "xxxxx",
    "{Other Fields}"   : "{Omitted}"
  },
  {
    "BillingDate"      : "2022-xx-xx",
    "ProductCode"      : "oss",
    "ProductName"      : "Block Storage",
    "PretaxAmount"     : 0.22,
    "PretaxGrossAmount": 0.32,
    "account_id"       : "1234xxxxxx999",
    "account_name"     : "xxxxx",
    "{Other Fields}"   : "{Omitted}"
  },
  {
    "BillingDate"      : "2022-xx-xx",
    "ProductCode"      : "snapshot",
    "ProductName"      : "Block Storage",
    "account_id"       : "1234xxxxxx999",
    "account_name"     : "xxxxx",
    "PretaxAmount"     : 0.02,
    "PretaxGrossAmount": 0.02,
    "{Other Fields}"   : "{Omitted}"
  }
]

Aggregated by Script

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
[
  {
    "measurement": "cloud_bill",
    "tags": {
      "product_code": "oss",
      "product_name": "Block Storage",
      "account_id"  : "1234xxxxxx999",
      "account_name": "xxxxx",
    },
    "fields": {
      "amount"        : 0.34,
      "offical_amount": 0.54,
      "account_id"    : "1234xxxxxx999",
      "account_name"  : "xxxxx",
    },
    "timestamp": 1657507021
  },
  {
    "measurement": "cloud_bill",
    "tags": {
      "product_code": "snapshot",
      "product_name": "Block Storage",
      "account_id"  : "1234xxxxxx999",
      "account_name": "xxxxx",
    },
    "fields": {
      "amount"        : 0.02,
      "offical_amount": 0.02
    },
    "timestamp": 1657507021
  }
]

Appendix

Alibaba Cloud - Billing Management 'Query Instance Billing Service'