nfsen 1.3.8 added a $socket argument to DoRebuild (here compared to 
1.3.6p1):

  sub DoRebuild {
+       my $socket               = shift;
         my $profileinfo  = shift;

However, install.pl calls it without the extra argument:

                     NfProfile::DoRebuild(\%profileinfo, $profilename, 
$profilegroup, $profilepath, 1, 0);

As a result, install.pl fails with this error:

Can't use string ("live") as a HASH ref while "strict refs" in use at 
libexec/NfProfile.pm line 1238.

Plus, there are two other places within ./libexec/NfProfile.pm where 
DoRebuild is called without the extra argument (within sub 
CheckProfiles).  I propose fixing this by passing an extra first 
argument *STDOUT; see patch pasted inline below.

Incidentally, there's another problem if you use hyphens in your 
hostnames, for example "ix-rtr1" and "ix-rtr2":


Unable to create graph: No such file or directory
Error GenGraph: Profile: live, flows-day: don't understand 
'dataix-rtr2,1,*' at libexec/NfSenRRD.pm line 341.

Adding some Dumper calls shows the following being set to RRDs::graph:

'DEF:dataix-rtr2=/var/nfsen/profiles-stat/live/ix-rtr2.rrd:flows:AVERAGE',
           'CDEF:ix-rtr2=dataix-rtr2,1,*',
'DEF:dataix-rtr1=/var/nfsen/profiles-stat/live/ix-rtr1.rrd:flows:AVERAGE',
           'CDEF:ix-rtr1=dataix-rtr1,1,*'

It seems that the hyphen is being interpreted as a subtraction by CDEF.  
The workaround is to rename your data sources with underscore instead of 
hyphen.  However, this was painful to debug (and of course is not a 
valid hostname any more). I think it would be better if at least an 
error message were generated in this case.

Regards,

Brian.


--- libexec/NfProfile.pm.orig    2014-06-23 19:27:50.000000000 +0000
+++ libexec/NfProfile.pm    2017-05-21 08:12:22.404809275 +0000
@@ -3441,7 +3441,7 @@
                  } else {
                      $profileinfo{'type'} = 1;
                  }
-                my $status = DoRebuild(\%profileinfo, $profile, 
$profilegroup, $profilepath, 0, 0);
+                my $status = DoRebuild(*STDOUT, \%profileinfo, 
$profile, $profilegroup, $profilepath, 0, 0);
                  syslog('err', "Rebuilded profile '$profile' in group 
'$profilegroup': $status ");
              }
              if ( -f "$NfConf::PROFILESTATDIR/$profilepath/.CANCELED" ) {
@@ -3453,7 +3453,7 @@
                  } else {
                      $profileinfo{'type'} = 1;
                  }
-                my $status = DoRebuild(\%profileinfo, $profile, 
$profilegroup, $profilepath, 0, 0);
+                my $status = DoRebuild(*STDOUT, \%profileinfo, 
$profile, $profilegroup, $profilepath, 0, 0);
                  syslog('err', "Rebuilded profile '$profile' in group 
'$profilegroup': $status ");
              }
              if ( $profileinfo{'locked'} ) {
--- install.pl.orig    2017-01-19 16:16:21.000000000 +0000
+++ install.pl    2017-05-21 08:10:03.564458566 +0000
@@ -553,7 +553,7 @@
                  if( ! -f 
"$NfConf::PROFILEDATADIR/$profilepath/$channel/.nfstat") {
                      # no shadow profile, but missing channel stat
                      print "Rebuilding profile stats for 
'$profilegroup/$profilename'\n";
-                    NfProfile::DoRebuild(\%profileinfo, $profilename, 
$profilegroup, $profilepath, 1, 0);
+                    NfProfile::DoRebuild(*STDOUT, \%profileinfo, 
$profilename, $profilegroup, $profilepath, 1, 0);
                      NfProfile::WriteProfile(\%profileinfo);
                  }
                  # make sure it's own by nfsen_uid after the rebuild


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Nfsen-discuss mailing list
Nfsen-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nfsen-discuss

Reply via email to