Viewing Usage Data

Page last updated:

This topic describes how operators can view pod usage information from their Pivotal Container Service (PKS) deployment. Operators can use this data to calculate billed usage, perform customer chargebacks, and generate usage reports.

The PKS 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.

About Usage Data

This section describes the usage data records you can view in the PKS billing database. The agent pod collects usage data for the deployment and sends the data to the PKS aggregator agent. The aggregator agent then stores the data in the PKS database. You can access the PKS database from the PKS 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. Select the Pivotal Container Service 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 PKS network. If your system is outside the network, you can SSH into the PKS VM. For more information, see SSH into the PKS API VM.
  7. On the command line, log in to the billing database by running mysql -h IP-ADDRESS -u billing -p billing, replacing IP-ADDRESS with the IP you located in a previous step.

    For example:
    mysql -h 10.0.10.10 -u billing -p billing
  8. When prompted by the command line, enter the billing database password you recorded in a previous step.
  9. 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)
    
  10. 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)

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


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