I’ve made a limited translation of whisper-resize into Lua. I’ve run it on a few files, but not tested extensively. Instead of a command-line invocation, it just runs stand-alone and prompts for input. For example:
input path: whisper/uptime.m.wsp
%prog 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
old schema: 20m:30d  average
new archive retentions: 1h:7d 3h:30d 1d:1y
x files factor:
Retrieving all data from the archives
1 Mon Feb 20 16:40:00 2017
Creating new whisper database: whisper/uptime.m.wsp.new
Created: whisper/uptime.m.wsp.new (27984 bytes)
Migrating data without aggregation...
Mon Feb 20 16:40:00 2017
old archive 1 # non-null points: 643
Program completed in 95.47 seconds (pid: 13292).
You give it the whole path to the input Whisper file (including the .wsp) and it will use the SAME name with .new appended to that for the output file. In this example, I’m changing the archive structure from “20m:30d” to “1h:7d 3h:30d 1d:1y”. If you simply press in reply to any prompt, then it will pick up the existing parameter from the input file (as with the aggregation method and x files factor above.)
The source code has the complete python code as comments, so you should be able to follow along. The only obscure part is the internal callback I use when updating the new file to avoid it being opened and closed each time, as it would be if simply using whisper.update()
No guarantees. I suggest you give it a good test! But do come back to me with any problems.