Quantcast
Channel: All EdgeRouter posts
Viewing all articles
Browse latest Browse all 60861

Re: My bandwidth monitoring solution....

$
0
0

Yes, you can.  That's how I have mine set up.

 

sudo vi /etc/init.d/vnstat

At line 27 insert the start (before the daemon starts):

if [ ! -d "/var/log/vnstat" ]; then
mkdir /var/log/vnstat
fi
cp /var/lib/vnstat/eth0 /var/log/vnstat/

Now around line 39 insert the stop additions (after the daemon stops):

cp /var/log/vnstat/eth0 /var/lib/vnstat/

 

On service start, this creates the directory if needed, then copies the database file from flash to ram.  Then on service stop it copies the file back from ram to flash so you can reboot without loosing your stats.

I also added a cron entry to restart vnstat every night at midnight so that my stat file gets saved to flash once per night in case of an unexpected shutdown or power outage.


Viewing all articles
Browse latest Browse all 60861

Trending Articles