"IP Traffic Monitoring" gettings wiped out on setting change

Discussion in 'Tomato Firmware' started by Morac, Apr 28, 2012.

  1. Morac

    Morac Network Guru Member

    I have a LinkSys E3000. I've been running the Toastman USB-ext-VPN builds which have "IP Traffic Monitoring" in them. Every load I've tried (up till the latest) has the following problem.

    Any time the cstats process stops and starts, such as clicking save on the "Admin: IP Traffic Monitoring" page, all the IP traffic data gets wiped out. The same thing happens if I manually back up the cstats data file and restore it. It basically looks like cstats can't read in the existing cstats data so it just dumps it and starts fresh.

    Similarly if I back up the cstats data on the "Admin: IP Traffic Monitoring" and try to restore it, I usually get an "Error reading file" message. Today is the first time I could actually restore it successfully, but that might be because I saved it right after it got wiped so there was very little data to read.

    It works fine as long as I don't cause cstats to stop and start. I've gone as long as about 70 days uptime and that entire time had IP traffic data. I lost all of it, when I changed a setting.

    There are no errors in the log file. Here's the NVRAM data (I've wiped the NVRAM so that's not it either)
  2. Planiwa

    Planiwa Network Guru Member

    Leaving the particulars aside . . .

    Imagine a world where, when you change a setting in a GUI page, nothing else is molested, nothing is reset, restarted, or removed except what is necessary, reasonable, expected, and good, and all pending "collateral" damage is disclosed, with an option to rethink, when you click on [Save].

    We can dream, can't we? :)
  3. Morac

    Morac Network Guru Member

    So I take it that no one (not even the person who wrote this) knows why this is happening?
  4. Morac

    Morac Network Guru Member

    I decided to save the cstats data on CIFS1. That seems to be working, but I haven't run it long enough to see if that has the same problem.

    Looking at the code though it looks like cstats won't restore from the web UI if the data file gets larger than 10 KB in size. The cstats data file grows to be that large in about a day so that explains why it won't load any more.

    Any reason for the 10 KB limit?
  5. teaman

    teaman LI Guru Member

    Hello - I'm person who wrote this IPTraffic/cstats extension for Tomato and I think I do know why these problems are happening. I just don't have a lot of time available/dedicated to such a voluntary project.

    Please have a look at this post:

    These issues with backup/restore from the web UI are related and pretty much the same kind of thing is happening in this case.

    While a fix isn't available, please try running cstats with the 'Create Backups' option enabled (cstats_bak=1), ensure the volume/path set in 'Save History Location' is mounted and available at all times, as well as perhaps reducing the 'Save Frequency' to something smaller (cstats_stime default = once every 2 days). Also, it might be advisable to disable the 'Enable Auto-Discovery' option and just configure which IPs you want to monitor/keep track on the Basic->Static DHCP/ARP page.

    By the way, this would be probably the best place to report problems on Teaman-related features:

    When in doubt about the author of a particular feature, have a look a the 'About' page as it should help.


    EDIT: fixed in my (local) git repo, should be pushed to the public git repo soon.
  6. Morac

    Morac Network Guru Member

    Thanks for responding.

    I think 100k might be overkill as I've never seen anything larger than 20k, but if it doesn't cause problems that should be good. Thanks.

    As for my other problem where the cstats data simply gets wiped out when pressing the save button on "Admin: IP Traffic Monitoring" page (or stopping and starting cstats), that appears to only happen if the cstats data is saved to RAM. Looking at the "load" procedure, it looks like it doesn't even bother to load the existing "history_fn" file if it's being stored in RAM. That's not good, but it does explain why changing the location to CIFS1 works. That's not how rstats works which does the following code to restore the current rstats from the RAM disk (which is missing from cstats.c)

    Here's the starting lines in rstats.c and cstats.c, the above code is only in rstats.c, but not in cstats.c:



    I submitted the remaining issue at your site:

  7. teaman

    teaman LI Guru Member

    Thanks for filling the bug report!

    About sizes: the cstats-history.gz file in one of my routers is 26k (gzip, compressed), whereas it expands to about 395k when uncompressed (that's about 51 IPs being tracked, BTW).


    EDIT: actual file size is 403920 bytes. Since each entry uses 7920: 403920/7920 = 51 IPs ;)
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice