phaag / nfsen

Legacy NfSen code
Other
21 stars 9 forks source link

NfSen error #32

Closed fatherfbi closed 3 months ago

fatherfbi commented 6 months ago

Hi Peter! There are 2 errors

1. root@nfsen:/# /opt/nfsen/bin/nfsen reconfig Argument "-z=lz4" isn't numeric in numeric eq (==) at /opt/nfsen/libexec/NfConf.pm line 236.

2. Start/restart collector on port '9422' for (nas2)Use of uninitialized value $nfdump_version in numeric eq (==) at /opt/nfsen/libexec/NfSenRC.pm line 88. Use of uninitialized value $nfdump_version in numeric eq (==) at /opt/nfsen/libexec/NfSenRC.pm line 121. -l is a legacy option and may get removed in future. Please use -w to set output directory [225518]

kjeacle commented 5 months ago

I'm seeing similar problems using FreeBSD's 1.3.11 package. It seems to stem from the fact that the hints file in /usr/local/var/nfsen/profiles-stat doesn't appear to have any useful data in it. It's read by the code for multiple tasks but I don't know where it's supposed to get updated with relevant local configuration values.

# nfsen reconfig
/
Remove configured sources: xxxx
Continue? [y/n] y
Delete source(s): xxxx:
Delete source 'xxxx' Use of uninitialized value $port in concatenation (.) or string at /usr/local/libexec/nfsen/NfSenRC.pm line 365.
Use of uninitialized value $port in exists at /usr/local/libexec/nfsen/Nfsources.pm line 275.

# service nfsen restart
Shutdown nfcapd: ()[20288]. .
Shutdown nfsend:[58729].
Starting nfcapd:(xxxx)Use of uninitialized value $nfdump_version in numeric eq (==) at /usr/local/libexec/nfsen/NfSenRC.pm line 88.
Use of uninitialized value $nfdump_version in numeric eq (==) at /usr/local/libexec/nfsen/NfSenRC.pm line 121.
-l is a legacy option and may get removed in future. Please use -w to set output directory
phaag commented 5 months ago

@fatherfbi - hmm -- I assume, your nfsen version is too old or nfdump too new. You should use the latest main repo. That should work with nfdump-1.7.x.

fatherfbi commented 5 months ago

@phaag I use nfdump v1.7.4 and nfsen v1.3.10, system Ubuntu 22.04.4 LTS

kjeacle commented 4 months ago

FWIW, the FreeBSD issue is that there is no install.pl used or included in the binary package so the hints file is never initialised. Not ideal but the following code will set some hardcoded values so that the other components don't complain.

#!/usr/bin/env perl

use lib "/usr/local/libexec/nfsen";
use NfSen;

my $hints = NfSen::LoadHints();

$$$hints{'subdirlayout'} = 1;
$$$hints{'nfdump'} = 7;
$$$hints{'version'} = "1.3.11";
$$$hints{'installed'} = time();

NfConf::LoadConfig("/path/to/nfsen.conf");
foreach my $source ( sort keys %NfConf::sources ) {
    my $port = $NfConf::sources{$source}{'port'};
    $$$hints{'sources'}{$source} = $port;
}

NfSen::StoreHints();
phaag commented 3 months ago

So, maybe the FreeBSD package could be patched accordingly.