mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-27 15:54:29 +02:00
2008-10-20 Esteban Sanchez <estebans@artica.es>
* lib/PandoraFMS/DB.pm: Fixed a strange bug that was causing to generate events of servers going down, the solution was to update own keepalive before checking others server status. Tab style correction, replacing blankspaces with tab. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1173 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
38df3554bc
commit
b46fab2e7f
@ -1,3 +1,10 @@
|
|||||||
|
2008-10-20 Esteban Sanchez <estebans@artica.es>
|
||||||
|
|
||||||
|
* lib/PandoraFMS/DB.pm: Fixed a strange bug that was causing to
|
||||||
|
generate events of servers going down, the solution was to update
|
||||||
|
own keepalive before checking others server status. Tab style
|
||||||
|
correction, replacing blankspaces with tab.
|
||||||
|
|
||||||
2008-10-20 Manuel Arostegui <marostegui@artica.es>
|
2008-10-20 Manuel Arostegui <marostegui@artica.es>
|
||||||
|
|
||||||
* pandora_server_installer: Added dependency
|
* pandora_server_installer: Added dependency
|
||||||
|
@ -22,7 +22,7 @@ use warnings;
|
|||||||
use Time::Local;
|
use Time::Local;
|
||||||
use Time::Format qw(%time %strftime %manip); # For data mangling
|
use Time::Format qw(%time %strftime %manip); # For data mangling
|
||||||
use DBI;
|
use DBI;
|
||||||
use Date::Manip; # Needed to manipulate DateTime formats of input, output and compare
|
use Date::Manip;# Needed to manipulate DateTime formats of input, output and compare
|
||||||
use XML::Simple;
|
use XML::Simple;
|
||||||
use HTML::Entities;
|
use HTML::Entities;
|
||||||
|
|
||||||
@ -834,9 +834,9 @@ sub module_generic_proc (%$$$$$) {
|
|||||||
my $a_datos = $datos->{data}->[0];
|
my $a_datos = $datos->{data}->[0];
|
||||||
|
|
||||||
if ((ref($a_datos) eq "HASH")){
|
if ((ref($a_datos) eq "HASH")){
|
||||||
$a_datos = 0; # If get bad data, then this is bad value, not "unknown" (> 1.3 version)
|
$a_datos = 0;# If get bad data, then this is bad value, not "unknown" (> 1.3 version)
|
||||||
} else {
|
} else {
|
||||||
$a_datos = sprintf("%.2f", $a_datos); # Two decimal float. We cannot store more
|
$a_datos = sprintf("%.2f", $a_datos);# Two decimal float. We cannot store more
|
||||||
} # to change this, you need to change mysql structure
|
} # to change this, you need to change mysql structure
|
||||||
$a_datos =~ s/\,/\./g; # replace "," by "." avoiding locale problems
|
$a_datos =~ s/\,/\./g; # replace "," by "." avoiding locale problems
|
||||||
my $a_name = $datos->{name}->[0];
|
my $a_name = $datos->{name}->[0];
|
||||||
@ -902,7 +902,7 @@ sub module_generic_data (%$$$$$) {
|
|||||||
}
|
}
|
||||||
if ($m_data =~ /[0-9]*/){
|
if ($m_data =~ /[0-9]*/){
|
||||||
$m_data =~ s/\,/\./g; # replace "," by "."
|
$m_data =~ s/\,/\./g; # replace "," by "."
|
||||||
$m_data = sprintf("%.2f", $m_data); # Two decimal float. We cannot store more
|
$m_data = sprintf("%.2f", $m_data);# Two decimal float. We cannot store more
|
||||||
} else {
|
} else {
|
||||||
$m_data =0;
|
$m_data =0;
|
||||||
}
|
}
|
||||||
@ -949,7 +949,7 @@ sub module_generic_data_inc (%$$$$$) {
|
|||||||
my $a_min = $datos->{min}->[0];
|
my $a_min = $datos->{min}->[0];
|
||||||
if (is_numeric($m_data)){
|
if (is_numeric($m_data)){
|
||||||
$m_data =~ s/\,/\./g; # replace "," by "."
|
$m_data =~ s/\,/\./g; # replace "," by "."
|
||||||
$m_data = sprintf("%.2f", $m_data); # Two decimal float. We cannot store more
|
$m_data = sprintf("%.2f", $m_data);# Two decimal float. We cannot store more
|
||||||
# to change this, you need to change mysql structure
|
# to change this, you need to change mysql structure
|
||||||
$m_data =~ s/\,/\./g; # replace "," by "."
|
$m_data =~ s/\,/\./g; # replace "," by "."
|
||||||
|
|
||||||
@ -1292,6 +1292,9 @@ sub pandora_serverkeepaliver (%$$) {
|
|||||||
my @data;
|
my @data;
|
||||||
my $err;
|
my $err;
|
||||||
|
|
||||||
|
# First of all, update our keepalive
|
||||||
|
pandora_updateserver ($pa_config, $pa_config->{'servername'}, 1, $opmode, $dbh);
|
||||||
|
|
||||||
my $temp = $pa_config->{"keepalive"} - $pa_config->{"server_threshold"};
|
my $temp = $pa_config->{"keepalive"} - $pa_config->{"server_threshold"};
|
||||||
|
|
||||||
if ($temp <= 0){
|
if ($temp <= 0){
|
||||||
@ -1299,8 +1302,7 @@ sub pandora_serverkeepaliver (%$$) {
|
|||||||
$temp = $pa_config->{"keepalive_orig"} * 2; # Down if keepalive x 2 seconds unknown
|
$temp = $pa_config->{"keepalive_orig"} * 2; # Down if keepalive x 2 seconds unknown
|
||||||
my $fecha_limite = DateCalc($timestamp,"- $temp seconds",\$err);
|
my $fecha_limite = DateCalc($timestamp,"- $temp seconds",\$err);
|
||||||
$fecha_limite = &UnixDate($fecha_limite,"%Y-%m-%d %H:%M:%S");
|
$fecha_limite = &UnixDate($fecha_limite,"%Y-%m-%d %H:%M:%S");
|
||||||
# Look updated servers and take down non updated servers
|
my $query_idag = "SELECT * FROM tserver WHERE keepalive < '$fecha_limite'";
|
||||||
my $query_idag = "select * from tserver where keepalive < '$fecha_limite'";
|
|
||||||
my $s_idag = $dbh->prepare($query_idag);
|
my $s_idag = $dbh->prepare($query_idag);
|
||||||
$s_idag ->execute;
|
$s_idag ->execute;
|
||||||
if ($s_idag->rows != 0) {
|
if ($s_idag->rows != 0) {
|
||||||
@ -1321,7 +1323,6 @@ sub pandora_serverkeepaliver (%$$) {
|
|||||||
}
|
}
|
||||||
$s_idag->finish();
|
$s_idag->finish();
|
||||||
# Update my server
|
# Update my server
|
||||||
pandora_updateserver ($pa_config, $pa_config->{'servername'}, 1, $opmode, $dbh);
|
|
||||||
$pa_config->{"keepalive"} = $pa_config->{"keepalive_orig"};
|
$pa_config->{"keepalive"} = $pa_config->{"keepalive_orig"};
|
||||||
}
|
}
|
||||||
$pa_config->{"keepalive"} = $pa_config->{"keepalive"} - $pa_config->{"server_threshold"};
|
$pa_config->{"keepalive"} = $pa_config->{"keepalive"} - $pa_config->{"server_threshold"};
|
||||||
@ -2269,3 +2270,4 @@ sub export_module_data {
|
|||||||
|
|
||||||
1;
|
1;
|
||||||
__END__
|
__END__
|
||||||
|
# Look updated servers and take down non updated servers
|
||||||
|
Loading…
x
Reference in New Issue
Block a user