Welcome to Pandora FMS Community!

Find answers, ask questions, and connect with our community around the world.

Welcome to Pandora FMS Community Forums Community support replace the use of perl:: threads by perl::forks

  • replace the use of perl:: threads by perl::forks

    Posted by daggett on November 28, 2006 at 23:51

    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

    Sancho replied 18 years, 2 months ago 2 Members · 5 Replies
  • 5 Replies
  • daggett

    Member
    November 29, 2006 at 00:14
    0 Karma points
    Community rank: tentacle-noob-1 Tentacle noob
    Like it
    Up
    0
    Down
    Drop it
    ::

    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

  • Sancho

    Administrator
    November 29, 2006 at 04:55
    2309 Karma points
    Community awards: bulb Bright ideas
    Community rank: tentacle_master_icon Tentacle Master
    Like it
    Up
    0
    Down
    Drop it
    ::

    Disable MD5 on Pandora server and you dont get that problem anymore. This is an option on server .conf file.

  • daggett

    Member
    November 29, 2006 at 12:14
    0 Karma points
    Community rank: tentacle-noob-1 Tentacle noob
    Like it
    Up
    0
    Down
    Drop it
    ::

    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

  • daggett

    Member
    November 29, 2006 at 12:16
    0 Karma points
    Community rank: tentacle-noob-1 Tentacle noob
    Like it
    Up
    0
    Down
    Drop it
    ::

    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

  • Sancho

    Administrator
    December 1, 2006 at 15:39
    2309 Karma points
    Community awards: bulb Bright ideas
    Community rank: tentacle_master_icon Tentacle Master
    Like it
    Up
    0
    Down
    Drop it
    ::

    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.