1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
Dismiss Notice

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!

MS Excel Script to read Tomato RStat Files

Discussion in 'Asuswrt-Merlin' started by Jeffrey Young, Feb 17, 2020.

Tags:
  1. Jeffrey Young

    Jeffrey Young Occasional Visitor

    Joined:
    Dec 22, 2019
    Messages:
    32
    Location:
    Canada
    Hello everyone,

    Updated March 15, 2020
    Found a bug in the Month Addition and fixed.

    After trying a number of python scripts that I found elsewhere that claims to read the Tomato Rstat files that Merlin creates to no avail (did not find any script that did not result in some error), I decided to create my own script in Excel VBA.

    The MS Excel workbook with the script is here: https://www.dropbox.com/s/s33jz4r2dgooye9/Rstat_Read.zip?dl=0

    The file is zipped and will need to be unzipped first.

    Using the script is straight forward;

    1. Open the workbook and enable macros (you guys don't me from a hole in the wall, so please make sure you scan the file for bad bugs).

    2. Click on the radio button at the top of the worksheet. An open file dialog box will open and ask you for an UNCOMPRESSED tomato RSTAT file. There are plenty of freeware and shareware archive utilities around that can unzip the *.gz rstat file. I use 7-zip. You can also use gunzip from a terminal window in Merlin to unzip the file. If you go the route of using the routers gunzip, copy the rstat file first and unzip the copy. I have a script that copies a backup of the rstat*.gz file to my NAS nightly.

    3. The script creates a new workbook with the stats from the rstat file loaded. You can then change the units on the drop down box to show the data in Kilobytes, Megabytes, or Gigabytes.

    The Rstat file stores 61 days of daily usage and up to 24 months of monthly usage.

    I make no copyright claim, please feel free to use it as you wish. I just wanted something to get the data out and decided to share the file. If there is a better way of sharing the file, I am open to suggestions.

    Cheers
     
    Last edited: Mar 15, 2020
    ColinTaylor, joe scian and elorimer like this.
  2. Jeffrey Young

    Jeffrey Young Occasional Visitor

    Joined:
    Dec 22, 2019
    Messages:
    32
    Location:
    Canada
    Hello all, I found a bug in the monthly totals (was unaware of how RSTAT writes end of month data).

    Anyway, fixed the addition error and updated the DropBox link.