mbolli / nfsen-ng

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

nfsen-ng: 400 - Bad Request. rrd_xport failed. #17

Closed hans-mayer closed 5 years ago

hans-mayer commented 5 years ago

Dear All,

I am not sure if I am right here. I didn't find a mailing for "nfsen-ng"

My issue I don't get any data on the GUI.

I followed the instructions at https://github.com/mbolli/nfsen-ng to install on a fresh installed "Ubuntu 18.04.1 LTS" "nfdump" wasn't found as packaged, so I compiled from source.

This is my file nfsen-ng/backend/settings/settings.php

<?php
/**
 * config file for nfsen-ng
 *
 * remarks:
 * * database name = datasource class name (case-sensitive)
 * * log priority should be one of the predefined core constants prefixed with LOG_
 */

$nfsen_config = array(
    'general' => array(
        'ports' => array(
            80, 22, 53,
        ),
        'sources' => array(
            'cs-sl0-s6506',
        ),
        'db' => 'RRD',
    ),
    'frontend' => array(
        'reload_interval' => 60,
    ),
    'nfdump' => array(
        'binary' => '/usr/bin/nfdump',
        'profiles-data' => '/var/nfdump/profiles-data',
        'profile' => 'live',
        'max-processes' => 2, // maximum number of concurrently running nfdump processes
    ),
    'db' => array(
        'Akumuli' => array(
            //'host' => 'localhost',
            //'port' => 8282,
        ),
        'RRD' => array()
    ),
    'log' => array(
        'priority' => LOG_DEBUG, // LOG_INFO, LOG_DEBUG is very talkative!
    )
);

I run

nfcapd -w -D -S 2 -B 1024000 -l /var/nfdump/profiles-data/live/cs-sl0-s6506 -p 10001

which writes sucessfully data in subdiretories like this

/var/nfdump/profiles-data/live/cs-sl0-s6506/2018/11/13/16/nfcapd.201811131620

But when I open my web-browser I get an error message:

Got 400 - Bad Request. rrd_xport failed. opening '/var/www/html/nfsen-ng/backend/datasources/data/cs-sl0-s6506.rrd': No such file or directory

and syslog shows at the same time:

Nov 13 16:52:52 hpg911 apache2: nfsen-ng: Was not able to find /var/www/html/nfsen-ng/backend/datasources/data/cs-sl0-s6506.rrd Nov 13 16:52:52 hpg911 apache2: nfsen-ng: 400 - Bad Request. rrd_xport failed. opening '/var/www/html/nfsen-ng/backend/datasources/data/cs-sl0-s6506.rrd': No such file or directory

I do not know where to configure a process to convert the pcap data to rrd files. I gave full permissions for /var/www/html/nfsen-ng/backend/datasources/data/ so it shouldn't be a permissions issue.

RRDtool 1.7.0 is installed,

apachectl -M shows php7_module is installed, but nothing about rrd, probably OK.

"pecl list" tells me

rrd 2.0.1 stable

I started manually "./cli.php start"

./cli.php status Running: 14178

Any help is welcome.

// Hans

davidshirk80 commented 7 months ago

