2012-04-23 Ramon Novoa <rnovoa@artica.es>
* lib/PandoraFMS/Core.pm: Merged from 4.0 branch. Do not insert zeroes when something goes wrong while processing an inc module. Fixes bug #3519591. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6102 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
cb2aeecc08
commit
e57e0e5371
|
@ -1,3 +1,9 @@
|
||||||
|
2012-04-23 Ramon Novoa <rnovoa@artica.es>
|
||||||
|
|
||||||
|
* lib/PandoraFMS/Core.pm: Merged from 4.0 branch. Do not insert zeroes
|
||||||
|
when something goes wrong while processing an inc module. Fixes bug
|
||||||
|
#3519591.
|
||||||
|
|
||||||
2012-04-23 Ramon Novoa <rnovoa@artica.es>
|
2012-04-23 Ramon Novoa <rnovoa@artica.es>
|
||||||
|
|
||||||
* lib/PandoraFMS/NetworkServer.pm,
|
* lib/PandoraFMS/NetworkServer.pm,
|
||||||
|
|
|
@ -1883,8 +1883,8 @@ sub subst_alert_macros ($$) {
|
||||||
##########################################################################
|
##########################################################################
|
||||||
# Process module data.
|
# Process module data.
|
||||||
##########################################################################
|
##########################################################################
|
||||||
sub process_data ($$$$$) {
|
sub process_data ($$$$$$) {
|
||||||
my ($data_object, $module, $module_type, $utimestamp, $dbh) = @_;
|
my ($pa_config, $data_object, $module, $module_type, $utimestamp, $dbh) = @_;
|
||||||
|
|
||||||
if ($module_type eq "log4x") {
|
if ($module_type eq "log4x") {
|
||||||
return log4x_get_severity_num($data_object);
|
return log4x_get_severity_num($data_object);
|
||||||
|
@ -1915,16 +1915,10 @@ sub process_data ($$$$$) {
|
||||||
|
|
||||||
# Process INC modules
|
# Process INC modules
|
||||||
if ($module_type =~ m/_inc$/) {
|
if ($module_type =~ m/_inc$/) {
|
||||||
$data = process_inc_data ($data, $module, $utimestamp, $dbh);
|
$data = process_inc_data ($pa_config, $data, $module, $utimestamp, $dbh);
|
||||||
|
|
||||||
# Not an error, no previous data
|
# No previous data or error.
|
||||||
if (!defined($data)){
|
return undef unless defined ($data);
|
||||||
$data_object->{'data'} = 0;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
# Same timestamp as previous data. Discard.
|
|
||||||
return undef if($data == -1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Post process
|
# Post process
|
||||||
|
@ -1944,8 +1938,8 @@ sub process_data ($$$$$) {
|
||||||
##########################################################################
|
##########################################################################
|
||||||
# Process data of type *_inc.
|
# Process data of type *_inc.
|
||||||
##########################################################################
|
##########################################################################
|
||||||
sub process_inc_data ($$$$) {
|
sub process_inc_data ($$$$$) {
|
||||||
my ($data, $module, $utimestamp, $dbh) = @_;
|
my ($pa_config, $data, $module, $utimestamp, $dbh) = @_;
|
||||||
|
|
||||||
my $data_inc = get_db_single_row ($dbh, 'SELECT * FROM tagente_datos_inc WHERE id_agente_modulo = ?', $module->{'id_agente_modulo'});
|
my $data_inc = get_db_single_row ($dbh, 'SELECT * FROM tagente_datos_inc WHERE id_agente_modulo = ?', $module->{'id_agente_modulo'});
|
||||||
|
|
||||||
|
@ -1954,6 +1948,7 @@ sub process_inc_data ($$$$) {
|
||||||
db_do ($dbh, 'INSERT INTO tagente_datos_inc
|
db_do ($dbh, 'INSERT INTO tagente_datos_inc
|
||||||
(id_agente_modulo, datos, utimestamp)
|
(id_agente_modulo, datos, utimestamp)
|
||||||
VALUES (?, ?, ?)', $module->{'id_agente_modulo'}, $data, $utimestamp);
|
VALUES (?, ?, ?)', $module->{'id_agente_modulo'}, $data, $utimestamp);
|
||||||
|
logger($pa_config, "Discarding first data for incremental module " . $module->{'nombre'} . "(module id " . $module->{'id_agente_modulo'} . ").", 10);
|
||||||
return undef;
|
return undef;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1963,11 +1958,12 @@ sub process_inc_data ($$$$) {
|
||||||
db_do ($dbh, 'INSERT INTO tagente_datos_inc
|
db_do ($dbh, 'INSERT INTO tagente_datos_inc
|
||||||
(id_agente_modulo, datos, utimestamp)
|
(id_agente_modulo, datos, utimestamp)
|
||||||
VALUES (?, ?, ?)', $module->{'id_agente_modulo'}, $data, $utimestamp);
|
VALUES (?, ?, ?)', $module->{'id_agente_modulo'}, $data, $utimestamp);
|
||||||
|
logger($pa_config, "Discarding data and resetting counter for incremental module " . $module->{'nombre'} . "(module id " . $module->{'id_agente_modulo'} . ").", 10);
|
||||||
return undef;
|
return undef;
|
||||||
}
|
}
|
||||||
|
|
||||||
# Should not happen
|
# Should not happen
|
||||||
return -1 if ($utimestamp == $data_inc->{'utimestamp'});
|
return undef if ($utimestamp == $data_inc->{'utimestamp'});
|
||||||
|
|
||||||
# Update inc data
|
# Update inc data
|
||||||
db_do ($dbh, 'UPDATE tagente_datos_inc SET datos = ?, utimestamp = ? WHERE id_agente_modulo = ?', $data, $utimestamp, $module->{'id_agente_modulo'});
|
db_do ($dbh, 'UPDATE tagente_datos_inc SET datos = ?, utimestamp = ? WHERE id_agente_modulo = ?', $data, $utimestamp, $module->{'id_agente_modulo'});
|
||||||
|
|
Loading…
Reference in New Issue