bjd / vnstat-php-frontend

PHP frontend for vnStat network traffic monitor
http://www.sqweek.com
Other
142 stars 70 forks source link

vnstat --dumpdb #34

Open franko108 opened 4 years ago

franko108 commented 4 years ago

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: https://github.com/vergoh/vnstat/issues/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

richardh538 commented 3 years ago

Any news? Does anyone have a patch for this? Any reactions what so ever?

EDIT: Well, I ditched the vnstat-php-project, nothing seems to happen and when I started to re-write, I found vnstati which itself can give the same/or more extensive information

I replaced it with vnstati and this php-code:

exec('vnstati -s -i eno1 -o eno1_s.png', $vnstat); exec('vnstati -d -i eno1 -o eno1_d.png', $vnstat); exec('vnstati -5 -i eno1 -o eno1_5.png', $vnstat); exec('vnstati -t -i eno1 -o eno1_t.png', $vnstat); exec('vnstati -hg -i eno1 -o eno1_hg.png', $vnstat);

Then img source the files created...

Matter closed for my part.

vladns commented 3 years ago

Any news? Does anyone have a patch for this? Any reactions what so ever?

EDIT: Well, I ditched the vnstat-php-project, nothing seems to happen and when I started to re-write, I found vnstati which itself can give the same/or more extensive information

I replaced it with vnstati and this php-code:

exec('vnstati -s -i eno1 -o eno1_s.png', $vnstat); exec('vnstati -d -i eno1 -o eno1_d.png', $vnstat); exec('vnstati -5 -i eno1 -o eno1_5.png', $vnstat); exec('vnstati -t -i eno1 -o eno1_t.png', $vnstat); exec('vnstati -hg -i eno1 -o eno1_hg.png', $vnstat);

Then img source the files created...

Matter closed for my part.

Hello! Is it possible for more details please? Where should these lines be placed?

richardh538 commented 3 years ago

Don't overwrite any existing files, create a new site on your webserver. Install vnstati apt install vnstati (if running debian/ubuntu) Download index.txt Change extension of this file to php. Fix ownership/etc Edit the interfaces, if their names differ from eno1 and enp11s0. See this as a hack.

thrau commented 3 years ago

Any news? Does anyone have a patch for this? Any reactions what so ever?

i've created a fork that makes vnstat-php-frontend work with vnstat2 and the newly introduced --json flag that outputs the data as json. works with vnstat 2.6, but not well tested yet though. since there doesn't seem to be activity in this repo anymore, i'm not bothering with a PR for now.

https://github.com/thrau/vnstat2-php-frontend

LxNix commented 2 years ago

A wrapper that reads the --json output and converts to --dumpdb lookalike.

1.modify config.php: $vnstat_bin = '/xxx/myvnstat.py'

2.modify myvnstat.py: eth0 -> "Monitoring network card"

myvnstat.zip