PDA

View Full Version : Patch oreon 1.4-4


clementthersiquel
16th April 2007, 16:53
Avez vous des problemes d'application du patch???

Moi j'ai ceci lorsque je l'applique. Tous les autres patchs sont passes sans problemes...

patching file ODS/lib/getPerfData.pm
Hunk #1 FAILED at 20.
Hunk #2 FAILED at 46.
Hunk #3 FAILED at 79.
3 out of 3 hunks FAILED -- saving rejects to file ODS/lib/getPerfData.pm.rej
patching file ODS/lib/getServiceData.pm
Hunk #1 FAILED at 47.
1 out of 1 hunk FAILED -- saving rejects to file ODS/lib/getServiceData.pm.rej
patching file ODS/lib/indentifyService.pm
Hunk #1 FAILED at 36.
1 out of 1 hunk FAILED -- saving rejects to file ODS/lib/indentifyService.pm.rej
patching file ODS/lib/purge.pm
Hunk #1 FAILED at 20.
Hunk #2 FAILED at 41.
Hunk #3 FAILED at 80.
3 out of 3 hunks FAILED -- saving rejects to file ODS/lib/purge.pm.rej
patching file ODS/lib/updateFunctions.pm
Hunk #1 FAILED at 57.
Hunk #2 FAILED at 97.
Hunk #3 FAILED at 129.
3 out of 3 hunks FAILED -- saving rejects to file ODS/lib/updateFunctions.pm.rej
patching file ODS/ods.pl

Merci d'avance pour votre aide

WAtt
16th April 2007, 17:10
Moi j'ai ca :

patch -p1 < /root/patch/oreon-patch-1.4-4/24-oreon-2007_04_13_-_19_28.patch
patching file ODS/lib/getPerfData.pm
patching file ODS/lib/getServiceData.pm
patching file ODS/lib/indentifyService.pm
patching file ODS/lib/purge.pm
patching file ODS/lib/updateFunctions.pm
patching file ODS/ods.pl


Tu es bien sur que tout les précedents patchs sont passés ?

Tu peux me mettre le contenu du .rej ?

clementthersiquel
16th April 2007, 18:04
J'ai applique le patch manuellement...ca marche toujours pas mais ca doit etre autre chose qui ne va pas..je vais chercher!!

WAtt
16th April 2007, 18:07
Tu peux me copier le contenu du fichier de rejet: ODS/lib/getPerfData.pm.rej

Je m'occupe des patchs pour Oreon, profite :)

BubuLeMag
16th April 2007, 18:37
J'ai quasiment les mêmes rejets (et je peux garantir être passé par tous les patchs précédents).

Il y a des erreurs de patch que je ne comprends pas. Il aurait du bien passer normalement. J'ai simplement repris les fichiers du svn du coup.


***************
*** 20,29 ****
################################################## ##################

