Open Aerya opened 5 years ago
@Aerya thanks for submitting this issue.
Could you please run "vnstat --json" on your system and attach the results to this issue and I can look into this for you.
Many thanks, Alex
vnstat2.x uses a different json tag for interface names. ('name' instead of 'id') The pull request for #35 also adds vnstat2 support.
"interfaces": [ { "name": "br0", "alias": "", "created": { "date": { "year": 2019, "month": 6, "day": 25 } }, "updated": { "date": { "year": 2019, "month": 10, "day": 11 }, "time": { "hour": 9, "minute": 5 } }, "traffic": { "total": { "rx": 1378209818161, "tx": 723392017482 }, ...
I have got the same issue (vnstat 2.6)
My config.php
// Set to true to set your own interfaces
$use_predefined_interfaces = true;
if ($use_predefined_interfaces == true) {
$interface_list = ["eth0", "eth1", "tun0"];
$interface_name['eth0'] = "Internal #1";
$interface_name['eth1'] = "Internal #2";
$interface_name['tun0'] = "VPN Tunnel";
}
The other guy on here who said that 'id' has been changed to 'name' is correct, you just need to modify 2 lines in the file...
/vnstat/includes/vnstat.php
line 81: array_push($vnstatInterfaces, $interface['name']);
Line 98: $arrayIndex = array_search($interface, array_column($this->vnstatData['interfaces'], 'name'));
And it works on vnstat 2.6 (Ubuntu 20.10).
hi,
Using your Docker. Vnstat compiled from sources: vnStat 2.4 by Teemu Toivola
Here's my config file:
// Disable error reporting to screen
/ini_set('display_errors', 0);
error_reporting(E_ALL);/
// Set the default system Timezone date_default_timezone_set('Europe/Paris');
// Path of vnstat $vnstat_bin_dir = '/usr/bin/vnstat';
// Set to true to set your own interfaces $use_predefined_interfaces = true;
if ($use_predefined_interfaces == true) { $interface_list = ["enp3s0", "veth031f9b8", "vethada0f5f"];
}
I have no interface to select in the WebUI.
Thanks