mbolli / nfsen-ng

Responsive NetFlow visualizer built on top of nfdump tools.
Apache License 2.0
231 stars 43 forks source link

Got 400 - Bad Request. rrd_xport failed. unknown option '--json' #11

Closed oishiiLatte closed 5 years ago

oishiiLatte commented 6 years ago

Hi.

I got this error when open the frontend

Got 400 - Bad Request. rrd_xport failed. unknown option '--json'

I already make sure the rrdtool that I installed on server is latest version.

Can you help me

mbolli commented 6 years ago

What's your exact rrdtool version?

oishiiLatte commented 6 years ago

ver 1.7.0

mbolli commented 5 years ago

Hey, can you check if you have libxml2 installed? Should be covered by librrd-dev's dependencies, but you never know... Generally the --json option was introduced with rrdtool 1.4.6 at the beginning of 2012 – are you sure it actually uses version 1.7.0?

crognlie commented 5 years ago

I'm having the same issues. Brand new 18.04.2 LTS install.

Trying to answer most of your questions in this issue and the previous one (#17):

ls -l /usr/lib/x86_64-linux-gnu/ | grep libxml2
lrwxrwxrwx  1 root root       16 Aug 10  2018 libxml2.so.2 -> libxml2.so.2.9.4
-rw-r--r--  1 root root  1834232 Aug 10  2018 libxml2.so.2.9.4

which rrdtool
/usr/bin/rrdtool

rrdtool -v | head -2
RRDtool 1.7.0  Copyright by Tobias Oetiker <tobi@oetiker.ch>
               Compiled Mar  1 2018 09:35:27

ls -lR /var/netflow/
/var/netflow/:
total 8
drwxr-xr-x 3 root root 4096 May 16 10:40 2019
-rw-r--r-- 1 root root  276 May 16 11:10 nfcapd.current.14567

/var/netflow/2019:
total 4
drwxr-xr-x 3 root root 4096 May 16 10:40 05

/var/netflow/2019/05:
total 4
drwxr-xr-x 2 root root 4096 May 16 11:10 16

/var/netflow/2019/05/16:
total 236
-rw-r--r-- 1 root root 10364 May 16 10:40 nfcapd.201905161035
-rw-r--r-- 1 root root 42340 May 16 10:45 nfcapd.201905161040
-rw-r--r-- 1 root root 33324 May 16 10:50 nfcapd.201905161045

diff settings.php settings.php.dist
24,25c24,25
<         'binary' => '/usr/local/bin/nfdump',
<         'profiles-data' => '/var/netflow',
---
>         'binary' => '/usr/bin/nfdump',
>         'profiles-data' => '/var/nfdump/profiles-data',
27c27
<         'max-processes' => 2, // maximum number of concurrently running nfdump processes
---
>         'max-processes' => 1, // maximum number of concurrently running nfdump processes

grep '^DAEMON_ARGS' /etc/init.d/nfdump
DAEMON_ARGS="-4 -w -D -S 1 -B 256000 -l $DATA_BASE_DIR -p 9995 -P $PIDFILE"

nfsen installed with 'git clone https://github.com/mbolli/nfsen-ng' today, nfdump 1.6.17 compiled with '--enable-nfprofile' yesterday. Same error on the page when loading /nfsen-ng/frontend/ :

Got 400 - Bad Request. rrd_xport failed. opening '/var/www/html/nfsenng/backend/datasources/data/source1.rrd': No such file or directory

Changing to LOG_DEBUG in settings.php doesn't give any extra information in syslog or apache access/error logs. This is what the request and the 400 error look like in apache log:

[16/May/2019:11:02:25 -0700] "GET /nfsen-ng/frontend/ HTTP/1.1" 200 4072 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.131 Safari/537.36" [16/May/2019:11:02:25 -0700] "GET /nfsen-ng/api/config HTTP/1.1" 200 453 "http://10.51.1.33/nfsen-ng/frontend/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.131 Safari/537.36" [16/May/2019:11:02:25 -0700] "GET /nfsen-ng/api/graph?datestart=1526493746&dateend=1558029746&type=flows&protocols%5B%5D=any&sources%5B%5D=source1&sources%5B%5D=source2&ports%5B%5D=0&display=sources HTTP/1.1" 400 419 "http://10.51.1.33/nfsen-ng/frontend/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.131 Safari/537.36" [16/May/2019:11:03:25 -0700] "GET /nfsen-ng/api/graph?datestart=1526493746&dateend=1558029806&type=flows&protocols%5B%5D=any&sources%5B%5D=source1&sources%5B%5D=source2&ports%5B%5D=0&display=sources HTTP/1.1" 400 419 "http://10.51.1.33/nfsen-ng/frontend/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.131 Safari/537.36"

And this is what I see in syslog:

May 16 18:02:25 graf apache2: nfsen-ng: Was not able to find /var/www/html/nfsen-ng/backend/datasources/data/source1.rrd May 16 18:02:25 graf apache2: nfsen-ng: Was not able to find /var/www/html/nfsen-ng/backend/datasources/data/source2.rrd May 16 18:02:25 graf apache2: nfsen-ng: 400 - Bad Request. rrd_xport failed. opening '/var/www/html/nfsen-ng/backend/datasources/data/source1.rrd': No such file or directory

mbolli commented 5 years ago

Can you post a listing of /var/www/html/nfsen-ng/backend/datasources/data/?

crognlie commented 5 years ago

There is no data subdir:

`/var/www/html/nfsen-ng$ ls backend/datasources/

akumuli.php datasource.php rrd.php`

Dona21 commented 5 years ago

Hi,

It seems that no import has been done before starting the daemon. My suggestion is to import the data first. Can you reboot the machine and try a complete import before to start the daemon ?

Locate the directory where cli.php is located and cd there : cd /var/www/html/nfsen-ng/backend

As root, run the import command ./cli.php -f -p -ps import

Hossein124 commented 4 years ago

Hi,

It seems that no import has been done before starting the daemon. My suggestion is to import the data first. Can you reboot the machine and try a complete import before to start the daemon ?

Locate the directory where cli.php is located and cd there : cd /var/www/html/nfsen-ng/backend

As root, run the import command ./cli.php -f -p -ps import

Hi Dana /var/www/html/nfsen-ng/backend# ./cli.php -f -p -ps import 2020-06-07 05:18:02 CLI: Starting import Resetting existing data...

Processing 2 sources... 0.0% 0/2194 ETC: ???. Elapsed: < 1 sec [> ]PHP Fatal error: Uncaught Exception: Could not read nfdump profile directory /var/nfdump/profiles-data/live in /var/www/html/nfsen-ng/backend/common/import.php:56 Stack trace:

0 /var/www/html/nfsen-ng/backend/cli.php(67): nfsen_ng\common\Import->start(Object(DateTime))

1 {main}

thrown in /var/www/html/nfsen-ng/backend/common/import.php on line 56 Plz Help me

Dona21 commented 4 years ago

Hi Hossein,

Let's try to find out where that could come from ;)

Please note that your issue seems not to be related with this closed one, opening another one would be better.

Thanks and regards