Changing the retention period for monitoring data

IBM Cloud Pak® for Data monitoring data is stored in an embedded InfluxDB database. By default, the data is retained for 30 days. You can increase the retention period to store additional data or decrease the retention period if you need to reduce the size of the database.

Before you begin

To complete this task, you must be an administrator on the Red Hat® OpenShift® Container Platform project where Cloud Pak for Data is deployed.

About this task

To change the retention period, you must change the settings of the embedded InfluxDB database.

Procedure

  1. Log in to your Red Hat OpenShift Container Platform cluster as a project administrator:
    oc login OpenShift_URL:port
  2. Change to the project where Cloud Pak for Data is deployed:
    oc project Project_name
  3. Get the password for the InfluxDB service:
    oc get secret -o yaml dsx-influxdb-auth

    Locate the influxdb-password entry in the response.

  4. Decode the password:
    echo value-from-influxdb-password | base64 -d

    Save the decoded password somewhere secure.

  5. Get the ID of an InfluxDB pod:
    oc get pods | grep influx
  6. Open a bash shell inside the pod:
    oc exec oc exec -it dsx-influxdb-0 bash
  7. Determine the current data retention policy.
    1. Connect to InfluxDB:
      influx -ssl -unsafeSsl
    2. Authenticate to InfluxDB:
      auth admin decoded-InfluxDB-password
    3. View the current retention policy:
      show retention policies on WATCHDOG;
      For example, the command might return:
      name         duration  shardGroupDuration replicaN default
      ----         --------  ------------------ -------- -------
      autogen      1440h0m0s 24h0m0s            1        true
      thirty_days  720h0m0s  24h0m0s            1        false
      three_days   72h0m0s   24h0m0s            1        false
    4. Change the retention policy:
      ALTER RETENTION POLICY thirty_days ON WATCHDOG DURATION duration REPLICATION 1
      Use InfluxDB notations to change the duration. For example:
      • To set the retention policy to 45 days, change duration to 45d
      • To set the retention policy to 6 weeks, change duration to 6w

      For more information about the InfluxDB notation, see Duration units in the InfluxDB documentation.