Description
I have just followed these instructions:
http://www.4geeksfromnet.com/2009/04/graphical-bandwidth-monitor-for-ubuntu.html
I apologize if this is out of date. Rather than setting up a of cron job to create the data files for each interface, why not do it from a single php script and run it from either cron or index.php. Cron is probably the better option.
This feels a lot neater and requires only needs one script to be run by cron. The $data_dir obviously needs to be writable by the web server.
I'd recommend creating a file called "run.php" with the following contents:
<?php
require_once("config.php");
for($i = 0; $i < count($iface_list); $i++){
$vnstat_bin." --dumpdb -i ".$iface_list[$i]." > ".$data_dir."/vnstat_dump_".$iface_list[$i];
}
?>
The cron service now need only run: "wget http://localhost/vnstat/run.php"
Adding
require_once('run.php');
to index.php, the system will always be showing the most up to date information and cron is not even needed. (Probably not great for production systems)