2012-06-12 Miguel de Dios <miguel.dedios@artica.es>

* lib/PandoraFMS/ReconServer.pm: fixed the recode into html entities
	the name of network component into the function
	"create_network_profile_modules".
	
	MERGED FROM 4.0.2




git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6507 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
mdtrooper 2012-06-12 12:34:51 +00:00
parent fcef3aeb66
commit d666e24144
2 changed files with 72 additions and 64 deletions

View File

@ -1,3 +1,11 @@
2012-06-12 Miguel de Dios <miguel.dedios@artica.es>
* lib/PandoraFMS/ReconServer.pm: fixed the recode into html entities
the name of network component into the function
"create_network_profile_modules".
MERGED FROM 4.0.2
2012-06-11 Miguel de Dios <miguel.dedios@artica.es>
* pandora_server/util/pandora_xml_stress.pl: cleaned source code

View File

@ -65,8 +65,8 @@ sub new ($$$$$$) {
# Call the constructor of the parent class
my $self = $class->SUPER::new($config, 3, \&PandoraFMS::ReconServer::data_producer, \&PandoraFMS::ReconServer::data_consumer, $dbh);
bless $self, $class;
return $self;
bless $self, $class;
return $self;
}
###############################################################################
@ -206,10 +206,10 @@ sub data_consumer ($$) {
next;
}
# GIS Code -----------------------------
# GIS Code -----------------------------
# If GIS is activated try to geolocate the ip address of the agent
# and store also it's position.
# and store also it's position.
if($pa_config->{'activate_gis'} == 1 && $pa_config->{'recon_reverse_geolocation_mode'} !~ m/^disabled$/i) {
@ -402,14 +402,14 @@ sub guess_os {
# Use xprobe2 if available
my $xprobe = $pa_config->{'xprobe2'};
if (-e $xprobe){
my $output = `$xprobe $host 2> /dev/null | grep 'Running OS' | head -1`;
return 10 if ($? != 0);
return pandora_get_os ($output);
}
if (-e $xprobe){
my $output = `$xprobe $host 2> /dev/null | grep 'Running OS' | head -1`;
return 10 if ($? != 0);
return pandora_get_os ($output);
}
# Use nmap by default
my $nmap = $pa_config->{'nmap'};
# Use nmap by default
my $nmap = $pa_config->{'nmap'};
my $output = `$nmap -F -O $host 2> /dev/null | grep 'Aggressive OS guesses'`;
return 10 if ($? != 0);
return pandora_get_os ($output);
@ -446,17 +446,17 @@ sub create_network_profile_modules {
logger($pa_config, "Processing network component '" . safe_output ($component->{'name'}) . "' for agent $addr.", 10);
# Use snmp_community from network task instead the component snmp_community
$component->{'snmp_community'} = safe_output ($snmp_community);
# Use snmp_community from network task instead the component snmp_community
$component->{'snmp_community'} = safe_output ($snmp_community);
# Create the module
my $module_id = db_insert ($dbh, 'id_agente_modulo', 'INSERT INTO tagente_modulo (id_agente, id_tipo_modulo, descripcion, nombre, max, min, module_interval, tcp_port, tcp_send, tcp_rcv, snmp_community, snmp_oid, ip_target, id_module_group, flag, disabled, plugin_user, plugin_pass, plugin_parameter, max_timeout, id_modulo, min_warning, max_warning, str_warning, min_critical, max_critical, str_critical, min_ff_event, id_plugin, post_process)
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, 1, 0, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)',
$agent_id, $component->{'type'}, $component->{'description'}, safe_input($component->{'name'}), $component->{'max'}, $component->{'min'}, $component->{'module_interval'}, $component->{'tcp_port'}, $component->{'tcp_send'}, $component->{'tcp_rcv'}, $component->{'snmp_community'},
$component->{'snmp_oid'}, $addr, $component->{'id_module_group'}, $component->{'plugin_user'}, $component->{'plugin_pass'}, $component->{'plugin_parameter'}, $component->{'max_timeout'}, $component->{'id_modulo'}, $component->{'min_warning'}, $component->{'max_warning'}, $component->{'str_warning'}, $component->{'min_critical'}, $component->{'max_critical'}, $component->{'str_critical'}, $component->{'min_ff_event'}, $component->{'id_plugin'}, $component->{'post_process'});
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, 1, 0, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)',
$agent_id, $component->{'type'}, $component->{'description'}, $component->{'name'}, $component->{'max'}, $component->{'min'}, $component->{'module_interval'}, $component->{'tcp_port'}, $component->{'tcp_send'}, $component->{'tcp_rcv'}, $component->{'snmp_community'},
$component->{'snmp_oid'}, $addr, $component->{'id_module_group'}, $component->{'plugin_user'}, $component->{'plugin_pass'}, $component->{'plugin_parameter'}, $component->{'max_timeout'}, $component->{'id_modulo'}, $component->{'min_warning'}, $component->{'max_warning'}, $component->{'str_warning'}, $component->{'min_critical'}, $component->{'max_critical'}, $component->{'str_critical'}, $component->{'min_ff_event'}, $component->{'id_plugin'}, $component->{'post_process'});
# An entry in tagente_estado is necessary for the module to work
db_do ($dbh, 'INSERT INTO tagente_estado (`id_agente_modulo`, `id_agente`, `last_try`, current_interval) VALUES (?, ?, \'1970-01-01 00:00:00\', ?)', $module_id, $agent_id, $component->{'module_interval'});
db_do ($dbh, 'INSERT INTO tagente_estado (`id_agente_modulo`, `id_agente`, `last_try`, current_interval) VALUES (?, ?, \'1970-01-01 00:00:00\', ?)', $module_id, $agent_id, $component->{'module_interval'});
logger($pa_config, 'Creating module ' . safe_output ($component->{'name'}) . " for agent $addr from network component.", 10);
}