leonward / OpenFPC

OpenFPC, Open Source Full Packet Capture
http://www.openfpc.org
70 stars 10 forks source link

MySQL/Perl errors for CX2DB #13

Open grleblanc opened 8 years ago

grleblanc commented 8 years ago

Hi all, I am running this on a new Ubuntu 16.04 server install and I am getting an error in the (/var/log/openfpc-cx2db-Default_Node.log) log file.

DBD::mysql::st execute failed: Incorrect integer value: 'Default_Node' for column 'sid' at row 1 at /usr/bin/openfpc-cx2db line 482, <FILE> line 8.

I can see the pcaps being saved, sessions being written but it doesn't look like its saving the session data into the DB.

=====================================
 Status from: Default_Node
=====================================
 * Node: Default_Node
   - Node Type                       :   NODE
   - Description                     :   "An OpenFPC node. www.openfpc.org"
   - Packet storage utilization      :   9 %
   - Session storage utilization     :   9 %
   - Space available in save path    :   9 %
   - Space used in the save path     :   2763692 (2.76 GB)
   - Session storage used            :   2763692 (2.76 GB)
   - Packet storage used             :   2763692 (2.76 GB)
   - PCAP file space used            :   1.2M
   - Local time on node              :   1467075331 (Mon Jun 27 20:55:31 2016 America/New_York)
   - Newest session in storage       :   -18000 (Wed Dec 31 14:00:00 1969 America/New_York)
   - Oldest session in storage       :   -18000 (Wed Dec 31 14:00:00 1969 America/New_York)
   - Oldest packet in storage        :   1467075093 (Mon Jun 27 20:51:33 2016 America/New_York)
   - Storage Window                  :   0 Days, 0 Hours, 0 Minutes, 0 Seconds
   - Load Average 1                  :   0.04
   - Load average 5                  :   0.01
   - Load average 15                 :   0.00
   - Number of session files lagging :   0
   - Number of sessions in Database  :   0
   - Node Timezone                   :   America/New_York
grleblanc commented 8 years ago

Alright so I was able to find a work around. The reason this was failing is because the DB schema for the session DB is requiring SID be an INT. As you can see the in openfpc-cx2db file, the database INSERT is passing the $HOSTNAME variable into that column (aka the node name). Which, is most definitely not a int.

I went into the default config file and changed NODENAME to 1, nuked all the table info, restarted OpenFPC and all is working.

john-r2 commented 5 years ago

Thanks gleblanc1783, this was a great help!! I changed line 41 in openfpc-cx2db to our $HOSTNAME = 1; and commented out line 91

$HOSTNAME = $CONFIG{'NODENAME'} if ( defined $CONFIG{'NODENAME'} );

now it logs to the db. I guess the long term fix is to change openfc-dbmaint to the correct schema

john-r2 commented 5 years ago

Face Palm!! I understand your fix now--change NODENAME in your openfpc-default.conf (or whatever) to an integer. Much better than editing program files... I didn't have to drop the db, just restart openfpc