Skip to content

Instantly share code, notes, and snippets.

@qsLI
Forked from sfgeorge/README.md
Created May 27, 2019 08:49
Show Gist options
  • Save qsLI/1c6f73ae488a62848c549bc993986730 to your computer and use it in GitHub Desktop.
Save qsLI/1c6f73ae488a62848c549bc993986730 to your computer and use it in GitHub Desktop.
Carbon / Graphite tip: How to use whisper-resize to change xFilesFactor on existing stats

Carbon / Graphite tip: How to use whisper-resize to change xFilesFactor on existing stats

Detailed Steps

1.) Update /etc/carbon/storage-aggregation.conf to use the new xFilesFactor setting for new stats, if you haven't yet already

2.) Get the retention ranges as defined in storage-schemas.conf

fgrep retentions /etc/carbon/storage-schemas.conf | tr ',' ' '

retentions = 10s:5m 5m:1d 1h:30d 1d:2y

3.) Switch to the user who owns existing whisper data. (You don't want to create whiser files owned by root)

4.) Invoke whisper-resize with the supplied retention values, replacing commas with spaces:

whisper-resize --xFilesFactor=0 /var/lib/carbon/whisper/stats/timers/foo/upper.wsp 10s:5m 5m:1d 1h:30d 1d:2y

Retrieving all data from the archives Creating new whisper database: /var/lib/carbon/whisper/stats/timers/foo/upper.wsp.tmp Created: /var/lib/carbon/whisper/stats/timers/foo/upper.wsp.tmp (21280 bytes) Migrating data without aggregation... Renaming old database to: /var/lib/carbon/whisper/stats/timers/foo/upper.wsp.bak Renaming new database to: /var/lib/carbon/whisper/stats/timers/foo/upper.wsp

5.) Ensure that the newly-created files have owner:group association consistent with other files (double-checking step #3)

6.) Compare the output of whisper-info upper.wsp and whisper-info upper.wsp.bak to ensure results are as expected

7.) Delete the .bak backup

Yolo Command

find /var/lib/carbon/whisper/stats \( -name 'upper.wsp' -o -name 'upper_90.wsp' -o -name 'lower.wsp' \) -exec whisper-resize --xFilesFactor=0 '{}' 10s:5m 5m:1d 1h:30d 1d:2y \; -exec chown carbon:carbon '{}' \; -exec chown carbon:carbon '{}.bak' \;  -print
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment