Save the traffic log data to NVRAM more often?

Post new topic   Reply to topic    DD-WRT Forum Index -> Broadcom SoC based Hardware
Author Message
JN
DD-WRT Guru


Joined: 29 Mar 2007
Posts: 771

PostPosted: Sun Sep 07, 2014 19:21    Post subject: Save the traffic log data to NVRAM more often? Reply with quote
How might I cause the router to save the traffic log data (daily internet consumption) more often. I understand it is saved only once a day and may be lost if router is rebooted. Is there a command I can use to force a write to NVRAM that I can issue manually or place in a cron job?

Thanks
Sponsor
cdmarshall
DD-WRT User


Joined: 09 Jul 2014
Posts: 308

PostPosted: Sun Sep 07, 2014 20:18    Post subject: Reply with quote
I do not believe that would at all be a good idea and would be difficult to implement. It would make more sense to send it outside the router to a USB or CIFS drive for storage. NVRAM is only 64k and if you fill it up with stuff that isn't needed to run the router.
_________________
EA-6900
Asus 68U
JN
DD-WRT Guru


Joined: 29 Mar 2007
Posts: 771

PostPosted: Mon Sep 08, 2014 5:15    Post subject: Reply with quote
cdmarshall wrote:
I do not believe that would at all be a good idea and would be difficult to implement. It would make more sense to send it outside the router to a USB or CIFS drive for storage. NVRAM is only 64k and if you fill it up with stuff that isn't needed to run the router.
I am just talking about the daily statistic of how much is uploaded/downloaded which does not take a lot of space. But I would be interested in how to store it on a thumbdrive as well as how to save it more often.
barryware
DD-WRT Guru


Joined: 26 Jan 2008
Posts: 13049
Location: Behind The Reset Button

PostPosted: Mon Sep 08, 2014 14:25    Post subject: Reply with quote
nvram commit

will save the ttraff data

_________________
[Moderator Deleted] Shocked
cdmarshall
DD-WRT User


Joined: 09 Jul 2014
Posts: 308

PostPosted: Mon Sep 08, 2014 14:42    Post subject: Reply with quote
Barry,
are you saying that that command alone will save it? Shouldn't you have to redirect it as the traffic daemon saves it in RAM. You would have to move it to NVRAM wouldn't you?

_________________
EA-6900
Asus 68U
barryware
DD-WRT Guru


Joined: 26 Jan 2008
Posts: 13049
Location: Behind The Reset Button

PostPosted: Mon Sep 08, 2014 14:58    Post subject: Reply with quote
try it.

nvram commit from telnet or the admin commmands tab, reboot the router. your ttraff data will be there.

you can also backup & restore the ttraff data from the wan status screen.

nvram is shadowed into ram when the router boots. notice in regard to changing parameters there is save and apply?

changes to nvram happen in ram. the commit (or apply) saves the nvram section that is in ram to the nvram area of the flash chip.

depending on what you change, the apply may reboot the router so services can stop / start with the new nvram variable.

_________________
[Moderator Deleted] Shocked
cdmarshall
DD-WRT User


Joined: 09 Jul 2014
Posts: 308

PostPosted: Mon Sep 08, 2014 15:17    Post subject: Reply with quote
but couldn't we also set it to same elsewhere such as a USB attached storage. There must be a way to redirect it. Just thinking out loud now. will have to look into that today.
_________________
EA-6900
Asus 68U
barryware
DD-WRT Guru


Joined: 26 Jan 2008
Posts: 13049
Location: Behind The Reset Button

PostPosted: Mon Sep 08, 2014 15:24    Post subject: Reply with quote
cdmarshall wrote:
but couldn't we also set it to same elsewhere such as a USB attached storage. There must be a way to redirect it. Just thinking out loud now. will have to look into that today.


that has been a feature requested in trac for a few years by myself and others but has not been addressed and probably will not be.

_________________
[Moderator Deleted] Shocked
cdmarshall
DD-WRT User


Joined: 09 Jul 2014
Posts: 308

PostPosted: Mon Sep 08, 2014 15:35    Post subject: Reply with quote
that i can understand but here are a few scripts i found that may help get where we want to go.

http://infodepot.wikia.com/wiki/Tc23emp

http://www.dd-wrt.com/wiki/index.php/Useful_Scripts
#!/bin/sh
T=0
D=`nvram show|grep traff-|cut -f1 -d=|awk -F"-" '{print $3,$2}'|cut -b-4,6-`
for d in $D
do
if [ $T -lt $d ]
then
T=$d
fi
done
T=`expr $T - 100`
for d in $D
do
if [ $T -gt $d ]
then
N=traff-`echo ${d}|cut -b5-`-`echo ${d}|cut -b-4`
nvram unset $N
fi

and then of course to clear the traffic data so it doesn't fill you NVRAM up

for i in `nvram show | grep traff- | cut -f1 -d=""`; do nvram unset $i; done

at least its a stating point to figure out options for moving it. If we can get it to a file to email it we should be able to get it to a file to store it elsewhere.

_________________
EA-6900
Asus 68U
JN
DD-WRT Guru


Joined: 29 Mar 2007
Posts: 771

PostPosted: Wed Sep 10, 2014 19:35    Post subject: Reply with quote
barryware wrote:
nvram commit

will save the ttraff data
Does this write only the blocks of NVRAM that have changes, or does it write them all?

If I put this in a cron tab to run 3-4 times a day is that going to put significant wear on the flash over a year or two, as compared to the normal once a day writes of the traffic plus normal occasional changes of settings?
barryware
DD-WRT Guru


Joined: 26 Jan 2008
Posts: 13049
Location: Behind The Reset Button

PostPosted: Wed Sep 10, 2014 19:59    Post subject: Reply with quote
it writes them all.

is your ttraff data that important you feel it is necessary to write it several times per day?

why don't you just save it as often as you want and write it in the event you need to.

There are several scripts about in regard to saving the routers config.

I use Fraters backup script and save the backup to an sd card.

You can customize Fraters script once you know how it works to save any part of nvram you want.

_________________
[Moderator Deleted] Shocked
JN
DD-WRT Guru


Joined: 29 Mar 2007
Posts: 771

PostPosted: Fri Sep 12, 2014 13:40    Post subject: Reply with quote
I just want to save it back to the NVRAM more often. Will it cause significant wear on the flash over a few years if I write it out 3-4 times a day on a cron tab? If someone has a way to move it to USB that would be OK too.
JN
DD-WRT Guru


Joined: 29 Mar 2007
Posts: 771

PostPosted: Thu Nov 13, 2014 19:18    Post subject: Reply with quote
Anyone have any working solutions to save the traffic data on a USB device, either with the built-in traffic daemon, or some other optware? I would like to get something working on USB that saves more than once a day.

Thanks
Display posts from previous:    Page 1 of 1
Post new topic   Reply to topic    DD-WRT Forum Index -> Broadcom SoC based Hardware All times are GMT

Navigation

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum