graphite: add cleanup job

Add the cron job that existed in puppet-graphite to cleanup old,
un-updated stats and directories.

Change-Id: Iac4676ae0ea1d5f1b96b6214ab6ab193c71a2d20
This commit is contained in:
Ian Wienand 2020-09-29 14:20:50 +10:00
parent 93445ff303
commit e764a59877

View File

@ -53,3 +53,21 @@
name:
- netcat
state: present
# Removes files not updated for ~9 months, and clears out empty directories
- name: Run periodic cleanup
cron:
name: "Graphite cleanup"
minute: "0"
hour: "2"
job: >
bash -c 'echo "--- $(date) ---";
find /opt/graphite/storage/whisper -type f -mtime +270 -name "*.wsp" -delete -print;
find /opt/graphite/storage/whisper -depth -type d -empty -delete -print'
>> /var/log/graphite-cleanup.log 2>&1
- name: Rotate cleanup logs
include_role:
name: logrotate
vars:
logrotate_file_name: '/var/log/graphite-cleanup.log'