diff --git a/pandora_console/extensions/sample_agent.php b/pandora_console/extensions/sample_agent.php deleted file mode 100644 index 558d5df5d1..0000000000 --- a/pandora_console/extensions/sample_agent.php +++ /dev/null @@ -1,66 +0,0 @@ - $id_agente], 'id_agente_modulo'); - $count_modules = count($modules); - - // Update of layout 1 (Rack sample). - $images_rack_server = [ - 'rack_server_rack', - 'rack_server', - 'rack_switch', - 'rack_firewall', - 'rack_double_server', - 'rack_frame', - 'rack_pdu', - ]; - $query = 'UPDATE `tlayout_data` SET `id_agent` = '.$id_agente.', `id_agente_modulo` = CASE '; - for ($i = 0; $i < $count_modules; $i++) { - $query .= 'WHEN `image` = "'.$images_rack_server[$i].'" THEN '.$modules[$i]['id_agente_modulo'].' '; - } - - $query .= 'END WHERE `id_layout` = 1 AND `image` IN ("'.implode('","', $images_rack_server).'");'; - - db_process_sql($query); - // Update of layout 2 (Dashboard). - $query = 'UPDATE `tlayout_data` SET `id_agent`= '.$id_agente.', `id_agente_modulo` = CASE '; - $query .= 'WHEN `id` = 107 THEN '.$modules[0]['id_agente_modulo'].' '; - $query .= 'WHEN `id` = 108 THEN '.$modules[1]['id_agente_modulo'].' '; - $query .= 'WHEN `id` = 109 THEN '.$modules[2]['id_agente_modulo'].' '; - $query .= 'WHEN `id` = 110 THEN '.$modules[2]['id_agente_modulo'].' '; - $query .= 'WHEN `id` = 111 THEN '.$modules[3]['id_agente_modulo'].' '; - $query .= 'WHEN `id` = 112 THEN '.$modules[4]['id_agente_modulo'].' '; - $query .= 'WHEN `id` = 113 THEN '.$modules[5]['id_agente_modulo'].' '; - $query .= 'WHEN `id` = 114 THEN '.$modules[6]['id_agente_modulo'].' '; - $query .= 'END WHERE `id_layout` = 2 AND `id` IN (107,108,109,110,111,112,113,114);'; - - db_process_sql($query); - - // This setting will avoid regenerate all the times the visual consoles. - config_update_value('sample_agent_deployed', 1); -} - -extensions_add_main_function('sample_agent_deployment'); diff --git a/pandora_server/FreeBSD/pandora_server.conf.new b/pandora_server/FreeBSD/pandora_server.conf.new index bbd58b5cff..ddca8a41ac 100644 --- a/pandora_server/FreeBSD/pandora_server.conf.new +++ b/pandora_server/FreeBSD/pandora_server.conf.new @@ -348,15 +348,6 @@ self_monitoring 1 # Self monitoring interval (in seconds). self_monitoring_interval 300 -# Pandora Sample Agent. If enabled, every 10 minutes, this embedded agent -# will make sample data. Disabled by default. - -sample_agent 0 - -# Pandora Sample Agent interval (in seconds). - -sample_agent_interval 600 - # Update parent from the agent xml #update_parent 1 diff --git a/pandora_server/NetBSD/pandora_server.conf.new b/pandora_server/NetBSD/pandora_server.conf.new index f5c2e79275..a4a77563f3 100644 --- a/pandora_server/NetBSD/pandora_server.conf.new +++ b/pandora_server/NetBSD/pandora_server.conf.new @@ -340,15 +340,6 @@ restart_delay 60 self_monitoring 1 -# Pandora Sample Agent. If enabled, every 10 minutes, this embedded agent -# will make sample data. Disabled by default. - -sample_agent 0 - -# Pandora Sample Agent interval (in seconds). - -sample_agent_interval 600 - # Update parent from the agent xml #update_parent 1 diff --git a/pandora_server/bin/pandora_server b/pandora_server/bin/pandora_server index ae07174f07..e04e326c02 100755 --- a/pandora_server/bin/pandora_server +++ b/pandora_server/bin/pandora_server @@ -491,16 +491,6 @@ sub pandora_server_tasks ($) { pandora_self_monitoring ($pa_config, $dbh); } - # Pandora sample agent - if (defined($pa_config->{'sample_agent'})) { - if ($pa_config->{'sample_agent'} == 1 - && !is_metaconsole($pa_config) - && $counter % $pa_config->{'sample_agent_interval'} == 0){ - pandora_sample_agent ($pa_config); - } - pandora_update_config_token ($dbh, 'sample_agent', $pa_config->{'sample_agent'}); - } - # Avoid counter overflow if ($counter >= ~0){ $counter = 0; diff --git a/pandora_server/conf/pandora_server.conf.new b/pandora_server/conf/pandora_server.conf.new index 8332becd62..3326e4a9ae 100644 --- a/pandora_server/conf/pandora_server.conf.new +++ b/pandora_server/conf/pandora_server.conf.new @@ -422,15 +422,6 @@ self_monitoring 1 # Self monitoring interval (in seconds). self_monitoring_interval 300 -# Pandora Sample Agent. If enabled, every 10 minutes, this embedded agent -# will make sample data. Disabled by default. - -sample_agent 0 - -# Pandora Sample Agent interval (in seconds). - -sample_agent_interval 600 - # Update parent from the agent xml update_parent 1 diff --git a/pandora_server/conf/pandora_server.conf.windows b/pandora_server/conf/pandora_server.conf.windows index efed94ed52..11e67f90eb 100644 --- a/pandora_server/conf/pandora_server.conf.windows +++ b/pandora_server/conf/pandora_server.conf.windows @@ -345,15 +345,6 @@ restart_delay 60 # Self monitoring interval (in seconds). #self_monitoring_interval 300 -# Pandora Sample Agent. If enabled, every 10 minutes, this embedded agent -# will make sample data. Disabled by default. - -sample_agent 0 - -# Pandora Sample Agent interval (in seconds). - -sample_agent_interval 600 - # Update parent from the agent xml #update_parent 1 diff --git a/pandora_server/lib/PandoraFMS/Config.pm b/pandora_server/lib/PandoraFMS/Config.pm index 021ade812d..e9003beec8 100644 --- a/pandora_server/lib/PandoraFMS/Config.pm +++ b/pandora_server/lib/PandoraFMS/Config.pm @@ -415,12 +415,6 @@ sub pandora_load_config { # Self monitoring interval $pa_config->{'self_monitoring_interval'} = 300; # 5.1SP1 - # Sample Agent - $pa_config->{'sample_agent'} = 0; - - # Sample agent interval - $pa_config->{'sample_agent_interval'} = 600; - # Process XML data files as a stack $pa_config->{"dataserver_lifo"} = 0; # 5.0 @@ -1014,12 +1008,6 @@ sub pandora_load_config { elsif ($parametro =~ m/^self_monitoring_interval\s+([0-9]*)/i) { $pa_config->{'self_monitoring_interval'} = clean_blank($1); } - elsif ($parametro =~ m/^sample_agent\s+([0-1])/i) { - $pa_config->{'sample_agent'} = clean_blank($1); - } - elsif ($parametro =~ m/^sample_agent_interval\s+([0-9]*)/i) { - $pa_config->{'sample_agent_interval'} = clean_blank($1); - } elsif ($parametro =~ m/^update_parent\s+([0-1])/i) { $pa_config->{'update_parent'} = clean_blank($1); } diff --git a/pandora_server/lib/PandoraFMS/Core.pm b/pandora_server/lib/PandoraFMS/Core.pm index 515c930769..c29fe1e6e2 100644 --- a/pandora_server/lib/PandoraFMS/Core.pm +++ b/pandora_server/lib/PandoraFMS/Core.pm @@ -100,8 +100,6 @@ Exported Functions: =item * C -=item * C - =back =head1 METHODS @@ -261,7 +259,6 @@ our @EXPORT = qw( pandora_server_statistics pandora_self_monitoring pandora_thread_monitoring - pandora_sample_agent pandora_process_policy_queue pandora_sync_agents_integria pandora_get_integria_ticket_types @@ -6135,84 +6132,6 @@ sub pandora_thread_monitoring ($$$) { close (XMLFILE); } -########################################################################## -=head2 C<< xml_module_template (I<$module_name>, I<$module_type>, I<$module_data>) >> - -Module template for sample agent - -=cut -########################################################################## -sub xml_module_template ($$$) { - my ($module_name, $module_type, $module_data) = @_; - my $output = "\n"; - - $module_name = "" if $module_name =~ /[\s+.]+/; - $module_data = "" if $module_data =~ /[\s+.]+/; - - $output .= "\t".$module_name."\n"; - $output .= "\t".$module_type."\n"; - $output .= "\t".$module_data."\n"; - $output .= "\n"; - - return $output; -} -########################################################################## -=head2 C<< pandora_sample_agent (I<$pa_config>) >> - -Pandora agent for make sample data - -=cut -########################################################################## -sub pandora_sample_agent ($) { - - my ($pa_config) = @_; - - my $utimestamp = time (); - my $timestamp = strftime ("%Y-%m-%d %H:%M:%S", localtime()); - # First line - my $xml_output = "\n"; - # Header - $xml_output = "\n"; - # Boolean ever return TRUE - $xml_output .= xml_module_template ("Boolean ever true", "generic_proc","1"); - # Boolean return TRUE at 80% of times - my $sample_boolean_mostly_true = 1; - $sample_boolean_mostly_true = 0 if rand(9) > 7; - $xml_output .= xml_module_template ("Boolean mostly true", "generic_proc",$sample_boolean_mostly_true); - # Boolean return false at 80% of times - my $sample_boolean_mostly_false = 0; - $sample_boolean_mostly_false = 1 if rand(9) > 7; - $xml_output .= xml_module_template ("Boolean mostly false", "generic_proc", $sample_boolean_mostly_false); - # Boolean ever return FALSE - $xml_output .= xml_module_template ("Boolean ever false", "generic_proc","0"); - # Random integer between 0 and 100 - $xml_output .= xml_module_template ("Random integer values", "generic_data",int(rand(100))); - # Random values obtained with sinusoidal curves between 0 and 100 values - my $b = 1; - my $sample_serie_curve = 1 + cos(deg2rad($b)); - $b = $b + rand(20)/10; - $b = 0 if ($b > 180); - $sample_serie_curve = $sample_serie_curve * $b * 10; - $sample_serie_curve =~ s/\,/\./g; - $xml_output .= xml_module_template ("Random serie curve", "generic_data", $sample_serie_curve); - # String with 10 random characters - my $sample_random_text = ""; - my @characters = ('a'..'z','A'..'Z'); - for (1...10){ - $sample_random_text .= $characters[int(rand(@characters))]; - } - $xml_output .= xml_module_template ("Random text", "generic_data_string", $sample_random_text); - # End of xml - $xml_output .= ""; - # File path definition - my $filename = $pa_config->{"incomingdir"}."/".$pa_config->{'servername'}.".sample.".$utimestamp.".data"; - # Opening, Writing and closing of XML - open (my $xmlfile, ">", $filename) or die "[FATAL] Could not open sample XML file for deploying monitorization at '$filename'"; - print $xmlfile $xml_output; - close ($xmlfile); - -} - ########################################################################## =head2 C<< set_master (I<$pa_config>, I<$dbh>) >>