Configure Metric Retention

By default, OpenTSDB stores two weeks of metrics. Based on your requirements, you can change the metric-retention period.

The following cron job runs each day to purge metrics based on the retention period:
$min $hour * * *      $OTSDB_HOME/bin/tsdb_cluster_mgmt.sh -purgeData -retentionPeriod '2 weeks ago'
To edit the metric-retention period:
  1. Depending on the operating system, use crontab -e as the cluster admin (typically mapr) user, or open a crontab file:
    • For RHEL:
      "/var/spool/cron/$MAPR_USER"
    • For SLES:
      "/var/spool/cron/tabs/$MAPR_USER"
    • For Ubuntu:
      "/var/spool/cron/crontabs/$MAPR_USER"
  2. In the following line, update the value of '2 months ago' to the new retention period. You can use any format accepted by the date -- date= command, such as '2 months ago' or '2 days ago'. For example:
    27 5 * * *      /opt/mapr/opentsdb/opentsdb-2.4.1/bin/tsdb_cluster_mgmt.sh -purgeData -retentionPeriod '2 months ago'
    To delete metrics from 1/1/2000 to [current date - 2 days]:
    27 5 * * *      /opt/mapr/opentsdb/opentsdb-2.4.1/bin/tsdb_cluster_mgmt.sh -purgeData -retentionPeriod '2 days ago'
WARNING
Data Fabric monitoring uses 2 MB of disk space per minute per node when HPE Ezmeral Data Fabric Streams metrics are enabled. This is approximately 3 GB per day on a single node or 7 GB per node per day with 3X replication. This streams metrics data is automatically deleted every 30 days.
NOTE
For more information, see the OpenTSDB scan command documentation.