Sorry - I forgot to delete my comment earlier - had a lot going on at work and missed the fact that I was no longer in root - issue is fixed on that front - and I am finishing the rest now! Sorry for the false alarm :-(

FontouraAbreu commented 7 months ago

@davidshirk80 I'll be waiting for your reply on the graphs not showing up issue

davidshirk80 commented 7 months ago

Last thing - on the final step: root@box1-test2:/var/www/nfsen-ng# php composer.phar install --no-dev Could not open input file: composer.phar

mbolli commented 7 months ago

@davidshirk80 you need to install composer from https://getcomposer.org

davidshirk80 commented 7 months ago

I tried - and got this: Composer (version 2.7.1) successfully installed to: /var/www/nfsen-ng/composer.phar Use it: php composer.phar

root@washingmachine-test2:/var/www/nfsen-ng# php composer.phar install --no-dev Do not run Composer as root/super user! See https://getcomposer.org/root for details Continue as root/super user [yes]?

If you select yes, you get this: Continue as root/super user [yes]? yes Composer could not find a composer.json file in /var/www/nfsen-ng To initialize a project, please create a composer.json file. See https://getcomposer.org/basic-usage

If you select no, it does nothing

mbolli commented 7 months ago

@davidshirk80 seems like you were not in the prepare-php-82 branch (that's why the composer.json is missing). Now that v0.3 is out, you can just git pull and retry the composer command.

davidshirk80 commented 7 months ago

Ran get pull - and then retried:

root@dshirk-test2:/var/www/nfsen-ng# php composer.phar install --no-dev Do not run Composer as root/super user! See https://getcomposer.org/root for details Continue as root/super user [yes]? yes Installing dependencies from lock file Verifying lock file contents can be installed on current platform. Nothing to install, update or remove Generating autoload files

^ is that correct?

mbolli commented 7 months ago

@davidshirk80 that is correct!

davidshirk80 commented 7 months ago

OK - - the rest of the setup seemed to go good - generating rrd files in their proper location now :-D ( /var/www/nfsen-ng/backend/datasources/data ) Now my apache is hanging up, and the /var/nfdump/ folder does not even exist given the new install - so figuring that out now! But I can say for certain that the RRD issue is fixed! Will start another string if I cannot figure out the rest - thank you for your time!

FontouraAbreu commented 7 months ago

@davidshirk80 any updates?

davidshirk80 commented 7 months ago

My apologies - no. Something happened to the VM i was on and I needed a fresh install - now out of the blue, I am getting alot of PEAR issues on the new machine: root@machine:~/nfdump-1.7.4# pecl install rrd Warning: foreach() argument must be of type array|object, null given in Command.php on line 249 Warning: foreach() argument must be of type array|object, null given in /usr/share/php/PEAR/Command.php on line 249 And many more. Tried rolling back and fresh installing the whole 9 - but still the same thing.

Are you all installing on bare metal or on a VM?

davidshirk80 commented 7 months ago

I know YACC was not installed - it turns out that is Bison now: https://silcnitc.github.io/install.html

FontouraAbreu commented 7 months ago

Are you all installing on bare metal or on a VM?

VM

I've faced this same issue but I remember it being just a disabled mod. Check this out: https://serverfault.com/questions/589877/pecl-command-produces-long-list-of-errors

davidshirk80 commented 7 months ago

I installed composer exactly as stated on the site, and got this:

Some settings on your machine make Composer unable to work properly. Make sure that you fix the issues listed below and run this script again:

The phar extension is missing.

I figured out the fix earlier, but my dumb a$$ forgot to wrote it down, and I cannot find it again. Will update when I find it.

mbolli commented 7 months ago

@davidshirk80 are you sure you installed PHP according to the instructions? The phar extension is normally bundled. Try to activate it with phpenmod phar and if that's not working apt install php-phar.

davidshirk80 commented 7 months ago

Sorry, finally got permissions for the VM and completely re-installed Ubuntu 22.04 from the ground up with only ssh added into the install. Running it now!

davidshirk80 commented 7 months ago

Install went 100% perfect - configuring nfdump now and will report back

davidshirk80 commented 7 months ago

So unfortunately I could not validate that the rrd issue was fixed. Thing is - as happy as I am that Phaag is keeping up with nfdump, I could not find much direction on how to configure it to work with nfsen-ng. As a result, the front end is not getting fed and no rrd being able to be generated. Checking my apache2 settings to figure out why the the webpage is returning a 404 as well.

FontouraAbreu commented 6 months ago

@mbolli made a PR updating some readme sections based on somethings discussed on this issue, I would appreciate if you could have a look at it. @davidshirk80 may also like to check it out and say if it helps or clarifies some of the configuration steps

mbolli commented 6 months ago

@FontouraAbreu I definitely will, thanks

davidshirk80 commented 6 months ago

The only open PR I see in on opensuse instructions