Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
oishiiLatte opened this issue Apr 19, 2018 · 9 comments
Closed

Comments

@oishiiLatte
Copy link

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
Copy link
Owner

mbolli commented Apr 20, 2018

What's your exact rrdtool version?

@oishiiLatte
Copy link
Author

ver 1.7.0

@mbolli
Copy link
Owner

mbolli commented Oct 16, 2018

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
Copy link

crognlie commented May 16, 2019

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 <[email protected]>
               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
Copy link
Owner

mbolli commented May 17, 2019

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

@crognlie
Copy link

crognlie commented May 17, 2019

There is no data subdir:

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

akumuli.php datasource.php rrd.php`

@Dona21
Copy link
Collaborator

Dona21 commented May 17, 2019

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

@Dona21 Dona21 closed this as completed Jul 11, 2019
@Hossein124
Copy link

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
Copy link
Collaborator

Dona21 commented Jun 8, 2020

Hi Hossein,

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

  • Did you edit your copy of settings.php ?
  • Do you have some nfcapd data under /var/nfdump/profiles-data/live ? There is a note in the configuration part of the README concerning the expected profiles-data folder structure -> PROFILES_DATA_PATH/PROFILE/SOURCE/YYYY/MM/DD/nfcapd.YYYYMMDDHHII, e.g. /var/nfdump/profiles_data/live/source1/2018/12/01/nfcapd.201812010225
  • In case you have the data mentioned on the previous point, do you execute the daemon command with a user that has the correct read permissions for /var/nfdump/profiles-data/live directory, sub directories and files ?

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

Thanks and regards

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants