IBM® Cloud Private metering service

You can use the metering service to view and download detailed usage metrics for your applications and cluster.

The metering service is automatically installed as part of the IBM Cloud Private environment.

Viewing metering reports

  1. From the IBM Cloud Private management console, open the navigation menu and click Platform > Metering.
  2. View and download metering data.
    • To view metering data for applications, click Containers and go to to an application.
      • You can view metrics for Available Cores, Capped Cores, and Memory.
      • You can update the displayed time range to show a period of interest.
      • You can download the displayed data for a specific application as a .csv file.
    • To download a .csv file that contains a monthly report of application metrics data, click Download Report. The report contains a summary of usage data for both the product and each container instance.
      • Your Virtual Processing Core (VPC) usage is the number of Ccores that is listed in the report.
    • To view metering data for nodes in your cluster, click Platform.

Using the metering service to manage chargebacks

If you are interested in tracking IBM Cloud Private usage by a subset of the cluster's users, such as teams, department, individuals, or specific clients, use strategic namespace assignments to track the data. You can use the data that the metering service gathers about core, memory, and processor usage to manage billing for the cluster users, a practice that is commonly known as "chargeback."

To use namespaces to manage chargebacks, you determine the subset of user that you want to track. Then, you create a namespace for each group of users, and assign each user access to only the namespace for the users' group. When you need to manage chargebacks for the groups, review the usage for each namespace. You can use the usage information for each namespace to assign billing for the group.

Purging metering data from IBM Cloudant

Accumulated metering data can quickly fill up disk space on your nodes.

To verify the metering data usage, on your master node, run the following command:

  cd /opt/ibm/cfc/cloudant/cloudant/view_index/.shards/; du -hs `find . -name conc_usage*`

If the disk space usage is high, complete the following steps to compact the files.

  1. Set up the kubectl CLI. See Accessing your IBM Cloud Private cluster by using the kubectl CLI.
  2. Compact the files by running the following commands. The database compaction commands run asynchronously. If the launch of the command is successful, a response message of OK is returned. The commands might take several minutes to complete.

     kubectl -n kube-system exec -it icp-ds-0 -- /bin/bash -c 'curl -k -H "Content-Type: application/json" -X POST https://admin:$ADMIN_PASSWORD@cloudantdb:6984/conc_usage/_compact'
    
     kubectl -n kube-system exec -it icp-ds-0 -- /bin/bash -c 'curl -k -H "Content-Type: application/json" -X POST https://admin:$ADMIN_PASSWORD@cloudantdb:6984/conc_usage/_compact/designDoc'
    
     kubectl -n kube-system exec -it icp-ds-0 -- /bin/bash -c 'curl -k -H "Content-Type: application/json" -X POST https://admin:$ADMIN_PASSWORD@cloudantdb:6984/conc_usage/_compact/designDoc2'
    
  3. Verify that all the compaction jobs are complete.

     kubectl -n kube-system exec -it icp-ds-0 -- /bin/bash -c 'curl -k -H "Content-Type: application/json" -X GET https://admin:$ADMIN_PASSWORD@cloudantdb:6984/_active_tasks'
    

    The output resembles the following text:

       []
    
  4. To prevent further growth of the metering data, you must add an environment variable to the metering-dm deployment.

    1. Log in to the IBM Cloud Private management console.
    2. From the navigation menu, click Workloads > Deployment.
    3. Find the metering-dm deployment. Select Action > Edit. The metering-dm deployment's JSON file is displayed.
    4. Under the spec.template.spec.containers section, find the env section.
    5. Add a new environment variable.

      {
       "name": "HC_DM_CONCERENABLED",
       "value": "false"
      },
      
    6. Click Submit. After you submit the changes, you do not need to manually restart any pods or servers.

The metering-dm pod is automatically recreated with the new environment variable, and the conc_usage database files stop growing. This updates produces no negative effects or loss of data in your environment.