Now I wonder how I can merge my rstats data from multiple backups into one rstats database.
00 06 79 00 00 00 00 00 00 CA 9A 38 00 00 00 00 00 CA 9A 38 00 00 00 00
1C 02 7A 00 00 00 00 00 52 D6 2B 91 02 00 00 00 4E AE 0E 1A 00 00 00 00
1D 02 7A 00 00 00 00 00 5F 6E D5 97 03 00 00 00 5E 63 C6 1D 00 00 00 00
1E 02 7A 00 00 00 00 00 60 7E 1C 0D 03 00 00 00 C9 10 15 B9 03 00 00 00
1F 02 7A 00 00 00 00 00 E8 B1 B0 9B 00 00 00 00 EF 95 AC A3 08 00 00 00
1D 00 7A 00 00 00 00 00 B5 36 FC EB 03 00 00 00 DC 79 FB 20 00 00 00 00
1E 00 7A 00 00 00 00 00 01 F3 62 A1 02 00 00 00 DF AD 08 5C 00 00 00 00
...
3/28/2022 11025503826 437169742
3/29/2022 15432248927 499540830
3/30/2022 13104873056 15990067401
3/31/2022 2612048360 37105735151
1/29/2022 16844076725 553351644
1/30/2022 11297551105 1544072671
...
# RStats log format:
# First four bytes are magic string that indicate version
# Next four bytes are empty, presumably for QWORD alignment
# Next 24 bytes are empty, for future usage?
# Next are 61 3-tuples for day-level stats,
# contains date, download and upload totals (8 byte/value)
# Next is one-byte counter that should match actual number of previous 3-tuples
# Next seven bytes are empty, presumably for QWORD alignment
# Next 24 bytes are empty, again for future usage?
# Next are 12 3-tuples for month-level stats,
# contains date, download and upload totals (8 byte/value)
# Version 1 logfiles hold another 12 month-level stat entries
# Last is one-byte counter that should match actual number of previous 3-tuples
year = ((num >> 16) & 0xFF) + 1900
month = ((num >> 8) & 0xFF) + 1
day = (num & 0xFF) or 1
Upon further examination, I think my rstats files had complete daily data, but the Excel script didn't pick up on them because it presumes them to be in chronological order in the rstats file. It doesn't appear that the daily data are in chronological order. For example, from my rstats backup:
Code:1C 02 7A 00 00 00 00 00 52 D6 2B 91 02 00 00 00 4E AE 0E 1A 00 00 00 00 1D 02 7A 00 00 00 00 00 5F 6E D5 97 03 00 00 00 5E 63 C6 1D 00 00 00 00 1E 02 7A 00 00 00 00 00 60 7E 1C 0D 03 00 00 00 C9 10 15 B9 03 00 00 00 1F 02 7A 00 00 00 00 00 E8 B1 B0 9B 00 00 00 00 EF 95 AC A3 08 00 00 00 1D 00 7A 00 00 00 00 00 B5 36 FC EB 03 00 00 00 DC 79 FB 20 00 00 00 00 1E 00 7A 00 00 00 00 00 01 F3 62 A1 02 00 00 00 DF AD 08 5C 00 00 00 00 ...
Translated to human-readable:
Code:3/28/2022 11025503826 437169742 3/29/2022 15432248927 499540830 3/30/2022 13104873056 15990067401 3/31/2022 2612048360 37105735151 1/29/2022 16844076725 553351644 1/30/2022 11297551105 1544072671 ...
However, the Excel sheet only picks up on the data from 3/28-3/31.
What's also interesting is the disparity between rstats and Traffic Analyzer. For example, rstats reports 13,104,873,056 bytes downloaded on 3/30. However, Traffic Analyzer reports 12,857,189,520 bytes downloaded on 3/30.
killall -SIGTERM rstats
it does write out all its files in /var/lib/misc
, but when you start rstats again it has "lost" all the "Last 24 hours" data. It picks up all the other data from past days and months, but today's data up until the time the process was killed is lost.LOL -> FAIL , "killall" wont workI will PM the data.
It looks like once the rstats daily data reaches the limit it just rolls over and starts overwriting the oldest daily data and advances from there.
I was able to put everything together by cutting/pasting 24-byte blocks between rstats files in a hex editor.
The only hiccup I noticed was that if youkillall -SIGTERM rstats
it does write out all its files in/var/lib/misc
, but when you start rstats again it has "lost" all the "Last 24 hours" data. It picks up all the other data from past days and months, but today's data up until the time the process was killed is lost.
It worked fine.LOL -> FAIL , "killall" wont work
admin@RT-AX86U-AR28:/var/lib/misc# killall -SIGTERM rstats
admin@RT-AX86U-AR28:/var/lib/misc# pidof rstats
admin@RT-AX86U-AR28:/var/lib/misc#
killall -SIGERM rstats
service start_rstats
Yes it does. Maybe you don't know what the killall command is. LOLLOL -> FAIL , "killall" wont work
That's just cosmetic as the "last 24 hours" graph data is held in memory. The data is still recorded in the rstats file up until the last save - which is why you should set the save frequency to 1 hour.The issue with losing today's stats happens even if you don't do anything with the data files. Just look at your "Last 24 hours" data and then execute:
Code:killall -SIGERM rstats service start_rstats
Now go look at your "Last 24 hours" and see that it's empty.
I thought it was to kill any processes matching the name given as the argument?Yes it does. Maybe you don't know what the killall command is. LOL
I wish it would save that state, too. Of course it's not a big deal but it is a little annoying.That's just cosmetic as the "last 24 hours" graph data is held in memory. The data is still recorded in the rstats file up until the last save - which is why you should set the save frequency to 1 hour.
I will PM the data.
It looks like once the rstats daily data reaches the limit it just rolls over and starts overwriting the oldest daily data and advances from there.
I was able to put everything together by cutting/pasting 24-byte blocks between rstats files in a hex editor.
The only hiccup I noticed was that if youkillall -SIGTERM rstats
it does write out all its files in/var/lib/misc
, but when you start rstats again it has "lost" all the "Last 24 hours" data. It picks up all the other data from past days and months, but today's data up until the time the process was killed is lost.
I found a python script that spits out comma-separated human-readable data from an rstats file in case anyone is interested. It can be handy if you want to keep data longer term than the 24 months that the rstats format will allow.
GitHub - VREMSoftwareDevelopment/rstats-cstats: Tomato USB Python scripts to dump RStats and CStats information
Tomato USB Python scripts to dump RStats and CStats information - VREMSoftwareDevelopment/rstats-cstatsgithub.com
I was able to run it using python under cygwin.I've seen this script. I tried to port it at one time to Windows using a windows python compiler, but had luck. It is what prompted me to write the Excel script for windows.
I was able to run it using python under cygwin.
Welcome To SNBForums
SNBForums is a community for anyone who wants to learn about or discuss the latest in wireless routers, network storage and the ins and outs of building and maintaining a small network.
If you'd like to post a question, simply register and have at it!
While you're at it, please check out SmallNetBuilder for product reviews and our famous Router Charts, Ranker and plenty more!