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

RSTATS save/restore issue

Discussion in 'Tomato Firmware' started by Morac, Dec 1, 2008.

  1. Morac

    Morac Network Guru Member

    I'm using the FTP script to backup and restore the bandwidth history and today after rebooting I noticed it wasn't restored correctly. I checked and saw that even though the data was restored it wasn't being read correctly. I finally tracked the problem down to the fact that rstats does not like a rstats-history file being in the /tmp/var/lib/misc directory. I'm not sure where that file came from since normally the file is named rstats-history.gz (it is compressed), but I found that the update that had been created on reboot (and restored) had a rstats-history file and a rstats-history.gz file of 0 length. This is what caused the problem. Any idea why this occurred?
  2. mraneri

    mraneri Network Guru Member

    I saw notes in 1.22 that there was some change in how the history is stored. I don't know if it kills the script or not, as I have not upgraded yet. Someone else may have more info than I do at the moment.

    I haven't upgraded yet, though, because if it ain't broke, don't fix it... Though TCP-Vegas may be a reason for me to do so in the near future. If it hasn't been figured out by then, I'll check into it.
  3. Morac

    Morac Network Guru Member

    I figured out the problem. The script gives rstat 1 second to write the data to "disk" before it TARs it up for backup. Under 1.21 this was enough time, but under 1.22 the data may take longer than 1 second to dump and I ended up TARing the files before the history files were gziped. This caused a corruption on the restore. Fortunately the data was good so I could just gzip it and then force a restore, so I only lost about 6 hours worth of history. Unfortunately I had downloaded about 5.2 GB during those 6 hours. Oh well.

    I'm not sure if this is really a 1.22 issue or if it's because I now have a much longer history (9 months worth). In any case I bumped up the delay to 3 seconds and now it works.
  4. LeoKesler

    LeoKesler Addicted to LI Member

    How I can to change this delay ?
  5. mraneri

    mraneri Network Guru Member

    Good catch.
    It's possible something changed. I had 16 months of history with no problem in 1.17 (before I killed it accidentally due to my own error.)
  6. Morac

    Morac Network Guru Member

    Assuming you use a script based on the ones in this thread, just bump up the number after the word sleep.
  7. mraneri

    mraneri Network Guru Member

    The "sleep" AFTER the "killall -1 rstats"
  8. Morac

    Morac Network Guru Member

    Yes, that's correct. I forgot to mention that since my script only has one sleep statement in it.

    Also don't make it too large since Jon wrote me that the shutdown processing only waits 10 seconds for the scripts to complete. If the stat backup hasn't occurred by that point, it won't happen.

Share This Page