Skip to content

Configuration Manual for the "Tencent Cloud - Billing" Collector

Before reading this, please first read:

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 current date - 2 days. It is recommended to run this script once a day

The program has built-in duplicate collection prevention. If run multiple times within the same day, all subsequent executions after the first will automatically skip.

1. Configuration Structure

This collector does not require configuration.

2. Data Reporting Format

After data synchronization, you can view the data 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": "clb",
    "product_name": "Load Balancer CLB ",
    "account_id"  : "100025xxxxxx113474",
    "account_name": "100025xxxxxx113474"
  },
  "fields": {
    "amount"        : 0.82733567,
    "offical_amount": 0.82733567
  },
  "timestamp": 1657507837
}

Fields in tags and fields may change with subsequent updates

3. Statistical Description

Reported Field API Return Field Description
Product Code product_code BusinessCode Extracted from BusinessCode
For example: "p_clb" -> "clb"
Product Name product_name BusinessCodeName
Original Price offical_amount ComponentSet.Cost
Paid Amount amount CashPayAmount
+ VoucherPayAmount
Cash payment
+ Voucher payment
Timestamp timestamp Date when the bill was generated
Customer Account ID account_id PayerUin Log into Tencent Cloud, find the avatar at the top right corner - Access Management - Users - User List, to see account name, account ID information
Customer Account Name account_name Interface ListUsers.Name field or PayerUin field The ListUsers interface returns all sub-user information. Match the PayerUin field returned by the bill interface with the Uin field returned by the ListUsers interface to obtain the corresponding Name field. If no match is found, use PayerUin by default

Data statistical granularity is Product Name Code: BusinessCode

Consumption amounts with the same product name code will be combined for calculation. A product may correspond to multiple components (ComponentSet), so all components need to be added together before assigning values. For details, see the comparison between the Tencent Cloud API original data and the aggregated data after the script runs below.

Tencent Cloud API interfaces refer to Tencent Cloud - Billing Management 'Query Bill Detail Data' and Tencent Cloud - Access Management 'Retrieve Sub-users'. The interface addresses are visible in the appendix.

Tencent Cloud Query Bill Detail Data (DescribeBillDetail) Interface Return 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
[
  {
    "BusinessCodeName": "Load Balancer CLB",
    "BusinessCode"    : "p_clb",
    "ComponentSet": [
      {
        "Cost"            : "0.20000000",
        "VoucherPayAmount": "0",
        "CashPayAmount"   : "0.20000000",
        "{Other Fields}"  : "{Omitted}"
      },
      {
        "Cost"            : "0.10000000",
        "VoucherPayAmount": "0",
        "CashPayAmount"   : "0.10000000",
        "{Other Fields}"  : "{Omitted}"
      }
    ]
  },
  {
    "BusinessCodeName": "Load Balancer CLB",
    "BusinessCode"    : "p_clb",
    "ComponentSet": [
      {
        "Cost"            : "0.10000000",
        "VoucherPayAmount": "0",
        "CashPayAmount"   : "0.10000000",
        "{Other Fields}"  : "{Omitted}"
      },
      {
        "Cost"            : "0.30000000",
        "VoucherPayAmount": "0",
        "CashPayAmount"   : "0.30000000",
        "{Other Fields}"  : "{Omitted}"
      }
    ]
  }
]

Aggregated Data After Script Runs

JSON
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
[
  {
    "measurement": "cloud_bill",
    "tags": {
      "product_code": "clb",
      "product_name": "Load Balancer CLB",
      "account_id"  : "100025xxxxxx113474",
      "account_name": "100025xxxxxx113474"
    },
    "fields": {
      "amount"        : 0.7,
      "offical_amount": 0.7
    },
    "timestamp": 1657507837
  }
]

X. Appendix

Tencent Cloud - Billing Management 'Query Bill Detail Data'

Refer to the official Tencent Cloud documentation: