Closed nrensen closed 4 years ago
I support the general case made here, a few points:
NfDump
class would better be moved to a processor
directoryProcessor
interface could be added to the same directory, NfDump
would implement itProcessor
like your custom NfDump
implementation could either extend the default NfDump
or create something new, but implementing the Processor
interfaceNewNfDump()
would additionally check if the class specified in settings implements Processor
NewNfDump()
would default to the existing NfDump
class for backward compatibilityNewNfDump()
being renamed with lowercase N at the beginning, and static
keyword addedI could probably do the first two, although you'd need to rebase...
Thanks for your comments, all very reasonable. I will work towards a diff that meets those requirements.
Thanks also for your responsiveness in general. I have a few other little things that I am working on for nfsen-ng. I am also planning on trying to get a diff accepted into nfdump to include fl (number of flows) and the ...per second metrics added to the csv output so that they are available to nfsen-ng.
Instead of adjusting this branch, it is more convenient for me to create a new pull request from a new branch addressing the comments above.
This diff adds support for custom NfDump implementation by specifying an nfdump class in settings (similarly to the way custom databases are supported). I use this to allow nfsen-ng to run in a php chroot without direct access to the nfcapd files. The original nfsen supports this.
My custom nfdump model (not included here), which is similar to the original nfsen, is to run a separate nfsend daemon and have nfsen-ng communicate via a fifo. This could also work using a socket which would allow nfsen-ng to run on a different host from that where the nfcapd files reside.
You may consider this too obscure to support within the nfsen-ng code base, although the additional complexity is minimal. If you are concerned that existing nfsen-ng users will be required to add the nfdump entry in the general settings then I can alter NewNfDump() to default to the normal nfsen-ng NfDump implementation if there is no nfdump class specified in settings.