Ntop not creating correct ntop.sh file on reboot



  • Not sure if anyone has noticed this or maybe its my setup. When I setup ntop using the ntop settings page, the below ntop.sh file is created:

    
    ...
    rc_start() {
    	/usr/local/bin/ntop -i em3,em2,gif0,em0_vlan5,ppp0 -u root -d --ipv4 -M -x 8102 -X 8192 &
    }
    ...
    
    

    When I reboot my box this file is created:

    
    ...
    rc_start() {
    	/usr/local/bin/ntop -i  -u root -d --ipv4 -M -x 8102 -X 8192 &
    }
    ...
    
    

    You will see there is an extra space after -i, which when I try to manually run this file from the cmdline, it reports back saying: "FATAL ERROR: Unrecognized/unprocessed ntop options"

    It seems that my interfaces I pick are not saving after reboot. Looking at my config.xml file, all 5 are there tho.

    Log:

    
    Jul 5 11:23:52 	ntop[33138]: THREADMGMT[t679481664]: ntop RUNSTATE: INIT(2)
    Jul 5 11:23:52 	ntop[33138]: THREADMGMT[t679481664]: ntop RUNSTATE: PREINIT(1)
    Jul 5 11:23:50 	ntop[31975]: THREADMGMT[t679481664]: ntop RUNSTATE: INIT(2)
    Jul 5 11:23:50 	ntop[31975]: THREADMGMT[t679481664]: ntop RUNSTATE: PREINIT(1)
    Jul 5 11:23:46 	ntop[30483]: THREADMGMT[t679481664]: ntop RUNSTATE: INIT(2)
    Jul 5 11:23:46 	ntop[30483]: THREADMGMT[t679481664]: ntop RUNSTATE: PREINIT(1)
    
    

    For now I've created a copy of a working ntop.sh file and have monit start it if its not running.

    I need to do some more testing but I noticed since i've been using snapshots that are less then 1 1/2 week old, ntop will have a core dump every 1-5hrs. Running snapshots from May, ntop never had a core dump. Monit solves this coredump issue but restarting ntop but it was nice not seeing any restarts of ntop for a month..

    thanks in advance


  • Rebel Alliance Developer Netgate

    Does it work if you only select a single interface?



  • @jimp:

    Does it work if you only select a single interface?

    Yes it does. I just tried it with only WAN and LAN interfaces, and it failed…So i'm guessing it doesn't like multiple interfaces


  • Rebel Alliance Developer Netgate

    There is probably something in the code that isn't saving the multiple interfaces specification into the config right, either that or reading it back right. I'll take a look when I get a chance.



  • thanks jimp! Not rush on my part :-) I have a work around for the interfaces, but i need to figure out why ntop isn't stable anymore…


  • Rebel Alliance Developer Netgate

    Looks like it was a problem in general with packages and the interface selector. I fixed it up:

    https://github.com/bsdperimeter/pfsense/commit/6108a08ce296ea2643ee6b6297156da8412dcb00

    ntop has been extremely stable for me so far on 2.0 since I got it running, I've never seen it stop abruptly like I did on 1.2.x. Though I am only using it on a single interface.



  • @jimp:

    Looks like it was a problem in general with packages and the interface selector. I fixed it up:

    https://github.com/bsdperimeter/pfsense/commit/6108a08ce296ea2643ee6b6297156da8412dcb00

    ntop has been extremely stable for me so far on 2.0 since I got it running, I've never seen it stop abruptly like I did on 1.2.x. Though I am only using it on a single interface.

    Thanks again jimp! I'll try the fix later tonight.

    ntop has been stable for me since you fixed it for 2.0. I was away for most of June with little access to my box and it stayed up the whole time. I would say I was updating my snapshot about once a week from Jan-May with reg gitsync since I'm using the ipv6 code. Once I got home 2 weeks ago, I did an update and its been crapping out every 1-5hrs..

    Its been running strong so far with 1 interface for the last 2 hrs(I usually have 5 bind to it). Do i need all of them, not really…. but I like my stats,lol..... When I have some time, I'll do a fresh install and see if that clears up my issue.

    as always, thanks again!



  • I manually added the code since its not in the IPv6 codeset yet. Works perfectly! Interfaces stay highlighted now, they weren't before.

    As for my other issue, I think I solved it. I forgot that I inserted my Verizon 3G USB into the router after I got home and added interface ppp0 to the mix. Looking at the logs, Ntop would shutdown shortly after the ppp0 renews. It stayed up all night with all the interfaces expect the ppp0 so far… Lets see what today brings..

    Thanks again

    P.S Would the code you added affect any other plugins? Noticed that impector doesn't keep interface or protocols anymore and I thought it did.


  • Rebel Alliance Developer Netgate

    It shouldn't have affected any other packages unless they had some code to work around the fact that the old interface selection was broken. IMspector may have been trying to outsmart the bug.



  • @jimp:

    It shouldn't have affected any other packages unless they had some code to work around the fact that the old interface selection was broken. IMspector may have been trying to outsmart the bug.

    I think IMspector worked around it, but now it doesn't know what to do:

    Before the code in my config.xml:

    
    ...
    <iface_array>lan,opt4</iface_array>
    <proto_array>msn,icq,yahoo,irc</proto_array>
    ...
    
    

    after the code change, IMspector wont start if I make changes:

    
    ...
    <iface_array>Array</iface_array>
    <proto_array>Array</proto_array>
    ...
    
    

    From the system log:

    
    Jul 6 10:51:59 	imspector: Good-bye
    Jul 6 10:51:59 	php: imspector: Stopping service: no interfaces and/or protocols selected
    Jul 6 10:51:59 	php: imspector: Interface Array has no ip address, ignoring
    
    

    I manually edited config.xml and it starts on startup… Just can't make any changes to via the web interface.


  • Rebel Alliance Developer Netgate

    Hmm, interesting, since the only field name that should have had any change would have been named exactly interface_array, not the others. They should have had the same net effect as before.


  • Rebel Alliance Developer Netgate

    Found it, I forgot one bit in the change I made.

    https://github.com/bsdperimeter/pfsense/commit/292b356f8cdaf26b919009f1a1bc51a1ea02166f

    I pushed all that into the ipv6 fork as well.



  • Thank you! That did the trick



  • Hi,

    I'm having the same problem on 2.0 RC3 amd64 with ntop 4.0.1_1 v2 when i choose two ifs. i've checked pkg_edit.php but it's different to the code you posted.

    Regards.

    198:208
    _$fieldname  = $fields['fieldname'];
    $fieldvalue = $POST[$fieldname];
    if (is_array($fieldvalue))
    $fieldvalue = implode(',', $fieldvalue);
    else {
    $fieldvalue = trim($fieldvalue);
    if ($fields['encoding'] == 'base64')
    $fieldvalue = base64_encode($fieldvalue);
    }
    if($fieldname)
    $pkgarr[$fieldname] = $fieldvalue;


  • Rebel Alliance Developer Netgate

    @ncolunga:

    I'm having the same problem on 2.0 RC3 amd64 with ntop 4.0.1_1 v2 when i choose two ifs. i've checked pkg_edit.php but it's different to the code you posted.

    What snapshot date are you on?



  • I've updated to Aug 1 firmware but this didnt solve the problem.

    Thank you.


  • Rebel Alliance Developer Netgate

    Are you using IPv6 code?



  • No, but i have done a new install, upgrade to Aug 2 firmware and now everything is ok. It seems to be related some way to my old config backup.

    Thank you.


Locked