bjd / vnstat-php-frontend Goto Github PK
View Code? Open in Web Editor NEWPHP frontend for vnStat network traffic monitor
Home Page: http://www.sqweek.com
License: Other
PHP frontend for vnStat network traffic monitor
Home Page: http://www.sqweek.com
License: Other
Can we do a live monitoring using the PHP front end?
No svg graphs are shown, after digging into it, the svg contains a notice like
Notice: Array to string conversion in $webroot/vnstat/graph_svg.php on line 48
so as a quick workaround, these changes to the config.php file are helping, as long as this is not fixed
-error_reporting(E_ALL | E_NOTICE);
+error_reporting(E_ALL & ~E_NOTICE);
Hi team,
I just tried your vnstat PHP frontend and calling "php vnstat.php" from CLI failed with error in line 47 (T() undefined function).
What went wrong, pls ? My handling of the script, or something else ?
Thank you and kind regards
Michael
Hi.
I think variables "$vnstat_bin" and "data_dir" in config should be default commented (or ='').
In vnstat.php in function get_vnstat_data:
if (!isset($vnstat_bin) || $vnstat_bin == '')
should be inverted to:
if (isset($vnstat_bin) && $vnstat_bin != '')
(If we have set location of dump get data from file)
Hi, love this vnstat interface!
I'd really like to see a "realtime" page to show vnstat data if it is running in live (-l) mode.
At the moment I can only see hourly, daily & monthly.
Thanks for reading!
Hello,
I'm not sure how much are you maintaining this project.
vnstat from version 2.0 doesn't support command vnstat --dumpdb
as it is currently required for your frontend to fill the data from vnstat.
Here is the ticket and suggestion from vnstat
maintainer: vergoh/vnstat#141
Seems that the best option would be using command:
vnstat --json
which exports data to json format and then to parse it properly.
What is your opinion?
I know, you may answer - "well, try to fix it yourself" . Maybe, not sure/not much time at the moment.
Thanks.
All the best,
Frank
It looks like vnstat-php is trying to auto-detect the script's location and force all links to be under this root. This doesn't work if the location cannot be auto-detected (e.g. script is behind a reverse proxy).
I'm not actually sure if there's much point in the $script
variable, as there's non-dynamic references to graph_svg.php, for example (so some dynamic path detection isn't being used anyway). I suppose if you want to allow the user to rename index.php to something else, it may come in handy, in which case, using basename
on the $script
variable would be just as effective.
Thanks for the script!
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)
I've followed every instruction here.
using vnstat 1.10
frontend 1.5.2
Do you have a docker image for your php frontend?
I would like to see all data in KB (or MB) instead of "auto" b/kb/mb/gb. This allows me to see at a glance very large and very small values.
Hi all,
Thank you for this great tool... But was wondering if you arent planning to upgrade the actual version using google charts... It is way better, more "shiny" and much beautiful :)
Thanks anyway :)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.