What's new

Request: Write traffic stats before reboot.

  • SNBForums Code of Conduct

    SNBForums is a community for everyone, no matter what their level of experience.

    Please be tolerant and patient of others, especially newcomers. We are all here to share and learn!

    The rules are simple: Be patient, be nice, be helpful or be gone!

Bagman

Regular Contributor
I've got a feature request for traffic stats. Like a lot of people, I log my stats to a USB device.

I've noticed that when you reboot the router, you lose any record of traffic stats since the last time the stats were written out to disk/jffs. Would it be possible for you to change it so that when the unit is rebooted, it writes the stats out if they are stored somewhere other than RAM before it actually reboots?

Obviously this won't make any difference if the router crashes, or is manually powered off, but for normal GUI driven reboots or when upgrading firmware, it means the user doesn't lose up to an hour of traffic stats.

I don't know if you would want to implement it the same for anything that happens over the command line when telnetted into the router, or just allow normal reboot/shutdown commands as is. I'd be quite happy if it was just the GUI was clever enough to write out stats if asked to reboot.
 
Just put the right command in the services-stop script?

(I don't know the right command, maybe there isn't one to force writing the statistics?)
 
I've got a feature request for traffic stats. Like a lot of people, I log my stats to a USB device.

I've noticed that when you reboot the router, you lose any record of traffic stats since the last time the stats were written out to disk/jffs. Would it be possible for you to change it so that when the unit is rebooted, it writes the stats out if they are stored somewhere other than RAM before it actually reboots?

Obviously this won't make any difference if the router crashes, or is manually powered off, but for normal GUI driven reboots or when upgrading firmware, it means the user doesn't lose up to an hour of traffic stats.

I don't know if you would want to implement it the same for anything that happens over the command line when telnetted into the router, or just allow normal reboot/shutdown commands as is. I'd be quite happy if it was just the GUI was clever enough to write out stats if asked to reboot.
Since you are in control of the reboot, before doing it could you just use the RT-x66U menus to either "eject" the device, or "safely remove disk" from the "Network Map" ?

GH
 
I've got a feature request for traffic stats. Like a lot of people, I log my stats to a USB device.

I've noticed that when you reboot the router, you lose any record of traffic stats since the last time the stats were written out to disk/jffs. Would it be possible for you to change it so that when the unit is rebooted, it writes the stats out if they are stored somewhere other than RAM before it actually reboots?

Obviously this won't make any difference if the router crashes, or is manually powered off, but for normal GUI driven reboots or when upgrading firmware, it means the user doesn't lose up to an hour of traffic stats.

I don't know if you would want to implement it the same for anything that happens over the command line when telnetted into the router, or just allow normal reboot/shutdown commands as is. I'd be quite happy if it was just the GUI was clever enough to write out stats if asked to reboot.

It's supposed to do that (stats get written to disk when cstats/rstats are shutting down), but I can check to make sure it's actually working.
 
Since you are in control of the reboot, before doing it could you just use the RT-x66U menus to either "eject" the device, or "safely remove disk" from the "Network Map" ?

GH

That will remove the disk and make sure the write buffer is empty, that won't make the router write out the stats half an hour early, the data is in ram, not sent to the disk yet.
 
Last edited:
It's supposed to do that (stats get written to disk when cstats/rstats are shutting down), but I can check to make sure it's actually working.

It's not working on mine. I know I downloaded nearly a couple of gigs this morning, and then updated to the release firmware. After the router rebooted and came back up, it only showed the .03 of a gig downloaded after midnight last night.

It seems to me that if you reboot, you just loose whatever traffic data is waiting to be written at the "every hour" mark.
 
It's not working on mine. I know I downloaded nearly a couple of gigs this morning, and then updated to the release firmware. After the router rebooted and came back up, it only showed the .03 of a gig downloaded after midnight last night.

It seems to me that if you reboot, you just loose whatever traffic data is waiting to be written at the "every hour" mark.

Could be that the firmware is removing the USB disk before closing down the traffic monitoring services, so it no longer has access to the datafile to save it. I'll have to check.
 
That will remove the disk and make sure the write buffer is empty, that won't make the router write out the stats half an hour early, the data is in ram, not sent to the disk yet.
I understand your point. I was under the impression that the data was sent "live" to the disk. Sorry.

GH
 
I understand your point. I was under the impression that the data was sent "live" to the disk. Sorry.

GH


No, the most frequently you can write the traffic data is every hour. If you did it all the time you would risk wearing out the flash ram. Not a big deal with a cheap USB stick, but if you were storing the traffic data on /jffs, it would be a bit harsh.
 

Latest threads

Sign Up For SNBForums Daily Digest

Get an update of what's new every day delivered to your mailbox. Sign up here!
Top