sub GetPerfData(){
- my ($line_tab, $sth2, $data, $flag_drop);
- use vars qw($con_oreon $con_ods);

CheckMySQLConnexion();

$sth2 = $con_ods->prepare("SELECT perfdata_file FROM config");
if (!$sth2->execute) {writeLogFile("Error when getting perfdata file : " . $sth2->errstr . "\n");}
--- 20,34 ----
################################################## ##################

sub GetPerfData(){
+ my ($line_tab, $sth2, $data, $flag_drop, $sleeptime);

CheckMySQLConnexion();
+ $sth2 = $con_oreon->prepare("SELECT oreon_path FROM general_opt LIMIT 1");
+ if (!$sth2->execute) {writeLogFile("Error when getting oreon Path : " . $sth2->errstr . "\n");}
+ $data = $sth2->fetchrow_hashref();
+ my $STOPFILE = $data->{'oreon_path'} . "ODS/stopods.flag";
+ undef($sth2);
+ undef($data);

$sth2 = $con_ods->prepare("SELECT perfdata_file FROM config");
if (!$sth2->execute) {writeLogFile("Error when getting perfdata file : " . $sth2->errstr . "\n");}
***************
*** 41,49 ****
}
if (open(PFDT, "< $PFDT"."_read")){
CheckMySQLConnexion();
-
$sth2 = $con_ods->prepare("SELECT auto_drop,drop_file,perfdata_file FROM config");
- if (!$sth2->execute) {writeLogFile("Error when getting drop and perfdata properties : " . $sth2->errstr . "\n");}
$data = $sth2->fetchrow_hashref();

$PFDT = $data->{'perfdata_file'};
--- 46,54 ----
}
if (open(PFDT, "< $PFDT"."_read")){
CheckMySQLConnexion();
+
$sth2 = $con_ods->prepare("SELECT auto_drop,drop_file,perfdata_file FROM config");
+ if (!$sth2->execute) {writeLogFile("Error when getting drop and perfdata properties : ".$sth2->errstr."\n");}
$data = $sth2->fetchrow_hashref();

$PFDT = $data->{'perfdata_file'};
***************
*** 74,84 ****

if ($flag_drop == 1){close(DROP);}
undef($line_tab);
} else {
writeLogFile("Error When reading data in tmp read file : $!");
}
}
- sleep(getSleepTime());
}
}

--- 79,98 ----

if ($flag_drop == 1){close(DROP);}
undef($line_tab);
+ undef($flag_drop);
} else {
writeLogFile("Error When reading data in tmp read file : $!");
}
}
+ $sleeptime = getSleepTime();
+ for (my $i = 0;$i <= $sleeptime;$i++){
+ # Check if ods must leave
+ return () if (-r $STOPFILE);
+ # Sleep Time between To check
+ sleep(1);
+ }
+ undef($sleeptime);
+ undef($i);
}
}



***************
*** 36,51 ****
$host_id = getHostID($_[0]);
if ($host_id){
$service_id = getServiceID($host_id, $_[1]);
- $sth1 = $con_ods->prepare("SELECT * FROM `index_data` WHERE `host_id` = '".$host_id."' AND `service_id` = '".$service_id."'");
- if (!$sth1->execute) {writeLogFile("Error:" . $sth1->errstr . "\n");}
- if ($sth1->rows() == 0){
- $sth1 = $con_ods->prepare("INSERT INTO `index_data` (`host_name`, `host_id`, `service_description`, `service_id`) VALUES ('".$_[0]."', '".$host_id."', '".$_[1]."', '".$service_id."')");
- if (!$sth1->execute) {writeLogFile("Error:" . $sth1->errstr . "\n");}
- } else {
- $sth1 = $con_ods->prepare("UPDATE `index_data` SET `host_name` = '".$_[0]."' , `service_description` = '".$_[1]."' where `host_id` = '".$host_id."' AND `service_id` = '".$service_id."'");
if (!$sth1->execute) {writeLogFile("Error:" . $sth1->errstr . "\n");}
}
- undef($sth1);
}
}
}
--- 36,53 ----
$host_id = getHostID($_[0]);
if ($host_id){
$service_id = getServiceID($host_id, $_[1]);
+ if ($service_id){
+ $sth1 = $con_ods->prepare("SELECT * FROM `index_data` WHERE `host_id` = '".$host_id."' AND `service_id` = '".$service_id."'");
if (!$sth1->execute) {writeLogFile("Error:" . $sth1->errstr . "\n");}
+ if ($sth1->rows() == 0){
+ $sth1 = $con_ods->prepare("INSERT INTO `index_data` (`host_name`, `host_id`, `service_description`, `service_id`) VALUES ('".$_[0]."', '".$host_id."', '".$_[1]."', '".$service_id."')");
+ if (!$sth1->execute) {writeLogFile("Error:" . $sth1->errstr . "\n");}
+ } else {
+ $sth1 = $con_ods->prepare("UPDATE `index_data` SET `host_name` = '".$_[0]."' , `service_description` = '".$_[1]."' where `host_id` = '".$host_id."' AND `service_id` = '".$service_id."'");
+ if (!$sth1->execute) {writeLogFile("Error:" . $sth1->errstr . "\n");}
+ }
+ undef($sth1);
}
}
}
}



