2008-05-19 Ramon Novoa <rnovoa@artica.es>
* bin/pandora_server: Added support to process multiple data from a single module. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@835 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
5a8150e944
commit
de37cbcabe
|
@ -1,3 +1,8 @@
|
|||
2008-05-19 Ramon Novoa <rnovoa@artica.es>
|
||||
|
||||
* bin/pandora_server: Added support to process multiple data
|
||||
from a single module.
|
||||
|
||||
2008-04-24 Ramon Novoa <rnovoa@artica.es>
|
||||
|
||||
* util/pandora_db.pl: Rewrote and enabled pandora_compactdb.
|
||||
|
|
|
@ -349,22 +349,36 @@ sub procesa_datos {
|
|||
$module_name = $part->{name}->[0];
|
||||
if (defined($module_name)){ # Skip modules without names
|
||||
logger($pa_config, "Processing module Name ( $module_name ) type ( $tipo_modulo ) for agent ( $agent_name )", 5);
|
||||
if ($tipo_modulo eq 'generic_data') {
|
||||
module_generic_data ($pa_config, $part, $timestamp, $agent_name, "generic_data", $dbh);
|
||||
}
|
||||
elsif ($tipo_modulo eq 'generic_data_inc') {
|
||||
module_generic_data_inc ($pa_config, $part, $timestamp, $agent_name,"generic_data_inc", $dbh);
|
||||
}
|
||||
elsif ($tipo_modulo eq 'generic_data_string') {
|
||||
module_generic_data_string ($pa_config, $part, $timestamp, $agent_name,"generic_data_string", $dbh);
|
||||
}
|
||||
elsif ($tipo_modulo eq 'generic_proc') {
|
||||
module_generic_proc ($pa_config, $part, $timestamp, $agent_name, "generic_proc", $dbh);
|
||||
|
||||
# Data list
|
||||
if (defined $part->{datalist}) {
|
||||
foreach my $datalist (@{$part->{datalist}}) {
|
||||
if (! defined $datalist->{data}) {
|
||||
next;
|
||||
}
|
||||
|
||||
foreach my $data (@{$datalist->{data}}) {
|
||||
if (! defined $data->{value}) {
|
||||
next;
|
||||
}
|
||||
|
||||
$part->{data} = $data->{value};
|
||||
|
||||
# Data has its own timestamp
|
||||
if (defined $data->{timestamp}) {
|
||||
process_module_data($pa_config, $data->{timestamp}->[0], $agent_name, $tipo_modulo, $part, $dbh);
|
||||
}
|
||||
else {
|
||||
process_module_data($pa_config, $timestamp, $agent_name, $tipo_modulo, $part, $dbh);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
# Single data
|
||||
else {
|
||||
logger($pa_config, "ERROR: Received data from an unknown module ($tipo_modulo)", 2);
|
||||
}
|
||||
}
|
||||
process_module_data($pa_config, $timestamp, $agent_name, $tipo_modulo, $part, $dbh);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
logger($pa_config, "ERROR: There is no agent defined with name $agent_name ($id_agente)", 2);
|
||||
|
@ -373,3 +387,34 @@ sub procesa_datos {
|
|||
logger($pa_config, "ERROR: Received data from an unknown agent", 1);
|
||||
}
|
||||
}
|
||||
|
||||
##########################################################################
|
||||
## SUB process_module_data ()
|
||||
## ($pa_config, $timestamp, $agent_name, $tipo_modulo, $module, $dbh)
|
||||
## Process module data according to the module type.
|
||||
##########################################################################
|
||||
|
||||
sub process_module_data {
|
||||
my $pa_config = $_[0];
|
||||
my $timestamp = $_[1];
|
||||
my $agent_name = $_[2];
|
||||
my $tipo_modulo = $_[3];
|
||||
my $module = $_[4];
|
||||
my $dbh = $_[5];
|
||||
|
||||
if ($tipo_modulo eq 'generic_data') {
|
||||
module_generic_data ($pa_config, $module, $timestamp, $agent_name, "generic_data", $dbh);
|
||||
}
|
||||
elsif ($tipo_modulo eq 'generic_data_inc') {
|
||||
module_generic_data_inc ($pa_config, $module, $timestamp, $agent_name,"generic_data_inc", $dbh);
|
||||
}
|
||||
elsif ($tipo_modulo eq 'generic_data_string') {
|
||||
module_generic_data_string ($pa_config, $module, $timestamp, $agent_name,"generic_data_string", $dbh);
|
||||
}
|
||||
elsif ($tipo_modulo eq 'generic_proc') {
|
||||
module_generic_proc ($pa_config, $module, $timestamp, $agent_name, "generic_proc", $dbh);
|
||||
}
|
||||
else {
|
||||
logger($pa_config, "ERROR: Received data from an unknown module ($tipo_modulo)", 2);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue