# Icinga2 Graphite - purge old data - Maintenance

**URL:** <https://community.icinga.com/t/icinga2-graphite-purge-old-data-maintenance/3669>\
**Category:** Icinga 2\
**Created:** [March 2, 2020, 5:10pm UTC](https://community.icinga.com/t/icinga2-graphite-purge-old-data-maintenance/3669 "2020-03-02T17:10:48Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![mani.vajrala](https://community.icinga.com/letter_avatar_proxy/v4/letter/m/0ea827/32.png) [@mani.vajrala](https://community.icinga.com/u/mani.vajrala)\
**Post date:** [March 2, 2020, 5:10pm UTC](https://community.icinga.com/t/icinga2-graphite-purge-old-data-maintenance/3669/1 "2020-03-02T17:10:48Z")

</div>

I have followed this documentation [https://www.trash.co.nz/2018/11/icinga2-graph-data-retention/](https://www.trash.co.nz/2018/11/icinga2-graph-data-retention/) for setting up he graphite data retention… current configuration is  
[carbon]  
pattern = ^carbon.  
retentions = 10s:6h,1m:1w,15m:1y

[default\_1min\_for\_1day]  
pattern = .\*  
retentions = 10s:6h,1m:6d,10m:1800d

I still have few gaps to maintain the graphite data… We have around 120 hosts & we have created separate mount point that is around 200G. right now this is 65% filled… I would like to understand how to maintain graphite data… is something i need to schedule cron job to clean the data which is older than 7 days? i am little scared to purge any graphite data…

I am trying to do this [https://sysadmin.compxtreme.ro/clean-up-whisper-database/](https://sysadmin.compxtreme.ro/clean-up-whisper-database/)

Can you please advise the which is the best way to maintain graphite data & we don’t want file system filled 100%…

---

<div class="post-metadata">

**Author:** ![blakehartshorn](https://community.icinga.com/user_avatar/community.icinga.com/blakehartshorn/32/599_2.png) [@blakehartshorn](https://community.icinga.com/u/blakehartshorn)\
**Post date:** [March 2, 2020, 5:51pm UTC](https://community.icinga.com/t/icinga2-graphite-purge-old-data-maintenance/3669/2 "2020-03-02T17:51:21Z")

</div>

So when whisper files are created by the carbon cache daemon, they claim all the disk size they need. That is, if you tell a metric to retain 1,800 days worth of data, it creates a file large enough to fit all of that data into.

The second link you provided is basically a good way to remove metrics that are obsolete; service checks you’ve removed from Icinga.

If you want less retentions for existing Graphite data, look into the whisper-resize script that comes with it. Be careful though, this irreversibly changes these files.

```auto
/usr/local/bin/whisper-resize.py --help
Usage: whisper-resize.py path timePerPoint:timeToStore [timePerPoint:timeToStore]*

timePerPoint and timeToStore specify lengths of time, for example:

60:1440 60 seconds per datapoint, 1440 datapoints = 1 day of retention
15m:8 15 minutes per datapoint, 8 datapoints = 2 hours of retention
1h:7d 1 hour per datapoint, 7 days of retention
12h:2y 12 hours per datapoint, 2 years of retention

Options:
  -h, --help show this help message and exit
  --xFilesFactor=XFILESFACTOR
                        Change the xFilesFactor
  --aggregationMethod=AGGREGATIONMETHOD
                        Change the aggregation function (average, sum, last,
                        max, min, avg_zero, absmax, absmin)
  --force Perform a destructive change
  --newfile=NEWFILE Create a new database file without removing the
                        existing one
  --nobackup Delete the .bak file after successful execution
  --aggregate Try to aggregate the values to fit the new archive
                        better. Note that this will make things slower and use
                        more memory.

```

---

<div class="post-metadata">

**Author:** ![hamester\_citti](https://community.icinga.com/letter_avatar_proxy/v4/letter/h/ba8739/32.png) [@hamester\_citti](https://community.icinga.com/u/hamester_citti)\
**Post date:** [March 4, 2020, 9:56am UTC](https://community.icinga.com/t/icinga2-graphite-purge-old-data-maintenance/3669/3 "2020-03-04T09:56:07Z")

</div>

It it also helpful to find/ delete files that have not changed or empty.

> find /var/lib/graphite/whisper/icinga2/ -type f -name \*.wsp -mtime +30 -delete  
> find /var/lib/graphite/whisper/icinga2/ -type d -empty -delete