***************
*** 20,28 ****
################################################## ##################

sub CheckRestart(){
- use vars qw($con_oreon $con_ods);
my $last_restart;
my $last_restart_stt;
while(2){
CheckMySQLConnexion();
$last_restart = getLastRestart();
--- 20,37 ----
################################################## ##################

sub CheckRestart(){
+ my ($sth2, $data, $purgeinterval);
my $last_restart;
my $last_restart_stt;
+
+ CheckMySQLConnexion();
+ $sth2 = $con_oreon->prepare("SELECT oreon_path FROM general_opt LIMIT 1");
+ if (!$sth2->execute) {writeLogFile("Error when getting oreon Path : " . $sth2->errstr . "\n");}
+ $data = $sth2->fetchrow_hashref();
+ my $STOPFILE = $data->{'oreon_path'} . "ODS/stopods.flag";
+ undef($sth2);
+ undef($data);
+
while(2){
CheckMySQLConnexion();
$last_restart = getLastRestart();
***************
*** 32,38 ****
purgeRrdDB() if (getPurgeConfig());
check_HostServiceID();
}
- sleep(getPurgeInterval());
}
}

--- 41,56 ----
purgeRrdDB() if (getPurgeConfig());
check_HostServiceID();
}
+
+ $purgeinterval = getPurgeInterval();
+ for (my $i = 0;$i <= $purgeinterval;$i++){
+ # Check if ods must leave
+ return () if (-r $STOPFILE);
+ # Sleep Time between To check
+ sleep(1);
+ }
+ undef($purgeinterval);
+ undef($i);
}
}

