2011-12-01 Juan Manuel Ramon <juanmanuel.ramon@artica.es>

* lib/PandoraFMS/NetworkServer.pm
	 lib/PandoraFMS/WMIServer.pm
	 lib/PandoraFMS/PluginServer.pm
	 lib/PandoraFMS/PredictionServer.pm: Fixed os_version  when an agent 
	 is updated.
	 
	 Fixes: #3314285 



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@5226 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
juanmanuelr 2011-12-01 18:05:42 +00:00
parent 3f0f18bd1b
commit 7b4e536199
5 changed files with 42 additions and 5 deletions

View File

@ -1,3 +1,13 @@
2011-12-01 Juan Manuel Ramon <juanmanuel.ramon@artica.es>
* lib/PandoraFMS/NetworkServer.pm
lib/PandoraFMS/WMIServer.pm
lib/PandoraFMS/PluginServer.pm
lib/PandoraFMS/PredictionServer.pm: Fixed os_version when an agent
is updated.
Fixes: #3314285
2011-12-01 Juan Manuel Ramon <juanmanuel.ramon@artica.es>
* lib/PandoraFMS/DB.pm

View File

@ -393,7 +393,9 @@ sub exec_network_module ($$$$) {
my $module_result = 1; # Fail by default
my $module_data = 0;
my $id_agente = $module->{'id_agente'};
my $agent_name = get_agent_name ($dbh, $id_agente);
my $agent_row = get_db_single_row ($dbh, 'SELECT * FROM tagente WHERE id_agente = ?', $id_agente);
my $agent_name = $agent_row->{'nombre'};
my $agent_os_version = $agent_row->{'os_version'};
my $id_tipo_modulo = $module->{'id_tipo_modulo'};
my $ip_target = $module->{'ip_target'};
my $snmp_oid = $module->{'snmp_oid'};
@ -481,8 +483,12 @@ sub exec_network_module ($$$$) {
my %data = ("data" => $module_data);
pandora_process_module ($pa_config, \%data, '', $module, '', $timestamp, $utimestamp, $server_id, $dbh);
if ($agent_os_version eq ''){
$agent_os_version = $pa_config->{'servername'}.'_Net';
}
# Update agent last contact using Pandora version as agent version
pandora_update_agent ($pa_config, $timestamp, $id_agente, $pa_config->{'servername'}.'_Net', $pa_config->{'version'}, -1, $dbh);
pandora_update_agent ($pa_config, $timestamp, $id_agente, $agent_os_version, $pa_config->{'version'}, -1, $dbh);
} else {
# Modules who cannot connect or something go bad, update last_execution_try field

View File

@ -213,7 +213,14 @@ sub data_consumer ($$) {
my %data = ("data" => $module_data);
pandora_process_module ($pa_config, \%data, '', $module, '', $timestamp, $utimestamp, $self->getServerID (), $dbh);
pandora_update_agent ($pa_config, $timestamp, $module->{'id_agente'}, $pa_config->{'servername'}.'_Plugin', $pa_config->{'version'}, -1, $dbh);
my $agent_os_version = get_db_value ($dbh, 'SELECT os_version FROM tagente WHERE id_agente = ?', $module->{'id_agente'});
if ($agent_os_version eq ''){
$agent_os_version = $pa_config->{'servername'}.'_Plugin';
}
pandora_update_agent ($pa_config, $timestamp, $module->{'id_agente'}, $agent_os_version, $pa_config->{'version'}, -1, $dbh);
}
1;

View File

@ -256,7 +256,14 @@ sub exec_prediction_module ($$$$) {
my %data = ("data" => $module_data);
pandora_process_module ($pa_config, \%data, '', $agent_module, '', $timestamp, $utimestamp, $server_id, $dbh);
pandora_update_agent ($pa_config, $timestamp, $agent_module->{'id_agente'}, $pa_config->{'servername'}.'_Prediction', $pa_config->{'version'}, -1, $dbh);
my $agent_os_version = get_db_value ($dbh, 'SELECT os_version FROM tagente WHERE id_agente = ?', $agent_module->{'id_agente'});
if ($agent_os_version eq ''){
$agent_os_version = $pa_config->{'servername'}.'_Prediction';
}
pandora_update_agent ($pa_config, $timestamp, $agent_module->{'id_agente'}, $agent_os_version, $pa_config->{'version'}, -1, $dbh);
}
1;

View File

@ -197,7 +197,14 @@ sub data_consumer ($$) {
my %data = ("data" => $module_data);
pandora_process_module ($pa_config, \%data, '', $module, '', $timestamp, $utimestamp, $self->getServerID (), $dbh);
pandora_update_agent ($pa_config, $timestamp, $module->{'id_agente'}, $pa_config->{'servername'} . '_WMI', $pa_config->{'version'}, -1, $dbh);
my $agent_os_version = get_db_value ($dbh, 'SELECT os_version FROM tagente WHERE id_agente = ?', $module->{'id_agente'});
if ($agent_os_version eq ''){
$agent_os_version = $pa_config->{'servername'}.'_WMI';
}
pandora_update_agent ($pa_config, $timestamp, $module->{'id_agente'}, $agent_os_version, $pa_config->{'version'}, -1, $dbh);
}
1;