Viewing Usage Data from the Billing Database

Note: As of v1.8, Enterprise PKS has been renamed to VMware Tanzu Kubernetes Grid Integrated Edition. Some screenshots in this documentation do not yet reflect the change.

Page last updated:

Deprecation Notice: In Tanzu Kubernetes Grid Integrated Edition v1.9, the billing database is scheduled to be removed. You can use Telemetry instead of the billing database. For more information, see Telemetry. If you are impacted by this deprecation, please reach out to pks-telemetry@groups.vmware.com.

This topic describes how operators can view VMware Tanzu Kubernetes Grid Integrated Edition pod usage information from the billing database.

About the Billing Database

The Tanzu Kubernetes Grid Integrated Edition billing database stores the following pod usage data:

  • Watermark: the number of pods that run at a single time.
  • Consumption: the memory and CPU usage of pods.

You can use this data to calculate billed usage, perform customer chargebacks, generate usage reports, and perform other functions.

Usage Data Format

This section describes the usage data records you can view in the Tanzu Kubernetes Grid Integrated Edition billing database. The agent pod collects usage data for the deployment and sends the data to the Tanzu Kubernetes Grid Integrated Edition aggregator agent. The aggregator agent then stores the data in the Tanzu Kubernetes Grid Integrated Edition billing database. You can access the billing database from the TKGI API VM.

The following is an example of a pod usage data table:

+--------------------------------------+---------------------+---------------------+--------------+--------------+-------------------------------------------------------+
| id                                   | first_seen          | last_seen           | namespace    | name         | service_instance_id                                   |
+--------------------------------------+---------------------+---------------------+--------------+--------------+-------------------------------------------------------+
| 12a345b6-7890-13c4-de5f-67890a123b4c | 2019-01-07 13:57:03 | 2019-01-08 11:34:33 | my-namespace | my-pod       | service-instance_a12b3456-78cd-90e1-fa2b-3456c789def0 |
| ac203f27-104b-11e9-b520-42010a000b0a | 2019-01-04 18:09:04 | 2019-01-07 14:09:03 | my-namespace | my-other-pod | service-instance_a12b3456-78cd-90e1-fa2b-3456c789def0 |
+--------------------------------------+---------------------+---------------------+--------------+--------------+-------------------------------------------------------+
2 rows in set (0.00 sec)

The following table describes the fields that appear in the pod usage data table:

Field Name Description
id Unique record identifier
first_seen The date when the pod was first recorded to the database
last_seen The date when the pod was most recently recorded to the database
namespace The namespace where the pod is deployed
name The name of the pod
service_instance_id The cluster where the pod is deployed

View Usage Data

To view the pod usage data table, follow the steps below:

  1. In a browser, navigate to Ops Manager.
  2. Click the Tanzu Kubernetes Grid Integrated Edition tile.
  3. Select the Status tab. Record the IP address that appears in the IPS column.
  4. Select the Credentials tab.
  5. Click the credential link next to Cf Mysql Billing Db Password. Record the billing database password that appears.
  6. Open a terminal window from any system inside your TKGI network. If your system is outside the network, SSH into a TKGI DB VM, whether it is a singleton or one of multiple DB VMs.
    For more information, see SSH into a TKGI DB VM in Using BOSH Diagnostic Commands in Tanzu Kubernetes Grid Integrated Edition.
  7. On the command line, log in to the billing database in one of the following ways:

    • Run the following command to connect by IP address from inside the TKGI DB VM:

      mysql -h 127.0.0.1 --port 3333 -u billing -p BILLING-PASSWORD
      

      Where BILLING-PASSWORD is the billing database password you located in the steps above.

    • Run the following command to connect using the MySQL socket file from inside the TKGI DB VM:

      mysql --socket=/var/vcap/sys/run/pxc-mysql/mysqld.sock -u billing -p BILLING-PASSWORD
      

      Where BILLING-PASSWORD is the billing database password you located in the steps above.

    • Run the following command to connect by IP address from outside the TKGI DB VM:

      mysql -h IP-ADDRESS --port 3306 -u billing -p BILLING-PASSWORD
      

      Where:

      • IP-ADDRESS is the IP address that you located in the steps above.
      • BILLING-PASSWORD is the billing database password you located in the steps above.
  8. View the tables in the billing database by running show tables;.

    For example:

    MariaDB [billing]> show tables;
    +-------------------+
    | Tables_in_billing |
    +-------------------+
    | pods              |
    | schema_migrations |
    +-------------------+
    2 rows in set (0.00 sec)
    

  9. View the raw pod usage data in the pods table by running select * from pods;.

    For example:

    MariaDB [billing]> select * from pods;
    +--------------------------------------+---------------------+---------------------+--------------+--------------+-------------------------------------------------------+
    | id                                   | first_seen          | last_seen           | namespace    | name         | service_instance_id                                   |
    +--------------------------------------+---------------------+---------------------+--------------+--------------+-------------------------------------------------------+
    | 12a345b6-7890-13c4-de5f-67890a123b4c | 2019-01-07 13:57:03 | 2019-01-08 11:34:33 | my-namespace | my-pod       | service-instance_a12b3456-78cd-90e1-fa2b-3456c789def0 |
    | ac203f27-104b-11e9-b520-42010a000b0a | 2019-01-04 18:09:04 | 2019-01-07 14:09:03 | my-namespace | my-other-pod | service-instance_a12b3456-78cd-90e1-fa2b-3456c789def0 |
    +--------------------------------------+---------------------+---------------------+--------------+--------------+-------------------------------------------------------+
    2 rows in set (0.00 sec)
    

  10. (Optional) For information about running additional queries against the billing database, see the following articles in the Knowledge Base:


Please send any feedback you have to pks-feedback@pivotal.io.