***************
*** 62,69 ****
}
undef($data);
undef($sth2);
- undef($sth3);
-
$sth2 = $con_ods->prepare("SELECT host_id, service_id FROM index_data WHERE `host_name` != 'OSL_Module' AND `host_name` != 'META_Module'");
if (!$sth2->execute) {writeLogFile("Error in Drain function 3 : " . $sth2->errstr . "\n");}
while ($data = $sth2->fetchrow_hashref()){
--- 80,88 ----
}
undef($data);
undef($sth2);
+ undef($sth3);
+ undef($data_hg);
+
$sth2 = $con_ods->prepare("SELECT host_id, service_id FROM index_data WHERE `host_name` != 'OSL_Module' AND `host_name` != 'META_Module'");
if (!$sth2->execute) {writeLogFile("Error in Drain function 3 : " . $sth2->errstr . "\n");}
while ($data = $sth2->fetchrow_hashref()){

BubuLeMag
16th April 2007, 18:37
et le dernier rejet :


***************
*** 57,67 ****
my $sth2 = $con_oreon->prepare("SELECT interval_length FROM cfg_nagios WHERE nagios_activate");
if (!$sth2->execute) {writeLogFile("Error when getting interval_length : " . $sth2->errstr . "\n");}
$data = $sth2->fetchrow_hashref();
- $interval = $interval * $data->{'interval_length'} * 2;
undef($data);
undef($sth2);
$nb_value = $_[5] * 24 * 60 * 60 / $interval;
- writeLogFile("interval : ".$_[5]." - nb value : $nb_value \n");
RRDs::create ($_[0].$_[1].".rrd", "-b ".$begin, "-s ".$interval, "DS:metric:GAUGE:".$interval.":U:U", "RRA:AVERAGE:0.5:1:".$nb_value, "RRA:MIN:0.5:12:".$nb_value, "RRA:MAX:0.5:12:".$nb_value);
$ERR = RRDs::error;
if ($ERR){writeLogFile("ERROR while creating $_[0]$_[1].rrd : $ERR\n");}
--- 57,66 ----
my $sth2 = $con_oreon->prepare("SELECT interval_length FROM cfg_nagios WHERE nagios_activate");
if (!$sth2->execute) {writeLogFile("Error when getting interval_length : " . $sth2->errstr . "\n");}
$data = $sth2->fetchrow_hashref();
+ $interval = $interval * $data->{'interval_length'} + 10;
undef($data);
undef($sth2);
$nb_value = $_[5] * 24 * 60 * 60 / $interval;
RRDs::create ($_[0].$_[1].".rrd", "-b ".$begin, "-s ".$interval, "DS:metric:GAUGE:".$interval.":U:U", "RRA:AVERAGE:0.5:1:".$nb_value, "RRA:MIN:0.5:12:".$nb_value, "RRA:MAX:0.5:12:".$nb_value);
$ERR = RRDs::error;
if ($ERR){writeLogFile("ERROR while creating $_[0]$_[1].rrd : $ERR\n");}
***************
*** 98,104 ****
} else {
if ($_[0] && $_[1] && $_[5]){
my $begin = $_[4] - 200000;
- $interval = 120;
RRDs::create ($_[0]."/".$_[1].".rrd", "-b ".$begin, "-s ".$interval, "DS:metric:GAUGE:".$interval.":U:U", "RRA:AVERAGE:0.5:1:".$_[5], "RRA:MIN:0.5:12:".$_[5], "RRA:MAX:0.5:12:".$_[5]);
$ERR = RRDs::error;
if ($ERR){writeLogFile("ERROR while creating $_[0]/$_[1].rrd : $ERR\n");}
--- 97,112 ----
} else {
if ($_[0] && $_[1] && $_[5]){
my $begin = $_[4] - 200000;
+ $interval = getServiceCheckInterval($_[1]);
+ if (!defined($interval)){$interval = 3};
+ CheckMySQLConnexion();
+ my $sth2 = $con_oreon->prepare("SELECT interval_length FROM cfg_nagios WHERE nagios_activate");
+ if (!$sth2->execute) {writeLogFile("Error when getting interval_length : " . $sth2->errstr . "\n");}
+ $data = $sth2->fetchrow_hashref();
+ $interval = $interval * $data->{'interval_length'} + 10;
+ undef($data);
+ undef($sth2);
+ $nb_value = $_[5] * 24 * 60 * 60 / $interval;
RRDs::create ($_[0]."/".$_[1].".rrd", "-b ".$begin, "-s ".$interval, "DS:metric:GAUGE:".$interval.":U:U", "RRA:AVERAGE:0.5:1:".$_[5], "RRA:MIN:0.5:12:".$_[5], "RRA:MAX:0.5:12:".$_[5]);
$ERR = RRDs::error;
if ($ERR){writeLogFile("ERROR while creating $_[0]/$_[1].rrd : $ERR\n");}
***************
*** 121,124 ****
undef($sth1);
}

- 1;--- 129,132 ----
undef($sth1);
}

+ 1;

WAtt
16th April 2007, 18:52
Tu pourrai me faire un diff -urN entre le fichier SVN et ton ancien fichier ?

PS: je viens de refaire tt les patches sur une install oreon propre (et temporaire) ca marche sans probleme ...

clementthersiquel
16th April 2007, 19:55
Moi aussi, je viens de reinstaller oreon et la tout est passe sans probleme...Allez comprendre..

BubuLeMag
16th April 2007, 20:10
Je pense avoir compris.

Le diff m'indique qu'il n'y a aucune différence entre le fichier .orig et celui que j'ai mis du SVN. Or le patch 1.4-3 avait généré des rejets et j'avais trouvé plus malin pour moi de prendre les fichiers du SVN... je suppose que les corrections avaient déjà été faite...

*se met des baffes*

WAtt
16th April 2007, 21:46
....
Si tu prends les version SVN c'est l'équivalent des versions patchées :)

Bon j'avoue que tu m'as qd meme fait peur... J'ai presque cru avoir merdé un truc .... :)