Pages: [1]   Go Down
Author Topic: replace the use of perl:: threads by perl::forks  (Read 302 times)
0 Members and 1 Guest are viewing this topic.
daggett
Sr. Member
****

Karma: 0
Offline Offline

Posts: 109


View Profile
« on: November 28, 2006, 08:51:16 PM »

Hi all,
I had real pain to make pandora server working on a Mandriva 2007 because thread support isn't compiled in perl rpm, It makes compilation of the script fail. So a compilation of perl from sources is necessary, and then it's really a tricky thing to make it work and integrate it in the system...

So I replaced the instructions in pandora_server.pl :
use threads;
use threads::shared;

with:
use forks;
use forks::shared;

And now it's running OK, BUT it doesn't process correctly XML files in data_in/ directory.

In the log file I have this:
2006/11/28 21:41:10 [V4] Ready to parse /opt/pandora/pandora_server/data_in/MyServer.1164746463.data
2006/11/28 21:41:10 [ERROR] Error processing XML contents in /opt/pandora/pandora_server/data_in/MyServer.1164746463.data
2006/11/28 21:41:10 [V1] ERROR: Received data from an unnamed agent

Nothing is added to mysql database (only date of last login, so mysql is working).
ssh is working as well because I have 2 new files every 5 minutes from the client agent placed in data_in/ of the server.
and this kind of files in data_in/ appears after processing the 2 XML files:
-rw-rw-rw- 1 root root 1778 nov 28 21:41 MyServer.1164746463.data_BADXML

So I don't know what's wrong with it... I will try to find out, feel free to help!! ;O)

bye
« Last Edit: January 01, 1970, 01:00:00 AM by daggett » Logged

daggett
Sr. Member
****

Karma: 0
Offline Offline

Posts: 109


View Profile
« Reply #1 on: November 28, 2006, 09:14:49 PM »

So, it seems that the MD5 digest is not doing its job properly...
lines 112 to 145:
                                       # Procesa_Datos its the main function to process datafile
                  my $config; # Hash Reference, used to store XML data
                                           # But first we needed to verify integrity of data file
                                           if ($pa_config->{'pandora_check'} == 1){
                     logger ($pa_config, "Integrity of Datafile using MD5 is verified: $file_data",3);
                  }
                       eval { # XML Processing error catching procedure. Critical due XML was no validated
                                           logger ($pa_config, "Ready to parse $file_data",4);
                                           $config = XMLin($file_data, forcearray=>'module');
                                   };
                                   if ($@) {
                                            logger ($pa_config, "[ERROR] Error processing XML contents in $file_data",0);
                                            copy ($file_data,$file_data."_BADXML");
                                            if (($pa_config->{'pandora_check'} == 1) && ( -e $file_md5 )) {
                        copy ($file_md5,$file_md5."_BADCHECKUM");
                     }
                                   }
                  procesa_datos($pa_config, $config, $dbh);
                  undef $config;
                                           # If _everything_ its ok..
                  # delete files
                                           unlink ($file_data);
                                           if ( -e $file_md5 ) {
                     unlink ($file_md5);
                  }
                                   } else { # md5 check fails
                       logger ( $pa_config, "[ERROR] MD5 Checksum failed! for $file_data",0);
                  # delete files
                                           unlink ($file_data);
                                           if ( -e $file_md5 ) {
                     unlink ($file_md5);
                  }
                   }
               } # No checksum file, ignore file

I'm not used to perl, so I don't know what it does in details, but it seems to come from those lines.

bye
« Last Edit: January 01, 1970, 01:00:00 AM by daggett » Logged

Sancho Lerena
Administrator
Expert member
*****

Karma: 24
Offline Offline

Posts: 1151


I can see everything... with my glasses :-)


View Profile WWW
« Reply #2 on: November 29, 2006, 01:55:02 AM »

Disable MD5 on Pandora server and you dont get that problem anymore. This is an option on server .conf file.
« Last Edit: January 01, 1970, 01:00:00 AM by nil » Logged

-- See you in the other screen.

daggett
Sr. Member
****

Karma: 0
Offline Offline

Posts: 109


View Profile
« Reply #3 on: November 29, 2006, 09:14:02 AM »

Ok, thanks, MD5 wasn't enabled, so it wasn't an MD5 problem as I was thinking yesterday.

well, after a good night sleeping, I came back to this problem...
It appeared that perl::XML::Parser was not installed.

So my question is : why is it cimpiling/running fine, even if this perl module is missing?
no error logged about this, and it's a quiet important module...

Well maybe this could be added in the prerequisites in the documentation?
I know this is kind of obvious for many people, but I didn't think about that at first time, and I lost  some precious time.

regards, bye
« Last Edit: January 01, 1970, 01:00:00 AM by daggett » Logged

daggett
Sr. Member
****

Karma: 0
Offline Offline

Posts: 109


View Profile
« Reply #4 on: November 29, 2006, 09:16:20 AM »

So, I can say that now, just by replacing threads by forks, ythe pandora server is working fine on a Mandriva 2007.

There are a few more problems, but I will open new threads for them.

Bye
« Last Edit: January 01, 1970, 01:00:00 AM by daggett » Logged

Sancho Lerena
Administrator
Expert member
*****

Karma: 24
Offline Offline

Posts: 1151


I can see everything... with my glasses :-)


View Profile WWW
« Reply #5 on: December 01, 2006, 12:39:18 PM »

Quote from: "daggett"
Ok, thanks, MD5 wasn't enabled, so it wasn't an MD5 problem as I was thinking yesterday.

well, after a good night sleeping, I came back to this problem...
It appeared that perl::XML::Parser was not installed.

So my question is : why is it cimpiling/running fine, even if this perl module is missing?
no error logged about this, and it's a quiet important module...

Well maybe this could be added in the prerequisites in the documentation?
I know this is kind of obvious for many people, but I didn't think about that at first time, and I lost  some precious time.

regards, bye


I think that XML:Simple package required requires XML::Parser, it depends of the distro to warn about dependencies.
« Last Edit: January 01, 1970, 01:00:00 AM by nil » Logged

-- See you in the other screen.

Pages: [1]   Go Up
Print
 
Jump to:  


SourceForge.net Logo  This site is monitored by Pandora FMS   ArticaST