Uploading usage metrics to IBM Software Central

In an offline or air-gapped environment, the IBM Usage Metering Service cannot connect directly to IBM Software Central.

Before you begin

You must have the following prerequisites:
  • IBM Entitlement Key for authentication

  • Network access to Software Central from the machine performing the upload

  • A kubectl access to the cluster

To use this documentation offline, see Offline and mobile access.

About this task

You must manually download the usage data and upload it to Software Central.

Procedure

  1. Expose the usage metering service.
    It depends on your cluster environment but the service to expose is ibm-usage-metering-instance. The URL exposed by the service references the next steps as UMS_URL.
  2. Download usage data.
    Retrieve the metering data from the service:
    UMS_TOKEN=$(kubectl get secret ibm-usage-metering-upload-token -n "${NAMESPACE}" -o jsonpath='{.data.token}' 2>/dev/null | base64 -d || echo "")
    UMS_URL=<URL FOR THE USAGE METERING SERVICE>
    curl -k --output "swc_payload.tar.gz" \
    --header "Authorization: Bearer ${UMS_TOKEN}" \
    Note: This is a sample. The URL differs depending on the user's specific Kubernetes installation. For more information, see Deploying to a managed Kubernetes service.
  3. Verify the downloaded data.
    Extract and inspect the usage data:
    tar xvzf swc_payload.tar.gz
    Expected output:
    x manifest.json
    x usage.json
    
    Extracted output:
    • manifest.json: Metadata about the usage data package
    • usage.json: Actual usage metrics data
      • Product usage statistics (for example, number of pods and resources)
      • Metric collection timestamps and intervals
  4. Upload data to Software Central.
    Upload the usage data to Software Central:
    curl -X POST "https://swc.saas.ibm.com/metering/api/v2/metrics" \
         -H "Authorization: Bearer <IEK>" \
         -F "file=@swc_payload.tar.gz;type=application/gzip"

    Parameter:

  5. Verify upload.
    Verify the usage data in the Software Central portal:
    1. Go to MyIBM Container Software Library External link opens a new window or tab.
    2. Check the usage reports section for your uploaded data.
    Tip: Schedule this process regularly (for example, monthly) to ensure compliance reporting is up to date.