From f9abfa043c294a4dad2ad6f3570142169ec88481 Mon Sep 17 00:00:00 2001 From: fermin831 Date: Fri, 13 Oct 2017 11:59:37 +0200 Subject: [PATCH 001/149] Added _event_cfX_ to macros help --- pandora_console/include/help/en/help_alert_config.php | 1 + pandora_console/include/help/en/help_alert_macros.php | 1 + pandora_console/include/help/es/help_alert_config.php | 1 + pandora_console/include/help/es/help_alert_macros.php | 1 + pandora_console/include/help/ja/help_alert_config.php | 1 + pandora_console/include/help/ja/help_alert_macros.php | 1 + 6 files changed, 6 insertions(+) diff --git a/pandora_console/include/help/en/help_alert_config.php b/pandora_console/include/help/en/help_alert_config.php index fec6b2a7bf..ff1c16522d 100644 --- a/pandora_console/include/help/en/help_alert_config.php +++ b/pandora_console/include/help/en/help_alert_config.php @@ -52,6 +52,7 @@ Apart from the defined module macros, the following macros are also available:
  • _alert_text_severity_ : Text alert severity (Maintenance, Informational, Normal Minor, Warning, Major, Critical).
  • _event_text_severity_ : (Only event alerts) Text event (who fire the alert) severity (Maintenance, Informational, Normal Minor, Warning, Major, Critical).
  • _event_id_ : (Only event alerts) Id of the event that fired the alert.
  • +
  • _event_cfX_ : (Only event alerts) Key of the event custom field that fired the alert.
  • _id_agent_ : Id of agent, useful to build direct URL to redirect to a Pandora FMS console webpage.
  • _id_group_ : Id of agent group.
  • _id_module_ : Id of module.
  • diff --git a/pandora_console/include/help/en/help_alert_macros.php b/pandora_console/include/help/en/help_alert_macros.php index 5382c502ab..5b9185b991 100644 --- a/pandora_console/include/help/en/help_alert_macros.php +++ b/pandora_console/include/help/en/help_alert_macros.php @@ -45,6 +45,7 @@ Besides the defined module macros, the following macros are available:
  • _alert_text_severity_: Priority level, in text, for the alert (Maintenance, Informational, Normal Minor, Major, Critical).
  • _event_text_severity_: (Only event alerts) Text event (which triggered the alert) severity (Maintenance, Informational, Normal Minor, Warning, Major, Critical).
  • _event_id_: (Only event alerts) ID of the event that triggered the alert.
  • +
  • _event_cfX_ : (Only event alerts) Key of the event custom field that fired the alert.
  • _id_agent_: Agent’s ID, useful for building a direct URL that redirects to a Pandora FMS console webpage.
  • _id_group_ : Agent group ID.
  • _id_module_ : ID of module.
  • diff --git a/pandora_console/include/help/es/help_alert_config.php b/pandora_console/include/help/es/help_alert_config.php index 5ab70b784e..565e40afe2 100644 --- a/pandora_console/include/help/es/help_alert_config.php +++ b/pandora_console/include/help/es/help_alert_config.php @@ -54,6 +54,7 @@ Además de las macros de módulo definidas, las siguientes macros están disponi
  • _alert_text_severity_: Prioridad en texto de la alerta. (Maintenance, Informational, Normal Minor, Warning, Major, Critical)
  • _eventt_text_severity_: (Solo alertas de evento) Prioridad en texto de el evento que dispara la alerta. (Maintenance, Informational, Normal Minor, Warning, Major, Critical)
  • _event_id_ : (Solo alertas de evento) Id del evento que disparó la alerta.
  • +
  • _event_cfX_ : (Solo alertas de evento) Clave del campo personalizado del evento que disparó la alerta.
  • _id_agent_: ID del agente, util para construir URL de acceso a la consola de Pandora.
  • _id_group_ : Id del grupo de agente.
  • _id_module_ : ID del módulo.
  • diff --git a/pandora_console/include/help/es/help_alert_macros.php b/pandora_console/include/help/es/help_alert_macros.php index 74efb4582b..f4d179fb79 100644 --- a/pandora_console/include/help/es/help_alert_macros.php +++ b/pandora_console/include/help/es/help_alert_macros.php @@ -45,6 +45,7 @@ Además de las macros de módulo definidas, las siguientes macros están disponi
  • _alert_text_severity_: Prioridad en texto de la alerta (Maintenance, Informational, Normal Minor, Warning, Major, Critical).
  • _eventt_text_severity_: (Solo alertas de evento) Prioridad en texto de el evento que dispara la alerta (Maintenance, Informational, Normal Minor, Warning, Major, Critical).
  • _event_id_: (Solo alertas de evento) Id del evento que disparó la alerta.
  • +
  • _event_cfX_ : (Solo alertas de evento) Clave del campo personalizado del evento que disparó la alerta.
  • _id_agent_: ID del agente, util para construir URL de acceso a la consola de Pandora.
  • _id_group_ : Id del grupo de agente.
  • _id_module_ : ID del módulo.
  • diff --git a/pandora_console/include/help/ja/help_alert_config.php b/pandora_console/include/help/ja/help_alert_config.php index 592ed64ee3..a2cd8ca519 100644 --- a/pandora_console/include/help/ja/help_alert_config.php +++ b/pandora_console/include/help/ja/help_alert_config.php @@ -53,6 +53,7 @@ email アクションを設定するには、_field1_ (送信先アドレス)、
  • _alert_text_severity_ : テキストでのアラートの重要度 (Maintenance, Informational, Normal Minor, Warning, Major, Critical)
  • _event_text_severity_ : (イベントアラートのみ) イベント(アラートの発生元)のテキストでの重要度 (Maintenance, Informational, Normal Minor, Warning, Major, Critical)
  • _event_id_ : (イベントアラートのみ) アラート発生元のイベントID
  • +
  • _event_cfX_ : (Only event alerts) Key of the event custom field that fired the alert.
  • _id_agent_ : エージェントのID / Webコンソールへのリンクを生成するのに便利です
  • _id_group_ : エージェントグループのID
  • _id_module_ : モジュールID
  • diff --git a/pandora_console/include/help/ja/help_alert_macros.php b/pandora_console/include/help/ja/help_alert_macros.php index c9729e6bfd..236f0e4e72 100644 --- a/pandora_console/include/help/ja/help_alert_macros.php +++ b/pandora_console/include/help/ja/help_alert_macros.php @@ -45,6 +45,7 @@
  • _alert_text_severity_ : テキストでのアラートの重要度 (Maintenance, Informational, Normal Minor, Warning, Major, Critical)
  • _event_text_severity_ : (イベントアラートのみ) イベント(アラートの発生元)のテキストでの重要度 (Maintenance, Informational, Normal Minor, Warning, Major, Critical)
  • _event_id_ : (イベントアラートのみ) アラート発生元のイベントID
  • +
  • _event_cfX_ : (Only event alerts) Key of the event custom field that fired the alert.
  • _id_agent_ : エージェントのID / Webコンソールへのリンクを生成するのに便利です
  • _id_group_ : エージェントグループのID
  • _id_module_ : モジュール ID
  • From 90366e7e586a1ca69441e8adfee11553fbca2ef7 Mon Sep 17 00:00:00 2001 From: Ramon Novoa Date: Fri, 13 Oct 2017 15:49:12 +0200 Subject: [PATCH 002/149] Performance improvements. Rewrote safe_input and safe_output. Ref pandora_enterprise#1465. --- pandora_server/lib/PandoraFMS/DataServer.pm | 11 +- pandora_server/lib/PandoraFMS/Tools.pm | 271 ++++++++++---------- 2 files changed, 144 insertions(+), 138 deletions(-) diff --git a/pandora_server/lib/PandoraFMS/DataServer.pm b/pandora_server/lib/PandoraFMS/DataServer.pm index ebd8f860ee..603cbf8cf2 100644 --- a/pandora_server/lib/PandoraFMS/DataServer.pm +++ b/pandora_server/lib/PandoraFMS/DataServer.pm @@ -186,6 +186,7 @@ sub data_consumer ($$) { for (0..1) { eval { threads->yield; + $xml_data = XMLin ($file_name, forcearray => 'module'); }; @@ -527,7 +528,7 @@ sub process_xml_data ($$$$$) { # Single data if (! defined ($module_data->{'datalist'})) { my $data_timestamp = get_tag_value ($module_data, 'timestamp', $timestamp); - process_module_data ($pa_config, $module_data, $server_id, $agent_name, $module_name, $module_type, $interval, $data_timestamp, $dbh, $new_agent); + process_module_data ($pa_config, $module_data, $server_id, $agent, $module_name, $module_type, $interval, $data_timestamp, $dbh, $new_agent); next; } @@ -544,7 +545,7 @@ sub process_xml_data ($$$$$) { $module_data->{'data'} = $data->{'value'}; my $data_timestamp = get_tag_value ($data, 'timestamp', $timestamp); - process_module_data ($pa_config, $module_data, $server_id, $agent_name, $module_name, + process_module_data ($pa_config, $module_data, $server_id, $agent, $module_name, $module_type, $interval, $data_timestamp, $dbh, $new_agent); } } @@ -584,16 +585,16 @@ sub process_xml_data ($$$$$) { # Process module data, creating module if necessary. ########################################################################## sub process_module_data ($$$$$$$$$$) { - my ($pa_config, $data, $server_id, $agent_name, + my ($pa_config, $data, $server_id, $agent, $module_name, $module_type, $interval, $timestamp, $dbh, $force_processing) = @_; # Get agent data - my $agent = get_db_single_row ($dbh, 'SELECT * FROM tagente WHERE nombre = ?', safe_input($agent_name)); if (! defined ($agent)) { - logger($pa_config, "Invalid agent '$agent_name' for module '$module_name'.", 3); + logger($pa_config, "Invalid agent for module '$module_name'.", 3); return; } + my $agent_name = $agent->{'nombre'}; # Get module parameters, matching column names in tagente_modulo my $module_conf; diff --git a/pandora_server/lib/PandoraFMS/Tools.pm b/pandora_server/lib/PandoraFMS/Tools.pm index e0dda9af4f..a9481d4f13 100755 --- a/pandora_server/lib/PandoraFMS/Tools.pm +++ b/pandora_server/lib/PandoraFMS/Tools.pm @@ -151,6 +151,141 @@ if ($OS eq 'linux') { } chomp($OS_VERSION); +# Entity to character mapping. Contains a few tweaks to make it backward compatible with the previous safe_input implementation. +my %ENT2CHR = ( + '#x00' => chr(0), + '#x01' => chr(1), + '#x02' => chr(2), + '#x03' => chr(3), + '#x04' => chr(4), + '#x05' => chr(5), + '#x06' => chr(6), + '#x07' => chr(7), + '#x08' => chr(8), + '#x09' => chr(9), + '#x0a' => chr(10), + '#x0b' => chr(11), + '#x0c' => chr(12), + '#x0d' => chr(13), + '#x0e' => chr(14), + '#x0f' => chr(15), + '#x10' => chr(16), + '#x11' => chr(17), + '#x12' => chr(18), + '#x13' => chr(19), + '#x14' => chr(20), + '#x15' => chr(21), + '#x16' => chr(22), + '#x17' => chr(23), + '#x18' => chr(24), + '#x19' => chr(25), + '#x1a' => chr(26), + '#x1b' => chr(27), + '#x1c' => chr(28), + '#x1d' => chr(29), + '#x1e' => chr(30), + '#x1f' => chr(31), + '#x20' => chr(32), + 'quot' => chr(34), + 'amp' => chr(38), + '#039' => chr(39), + '#40' => chr(40), + '#41' => chr(41), + 'lt' => chr(60), + 'gt' => chr(62), + '#92' => chr(92), + '#x80' => chr(128), + '#x81' => chr(129), + '#x82' => chr(130), + '#x83' => chr(131), + '#x84' => chr(132), + '#x85' => chr(133), + '#x86' => chr(134), + '#x87' => chr(135), + '#x88' => chr(136), + '#x89' => chr(137), + '#x8a' => chr(138), + '#x8b' => chr(139), + '#x8c' => chr(140), + '#x8d' => chr(141), + '#x8e' => chr(142), + '#x8f' => chr(143), + '#x90' => chr(144), + '#x91' => chr(145), + '#x92' => chr(146), + '#x93' => chr(147), + '#x94' => chr(148), + '#x95' => chr(149), + '#x96' => chr(150), + '#x97' => chr(151), + '#x98' => chr(152), + '#x99' => chr(153), + '#x9a' => chr(154), + '#x9b' => chr(155), + '#x9c' => chr(156), + '#x9d' => chr(157), + '#x9e' => chr(158), + '#x9f' => chr(159), + '#xa0' => chr(160), + '#xa1' => chr(161), + '#xa2' => chr(162), + '#xa3' => chr(163), + '#xa4' => chr(164), + '#xa5' => chr(165), + '#xa6' => chr(166), + '#xa7' => chr(167), + '#xa8' => chr(168), + '#xa9' => chr(169), + '#xaa' => chr(170), + '#xab' => chr(171), + '#xac' => chr(172), + '#xad' => chr(173), + '#xae' => chr(174), + '#xaf' => chr(175), + '#xb0' => chr(176), + '#xb1' => chr(177), + '#xb2' => chr(178), + '#xb3' => chr(179), + '#xb4' => chr(180), + '#xb5' => chr(181), + '#xb6' => chr(182), + '#xb7' => chr(183), + '#xb8' => chr(184), + '#xb9' => chr(185), + '#xba' => chr(186), + '#xbb' => chr(187), + '#xbc' => chr(188), + '#xbd' => chr(189), + '#xbe' => chr(190), + 'Aacute' => chr(193), + 'Auml' => chr(196), + 'Eacute' => chr(201), + 'Euml' => chr(203), + 'Iacute' => chr(205), + 'Iuml' => chr(207), + 'Ntilde' => chr(209), + 'Oacute' => chr(211), + 'Ouml' => chr(214), + 'Uacute' => chr(218), + 'Uuml' => chr(220), + 'aacute' => chr(225), + 'auml' => chr(228), + 'eacute' => chr(233), + 'euml' => chr(235), + 'iacute' => chr(237), + 'iuml' => chr(239), + 'ntilde' => chr(241), + 'oacute' => chr(243), + 'ouml' => chr(246), + 'uacute' => chr(250), + 'uuml' => chr(252), +); + +# Construct the character to entity mapping. +my %CHR2ENT; +while (my ($ent, $chr) = each(%ENT2CHR)) { + $CHR2ENT{$chr} = "&" . $ent . ";"; +} ############################################################################### # Sets user:group owner for the given file @@ -201,49 +336,7 @@ sub pandora_trash_ascii { sub safe_input($) { my $value = shift; - $value = encode_entities ($value, "<>&"); - - #//Replace the character '\' for the equivalent html entitie - $value =~ s/\\/\/gi; - - #// First attempt to avoid SQL Injection based on SQL comments - #// Specific for MySQL. - $value =~ s/\/\*//*/gi; - $value =~ s/\*\//*//gi; - - #//Replace ' for the html entitie - $value =~ s/\"/"/gi; - - #//Replace ' for the html entitie - $value =~ s/\'/'/gi; - - #//Replace ( for the html entitie - $value =~ s/\(/(/gi; - - #//Replace ( for the html entitie - $value =~ s/\)/)/gi; - - #//Replace some characteres for html entities - for (my $i=0;$i<33;$i++) { - my $pattern = chr($i); - my $hex = ascii_to_html($i); - $value =~ s/$pattern/$hex/gi; - } - - for (my $i=128;$i<191;$i++) { - my $pattern = chr($i); - my $hex = ascii_to_html($i); - $value =~ s/$pattern/$hex/gi; - } - - #//Replace characteres for tildes and others - my $trans = get_html_entities(); - - foreach(keys(%$trans)) - { - my $pattern = chr($_); - $value =~ s/$pattern/$trans->{$_}/g; - } + $value =~ s/([\x00-\xFF])/$CHR2ENT{$1}||$1/ge; return $value; } @@ -254,99 +347,11 @@ sub safe_input($) { sub safe_output($) { my $value = shift; - $value = decode_entities ($value); - - #//Replace the character '\' for the equivalent html entitie - $value =~ s/\/\\/gi; - - #// First attempt to avoid SQL Injection based on SQL comments - #// Specific for MySQL. - $value =~ s//*/\/\*/gi; - $value =~ s/*//\*\//gi; - - #//Replace ( for the html entitie - $value =~ s/(/\(/gi; - - #//Replace ( for the html entitie - $value =~ s/)/\)/gi; - - #//Replace ' for the html entitie - $value =~ s/'/')/gi; - - #//Replace " for the html entitie - $value =~ s/"/")/gi; - - #//Replace some characteres for html entities - for (my $i=0;$i<33;$i++) { - my $pattern = chr($i); - my $hex = ascii_to_html($i); - $value =~ s/$hex/$pattern/gi; - } - - for (my $i=128;$i<191;$i++) { - my $pattern = chr($i); - my $hex = ascii_to_html($i); - $value =~ s/$hex/$pattern/gi; - } - - #//Replace characteres for tildes and others - my $trans = get_html_entities(); - - foreach(keys(%$trans)) - { - my $pattern = chr($_); - $value =~ s/$trans->{$_}/$pattern/g; - } - + _decode_entities ($value, \%ENT2CHR); + return $value; } -########################################################################## -# SUB get_html_entities -# Returns a hash table with the acute and special html entities -# Usefull for future chars addition: -# http://cpansearch.perl.org/src/GAAS/HTML-Parser-3.68/lib/HTML/Entities.pm -########################################################################## - -sub get_html_entities { - my %trans = ( - 225 => 'á', - 233 => 'é', - 237 => 'í', - 243 => 'ó', - 250 => 'ú', - 193 => 'Á', - 201 => 'É', - 205 => 'Í', - 211 => 'Ó', - 218 => 'Ú', - 228 => 'ä', - 235 => 'ë', - 239 => 'ï', - 246 => 'ö', - 252 => 'ü', - 196 => 'Ä', - 203 => 'Ë', - 207 => 'Ï', - 214 => 'Ö', - 220 => 'Ü', - 241 => 'ñ', - 209 => 'Ñ' - ); - - return \%trans; -} -######################################################################## -# SUB ascii_to_html (string) -# Convert an ascii string to hexadecimal -######################################################################## - -sub ascii_to_html($) { - my $ascii = shift; - - return "&#x".substr(unpack("H*", pack("N", $ascii)),6,3).";"; -} - ######################################################################## # Sub daemonize () # Put program in background (for daemon mode) From 3a80eeeefc4e2a9e89d72b35ea97faa11e23bd0e Mon Sep 17 00:00:00 2001 From: enriquecd Date: Tue, 17 Oct 2017 11:30:52 +0200 Subject: [PATCH 003/149] Not show error when only update custom fields in agents - #1458 --- .../godmode/agentes/configurar_agente.php | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/pandora_console/godmode/agentes/configurar_agente.php b/pandora_console/godmode/agentes/configurar_agente.php index e2a264e6e0..dcf43b0617 100644 --- a/pandora_console/godmode/agentes/configurar_agente.php +++ b/pandora_console/godmode/agentes/configurar_agente.php @@ -228,7 +228,7 @@ if ($create_agent) { if ($id_agente !== false) { // Create custom fields for this agent foreach ($field_values as $key => $value) { - db_process_sql_insert ('tagent_custom_data', + $update_custom = db_process_sql_insert ('tagent_custom_data', array('id_field' => $key, 'id_agent' => $id_agente, 'description' => $value)); } @@ -730,13 +730,17 @@ if ($update_agent) { // if modified some agent paramenter if ($old_value === false) { // Create custom field if not exist - db_process_sql_insert ('tagent_custom_data', + $update_custom = db_process_sql_insert ('tagent_custom_data', array('id_field' => $key,'id_agent' => $id_agente, 'description' => $value)); } else { - db_process_sql_update ('tagent_custom_data', + $update_custom = db_process_sql_update ('tagent_custom_data', array('description' => $value), array('id_field' => $key,'id_agent' => $id_agente)); + + if($update_custom == 1){ + $update_custom_result = 1; + } } } @@ -793,7 +797,9 @@ if ($update_agent) { // if modified some agent paramenter WHERE id_group = ".$group_old); $result = db_process_sql_update ('tagente', $values, array ('id_agente' => $id_agente)); - if ($result == false) { + + + if ($result == false && $update_custom_result == false) { ui_print_error_message( __('There was a problem updating the agent')); } From 323bd7cac9e4dad2d67f669bc8b65af0ff271c21 Mon Sep 17 00:00:00 2001 From: Daniel Maya Date: Tue, 17 Oct 2017 15:12:16 +0200 Subject: [PATCH 004/149] Changed convert_urls in tinymce --- .../godmode/reporting/visual_console_builder.editor.php | 1 + 1 file changed, 1 insertion(+) diff --git a/pandora_console/godmode/reporting/visual_console_builder.editor.php b/pandora_console/godmode/reporting/visual_console_builder.editor.php index 28307766fd..7ead92f83e 100755 --- a/pandora_console/godmode/reporting/visual_console_builder.editor.php +++ b/pandora_console/godmode/reporting/visual_console_builder.editor.php @@ -180,6 +180,7 @@ ui_require_javascript_file ('encode_decode_base64'); tinyMCE.init({ mode : "exact", elements: "text-label", + convert_urls: false, theme : "advanced", Date: Tue, 17 Oct 2017 16:58:05 +0200 Subject: [PATCH 005/149] Created Safe operation mode --- pandora_console/extras/mr/9.sql | 5 + .../pandoradb_migrate_6.0_to_7.0.mysql.sql | 1 + .../godmode/agentes/agent_manager.php | 120 ++++++++++++------ .../godmode/agentes/configurar_agente.php | 12 +- pandora_console/pandoradb.sql | 1 + 5 files changed, 94 insertions(+), 45 deletions(-) create mode 100644 pandora_console/extras/mr/9.sql diff --git a/pandora_console/extras/mr/9.sql b/pandora_console/extras/mr/9.sql new file mode 100644 index 0000000000..055b7b36b3 --- /dev/null +++ b/pandora_console/extras/mr/9.sql @@ -0,0 +1,5 @@ +START TRANSACTION; + +ALTER TABLE tagente ADD COLUMN `safe_mode_module` int(10) unsigned NOT NULL default '0'; + +COMMIT; \ No newline at end of file diff --git a/pandora_console/extras/pandoradb_migrate_6.0_to_7.0.mysql.sql b/pandora_console/extras/pandoradb_migrate_6.0_to_7.0.mysql.sql index 4e31057a89..190dfd1b7d 100644 --- a/pandora_console/extras/pandoradb_migrate_6.0_to_7.0.mysql.sql +++ b/pandora_console/extras/pandoradb_migrate_6.0_to_7.0.mysql.sql @@ -1218,6 +1218,7 @@ ALTER TABLE tagente ADD `remote` tinyint(1) NOT NULL default 0; ALTER TABLE tagente ADD COLUMN `cascade_protection_module` int(10) unsigned NOT NULL default '0'; ALTER TABLE tagente ADD COLUMN (alias varchar(600) not null default ''); ALTER TABLE tagente ADD `alias_as_name` int(2) unsigned default '0'; +ALTER TABLE tagente ADD COLUMN `safe_mode_module` int(10) unsigned NOT NULL default '0'; UPDATE tagente SET tagente.alias = tagente.nombre; -- --------------------------------------------------------------------- diff --git a/pandora_console/godmode/agentes/agent_manager.php b/pandora_console/godmode/agentes/agent_manager.php index efee6dc435..42e71093ab 100644 --- a/pandora_console/godmode/agentes/agent_manager.php +++ b/pandora_console/godmode/agentes/agent_manager.php @@ -252,25 +252,6 @@ foreach ($modules as $m) { $modules_values[$m['id_module']] = $m['name']; } -$table->data[3][0] = __('Parent'); -$params = array(); -$params['return'] = true; -$params['show_helptip'] = true; -$params['input_name'] = 'id_parent'; -$params['print_hidden_input_idagent'] = true; -$params['hidden_input_idagent_name'] = 'id_agent_parent'; -$params['hidden_input_idagent_value'] = $id_parent; -$params['value'] = db_get_value ("alias","tagente","id_agente",$id_parent); -$params['selectbox_id'] = 'cascade_protection_module'; -$params['javascript_is_function_select'] = true; -$params['cascade_protection'] = true; - -$table->data[3][1] = ui_print_agent_autocomplete_input($params); - -$table->data[3][1] .= html_print_checkbox ("cascade_protection", 1, $cascade_protection, true).__('Cascade protection'). " " . ui_print_help_icon("cascade_protection", true); - -$table->data[3][1] .= "  " . __('Module') . " " . html_print_select ($modules_values, "cascade_protection_module", $cascade_protection_module, "", "", 0, true); - $table->data[4][0] = __('Group'); $table->data[4][1] = html_print_select_groups(false, "AR", false, 'grupo', $grupo, '', '', 0, true); $table->data[4][1] .= ' '; @@ -320,52 +301,87 @@ $table->class = "databox filters"; $table->head = array (); $table->style = array (); $table->style[0] = 'font-weight: bold; '; -$table->style[2] = 'font-weight: bold;'; +$table->style[4] = 'font-weight: bold;'; $table->data = array (); // Custom ID $table->data[0][0] = __('Custom ID'); $table->data[0][1] = html_print_input_text ('custom_id', $custom_id, '', 16, 255, true); +$table->data[1][0] = __('Parent'); +$params = array(); +$params['return'] = true; +$params['show_helptip'] = true; +$params['input_name'] = 'id_parent'; +$params['print_hidden_input_idagent'] = true; +$params['hidden_input_idagent_name'] = 'id_agent_parent'; +$params['hidden_input_idagent_value'] = $id_parent; +$params['value'] = db_get_value ("alias","tagente","id_agente",$id_parent); +$params['selectbox_id'] = 'cascade_protection_module'; +$params['javascript_is_function_select'] = true; +$params['cascade_protection'] = true; + +$table->data[1][1] = ui_print_agent_autocomplete_input($params); +$table->data[1][1] .= html_print_checkbox ("cascade_protection", 1, $cascade_protection, true).__('Cascade protection'). " " . ui_print_help_icon("cascade_protection", true); +$table->data[1][1] .= "  " . __('Module') . " " . html_print_select ($modules_values, "cascade_protection_module", $cascade_protection_module, "", "", 0, true); + +//safe operation mode +if($id_agente){ + $sql_modules = db_get_all_rows_sql("SELECT id_agente_modulo as id_module, nombre as name FROM tagente_modulo + WHERE id_agente = " . $id_agente); + $safe_mode_modules = array(); + $safe_mode_modules[0] = __('Any'); + foreach ($sql_modules as $m) { + $safe_mode_modules[$m['id_module']] = $m['name']; + } + + $table->data[2][0] = __('Safe operation mode') + . ui_print_help_tip(__('This mode allow Pandora FMS to disable all modules + of this agent while the selected module is on CRITICAL status'), true); + $table->data[2][1] = html_print_checkbox('safe_mode', 1, $safe_mode, true); + $table->data[2][1] .= "  " . __('Module') . " " . html_print_select ($safe_mode_modules, "safe_mode_module", $safe_mode_module, "", "", 0, true); +} + + // Learn mode / Normal mode -$table->data[1][0] = __('Module definition') . +$table->data[3][0] = __('Module definition') . ui_print_help_icon("module_definition", true); -$table->data[1][1] = __('Learning mode') . ' ' . +$table->data[3][1] = __('Learning mode') . ' ' . html_print_radio_button_extended ("modo", 1, '', $modo, false, 'show_modules_not_learning_mode_context_help();', 'style="margin-right: 40px;"', true); -$table->data[1][1] .= __('Normal mode') . ' ' . +$table->data[3][1] .= __('Normal mode') . ' ' . html_print_radio_button_extended ("modo", 0, '', $modo, false, 'show_modules_not_learning_mode_context_help();', 'style="margin-right: 40px;"', true); -$table->data[1][1] .= __('Autodisable mode') . ' ' . +$table->data[3][1] .= __('Autodisable mode') . ' ' . html_print_radio_button_extended ("modo", 2, '', $modo, false, 'show_modules_not_learning_mode_context_help();', 'style="margin-right: 40px;"', true); // Status (Disabled / Enabled) -$table->data[2][0] = __('Status'); -$table->data[2][1] = __('Disabled') . ' ' . +$table->data[4][0] = __('Status'); +$table->data[4][1] = __('Disabled') . ' ' . html_print_radio_button_extended ("disabled", 1, '', $disabled, false, '', 'style="margin-right: 40px;"', true); -$table->data[2][1] .= __('Active') . ' ' . +$table->data[4][1] .= __('Active') . ' ' . html_print_radio_button_extended ("disabled", 0, '', $disabled, false, '', 'style="margin-right: 40px;"', true); // Remote configuration -$table->data[3][0] = __('Remote configuration'); +$table->data[5][0] = __('Remote configuration'); if (!$new_agent) { - $table->data[3][1] = '' . __('Not available') . ''; + $table->data[5][1] = '' . __('Not available') . ''; if (isset($filename)) { if (file_exists ($filename['md5'])) { - $table->data[3][1] = date ("F d Y H:i:s", fileatime ($filename['md5'])); + $table->data[5][1] = date ("F d Y H:i:s", fileatime ($filename['md5'])); // Delete remote configuration - $table->data[3][1] .= ''; - $table->data[3][1] .= html_print_image( + $table->data[5][1] .= html_print_image( "images/cross.png", true, array ('title' => __('Delete remote configuration file'), 'style' => 'vertical-align: middle;')).''; - $table->data[3][1] .= '' . + $table->data[5][1] .= '' . ui_print_help_tip( __('Delete this conf file implies that for restore you must reactive remote config in the local agent.'), true); @@ -373,7 +389,7 @@ if (!$new_agent) { } } else - $table->data[3][1] = '' . __('Not available') . ''; + $table->data[5][1] = '' . __('Not available') . ''; $listIcons = gis_get_array_list_icons(); @@ -411,23 +427,23 @@ $table->data[0][3] = html_print_select($arraySelectIcon, "icon_path", array("id" => "icon_warning", "style" => "display:".$display_icons.";")); if ($config['activate_gis']) { - $table->data[1][2] = __('Ignore new GIS data:'); - $table->data[1][3] = __('Yes') . ' ' . + $table->data[3][2] = __('Ignore new GIS data:'); + $table->data[3][3] = __('Yes') . ' ' . html_print_radio_button_extended ("update_gis_data", 0, '', $update_gis_data, false, '', 'style="margin-right: 40px;"', true); - $table->data[1][3] .= __('No') . ' ' . + $table->data[3][3] .= __('No') . ' ' . html_print_radio_button_extended ("update_gis_data", 1, '', $update_gis_data, false, '', 'style="margin-right: 40px;"', true); } -$table->data[2][2] = __('Url address'); -$table->data[2][3] = html_print_input_text ('url_description', +$table->data[4][2] = __('Url address'); +$table->data[4][3] = html_print_input_text ('url_description', $url_description, '', 45, 255, true); -$table->data[3][2] = __('Quiet'); -$table->data[3][3] = ui_print_help_tip( +$table->data[5][2] = __('Quiet'); +$table->data[5][3] = ui_print_help_tip( __('The agent still runs but the alerts and events will be stop'), true); -$table->data[3][3] .= html_print_checkbox('quiet', 1, $quiet, true); +$table->data[5][3] .= html_print_checkbox('quiet', 1, $quiet, true); ui_toggle(html_print_table ($table, true), __('Advanced options')); unset($table); @@ -582,6 +598,26 @@ ui_require_jquery_file('bgiframe'); $("#cascade_protection_module").attr("disabled", 'disabled'); } }); + + var safe_mode_checked = $("#checkbox-safe_mode").is(":checked"); + if (safe_mode_checked) { + $("#safe_mode_module").removeAttr("disabled"); + } + else { + $("#safe_mode_module").attr("disabled", 'disabled'); + } + + $("#checkbox-safe_mode").change(function () { + var safe_mode_checked = $("#checkbox-safe_mode").is(":checked"); + + if (safe_mode_checked) { + $("#safe_mode_module").removeAttr("disabled"); + } + else { + $("#safe_mode_module").val(0); + $("#safe_mode_module").attr("disabled", 'disabled'); + } + }); paint_qrcode( " $update_gis_data, 'url_address' => $url_description, 'url_address' => $url_description, - 'quiet' => $quiet); + 'quiet' => $quiet, + 'safe_mode_module' => $safe_mode_module); if ($config['metaconsole_agent_cache'] == 1) { $values['update_module_count'] = 1; // Force an update of the agent cache. @@ -900,6 +904,8 @@ if ($id_agente) { $update_gis_data = $agent["update_gis_data"]; $url_description = $agent["url_address"]; $quiet = $agent["quiet"]; + $safe_mode_module = $agent["safe_mode_module"]; + $safe_mode = ($safe_mode_module) ? 1 : 0; } $update_module = (bool) get_parameter ('update_module'); diff --git a/pandora_console/pandoradb.sql b/pandora_console/pandoradb.sql index 0d749db694..9df76cbd34 100644 --- a/pandora_console/pandoradb.sql +++ b/pandora_console/pandoradb.sql @@ -85,6 +85,7 @@ CREATE TABLE IF NOT EXISTS `tagente` ( `alias` varchar(600) BINARY NOT NULL default '', `transactional_agent` tinyint(1) NOT NULL default '0', `alias_as_name` tinyint(2) NOT NULL default '0', + `safe_mode_module` int(10) unsigned NOT NULL default '0', PRIMARY KEY (`id_agente`), KEY `nombre` (`nombre`(255)), KEY `direccion` (`direccion`), From 7786a6fbd5dc0f564c6f58e69c187cc9a26a6aa6 Mon Sep 17 00:00:00 2001 From: enriquecd Date: Tue, 17 Oct 2017 17:03:05 +0200 Subject: [PATCH 006/149] Audit password changes in system audit log - #1329 --- pandora_console/godmode/users/configure_user.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pandora_console/godmode/users/configure_user.php b/pandora_console/godmode/users/configure_user.php index 0f3ce0cb57..b40ee077ea 100644 --- a/pandora_console/godmode/users/configure_user.php +++ b/pandora_console/godmode/users/configure_user.php @@ -236,6 +236,8 @@ if ($create_user) { case "postgresql": $result = create_user($id, $password_new, $values); if ($result) { + db_process_sql_insert ('tsesion', array('id_sesion' => '','id_usuario' => $id,'ip_origen' => $_SERVER['REMOTE_ADDR'],'accion' => 'Password change', + 'descripcion' => 'Access password updated','fecha' => date("Y-m-d H:i:s"),'utimestamp' => time())); $res = save_pass_history($id, $password_new); } break; @@ -334,6 +336,8 @@ if ($update_user) { else { $res2 = update_user_password ($id, $password_new); if ($res2) { + db_process_sql_insert ('tsesion', array('id_sesion' => '','id_usuario' => $id,'ip_origen' => $_SERVER['REMOTE_ADDR'],'accion' => 'Password change', + 'descripcion' => 'Access password updated','fecha' => date("Y-m-d H:i:s"),'utimestamp' => time())); $res3 = save_pass_history($id, $password_new); } ui_print_result_message ($res1 || $res2, @@ -345,6 +349,8 @@ if ($update_user) { $res2 = update_user_password ($id, $password_new); if ($res2) { $res3 = save_pass_history($id, $password_new); + db_process_sql_insert ('tsesion', array('id_sesion' => '','id_usuario' => $id,'ip_origen' => $_SERVER['REMOTE_ADDR'],'accion' => 'Password change', + 'descripcion' => 'Access password updated','fecha' => date("Y-m-d H:i:s"),'utimestamp' => time())); } ui_print_result_message ($res1 || $res2, __('User info successfully updated'), From 405cf9e16c7b67285c6f7381b49e91402508117a Mon Sep 17 00:00:00 2001 From: Daniel Maya Date: Tue, 17 Oct 2017 17:05:31 +0200 Subject: [PATCH 007/149] Fixed issue --- pandora_console/godmode/agentes/configurar_agente.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pandora_console/godmode/agentes/configurar_agente.php b/pandora_console/godmode/agentes/configurar_agente.php index 9833285e32..39f3cbba5b 100644 --- a/pandora_console/godmode/agentes/configurar_agente.php +++ b/pandora_console/godmode/agentes/configurar_agente.php @@ -166,6 +166,8 @@ if ($create_agent) { $id_os = (int) get_parameter_post ("id_os"); $disabled = (int) get_parameter_post ("disabled"); $custom_id = (string) get_parameter_post ("custom_id",''); + $cascade_protection = (int) get_parameter_post ("cascade_protection", 0); + $cascade_protection_module = (int) get_parameter_post("cascade_protection_module", 0); $safe_mode = (int) get_parameter_post ("safe_mode", 0); $safe_mode_module = (int) get_parameter_post ("safe_mode_module", 0); $icon_path = (string) get_parameter_post ("icon_path",''); From eaf4bd6e8dc99819313dbd02d904ad31ae2d1c9d Mon Sep 17 00:00:00 2001 From: daniel Date: Tue, 17 Oct 2017 19:00:05 +0200 Subject: [PATCH 008/149] fixed error in pandora_agent collections --- pandora_agents/unix/pandora_agent | 31 ++++++++++++++++++++++++++----- 1 file changed, 26 insertions(+), 5 deletions(-) diff --git a/pandora_agents/unix/pandora_agent b/pandora_agents/unix/pandora_agent index 2ed8bb51e5..9268ac6ef5 100755 --- a/pandora_agents/unix/pandora_agent +++ b/pandora_agents/unix/pandora_agent @@ -1244,7 +1244,11 @@ sub check_collections () { # Delete old collections if there are no broker agents if ($BrokerEnabled == 0) { - opendir (DIR, "$ConfDir/collections") || return; + if(!opendir (DIR, "$ConfDir/collections")){ + log_message ('Collection', "Could not open dir $ConfDir/collections"); + return; + } + while (defined (my $file_name = readdir(DIR))) { next if ($file_name eq '.' || $file_name eq '..'); @@ -1252,8 +1256,14 @@ sub check_collections () { $file_name =~ s/\.md5$//; if (! defined ($Collections{$file_name})) { - rmrf ("$ConfDir/collections/$file_name"); - unlink ("$ConfDir/collections/$file_name.md5"); + if(opendir (DIR_check, "$ConfDir/collections/$file_name")){ + closedir (DIR_check); + rmrf ("$ConfDir/collections/$file_name"); + unlink ("$ConfDir/collections/$file_name.md5"); + } + else { + log_message ('Collection', "Could not open dir $ConfDir/collections/$file_name"); + } } } closedir (DIR); @@ -1272,7 +1282,11 @@ sub check_collections () { # Get remote md5 error ("File '$Conf{'temporal'}/$collection_md5_file' already exists as a symlink and could not be removed: $!.") if (-l "$Conf{'temporal'}/$collection_md5_file" && !unlink("$Conf{'temporal'}/$collection_md5_file")); - next unless (recv_file ($collection_md5_file, $Conf{'server_path_md5'}) == 0); + if(recv_file ($collection_md5_file, $Conf{'server_path_md5'}) != 0){ + log_message ('Collection', "Could not write $collection_md5_file on " . $Conf{'server_path_md5'}); + next; + } + open (MD5_FILE, "< $Conf{'temporal'}/$collection_md5_file") || error ("Could not open file '$Conf{'temporal'}/$collection_md5_file' for reading: $!."); my $remote_collection_md5 = ; close (MD5_FILE); @@ -1284,13 +1298,20 @@ sub check_collections () { $local_collection_md5 = ; close MD5_FILE; } + else{ + log_message ('Collection', "Could not open dir $ConfDir/collections/$collection_md5_file"); + next; + } # Check for changes $local_collection_md5 = $remote_collection_md5 unless defined ($local_collection_md5); next if ($local_collection_md5 eq $remote_collection_md5); # Download and unzip - next unless (recv_file ($collection_file, $Conf{'server_path_zip'}) == 0); + if(recv_file ($collection_md5_file, $Conf{'server_path_md5'}) != 0){ + log_message ('Collection', "Could not write $collection_file on " . $Conf{'server_path_zip'}); + next; + } rmrf ("$ConfDir/collections/$collection"); `unzip -d "$ConfDir/collections/$collection" "$Conf{'temporal'}/$collection_file" 2>$DevNull`; unlink ("$Conf{'temporal'}/$collection_file"); From c30b05f40958f5f85877cc5f7c22193b4559e77c Mon Sep 17 00:00:00 2001 From: daniel Date: Wed, 18 Oct 2017 10:27:20 +0200 Subject: [PATCH 009/149] fixed error in event fields --- pandora_console/godmode/events/custom_events.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/pandora_console/godmode/events/custom_events.php b/pandora_console/godmode/events/custom_events.php index 94e834bbf5..f60ba4e5a6 100644 --- a/pandora_console/godmode/events/custom_events.php +++ b/pandora_console/godmode/events/custom_events.php @@ -30,15 +30,15 @@ $default = (int) get_parameter('default', 0); if ($default != 0) { - $event_fields = io_safe_input('evento,id_agente,estado,timestamp'); - $fields_selected = explode (',', $event_fields); + //$event_fields = io_safe_input('evento,id_agente,estado,timestamp'); + $fields_selected = explode (',', $config['event_fields']); } else if ($update != '') { $fields_selected = (array)get_parameter('fields_selected'); if ($fields_selected[0] == '') { - $event_fields = io_safe_input('evento,id_agente,estado,timestamp'); - $fields_selected = explode (',', $event_fields); + //$event_fields = io_safe_input('evento,id_agente,estado,timestamp'); + $fields_selected = explode (',', $config['event_fields']); } else { $event_fields = implode (',', $fields_selected); @@ -130,7 +130,7 @@ $event = array(); echo '

    '.__('Show event fields'); echo ' '; -html_print_image ('images/clean.png', false, array ('title' => __('Load default event fields'), 'onclick' => "if (! confirm ('" . __('Default event fields will be loaded. Do you want to continue?') ."')) return false")); +html_print_image ('images/clean.png', false, array ('title' => __('Load the fields from previous events'), 'onclick' => "if (! confirm ('" . __('Event fields will be loaded. Do you want to continue?') ."')) return false")); echo '

    '; $table = new stdClass(); From b641323eed9f98c941e3dfea42379f28cd58fd74 Mon Sep 17 00:00:00 2001 From: Alejandro Gallardo Escobar Date: Wed, 18 Oct 2017 17:29:06 +0200 Subject: [PATCH 010/149] [artica/pandora_enterprise#1462] Added the DB changes needed by the dashboard items slideshow feature --- pandora_console/extras/mr/9.sql | 4 ++++ pandora_console/extras/pandoradb_migrate_6.0_to_7.0.mysql.sql | 4 ++++ pandora_console/pandoradb.sql | 1 + 3 files changed, 9 insertions(+) create mode 100644 pandora_console/extras/mr/9.sql diff --git a/pandora_console/extras/mr/9.sql b/pandora_console/extras/mr/9.sql new file mode 100644 index 0000000000..bae52bda12 --- /dev/null +++ b/pandora_console/extras/mr/9.sql @@ -0,0 +1,4 @@ + +START TRANSACTION; +ALTER TABLE `tdashboard` ADD COLUMN `cells_slideshow` TINYINT(1) NOT NULL default 0; +COMMIT; diff --git a/pandora_console/extras/pandoradb_migrate_6.0_to_7.0.mysql.sql b/pandora_console/extras/pandoradb_migrate_6.0_to_7.0.mysql.sql index 4e31057a89..9be839a8a0 100644 --- a/pandora_console/extras/pandoradb_migrate_6.0_to_7.0.mysql.sql +++ b/pandora_console/extras/pandoradb_migrate_6.0_to_7.0.mysql.sql @@ -1440,3 +1440,7 @@ INSERT INTO tmodule VALUES (8, 'Wux module'); INSERT INTO ttipo_modulo VALUES (25,'web_analysis', 8, 'Web analysis data', 'module-wux.png'); +-- --------------------------------------------------------------------- +-- Table `tdashboard` +-- --------------------------------------------------------------------- +ALTER TABLE `tdashboard` ADD COLUMN `cells_slideshow` TINYINT(1) NOT NULL default 0; diff --git a/pandora_console/pandoradb.sql b/pandora_console/pandoradb.sql index 0d749db694..64e6f8582a 100644 --- a/pandora_console/pandoradb.sql +++ b/pandora_console/pandoradb.sql @@ -2206,6 +2206,7 @@ CREATE TABLE IF NOT EXISTS `tdashboard` ( `id_group` int(10) NOT NULL default 0, `active` tinyint(1) NOT NULL default 0, `cells` int(10) unsigned default 0, + `cells_slideshow` TINYINT(1) NOT NULL default 0 PRIMARY KEY (`id`) ) ENGINE = InnoDB DEFAULT CHARSET=utf8; From 138f187b51b0f688c2962a05804a13728f00f7b3 Mon Sep 17 00:00:00 2001 From: enriquecd Date: Wed, 18 Oct 2017 17:29:10 +0200 Subject: [PATCH 011/149] Add hide no data item checkbox to report templates - open - #1326 --- .../include/functions_reporting.php | 21 +++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) mode change 100644 => 100755 pandora_console/include/functions_reporting.php diff --git a/pandora_console/include/functions_reporting.php b/pandora_console/include/functions_reporting.php old mode 100644 new mode 100755 index 8a47d2c7d2..ea3bfa4277 --- a/pandora_console/include/functions_reporting.php +++ b/pandora_console/include/functions_reporting.php @@ -127,7 +127,7 @@ function reporting_make_reporting_data($report = null, $id_report, } $metaconsole_on = is_metaconsole(); - + $index_content = 0; foreach ($contents as $content) { $server_name = $content['server_name']; @@ -508,29 +508,41 @@ function reporting_make_reporting_data($report = null, $id_report, break; case 'agent_detailed_event': case 'event_report_agent': - $report['contents'][] = reporting_event_report_agent( + $report_control = reporting_event_report_agent( $report, $content, $type, $force_width_chart, $force_height_chart); + if($report_control['total_events'] == 0 && $content['hide_no_data'] == 1){ + continue; + } + $report['contents'][] = $report_control; break; case 'event_report_module': - $report['contents'][] = reporting_event_report_module( + $report_control = reporting_event_report_module( $report, $content, $type, $force_width_chart, $force_height_chart, $pdf); + if($report_control['total_events'] == 0 && $content['hide_no_data'] == 1){ + continue; + } + $report['contents'][] = $report_control; break; case 'event_report_group': - $report['contents'][] = reporting_event_report_group( + $report_control = reporting_event_report_group( $report, $content, $type, $force_width_chart, $force_height_chart); + if($report_control['total_events'] == 0 && $content['hide_no_data'] == 1){ + continue; + } + $report['contents'][] = $report_control; break; case 'top_n': $report['contents'][] = reporting_event_top_n( @@ -578,6 +590,7 @@ function reporting_make_reporting_data($report = null, $id_report, $pdf); break; } + $index_content++; } return reporting_check_structure_report($report); From 40c15af9f2fb6e5832861579f6f1856c2a68dde0 Mon Sep 17 00:00:00 2001 From: Alejandro Gallardo Escobar Date: Thu, 19 Oct 2017 11:46:55 +0200 Subject: [PATCH 012/149] [artica/pandora_enterprise#1477] Fixed the HTML entities problem of the sound events view --- pandora_console/operation/events/events.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pandora_console/operation/events/events.php b/pandora_console/operation/events/events.php index 15da1cf221..9ee74d2abc 100644 --- a/pandora_console/operation/events/events.php +++ b/pandora_console/operation/events/events.php @@ -165,7 +165,7 @@ if (is_ajax ()) { $module_name = modules_get_agentmodule_name($event['id_agentmodule']); $agent_name = agents_get_alias($event['id_agente']); - $return['message'] = $agent_name . " - " . __('Alert fired in module ') . io_safe_output($module_name) . + $return['message'] = io_safe_output($agent_name) . " - " . __('Alert fired in module ') . io_safe_output($module_name) . " - " . $event['timestamp']; } else if ($resultCritical) { @@ -176,7 +176,7 @@ if (is_ajax ()) { $module_name = modules_get_agentmodule_name($event['id_agentmodule']); $agent_name = agents_get_alias($event['id_agente']); - $return['message'] = $agent_name . " - " . __('Module ') . io_safe_output($module_name) . __(' is going to critical') . + $return['message'] = io_safe_output($agent_name) . " - " . __('Module ') . io_safe_output($module_name) . __(' is going to critical') . " - " . $event['timestamp']; } else if ($resultWarning) { @@ -187,7 +187,7 @@ if (is_ajax ()) { $module_name = modules_get_agentmodule_name($event['id_agentmodule']); $agent_name = agents_get_alias($event['id_agente']); - $return['message'] = $agent_name . " - " . __('Module ') . io_safe_output($module_name) . __(' is going to warning') . + $return['message'] = io_safe_output($agent_name) . " - " . __('Module ') . io_safe_output($module_name) . __(' is going to warning') . " - " . $event['timestamp']; } else if ($resultUnknown) { @@ -198,7 +198,7 @@ if (is_ajax ()) { $module_name = modules_get_agentmodule_name($event['id_agentmodule']); $agent_name = agents_get_alias($event['id_agente']); - $return['message'] = $agent_name . " - " . __('Module ') . io_safe_output($module_name) . __(' is going to unknown') . + $return['message'] = io_safe_output($agent_name) . " - " . __('Module ') . io_safe_output($module_name) . __(' is going to unknown') . " - " . $event['timestamp']; } else { From b9eba3454beb6b296fbc5b3ce5c601bbe988c553 Mon Sep 17 00:00:00 2001 From: Alejandro Gallardo Escobar Date: Thu, 19 Oct 2017 13:33:51 +0200 Subject: [PATCH 013/149] Error fix --- .../godmode/reporting/visual_console_builder.editor.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandora_console/godmode/reporting/visual_console_builder.editor.js b/pandora_console/godmode/reporting/visual_console_builder.editor.js index 22c6c4d8d4..bdb791fed6 100755 --- a/pandora_console/godmode/reporting/visual_console_builder.editor.js +++ b/pandora_console/godmode/reporting/visual_console_builder.editor.js @@ -1660,7 +1660,7 @@ function set_static_graph_status(idElement, image, status) { data: parameter, success: function (data) { set_static_graph_status(idElement, image, data); - if(values['show_statistics'] == 1){ + if(data['show_statistics'] == 1){ if($('#'+idElement+' table').css('float') == 'right' || $('#'+idElement+ ' table').css('float') == 'left'){ $('#'+idElement+ ' img').css('margin-top', parseInt($('#'+idElement).css('height'))/2 - parseInt($('#'+idElement+ ' img').css('height'))/2); } From d5646e80b73938e319060f607bc42a6394637508 Mon Sep 17 00:00:00 2001 From: Alejandro Gallardo Escobar Date: Thu, 19 Oct 2017 13:35:35 +0200 Subject: [PATCH 014/149] [artica/pandora_enterprise#1390] Fixed the error which caused the agent link status changed when moving a visual console item --- pandora_console/include/ajax/visual_console_builder.ajax.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pandora_console/include/ajax/visual_console_builder.ajax.php b/pandora_console/include/ajax/visual_console_builder.ajax.php index e854a31c49..08a1b069c3 100755 --- a/pandora_console/include/ajax/visual_console_builder.ajax.php +++ b/pandora_console/include/ajax/visual_console_builder.ajax.php @@ -639,7 +639,8 @@ switch ($action) { // Don't change the label because only change the positions unset($values['label']); unset($values['label_position']); - // Don't change background color in graphs when move + // Don't change this values when move + unset($values['enable_link']); switch ($type) { case 'group_item': From 039964771b7f4e8bdb0a77bd63b35631f9d792c8 Mon Sep 17 00:00:00 2001 From: Daniel Maya Date: Mon, 23 Oct 2017 16:43:16 +0200 Subject: [PATCH 015/149] Fixed search in status monitor with ACL enterprise --- .../operation/agentes/status_monitor.php | 34 +++++++++---------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/pandora_console/operation/agentes/status_monitor.php b/pandora_console/operation/agentes/status_monitor.php index 27baeced96..2c1db8f684 100644 --- a/pandora_console/operation/agentes/status_monitor.php +++ b/pandora_console/operation/agentes/status_monitor.php @@ -516,7 +516,7 @@ foreach ($custom_fields as $custom_field) { } -$filters = '
    '; if (is_metaconsole()) { @@ -943,31 +943,31 @@ if (!empty($result)) { $table->head[0] = '' . __('P.') . ''; $table->head[1] = __('Agent'); - $table->head[1] .=' ' . html_print_image('images/sort_up.png', true, array('style' => $selectAgentNameUp, 'alt' => 'up')) . '' . - '' . html_print_image('images/sort_down.png', true, array('style' => $selectAgentNameDown, 'alt' => 'down')) . ''; + $table->head[1] .=' ' . html_print_image('images/sort_up.png', true, array('style' => $selectAgentNameUp, 'alt' => 'up')) . '' . + '' . html_print_image('images/sort_down.png', true, array('style' => $selectAgentNameDown, 'alt' => 'down')) . ''; $table->head[2] = __('Data Type'); - $table->head[2] .= ' ' . html_print_image('images/sort_up.png', true, array('style' => $selectTypeUp, 'alt' => 'up')) . '' . - '' . html_print_image('images/sort_down.png', true, array('style' => $selectTypeDown, 'alt' => 'down')) . ''; + $table->head[2] .= ' ' . html_print_image('images/sort_up.png', true, array('style' => $selectTypeUp, 'alt' => 'up')) . '' . + '' . html_print_image('images/sort_down.png', true, array('style' => $selectTypeDown, 'alt' => 'down')) . ''; $table->align[2] = 'left'; $table->head[3] = __('Module name'); - $table->head[3] .= ' ' . html_print_image('images/sort_up.png', true, array('style' => $selectModuleNameUp, 'alt' => 'up')) . '' . - '' . html_print_image('images/sort_down.png', true, array('style' => $selectModuleNameDown, 'alt' => 'down')) . ''; + $table->head[3] .= ' ' . html_print_image('images/sort_up.png', true, array('style' => $selectModuleNameUp, 'alt' => 'up')) . '' . + '' . html_print_image('images/sort_down.png', true, array('style' => $selectModuleNameDown, 'alt' => 'down')) . ''; $table->head[4] = __('Server type'); - $table->head[4] .= ' ' . html_print_image('images/sort_up.png', true, array('style' => $selectModuleNameUp, 'alt' => 'up')) . '' . - '' . html_print_image('images/sort_down.png', true, array('style' => $selectModuleNameDown, 'alt' => 'down')) . ''; + $table->head[4] .= ' ' . html_print_image('images/sort_up.png', true, array('style' => $selectModuleNameUp, 'alt' => 'up')) . '' . + '' . html_print_image('images/sort_down.png', true, array('style' => $selectModuleNameDown, 'alt' => 'down')) . ''; $table->head[5] = __('Interval'); - $table->head[5] .= ' ' . html_print_image('images/sort_up.png', true, array('style' => $selectIntervalUp, 'alt' => 'up')) . '' . - '' . html_print_image('images/sort_down.png', true, array('style' => $selectIntervalDown, 'alt' => 'down')) . ''; + $table->head[5] .= ' ' . html_print_image('images/sort_up.png', true, array('style' => $selectIntervalUp, 'alt' => 'up')) . '' . + '' . html_print_image('images/sort_down.png', true, array('style' => $selectIntervalDown, 'alt' => 'down')) . ''; $table->align[5] = 'left'; $table->head[6] = __('Status'); - $table->head[6] .= ' ' . html_print_image('images/sort_up.png', true, array('style' => $selectStatusUp, 'alt' => 'up')) . '' . - '' . html_print_image('images/sort_down.png', true, array('style' => $selectStatusDown, 'alt' => 'down')) . ''; + $table->head[6] .= ' ' . html_print_image('images/sort_up.png', true, array('style' => $selectStatusUp, 'alt' => 'up')) . '' . + '' . html_print_image('images/sort_down.png', true, array('style' => $selectStatusDown, 'alt' => 'down')) . ''; $table->align[6] = 'left'; @@ -980,13 +980,13 @@ if (!empty($result)) { $table->head[9] = __('Data'); $table->align[9] = 'left'; if ( is_metaconsole() ) { - $table->head[9] .= ' ' . html_print_image('images/sort_up.png', true, array('style' => $selectStatusUp, 'alt' => 'up')) . '' . - '' . html_print_image('images/sort_down.png', true, array('style' => $selectStatusDown, 'alt' => 'down')) . ''; + $table->head[9] .= ' ' . html_print_image('images/sort_up.png', true, array('style' => $selectStatusUp, 'alt' => 'up')) . '' . + '' . html_print_image('images/sort_down.png', true, array('style' => $selectStatusDown, 'alt' => 'down')) . ''; } $table->head[10] = __('Timestamp'); - $table->head[10] .= ' ' . html_print_image('images/sort_up.png', true, array('style' => $selectTimestampUp, 'alt' => 'up')) . '' . - '' . html_print_image('images/sort_down.png', true, array('style' => $selectTimestampDown, 'alt' => 'down')) . ''; + $table->head[10] .= ' ' . html_print_image('images/sort_up.png', true, array('style' => $selectTimestampUp, 'alt' => 'up')) . '' . + '' . html_print_image('images/sort_down.png', true, array('style' => $selectTimestampDown, 'alt' => 'down')) . ''; $table->align[10] = 'left'; $id_type_web_content_string = db_get_value('id_tipo', 'ttipo_modulo', From ea51df8b2024050793414b76e5061b90b21ead67 Mon Sep 17 00:00:00 2001 From: enriquecd Date: Mon, 23 Oct 2017 18:54:57 +0200 Subject: [PATCH 016/149] Add show on top option to all visual console elements - #1313 --- .../pandoradb_migrate_6.0_to_7.0.mysql.sql | 1 + .../visual_console_builder.editor.js | 37 +++++++++++++++- .../reporting/visual_console_builder.php | 2 + .../ajax/visual_console_builder.ajax.php | 7 ++++ .../include/functions_visual_map.php | 42 ++++++++++++------- .../include/functions_visual_map_editor.php | 8 +++- pandora_console/pandoradb.sql | 1 + 7 files changed, 80 insertions(+), 18 deletions(-) diff --git a/pandora_console/extras/pandoradb_migrate_6.0_to_7.0.mysql.sql b/pandora_console/extras/pandoradb_migrate_6.0_to_7.0.mysql.sql index 4e31057a89..bf3fa97319 100644 --- a/pandora_console/extras/pandoradb_migrate_6.0_to_7.0.mysql.sql +++ b/pandora_console/extras/pandoradb_migrate_6.0_to_7.0.mysql.sql @@ -1231,6 +1231,7 @@ ALTER TABLE tlayout ADD `background_color` varchar(50) NOT NULL default '#FFF'; ALTER TABLE tlayout_data ADD `type_graph` varchar(50) NOT NULL default 'area'; ALTER TABLE tlayout_data ADD `label_position` varchar(50) NOT NULL default 'down'; ALTER TABLE tlayout_data ADD COLUMN `show_statistics` tinyint(2) NOT NULL default '0'; +ALTER TABLE tlayout_data ADD COLUMN `show_on_top` tinyint(1) NOT NULL default '0'; -- --------------------------------------------------------------------- -- Table `tagent_custom_fields` diff --git a/pandora_console/godmode/reporting/visual_console_builder.editor.js b/pandora_console/godmode/reporting/visual_console_builder.editor.js index bc69c22351..02ca529f8f 100755 --- a/pandora_console/godmode/reporting/visual_console_builder.editor.js +++ b/pandora_console/godmode/reporting/visual_console_builder.editor.js @@ -642,6 +642,7 @@ function readFields() { values['line_color'] = $("input[name='line_color']").val(); values['label_position'] = $(".labelpos[sel=yes]").attr('position'); values['show_statistics'] = $("input[name=show_statistics]").is(':checked') ? 1 : 0; + values['show_on_top'] = $("input[name=show_on_top]").is(':checked') ? 1 : 0; if (is_metaconsole()) { values['metaconsole'] = 1; @@ -1047,6 +1048,9 @@ function toggle_item_palette() { } hiddenFields(item); + + $("#show_on_top_row").css('display', 'table-row'); + $("#show_on_top." + item).css('display', 'block'); $("#properties_panel").show("fast"); @@ -1176,6 +1180,17 @@ function loadFieldsFromDB(item) { } } + if (key == 'show_on_top') { + if (val == "1") { + $("input[name=show_on_top]") + .prop("checked", true); + } + else { + $("input[name=show_on_top]") + .prop("checked", false); + } + } + if (key == 'type_graph') { $("select[name=type_graph]").val(val); } @@ -1601,6 +1616,7 @@ function cleanFields(item) { $("input[name='fill_color']").val('#ffffff'); $("input[name='line_width']").val(3); $("input[name='line_color']").val('#000000'); + $("input[name=show_on_top]").prop("checked", false); $("#preview").empty(); @@ -2517,8 +2533,6 @@ function createItem(type, values, id_data) { } $("#background").append(item); - $(".item").css('z-index', '2'); - $(".box_item").css('z-index', '1'); if (values['parent'] != 0) { var line = {"id": id_data, @@ -2541,6 +2555,14 @@ function createItem(type, values, id_data) { $('#text_'+id_data).css({'display':'block','float':'left'}); } + if(values['show_on_top'] == 1){ + $("#" + id_data).css('z-index', '10'); + } + + if(values['show_on_top'] == 0){ + $("#" + id_data).css('z-index', '5'); + } + } function addItemSelectParents(id_data, text) { @@ -2747,6 +2769,15 @@ function updateDB_visual(type, idElement , values, event, top, left) { refresh_lines(lines, 'background', true); draw_user_lines("", 0, 0, 0 , 0, 0, true); + + if(values['show_on_top'] == 1){ + $("#" + idElement).css('z-index',10); + } + + if(values['show_on_top'] == 0){ + $("#" + idElement).css('z-index',5); + } + } function updateDB(type, idElement , values, event) { @@ -3544,6 +3575,8 @@ function eventsBackground() { if ((!is_opened_palette) && (autosave)) { toggle_item_palette(); } + $("#show_on_top_row").css('display', 'none'); + $("#show_on_top." + item).css('display', ''); }); } diff --git a/pandora_console/godmode/reporting/visual_console_builder.php b/pandora_console/godmode/reporting/visual_console_builder.php index 7288784acf..a3256f8592 100755 --- a/pandora_console/godmode/reporting/visual_console_builder.php +++ b/pandora_console/godmode/reporting/visual_console_builder.php @@ -413,6 +413,8 @@ switch ($activeTab) { $value_show = get_parameter ("value_show", 'percent'); $label_type = get_parameter ("label_type", 'agent_module'); $enable_link = get_parameter ("enable_link", 'enable_link'); + $show_on_top = get_parameter ("show_on_top", 0); + // This var switch between creation of items, item_per_agent = 0 => item per module; item_per_agent <> 0 => item per agent $item_per_agent = get_parameter ("item_per_agent", 0); $id_server = (int)get_parameter('servers', 0); diff --git a/pandora_console/include/ajax/visual_console_builder.ajax.php b/pandora_console/include/ajax/visual_console_builder.ajax.php index e5e3ac546e..f89456a0a5 100755 --- a/pandora_console/include/ajax/visual_console_builder.ajax.php +++ b/pandora_console/include/ajax/visual_console_builder.ajax.php @@ -130,6 +130,7 @@ $line_color = get_parameter('line_color', ''); $get_element_status = get_parameter('get_element_status', 0); $enable_link = get_parameter('enable_link', 1); +$show_on_top = get_parameter('show_on_top', 0); $type_graph = get_parameter('type_graph', 'area'); $label_position = get_parameter('label_position', 'down'); $show_statistics = get_parameter('show_statistics', 0); @@ -431,6 +432,7 @@ switch ($action) { $values = array(); $values['label_position'] = $label_position; + $values['show_on_top'] = $show_on_top; // In Graphs, background color is stored in column image (sorry) if ($type == 'module_graph') { @@ -474,6 +476,9 @@ switch ($action) { if ($enable_link !== null) { $values['enable_link'] = $enable_link; } + if ($show_on_top !== null) { + $values['show_on_top'] = $show_on_top; + } if ($label !== null) { $values['label'] = $label; } @@ -639,6 +644,7 @@ switch ($action) { // Don't change the label because only change the positions unset($values['label']); unset($values['label_position']); + unset($values['show_on_top']); // Don't change background color in graphs when move switch ($type) { @@ -867,6 +873,7 @@ switch ($action) { $values['id_layout_linked'] = $map_linked; $values['parent_item'] = $parent; $values['enable_link'] = $enable_link; + $values['show_on_top'] = $show_on_top; $values['image'] = $background_color; $values['type_graph'] = $type_graph; diff --git a/pandora_console/include/functions_visual_map.php b/pandora_console/include/functions_visual_map.php index ed5141cc47..ef6e279609 100755 --- a/pandora_console/include/functions_visual_map.php +++ b/pandora_console/include/functions_visual_map.php @@ -110,6 +110,14 @@ function visual_map_print_item($mode = "read", $layoutData, $border_color = $layoutData['border_color']; $fill_color = $layoutData['fill_color']; $label_position = $layoutData['label_position']; + $show_on_top = $layoutData['show_on_top']; + + if($show_on_top){ + $show_on_top_index = 10; + } + else{ + $show_on_top_index = ''; + } $sizeStyle = ''; $borderStyle = ''; @@ -925,14 +933,14 @@ function visual_map_print_item($mode = "read", $layoutData, else { if ($width == 0 || $height == 0) { if ($layoutData['label_position']=='left') { - $img = '
    '.custom_graphs_print( + $img = '
    '.custom_graphs_print( $layoutData['id_custom_graph'], 180, 480, $period, null, true, 0, $only_image, $layoutData['image'], array(), '', array(), array(), true, false, false, true, 1, false, true).'
    '; } elseif ($layoutData['label_position']=='right') { - $img = '
    '.custom_graphs_print( + $img = '
    '.custom_graphs_print( $layoutData['id_custom_graph'], 180, 480, $period, null, true, 0, $only_image, $layoutData['image'], array(), '', array(), array(), true, @@ -952,14 +960,14 @@ function visual_map_print_item($mode = "read", $layoutData, } else { if ($layoutData['label_position']=='left') { - $img = '
    '.custom_graphs_print( + $img = '
    '.custom_graphs_print( $layoutData['id_custom_graph'], $height, $width, $period, null, true, 0, $only_image, $layoutData['image'], array(), '', array(), array(), true, false, false, true, 1, false, true).'
    '; } elseif($layoutData['label_position']=='right') { - $img = '
    '.custom_graphs_print( + $img = '
    '.custom_graphs_print( $layoutData['id_custom_graph'], $height, $width, $period, null, true, 0, $only_image, $layoutData['image'], array(), '', array(), array(), true, @@ -1005,7 +1013,7 @@ function visual_map_print_item($mode = "read", $layoutData, if ($width == 0 || $height == 0) { if ($layoutData['label_position']=='left') { - $img = '
    '. + $img = '
    '. grafico_modulo_sparse($id_module, $period, 0, 300, 180, modules_get_agentmodule_name($id_module),null, false, 1, false, 0, modules_get_unit($id_module), 0, 0, true, $only_image, '', 1, false, '', @@ -1013,7 +1021,7 @@ function visual_map_print_item($mode = "read", $layoutData, null, true, false, $type_graph) . '
    '; } elseif($layoutData['label_position']=='right') { - $img = '
    ' . + $img = '
    ' . grafico_modulo_sparse($id_module, $period, 0, 300, 180, modules_get_agentmodule_name($id_module),null, false, 1, false, 0, modules_get_unit($id_module), 0, 0, true, $only_image, '', @@ -1031,7 +1039,7 @@ function visual_map_print_item($mode = "read", $layoutData, } else{ if ($layoutData['label_position']=='left') { - $img = '
    ' . + $img = '
    ' . grafico_modulo_sparse($id_module, $period, 0, $width, $height, modules_get_agentmodule_name($id_module), null, false, 1, false, 0, modules_get_unit($id_module), 0, 0, true, $only_image, '', @@ -1040,7 +1048,7 @@ function visual_map_print_item($mode = "read", $layoutData, false, $type_graph) . '
    '; } elseif ($layoutData['label_position']=='right') { - $img = '
    ' . + $img = '
    ' . grafico_modulo_sparse($id_module, $period, 0, $width, $height, modules_get_agentmodule_name($id_module), null, false, 1, false, 0, modules_get_unit($id_module), 0, 0, true, $only_image, @@ -1094,10 +1102,10 @@ function visual_map_print_item($mode = "read", $layoutData, else { if ($width == 0 || $height == 0) { if ($layoutData['label_position']=='left') { - $img = '
    ' .graph_graphic_moduleevents ($layoutData['id_agent'], $layoutData['id_agente_modulo'], 500, 50, $layoutData['period'], '', true).'
    '; + $img = '
    ' .graph_graphic_moduleevents ($layoutData['id_agent'], $layoutData['id_agente_modulo'], 500, 50, $layoutData['period'], '', true).'
    '; } elseif ($layoutData['label_position']=='right') { - $img = '
    ' . graph_graphic_moduleevents ($layoutData['id_agent'], $layoutData['id_agente_modulo'], 500, 50, $layoutData['period'], '', true).'
    '; + $img = '
    ' . graph_graphic_moduleevents ($layoutData['id_agent'], $layoutData['id_agente_modulo'], 500, 50, $layoutData['period'], '', true).'
    '; } else { $img = graph_graphic_moduleevents ($layoutData['id_agent'], $layoutData['id_agente_modulo'], 500, 50, $layoutData['period'], '', true); @@ -1105,10 +1113,10 @@ function visual_map_print_item($mode = "read", $layoutData, } else{ if ($layoutData['label_position']=='left') { - $img = '
    ' . graph_graphic_moduleevents ($layoutData['id_agent'], $layoutData['id_agente_modulo'], $width, $height, $layoutData['period'], '', true).'
    '; + $img = '
    ' . graph_graphic_moduleevents ($layoutData['id_agent'], $layoutData['id_agente_modulo'], $width, $height, $layoutData['period'], '', true).'
    '; } elseif ($layoutData['label_position']=='right') { - $img = '
    ' .graph_graphic_moduleevents ($layoutData['id_agent'], $layoutData['id_agente_modulo'], $width, $height, $layoutData['period'], '', true).'
    '; + $img = '
    ' .graph_graphic_moduleevents ($layoutData['id_agent'], $layoutData['id_agente_modulo'], $width, $height, $layoutData['period'], '', true).'
    '; } else { $img = graph_graphic_moduleevents ($layoutData['id_agent'], $layoutData['id_agente_modulo'], $width, $height, $layoutData['period'], '', true); @@ -1165,6 +1173,10 @@ function visual_map_print_item($mode = "read", $layoutData, break; } + if($show_on_top){ + $z_index = 10; + } + echo '
    "; + echo "
    "; } else { if (!empty($proportion)) { @@ -1197,7 +1209,7 @@ function visual_map_print_item($mode = "read", $layoutData, $style .= "border-width: " . $border_width . "px; "; $style .= "border-color: " . $border_color . "; "; $style .= "background-color: " . $fill_color . "; "; - echo "
    "; + echo "
    "; } else { $style = ""; @@ -1207,7 +1219,7 @@ function visual_map_print_item($mode = "read", $layoutData, $style .= "border-width: " . $border_width . "px; "; $style .= "border-color: " . $border_color . "; "; $style .= "background-color: " . $fill_color . "; "; - echo "
    "; + echo "
    "; } } break; diff --git a/pandora_console/include/functions_visual_map_editor.php b/pandora_console/include/functions_visual_map_editor.php index 10732896ec..5df9927835 100755 --- a/pandora_console/include/functions_visual_map_editor.php +++ b/pandora_console/include/functions_visual_map_editor.php @@ -459,7 +459,13 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) { '' . __('Show statistics') . ' ' . html_print_checkbox('show_statistics', 1, '', true) . ''; - + + $form_items['show_on_top_row'] = array(); + $form_items['show_on_top_row']['items'] = array('group_item'); + $form_items['show_on_top_row']['html'] = + '' . __('Always show on top') . ' + ' . + html_print_checkbox('show_on_top', 1, '', true) . ''; $form_items['module_graph_size_row'] = array(); $form_items['module_graph_size_row']['items'] = array('module_graph', 'datos'); diff --git a/pandora_console/pandoradb.sql b/pandora_console/pandoradb.sql index 0d749db694..7e2c6bf223 100644 --- a/pandora_console/pandoradb.sql +++ b/pandora_console/pandoradb.sql @@ -1356,6 +1356,7 @@ CREATE TABLE IF NOT EXISTS `tlayout_data` ( `border_color` varchar(200) DEFAULT "", `fill_color` varchar(200) DEFAULT "", `show_statistics` tinyint(2) NOT NULL default '0', + `show_on_top` tinyint(1) NOT NULL default '0', PRIMARY KEY(`id`) ) ENGINE = InnoDB DEFAULT CHARSET=utf8; From b5faf010b07a8b1a910f9bb4e555c80b11b6aa77 Mon Sep 17 00:00:00 2001 From: Arturo Gonzalez Date: Tue, 24 Oct 2017 10:07:07 +0200 Subject: [PATCH 017/149] Fixed filter to show interface graph or not --- .../include/javascript/functions_pandora_networkmap.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/pandora_console/include/javascript/functions_pandora_networkmap.js b/pandora_console/include/javascript/functions_pandora_networkmap.js index a9c36700a8..9ecf90a045 100644 --- a/pandora_console/include/javascript/functions_pandora_networkmap.js +++ b/pandora_console/include/javascript/functions_pandora_networkmap.js @@ -754,6 +754,12 @@ function get_interface_data_to_table(node_selected, selected_links) { } else { jQuery.each(data, function (j, interface) { + if (interface['graph'] == "") { + var interf_graph = "--"; + } + else { + var interf_graph = interface['graph']; + } $("#interface_information").find('tbody') .append($('') .append($('') @@ -763,7 +769,7 @@ function get_interface_data_to_table(node_selected, selected_links) { .html(interface['status']) ) .append($('') - .html(interface['graph']) + .html(interf_graph) ) .append($('') .html(interface['ip']) From 9b1cbf3c9bd5139833b981eaba5ef63c4eb8d75d Mon Sep 17 00:00:00 2001 From: Daniel Maya Date: Tue, 24 Oct 2017 13:10:07 +0200 Subject: [PATCH 018/149] Changed column in tuser_task_scheduled --- pandora_console/extras/mr/9.sql | 13 +++++++++++++ .../extras/pandoradb_migrate_6.0_to_7.0.mysql.sql | 4 ++++ 2 files changed, 17 insertions(+) create mode 100644 pandora_console/extras/mr/9.sql diff --git a/pandora_console/extras/mr/9.sql b/pandora_console/extras/mr/9.sql new file mode 100644 index 0000000000..90f8cde128 --- /dev/null +++ b/pandora_console/extras/mr/9.sql @@ -0,0 +1,13 @@ +START TRANSACTION; + +SET @st_oum708 = (SELECT IF( + (SELECT COUNT(*) FROM information_schema.tables WHERE table_schema = DATABASE() AND table_name = 'tuser_task_scheduled') > 0, + "ALTER TABLE tuser_task_scheduled MODIFY args TEXT NOT NULL", + "SELECT 1" +)); + +PREPARE pr_oum708 FROM @st_oum708; +EXECUTE pr_oum708; +DEALLOCATE PREPARE pr_oum708; + +COMMIT; \ No newline at end of file diff --git a/pandora_console/extras/pandoradb_migrate_6.0_to_7.0.mysql.sql b/pandora_console/extras/pandoradb_migrate_6.0_to_7.0.mysql.sql index 4e31057a89..18b93b8eac 100644 --- a/pandora_console/extras/pandoradb_migrate_6.0_to_7.0.mysql.sql +++ b/pandora_console/extras/pandoradb_migrate_6.0_to_7.0.mysql.sql @@ -1326,6 +1326,10 @@ SET @vv1 = (SELECT COUNT(*) FROM information_schema.tables WHERE table_schema = IF @vv1>0 THEN ALTER TABLE tbackup ADD COLUMN `filepath` varchar(512) NOT NULL DEFAULT ""; END IF; +SET @vv2 = (SELECT COUNT(*) FROM information_schema.tables WHERE table_schema = DATABASE() AND table_name = 'tuser_task_scheduled'); +IF @vv2>0 THEN + ALTER TABLE tuser_task_scheduled MODIFY args TEXT NOT NULL; +END IF; END; // delimiter ; From d1a4458aad6efa90547965ac23e57fa38aa252dd Mon Sep 17 00:00:00 2001 From: Arturo Gonzalez Date: Tue, 24 Oct 2017 13:51:34 +0200 Subject: [PATCH 019/149] Added new section to menu --- pandora_console/operation/menu.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pandora_console/operation/menu.php b/pandora_console/operation/menu.php index 6c27ce428d..b7c57882a8 100644 --- a/pandora_console/operation/menu.php +++ b/pandora_console/operation/menu.php @@ -59,6 +59,8 @@ if (check_acl ($config['id_user'], 0, "AR")) { $sub2["operation/agentes/status_monitor"]["text"] = __('Monitor detail'); $sub2["operation/agentes/status_monitor"]["refr"] = 0; + enterprise_hook ('tag_view_submenu'); + $sub2["operation/agentes/alerts_status"]["text"] = __('Alert detail'); $sub2["operation/agentes/alerts_status"]["refr"] = 0; From 01a106e9f6a407e66310cbaf118f0db450927c6b Mon Sep 17 00:00:00 2001 From: fermin831 Date: Tue, 24 Oct 2017 13:53:06 +0200 Subject: [PATCH 020/149] Fixed console error 500 when mysql is not running --- pandora_console/include/functions_db.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandora_console/include/functions_db.php b/pandora_console/include/functions_db.php index 06c85ef194..70395cb205 100644 --- a/pandora_console/include/functions_db.php +++ b/pandora_console/include/functions_db.php @@ -81,7 +81,7 @@ function db_connect($host = null, $db = null, $user = null, $pass = null, $port $ownDir = dirname(__FILE__) . DIRECTORY_SEPARATOR; $config['homedir'] = $ownDir; $login_screen = 'error_authconfig'; - require($config['homedir'] . '/general/error_screen.php'); + require($config['homedir'] . '../general/error_screen.php'); exit; } else if ($error == 0) { From c0a690551b7733238330507f8dca596efb2e2185 Mon Sep 17 00:00:00 2001 From: enriquecd Date: Tue, 24 Oct 2017 17:11:59 +0200 Subject: [PATCH 021/149] Add order items setting bar to graph editor - #1382 --- .../reporting/graph_builder.graph_editor.php | 198 +++++++++++++++++- 1 file changed, 194 insertions(+), 4 deletions(-) diff --git a/pandora_console/godmode/reporting/graph_builder.graph_editor.php b/pandora_console/godmode/reporting/graph_builder.graph_editor.php index a89a9422ba..4daaf0c18d 100644 --- a/pandora_console/godmode/reporting/graph_builder.graph_editor.php +++ b/pandora_console/godmode/reporting/graph_builder.graph_editor.php @@ -32,6 +32,7 @@ require_once($config['homedir'] . "/include/functions_modules.php"); require_once($config['homedir'] . "/include/functions_groups.php"); $editGraph = (bool) get_parameter('edit_graph', 0); +$action = get_parameter('action', ''); if (isset ($_GET["get_agent"])) { $id_agent = $_POST["id_agent"]; @@ -39,6 +40,122 @@ if (isset ($_GET["get_agent"])) { $chunkdata = $_POST["chunk"]; } +switch ($action) { + case 'sort_items': + $resultOperationDB = null; + $position_to_sort = (int)get_parameter('position_to_sort', 1); + $ids_serialize = (string)get_parameter('ids_items_to_sort', ''); + $move_to = (string)get_parameter('move_to', 'after'); + + $countItems = db_get_sql(' + SELECT COUNT(id_gs) + FROM tgraph_source + WHERE id_graph = ' . $id_graph); + + if (($countItems < $position_to_sort) || ($position_to_sort < 1)) { + $resultOperationDB = false; + } + else if (!empty($ids_serialize)) { + $ids = explode('|', $ids_serialize); + + switch ($config["dbtype"]) { + case "mysql": + $items = db_get_all_rows_sql(' + SELECT id_gs, `order` + FROM tgraph_source + WHERE id_graph = ' . $id_graph . ' + ORDER BY `order`'); + break; + } + + if ($items === false) $items = array(); + + + // Clean the repeated order values + $order_temp = 1; + foreach ($items as $item) { + switch ($config["dbtype"]) { + case "mysql": + db_process_sql_update('tgraph_source', + array('`order`' => $order_temp), + array('id_gs' => $item['id_rc'])); + break; + } + + $order_temp++; + } + + + switch ($config["dbtype"]) { + case "mysql": + $items = db_get_all_rows_sql(' + SELECT id_gs, `order` + FROM tgraph_source + WHERE id_graph = ' . $id_graph . ' + ORDER BY `order`'); + break; + } + + if ($items === false) $items = array(); + + + + $temp = array(); + + $temp = array(); + foreach ($items as $item) { + //Remove the contents from the block to sort + if (array_search($item['id_gs'], $ids) === false) { + $temp[$item['order']] = $item['id_gs']; + } + } + $items = $temp; + + + + $sorted_items = array(); + foreach ($items as $pos => $id_unsort) { + if ($pos == $position_to_sort) { + if ($move_to == 'after') { + $sorted_items[] = $id_unsort; + } + + foreach ($ids as $id) { + $sorted_items[] = $id; + } + + if ($move_to != 'after') { + $sorted_items[] = $id_unsort; + } + } + else { + $sorted_items[] = $id_unsort; + } + } + + $items = $sorted_items; + + + + foreach ($items as $order => $id) { + switch ($config["dbtype"]) { + case "mysql": + + db_process_sql_update('tgraph_source', + array('`order`' => ($order + 1)), + array('id_gs' => $id)); + break; + } + } + + $resultOperationDB = true; + } + else { + $resultOperationDB = false; + } + break; + } + if ($editGraph) { $graphRows = db_get_all_rows_sql("SELECT t1.*, (SELECT t3.alias @@ -49,7 +166,8 @@ if ($editGraph) { WHERE t2.id_agente_modulo = t1.id_agent_module)) AS agent_name FROM tgraph_source t1 - WHERE t1.id_graph = " . $id_graph); + WHERE t1.id_graph = " . $id_graph . " order by `order`"); + $position_array = array(); $module_array = array(); $weight_array = array(); $agent_array = array(); @@ -65,6 +183,7 @@ if ($editGraph) { $weight_array[] = $graphRow['weight']; $label_array[] = $graphRow['label']; $agent_array[] = $graphRow['agent_name']; + $position_array[] = $graphRow['order']; } $graphInTgraph = db_get_row_sql("SELECT * FROM tgraph WHERE id_graph = " . $id_graph); @@ -81,11 +200,13 @@ if ($editGraph) { if (count($module_array) > 0) { echo ""; echo " + - "; + + "; $color = 0; for ($a = 0; $a < count($module_array); $a++) { // Calculate table line color @@ -98,7 +219,8 @@ if (count($module_array) > 0) { $color = 1; } - echo ""; + echo ""; + echo ""; echo ""; @@ -126,11 +248,55 @@ if (count($module_array) > 0) { echo ""; + echo ""; + + echo ""; + + + echo ""; } echo "
    ".__('P.')." ".__('Agent')." ".__('Module')." ".__('Label')." ".__('Weight')."".__('Delete')."".__('Delete')."".__('Sort')."
    " . $agent_array[$a] . "
    $position_array[$a]" . $agent_array[$a] . ""; echo modules_get_agentmodule_name ($module_array[$a]).""; echo "".html_print_image('images/cross.png', true, array ('title' => __('Delete'))).""; - echo "
    "; + + echo html_print_checkbox_extended('sorted_items[]', $idgs_array[$a], false, false, '', 'class="selected_check"', true); + + echo "
    "; } + +$table = new stdClass(); +$table->width = '100%'; +$table->colspan[0][0] = 3; +$table->size = array(); +$table->size[0] = '25%'; +$table->size[1] = '25%'; +$table->size[2] = '25%'; +$table->size[3] = '25%'; +if (defined("METACONSOLE")) { + $table->class = "databox data"; + $table->head[0] = __("Sort items"); + $table->head_colspan[0] = 4; + $table->headstyle[0] = 'text-align: center'; +} +else { + $table->data[0][0] = "". __("Sort items") . ""; +} +$table->data[1][0] = __('Sort selected items from position: '); +$table->data[1][1] = html_print_select_style( + array('before' => __('Move before to'), 'after' => __('Move after to')), 'move_to', + '', '', '', '', 0, true); +$table->data[1][2] = html_print_input_text_extended('position_to_sort', 1, + 'text-position_to_sort', '', 3, 10, false, "only_numbers('position_to_sort');", '', true); +$table->data[1][2] .= html_print_input_hidden('ids_items_to_sort', '', true); +$table->data[1][3] = html_print_submit_button(__('Sort'), 'sort_submit', false, 'class="sub upd"', true); +$table->data[1][4] = html_print_input_hidden('action', 'sort_items', true); + +echo ""; +html_print_table($table); +echo ""; + +echo "
    "; + + //Configuration form echo ''; echo "
    "; @@ -217,4 +383,28 @@ function filterByGroup(idGroup) { "json" ); } + +function added_ids_sorted_items_to_hidden_input() { + var ids = ''; + var first = true; + + $("input.selected_check:checked").each(function(i, val) { + if (!first) + ids = ids + '|'; + first = false; + + ids = ids + $(val).val(); + }); + + $("input[name='ids_items_to_sort']").val(ids); + + if (ids == '') { + alert(""); + + return false; + } + else { + return true; + } +} From d6f64e1ccabd6bb1b14362b926d4c00273ef461f Mon Sep 17 00:00:00 2001 From: enriquecd Date: Tue, 24 Oct 2017 17:47:45 +0200 Subject: [PATCH 022/149] Change width of snmp interface wizard select box - #1486 --- .../godmode/agentes/agent_wizard.snmp_interfaces_explorer.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandora_console/godmode/agentes/agent_wizard.snmp_interfaces_explorer.php b/pandora_console/godmode/agentes/agent_wizard.snmp_interfaces_explorer.php index f422f1ea40..023cb0330f 100644 --- a/pandora_console/godmode/agentes/agent_wizard.snmp_interfaces_explorer.php +++ b/pandora_console/godmode/agentes/agent_wizard.snmp_interfaces_explorer.php @@ -542,7 +542,7 @@ if (!empty($interfaces_list)) { $table->data[0][1] = ''; $table->data[0][2] = ''.__('Modules').''; - $table->data[1][0] = html_print_select ($interfaces_list, 'id_snmp[]', 0, false, '', '', true, true, true, '', false, 'width:200px;'); + $table->data[1][0] = html_print_select ($interfaces_list, 'id_snmp[]', 0, false, '', '', true, true, true, '', false, 'width:500px;'); $table->data[1][1] = html_print_image('images/darrowright.png', true); $table->data[1][2] = html_print_select (array (), 'module[]', 0, false, '', 0, true, true, true, '', false, 'width:200px;'); $table->data[1][2] .= html_print_input_hidden('agent', $id_agent, true); From 4f62a02ca1c590d4eed72339bcc0a68f4b93046e Mon Sep 17 00:00:00 2001 From: enriquecd Date: Tue, 24 Oct 2017 18:16:32 +0200 Subject: [PATCH 023/149] Change font family to install wizard button - #1500 --- pandora_console/include/styles/install.css | 1 + 1 file changed, 1 insertion(+) diff --git a/pandora_console/include/styles/install.css b/pandora_console/include/styles/install.css index 59b1fb98cc..6c558fdcba 100644 --- a/pandora_console/include/styles/install.css +++ b/pandora_console/include/styles/install.css @@ -192,6 +192,7 @@ div.installation_step { -o-transition-property: background-color, color; -o-transition-duration: 1s; color:#82b92e; + font-family: Sans, Arial, sans; } .btn_install_next:hover .btn_install_next_text { transition-property: background-color, color; From 7e6adb5d40ba8eb880fe41e786fd5849b908003c Mon Sep 17 00:00:00 2001 From: enriquecd Date: Tue, 24 Oct 2017 19:02:16 +0200 Subject: [PATCH 024/149] Db changes for tgraph_source field order - #1382 --- pandora_console/extras/pandoradb_migrate_6.0_to_7.0.mysql.sql | 1 + pandora_console/pandoradb.sql | 1 + 2 files changed, 2 insertions(+) diff --git a/pandora_console/extras/pandoradb_migrate_6.0_to_7.0.mysql.sql b/pandora_console/extras/pandoradb_migrate_6.0_to_7.0.mysql.sql index 22bcc52766..57b968ebaa 100644 --- a/pandora_console/extras/pandoradb_migrate_6.0_to_7.0.mysql.sql +++ b/pandora_console/extras/pandoradb_migrate_6.0_to_7.0.mysql.sql @@ -1411,6 +1411,7 @@ ALTER TABLE tserver_export MODIFY `name` varchar(600) BINARY NOT NULL default '' -- --------------------------------------------------------------------- ALTER TABLE tgraph_source ADD COLUMN id_server int(11) UNSIGNED NOT NULL default 0; +ALTER TABLE tgraph_source ADD COLUMN `order` int(10) NOT NULL default 0; -- --------------------------------------------------------------------- -- Table `tserver_export_data` diff --git a/pandora_console/pandoradb.sql b/pandora_console/pandoradb.sql index 0d749db694..1905a4fd05 100644 --- a/pandora_console/pandoradb.sql +++ b/pandora_console/pandoradb.sql @@ -1201,6 +1201,7 @@ CREATE TABLE IF NOT EXISTS `tgraph_source` ( `id_agent_module` int(11) NOT NULL default 0, `weight` float(8,3) NOT NULL DEFAULT 0, `label` varchar(150) DEFAULT '', + `order` int(10) DEFAULT 0, PRIMARY KEY(`id_gs`) ) ENGINE = InnoDB DEFAULT CHARSET=utf8; From 4473d16727ccd80e41c26c108ad83ac9703788bf Mon Sep 17 00:00:00 2001 From: enriquecd Date: Wed, 25 Oct 2017 11:35:58 +0200 Subject: [PATCH 025/149] Change phrases in system logfile viewer - #1263 --- pandora_console/extensions/pandora_logs.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pandora_console/extensions/pandora_logs.php b/pandora_console/extensions/pandora_logs.php index f20bcab720..4241018a16 100644 --- a/pandora_console/extensions/pandora_logs.php +++ b/pandora_console/extensions/pandora_logs.php @@ -69,9 +69,9 @@ function pandoralogs_extension_main () { ui_print_page_header (__("System logfile viewer"), "images/extensions.png", false, "", true, "" ); - echo "

    " . __('This tool is used just to view your Pandora FMS system logfiles directly from console') . "

    "; + echo "

    " . __('Use this tool to view your Pandora FMS logfiles directly on the console') . "

    "; - echo "

    " . __('You can control the size information to show in general setup (Log size limit in view extension), actually ') . $config['max_log_size'] * 1000 . "B" . "

    "; + echo "

    " . __('You can choose the amount of information shown in general setup (Log size limit in system logs viewer extension), ' . $config['max_log_size'] * 1000 . 'B at the moment') . "

    "; $logs_directory = (!empty($config["server_log_dir"])) ? io_safe_output($config["server_log_dir"]) : "/var/log/pandora"; From 3bafe27361c387ef0e1ce7f6cacd3c2911b64a4e Mon Sep 17 00:00:00 2001 From: Daniel Maya Date: Wed, 25 Oct 2017 12:04:14 +0200 Subject: [PATCH 026/149] added Search in custom fields --- pandora_console/include/functions_agents.php | 29 +++++++++++++++++-- .../operation/agentes/estado_agente.php | 19 ++++++++++-- 2 files changed, 44 insertions(+), 4 deletions(-) diff --git a/pandora_console/include/functions_agents.php b/pandora_console/include/functions_agents.php index 838fb58d55..5b4e922839 100644 --- a/pandora_console/include/functions_agents.php +++ b/pandora_console/include/functions_agents.php @@ -314,6 +314,13 @@ function agents_get_agents ($filter = false, $fields = false, $search = ''; } + if (isset($filter['search_custom'])) { + $search_custom = $filter['search_custom']; + unset($filter['search_custom']); + } else { + $search_custom = ''; + } + if (isset($filter['offset'])) { $offset = $filter['offset']; unset($filter['offset']); @@ -450,8 +457,8 @@ function agents_get_agents ($filter = false, $fields = false, $sql_extra, $where, $where_nogroup, $status_sql, $search, $disabled); } else { - $where = sprintf('%s AND %s AND (%s) %s AND %s', - $where, $where_nogroup, $status_sql, $search, $disabled); + $where = sprintf('%s AND %s AND (%s) %s AND %s %s', + $where, $where_nogroup, $status_sql, $search, $disabled, $search_custom); } $sql = sprintf('SELECT %s FROM tagente @@ -1299,6 +1306,24 @@ function agents_get_agent_id ($agent_name, $io_safe_input = false) { return (int) db_get_value ('id_agente', 'tagente', 'nombre', $agent_name); } +/** + * Get agents id from an agent alias. + * + * @param string $agent_alias Agent alias to get its id. + * @param boolean $io_safe_input If it is true transform to safe string, by default false. + * + * @return int Id from the agent of the given alias. + */ +function agents_get_agent_id_by_alias ($alias, $io_safe_input = false) { + if ($io_safe_input) { + $alias = io_safe_input($alias); + } + $sql = sprintf("SELECT tagente.id_agente FROM tagente WHERE alias LIKE '%s' ",$alias); + $agent_id = db_get_all_rows_sql($sql); + + return $agent_id; +} + /** * Get name of an agent. * diff --git a/pandora_console/operation/agentes/estado_agente.php b/pandora_console/operation/agentes/estado_agente.php index 151ae893ec..521537618a 100644 --- a/pandora_console/operation/agentes/estado_agente.php +++ b/pandora_console/operation/agentes/estado_agente.php @@ -141,6 +141,7 @@ ob_end_clean(); // Take some parameters (GET) $group_id = (int) get_parameter ("group_id", 0); $search = trim(get_parameter ("search", "")); +$search_custom = trim(get_parameter ("search_custom", "")); $offset = (int)get_parameter('offset', 0); $refr = get_parameter('refr', 0); $recursion = get_parameter('recursion', 0); @@ -205,7 +206,7 @@ html_print_checkbox ("recursion", 1, $recursion, false, false, 'this.form.submit echo ''; echo __('Search') . ' '; -html_print_input_text ("search", $search, '', 12); +html_print_input_text ("search", $search, '', 15); echo ''; @@ -222,6 +223,11 @@ html_print_select ($fields, "status", $status, 'this.form.submit()', __('All'), echo ''; +echo __('Search in custom fields') . ' '; +html_print_input_text ("search_custom", $search_custom, '', 15); + +echo ''; + html_print_submit_button (__('Search'), "srcbutton", '', array ("class" => "sub search")); @@ -384,7 +390,6 @@ switch ($sortField) { $search_sql = ''; if ($search != "") { - //$search_sql = " AND ( nombre " . $order_collation . " LIKE '%$search%' OR direccion LIKE '%$search%' OR comentarios LIKE '%$search%') "; $sql = "SELECT DISTINCT taddress_agent.id_agent FROM taddress INNER JOIN taddress_agent ON taddress.id_a = taddress_agent.id_a @@ -409,6 +414,14 @@ if ($search != "") { } } + +if(!empty($search_custom)){ + $search_sql_custom = " AND EXISTS (SELECT * FROM tagent_custom_data + WHERE id_agent = id_agente AND description LIKE '%$search_custom%')"; +} else { + $search_sql_custom = ""; +} + // Show only selected groups if ($group_id > 0) { $groups = array($group_id); @@ -464,6 +477,7 @@ else { 'disabled' => 0, 'id_grupo' => $groups, 'search' => $search_sql, + 'search_custom' => $search_sql_custom, 'status' => $status), array ('COUNT(*) as total'), $access, false); $total_agents = isset ($total_agents[0]['total']) ? @@ -474,6 +488,7 @@ else { 'id_grupo' => $groups, 'disabled' => 0, 'status' => $status, + 'search_custom' => $search_sql_custom, 'search' => $search_sql, 'offset' => (int) get_parameter ('offset'), 'limit' => (int) $config['block_size']), From f1cbaec98be1a7909b9afb527af7d017d1a21b14 Mon Sep 17 00:00:00 2001 From: fermin831 Date: Wed, 25 Oct 2017 12:11:56 +0200 Subject: [PATCH 027/149] Added safe_output to server events --- pandora_server/lib/PandoraFMS/Core.pm | 32 ++++++++++++-------- pandora_server/lib/PandoraFMS/DataServer.pm | 9 ++++-- pandora_server/lib/PandoraFMS/ReconServer.pm | 2 +- 3 files changed, 26 insertions(+), 17 deletions(-) diff --git a/pandora_server/lib/PandoraFMS/Core.pm b/pandora_server/lib/PandoraFMS/Core.pm index 77db28e6e7..e6ef632f73 100644 --- a/pandora_server/lib/PandoraFMS/Core.pm +++ b/pandora_server/lib/PandoraFMS/Core.pm @@ -525,7 +525,7 @@ Process an alert given the status returned by pandora_evaluate_alert. ########################################################################## sub pandora_process_alert ($$$$$$$$;$) { my ($pa_config, $data, $agent, $module, $alert, $rc, $dbh, $timestamp, $extra_macros) = @_; - + if (defined ($agent)) { logger ($pa_config, "Processing alert '" . safe_output($alert->{'name'}) . "' for agent '" . safe_output($agent->{'nombre'}) . "': " . (defined ($AlertStatus[$rc]) ? $AlertStatus[$rc] : 'Unknown status') . ".", 10); } @@ -565,12 +565,12 @@ sub pandora_process_alert ($$$$$$$$;$) { # Generate an event if ($table eq 'tevent_alert') { pandora_event ($pa_config, "Alert ceased (" . - $alert->{'name'} . ")", 0, 0, $alert->{'priority'}, $id, + safe_output($alert->{'name'}) . ")", 0, 0, $alert->{'priority'}, $id, (defined ($alert->{'id_agent_module'}) ? $alert->{'id_agent_module'} : 0), "alert_ceased", 0, $dbh, 'Pandora', '', '', '', '', $critical_instructions, $warning_instructions, $unknown_instructions); } else { pandora_event ($pa_config, "Alert ceased (" . - $alert->{'name'} . ")", $agent->{'id_grupo'}, + safe_output($alert->{'name'}) . ")", $agent->{'id_grupo'}, $agent->{'id_agente'}, $alert->{'priority'}, $id, (defined ($alert->{'id_agent_module'}) ? $alert->{'id_agent_module'} : 0), "alert_ceased", 0, $dbh, 'Pandora', '', '', '', '', $critical_instructions, $warning_instructions, $unknown_instructions); @@ -1611,9 +1611,8 @@ sub pandora_planned_downtime_disabled_once_stop($$) { db_do($dbh, 'UPDATE tplanned_downtime SET executed = 0 WHERE id = ?', $downtime->{'id'}); - pandora_event ($pa_config, - '(Created by ' . $downtime->{'id_user'} . ') Server ' . $pa_config->{'servername'} . ' stopped planned downtime: ' . $downtime->{'name'}, 0, 0, 1, 0, 0, 'system', 0, $dbh); + '(Created by ' . $downtime->{'id_user'} . ') Server ' . $pa_config->{'servername'} . ' stopped planned downtime: ' . safe_output($downtime->{'name'}), 0, 0, 1, 0, 0, 'system', 0, $dbh); pandora_planned_downtime_unset_disabled_elements($pa_config, $dbh, $downtime); @@ -1658,8 +1657,9 @@ sub pandora_planned_downtime_disabled_once_start($$) { SET executed = 1 WHERE id = ?', $downtime->{'id'}); + print"pandora_planned_downtime_disabled_once_start\n"; pandora_event ($pa_config, - "(Created by " . $downtime->{'id_user'} . ") Server ".$pa_config->{'servername'}." started planned downtime: ".$downtime->{'name'}, 0, 0, 1, 0, 0, 'system', 0, $dbh); + "(Created by " . $downtime->{'id_user'} . ") Server ".$pa_config->{'servername'}." started planned downtime: ".safe_output($downtime->{'name'}), 0, 0, 1, 0, 0, 'system', 0, $dbh); pandora_planned_downtime_set_disabled_elements($pa_config, $dbh, $downtime); @@ -1849,7 +1849,7 @@ sub pandora_planned_downtime_quiet_once_stop($$) { SET executed = 0 WHERE id = ?', $downtime->{'id'}); pandora_event ($pa_config, - "(Created by " . $downtime->{'id_user'} . ") Server ".$pa_config->{'servername'}." stopped planned downtime: ".$downtime->{'name'}, 0, 0, 1, 0, 0, 'system', 0, $dbh); + "(Created by " . $downtime->{'id_user'} . ") Server ".$pa_config->{'servername'}." stopped planned downtime: ".safe_output($downtime->{'name'}), 0, 0, 1, 0, 0, 'system', 0, $dbh); pandora_planned_downtime_unset_quiet_elements($pa_config, $dbh, $downtime->{'id'}); @@ -1890,8 +1890,9 @@ sub pandora_planned_downtime_quiet_once_start($$) { db_do($dbh, 'UPDATE tplanned_downtime SET executed = 1 WHERE id = ?', $downtime->{'id'}); + print"pandora_planned_downtime_quiet_once_start\n"; pandora_event ($pa_config, - "(Created by " . $downtime->{'id_user'} . ") Server ".$pa_config->{'servername'}." started planned downtime: ".$downtime->{'name'}, 0, 0, 1, 0, 0, 'system', 0, $dbh); + "(Created by " . $downtime->{'id_user'} . ") Server ".$pa_config->{'servername'}." started planned downtime: ".safe_output($downtime->{'name'}), 0, 0, 1, 0, 0, 'system', 0, $dbh); pandora_planned_downtime_set_quiet_elements($pa_config, $dbh, $downtime->{'id'}); @@ -1944,8 +1945,9 @@ sub pandora_planned_downtime_monthly_start($$) { db_do($dbh, 'UPDATE tplanned_downtime SET executed = 1 WHERE id = ?', $downtime->{'id'}); + print"pandora_planned_downtime_monthly_start\n"; pandora_event ($pa_config, - "Server ".$pa_config->{'servername'}." started planned downtime: ".$downtime->{'name'}, 0, 0, 1, 0, 0, 'system', 0, $dbh); + "Server ".$pa_config->{'servername'}." started planned downtime: ".safe_output($downtime->{'name'}), 0, 0, 1, 0, 0, 'system', 0, $dbh); if ($downtime->{'type_downtime'} eq "quiet") { @@ -2020,8 +2022,9 @@ sub pandora_planned_downtime_monthly_stop($$) { db_do($dbh, 'UPDATE tplanned_downtime SET executed = 0 WHERE id = ?', $downtime->{'id'}); + print"pandora_planned_downtime_monthly_stop\n"; pandora_event ($pa_config, - "Server ".$pa_config->{'servername'}." stopped planned downtime: ".$downtime->{'name'}, 0, 0, 1, 0, 0, 'system', 0, $dbh); + "Server ".$pa_config->{'servername'}." stopped planned downtime: ".safe_output($downtime->{'name'}), 0, 0, 1, 0, 0, 'system', 0, $dbh); if ($downtime->{'type_downtime'} eq "quiet") { pandora_planned_downtime_unset_quiet_elements($pa_config, @@ -2129,8 +2132,9 @@ sub pandora_planned_downtime_weekly_start($$) { db_do($dbh, 'UPDATE tplanned_downtime SET executed = 1 WHERE id = ?', $downtime->{'id'}); + print"pandora_planned_downtime_weekly_start\n"; pandora_event ($pa_config, - "Server ".$pa_config->{'servername'}." started planned downtime: ".$downtime->{'name'}, 0, 0, 1, 0, 0, 'system', 0, $dbh); + "Server ".$pa_config->{'servername'}." started planned downtime: ".safe_output($downtime->{'name'}), 0, 0, 1, 0, 0, 'system', 0, $dbh); if ($downtime->{'type_downtime'} eq "quiet") { pandora_planned_downtime_set_quiet_elements($pa_config, @@ -2243,8 +2247,10 @@ sub pandora_planned_downtime_weekly_stop($$) { db_do($dbh, 'UPDATE tplanned_downtime SET executed = 0 WHERE id = ?', $downtime->{'id'}); + + print"pandora_planned_downtime_weekly_stop\n"; pandora_event ($pa_config, - "Server ".$pa_config->{'servername'}." stopped planned downtime: ".$downtime->{'name'}, 0, 0, 1, 0, 0, 'system', 0, $dbh); + "Server ".$pa_config->{'servername'}." stopped planned downtime: ".safe_output($downtime->{'name'}), 0, 0, 1, 0, 0, 'system', 0, $dbh); if ($downtime->{'type_downtime'} eq "quiet") { pandora_planned_downtime_unset_quiet_elements($pa_config, @@ -2974,7 +2980,7 @@ sub pandora_create_agent ($$$$$$$$$$;$$$$$$$$$) { } logger ($pa_config, "Server '$server_name' CREATED agent '$agent_name' address '$address'.", 10); - pandora_event ($pa_config, "Agent [$alias] created by $server_name", $group_id, $agent_id, 2, 0, 0, 'new_agent', 0, $dbh); + pandora_event ($pa_config, "Agent [" . safe_output($alias) . "] created by $server_name", $group_id, $agent_id, 2, 0, 0, 'new_agent', 0, $dbh); return $agent_id; } diff --git a/pandora_server/lib/PandoraFMS/DataServer.pm b/pandora_server/lib/PandoraFMS/DataServer.pm index ebd8f860ee..dd4256e96d 100644 --- a/pandora_server/lib/PandoraFMS/DataServer.pm +++ b/pandora_server/lib/PandoraFMS/DataServer.pm @@ -333,19 +333,22 @@ sub process_xml_data ($$$$$) { if (defined ($data->{'group_id'}) && $data->{'group_id'} ne '') { $group_id = $data->{'group_id'}; if (! defined (get_group_name ($dbh, $group_id))) { - pandora_event ($pa_config, "Unable to create agent '$agent_name': group ID '" . $group_id . "' does not exist.", 0, 0, 0, 0, 0, 'error', 0, $dbh); + print "UNABLE GROUP ID\n"; + pandora_event ($pa_config, "Unable to create agent '" . safe_output($agent_name) . "': group ID '" . $group_id . "' does not exist.", 0, 0, 0, 0, 0, 'error', 0, $dbh); logger($pa_config, "Group ID " . $group_id . " does not exist.", 3); return; } } elsif (defined ($data->{'group'}) && $data->{'group'} ne '') { $group_id = get_group_id ($dbh, $data->{'group'}); if (! defined (get_group_name ($dbh, $group_id))) { - pandora_event ($pa_config, "Unable to create agent '$agent_name': group '" . $data->{'group'} . "' does not exist.", 0, 0, 0, 0, 0, 'error', 0, $dbh); + print "UNABLE GROUP\n"; + pandora_event ($pa_config, "Unable to create agent '" . safe_output($agent_name) . "': group '" . safe_output($data->{'group'}) . "' does not exist.", 0, 0, 0, 0, 0, 'error', 0, $dbh); logger($pa_config, "Group " . $data->{'group'} . " does not exist.", 3); return; } } else { - pandora_event ($pa_config, "Unable to create agent '$agent_name': autocreate_group $group_id does not exist. Edit the pandora_server.conf file and change it.", 0, 0, 0, 0, 0, 'error', 0, $dbh); + print "UNABLE AUTOCREATE\n"; + pandora_event ($pa_config, "Unable to create agent '" . safe_output($agent_name) . "': autocreate_group $group_id does not exist. Edit the pandora_server.conf file and change it.", 0, 0, 0, 0, 0, 'error', 0, $dbh); logger($pa_config, "Group id $group_id does not exist (check autocreate_group config token).", 3); return; } diff --git a/pandora_server/lib/PandoraFMS/ReconServer.pm b/pandora_server/lib/PandoraFMS/ReconServer.pm index b25c222bf7..3261729569 100644 --- a/pandora_server/lib/PandoraFMS/ReconServer.pm +++ b/pandora_server/lib/PandoraFMS/ReconServer.pm @@ -421,7 +421,7 @@ sub PandoraFMS::Recon::Base::create_agent($$) { $agent_id = pandora_create_agent($self->{'pa_config'}, $self->{'pa_config'}->{'servername'}, $host_name, $device, $self->{'group_id'}, 0, $id_os, '', 300, $self->{'dbh'}); return undef unless defined ($agent_id) and ($agent_id > 0); - pandora_event($self->{'pa_config'}, "[RECON] New " . $self->get_device_type($device) . " found (" . join(',', $self->get_addresses($device)) . ").", $self->{'group_id'}, $agent_id, 2, 0, 0, 'recon_host_detected', 0, $self->{'dbh'}); + pandora_event($self->{'pa_config'}, "[RECON] New " . safe_output($self->get_device_type($device)) . " found (" . join(',', safe_output($self->get_addresses($device))) . ").", $self->{'group_id'}, $agent_id, 2, 0, 0, 'recon_host_detected', 0, $self->{'dbh'}); $agent_learning = 1; # Create network profile modules for the agent From 38d216b1086fe088ace31f019d0782940a3eb323 Mon Sep 17 00:00:00 2001 From: fermin831 Date: Wed, 25 Oct 2017 15:42:54 +0200 Subject: [PATCH 028/149] Fixed automonitoring on Windows --- pandora_server/lib/PandoraFMS/Core.pm | 36 +++++++++++++++----------- pandora_server/lib/PandoraFMS/Tools.pm | 29 +++++++++++++++++++++ 2 files changed, 50 insertions(+), 15 deletions(-) diff --git a/pandora_server/lib/PandoraFMS/Core.pm b/pandora_server/lib/PandoraFMS/Core.pm index 77db28e6e7..6184910c5e 100644 --- a/pandora_server/lib/PandoraFMS/Core.pm +++ b/pandora_server/lib/PandoraFMS/Core.pm @@ -4702,23 +4702,29 @@ sub pandora_self_monitoring ($$) { $xml_output .=" $agents_unknown"; $xml_output .=" "; - $xml_output .=" "; - $xml_output .=" System_Load_AVG"; - $xml_output .=" generic_data"; - $xml_output .=" $load_average"; - $xml_output .=" "; + if (defined($load_average)) { + $xml_output .=" "; + $xml_output .=" System_Load_AVG"; + $xml_output .=" generic_data"; + $xml_output .=" $load_average"; + $xml_output .=" "; + } - $xml_output .=" "; - $xml_output .=" Free_RAM"; - $xml_output .=" generic_data"; - $xml_output .=" $free_mem"; - $xml_output .=" "; + if (defined($free_mem)) { + $xml_output .=" "; + $xml_output .=" Free_RAM"; + $xml_output .=" generic_data"; + $xml_output .=" $free_mem"; + $xml_output .=" "; + } - $xml_output .=" "; - $xml_output .=" FreeDisk_SpoolDir"; - $xml_output .=" generic_data"; - $xml_output .=" $free_disk_spool"; - $xml_output .=" "; + if (defined($free_disk_spool)) { + $xml_output .=" "; + $xml_output .=" FreeDisk_SpoolDir"; + $xml_output .=" generic_data"; + $xml_output .=" $free_disk_spool"; + $xml_output .=" "; + } $xml_output .= ""; diff --git a/pandora_server/lib/PandoraFMS/Tools.pm b/pandora_server/lib/PandoraFMS/Tools.pm index e0dda9af4f..838721a6fb 100755 --- a/pandora_server/lib/PandoraFMS/Tools.pm +++ b/pandora_server/lib/PandoraFMS/Tools.pm @@ -861,6 +861,24 @@ sub dateTimeToTimestamp { sub disk_free ($) { my $target = $_[0]; + my $OSNAME = $^O; + + # Get the free disk on data_in folder unit + if ($OSNAME eq "MSWin32") { + # Check relative path + my $unit; + if ($target =~ m/^([a-zA-Z]):/gi) { + $unit = $1/(1024*1024); + } else { + return; + } + # Get the free space of unit found + my $all_disk_info = `wmic logicaldisk get caption, freespace`; + if ($all_disk_info =~ m/$unit:\D*(\d+)/gmi){ + return $1; + } + return; + } # Try to use df command with Posix parameters... my $command = "df -k -P ".$target." | tail -1 | awk '{ print \$4/1024}'"; my $output = `$command`; @@ -874,6 +892,9 @@ sub load_average { if ($OSNAME eq "freebsd"){ $load_average = ((split(/\s+/, `/sbin/sysctl -n vm.loadavg`))[1]); + } elsif ($OSNAME eq "MSWin32") { + # Windows hasn't got load average. + $load_average = undef; } # by default LINUX calls else { @@ -896,6 +917,14 @@ sub free_mem { elsif ($OSNAME eq "netbsd"){ $free_mem = `cat /proc/meminfo | grep MemFree | awk '{ print \$2 }'`; } + elsif ($OSNAME eq "MSWin32"){ + $free_mem = `wmic OS get FreePhysicalMemory /Value`; + if ($free_mem =~ m/=(.*)$/gm) { + $free_mem = $1; + } else { + $free_mem = undef; + } + } # by default LINUX calls else { $free_mem = `free | grep Mem | awk '{ print \$4 }'`; From 7bd6f5e05dd6251d7c4b099e5944e61f0fe64639 Mon Sep 17 00:00:00 2001 From: Arturo Gonzalez Date: Wed, 25 Oct 2017 15:45:19 +0200 Subject: [PATCH 029/149] Added code to snmp filters form --- .../godmode/snmpconsole/snmp_filters.php | 133 ++++++++++++++++-- pandora_console/pandoradb.sql | 1 + 2 files changed, 120 insertions(+), 14 deletions(-) diff --git a/pandora_console/godmode/snmpconsole/snmp_filters.php b/pandora_console/godmode/snmpconsole/snmp_filters.php index 085b23957d..3def7ed776 100644 --- a/pandora_console/godmode/snmpconsole/snmp_filters.php +++ b/pandora_console/godmode/snmpconsole/snmp_filters.php @@ -28,6 +28,7 @@ $update_filter = (int) get_parameter ('update_filter', -2); $delete_filter = (int) get_parameter ('delete_filter', -1); $description = (string) get_parameter ('description', ''); $filter = (string) get_parameter ('filter', ''); +$index_post = (int) get_parameter('index_post', 0); // Create/update header if ($edit_filter > -2) { @@ -45,8 +46,37 @@ else {// Overview header // Create/update filter if ($update_filter > -2) { if ($update_filter > -1) { - $values = array('description' => $description, 'filter' => $filter); - $result = db_process_sql_update('tsnmp_filter', $values, array('id_snmp_filter' => $update_filter)); + $new_unified_id = (db_get_value_sql("SELECT unified_filters_id FROM tsnmp_filter WHERE id_snmp_filter = " . $update_filter)); + $elements = get_parameter('elements', array()); + + if ($index_post == 1) { + $filter = get_parameter('filter_' . $update_filter); + $values = array('description' => $description, 'filter' => $filter, 'unified_filters_id' => $new_unified_id); + $result = db_process_sql_update('tsnmp_filter', $values, array('id_snmp_filter' => $update_filter)); + } + else { + $elements = explode(",", $elements); + foreach ($elements as $e) { + $filter = get_parameter('filter_' . $e); + $values = array('description' => $description, 'filter' => $filter, 'unified_filters_id' => $new_unified_id); + $result = db_process_sql_update('tsnmp_filter', $values, array('id_snmp_filter' => $e)); + } + if (count($elements) == 1) { + $new_unified_id = (db_get_value_sql("SELECT MAX(unified_filters_id) FROM tsnmp_filter")) + 1; + + $filter = get_parameter('filter_' . $elements[0]); + $values = array('description' => $description, 'filter' => $filter, 'unified_filters_id' => $new_unified_id); + $result = db_process_sql_update('tsnmp_filter', $values, array('id_snmp_filter' => $elements[0])); + } + for ($i = 1; $i < $index_post; $i++) { + $filter = get_parameter('filter_' . $i); + $values = array( + 'description' => $description, + 'filter' => $filter, + 'unified_filters_id' => $new_unified_id); + $result = db_process_sql_insert('tsnmp_filter', $values); + } + } if ($result === false) { ui_print_error_message (__('There was a problem updating the filter')); } @@ -55,10 +85,27 @@ if ($update_filter > -2) { } } else { - $values = array( - 'description' => $description, - 'filter' => $filter); - $result = db_process_sql_insert('tsnmp_filter', $values); + $new_unified_id = (db_get_value_sql("SELECT MAX(unified_filters_id) FROM tsnmp_filter")) + 1; + + if ($index_post == 1) { + $filter = get_parameter('filter_0'); + $values = array( + 'description' => $description, + 'filter' => $filter, + 'unified_filters_id' => 0); + $result = db_process_sql_insert('tsnmp_filter', $values); + } + else { + for ($i = 0; $i < $index_post; $i++) { + $filter = get_parameter('filter_' . $i); + $values = array( + 'description' => $description, + 'filter' => $filter, + 'unified_filters_id' => $new_unified_id); + $result = db_process_sql_insert('tsnmp_filter', $values); + } + } + if ($result === false) { ui_print_error_message (__('There was a problem creating the filter')); } @@ -68,6 +115,16 @@ if ($update_filter > -2) { } } else if ($delete_filter > -1) { // Delete + $filters_to_upd = db_get_all_rows_sql("SELECT * FROM tsnmp_filter WHERE unified_filters_id = (SELECT unified_filters_id FROM tsnmp_filter WHERE id_snmp_filter = " . $delete_filter . ")"); + if (count($filters_to_upd) == 2) { + foreach ($filters_to_upd as $fil) { + if ($fil['id_snmp_filter'] != $delete_filter) { + $values = array('description' => $fil['description'], 'filter' => $fil['filter'], 'unified_filters_id' => 0); + db_process_sql_update('tsnmp_filter', $values, array('id_snmp_filter' => $fil['id_snmp_filter'])); + } + } + + } $result = db_process_sql_delete('tsnmp_filter', array('id_snmp_filter' => $delete_filter)); if ($result === false) { ui_print_error_message (__('There was a problem deleting the filter')); @@ -88,19 +145,46 @@ if ($edit_filter > -1) { // Create/update form if ($edit_filter > -2) { + $index = $index_post; $table->data = array (); + $table->id = 'filter_table'; $table->width = '100%'; $table->class = 'databox filters'; $table->data[0][0] = __('Description'); $table->data[0][1] = html_print_input_text ('description', $description, '', 60, 100, true); $table->data[1][0] = __('Filter'); - $table->data[1][1] = html_print_input_text ('filter', $filter, '', 60, 100, true); - $table->data[1][1] .= ui_print_help_tip (__("This field contains a substring, could be part of a IP address, a numeric OID, or a plain substring") . SEPARATOR_COLUMN, true); - + if ($edit_filter > -1) { + $filters = db_get_all_rows_sql("SELECT * FROM tsnmp_filter WHERE unified_filters_id = (SELECT unified_filters_id FROM tsnmp_filter WHERE id_snmp_filter = " . $edit_filter . ")"); + $j = 1; + foreach ($filters as $f) { + if ($j != 1) { + $table->data[$j][0] = ""; + } + $table->data[$j][1] = html_print_input_text ('filter_' . $f['id_snmp_filter'], $f['filter'], '', 60, 100, true); + if ($j == 1) { + $table->data[$j][1] .= ui_print_help_tip (__("This field contains a substring, could be part of a IP address, a numeric OID, or a plain substring") . SEPARATOR_COLUMN, true); + } + $j++; + } + } + else { + $table->data[1][1] = html_print_input_text ('filter_' . $index, $filter, '', 60, 100, true); + $table->data[1][1] .= ui_print_help_tip (__("This field contains a substring, could be part of a IP address, a numeric OID, or a plain substring") . SEPARATOR_COLUMN, true); + } + $index++; echo ''; html_print_input_hidden ('update_filter', $edit_filter); + html_print_input_hidden ('index_post', $index); + if ($edit_filter > -1) { + $filters_to_post = array(); + foreach ($filters as $fil) { + $filters_to_post[] = $fil['id_snmp_filter']; + } + html_print_input_hidden ('elements', implode(",", $filters_to_post)); + } html_print_table ($table); echo '
    '; + html_print_image('images/add.png', false, array('id' => 'add_filter', 'alt' => __('Click to add new filter'), 'title' => __('Click to add new filter'), 'style' => 'float:left;')); if ($edit_filter > -1) { html_print_submit_button (__('Update'), 'submit_button', false, 'class="sub upd"'); } @@ -112,7 +196,7 @@ if ($edit_filter > -2) { // Overview } else { - $result = db_get_all_rows_in_table ("tsnmp_filter"); + $result = db_get_all_rows_sql("SELECT * FROM tsnmp_filter ORDER BY unified_filters_id ASC"); if ($result === false) { $result = array (); require_once ($config['homedir'] . "/general/firts_task/snmp_filters.php"); @@ -130,15 +214,22 @@ else { $table->head[0] = __('Description'); $table->head[1] = __('Filter'); - $table->head[2] = __('Action'); - $table->size[2] = "50px"; - $table->align[2] = 'center'; + $table->head[2] = __('Function'); + $table->head[3] = __('Action'); + $table->size[3] = "50px"; + $table->align[3] = 'center'; foreach ($result as $row) { $data = array (); $data[0] = '' . $row['description'] . ''; $data[1] = $row['filter']; - $data[2] = '' . + if ($row['unified_filters_id'] == 0) { + $data[2] = "OR"; + } + else { + $data[2] = "AND (" . $row['unified_filters_id'] . ")"; + } + $data[3] = '' . html_print_image("images/config.png", true, array("border" => '0', "alt" => __('Update'))) . '' . '  ' . html_print_image("images/cross.png", true, array("border" => '0', "alt" => __('Delete'))) . ''; @@ -157,3 +248,17 @@ else { echo '
    '; } ?> + + diff --git a/pandora_console/pandoradb.sql b/pandora_console/pandoradb.sql index 0d749db694..7b8f09de5f 100644 --- a/pandora_console/pandoradb.sql +++ b/pandora_console/pandoradb.sql @@ -1707,6 +1707,7 @@ CREATE TABLE IF NOT EXISTS `tsnmp_filter` ( `id_snmp_filter` int(10) unsigned NOT NULL auto_increment, `description` varchar(255) default '', `filter` varchar(255) default '', + `unified_filters_id` int(10) not null default 0, PRIMARY KEY (`id_snmp_filter`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; From 58cbb2fe484ff2ac63a3f40b3124dd0789b55925 Mon Sep 17 00:00:00 2001 From: enriquecd Date: Wed, 25 Oct 2017 16:04:05 +0200 Subject: [PATCH 030/149] Add new fields to filter in search input text and operative selector filter - #1412 --- .../godmode/agentes/modificar_agente.php | 29 +++++++++++++++++-- 1 file changed, 26 insertions(+), 3 deletions(-) diff --git a/pandora_console/godmode/agentes/modificar_agente.php b/pandora_console/godmode/agentes/modificar_agente.php index 3c5406c46c..ebf90ea11f 100644 --- a/pandora_console/godmode/agentes/modificar_agente.php +++ b/pandora_console/godmode/agentes/modificar_agente.php @@ -24,6 +24,7 @@ $sortField = get_parameter('sort_field'); $sort = get_parameter('sort', 'none'); $recursion = (bool) get_parameter('recursion',false); $disabled = get_parameter('disabled', 0); +$os = get_parameter('os', 0); if ($ag_group == -1 ) $ag_group = (int) get_parameter ("ag_group", -1); @@ -163,6 +164,20 @@ html_print_select($fields,"disabled",$disabled,'this.form.submit()'); echo ""; +echo ""; +echo __('Operative System') . ' '; + +$pre_fields = db_get_all_rows_sql('select distinct(tagente.id_os),tconfig_os.description from tagente,tconfig_os where tagente.id_os = tconfig_os.id_os'); +$fields = array(); + +foreach ($pre_fields as $key => $value) { + $fields[$value['id_os']] = $value['description']; +} + +html_print_select($fields,"os",$os,'this.form.submit()','All',0); + +echo ""; + echo ""; echo __('Recursion') . ' '; html_print_checkbox ("recursion", 1, $recursion, false, false, 'this.form.submit()'); @@ -171,6 +186,8 @@ echo ""; echo __('Search') . ' '; html_print_input_text ("search", $search, '', 12); +echo ui_print_help_tip(__('Search filter by alias, name, description, IP address or custom fields content'), true); + echo ""; echo ""; echo ""; @@ -296,20 +313,26 @@ if ($search != "") { }else{ $search_sql = " AND ( nombre " . $order_collation . " LIKE LOWER('%$search%') OR alias " . $order_collation . " - LIKE LOWER('%$search%')) "; + LIKE LOWER('%$search%') OR comentarios " . $order_collation . " LIKE LOWER('%$search%') + OR EXISTS (SELECT * FROM tagent_custom_data + WHERE id_agent = id_agente AND description LIKE '%$search%'))"; } } if ($disabled == 1) { - $search_sql = " AND disabled = ". $disabled . $search_sql; + $search_sql .= " AND disabled = ". $disabled . $search_sql; } else { if ($disabled == 0) { - $search_sql = " AND disabled = 0" . $search_sql; + $search_sql .= " AND disabled = 0" . $search_sql; } } +if($os != 0){ + $search_sql .= " AND id_os = " . $os; +} + // Show only selected groups if ($ag_group > 0) { From 47c7f23208b35d41a2db329e635added739dd87b Mon Sep 17 00:00:00 2001 From: enriquecd Date: Wed, 25 Oct 2017 16:40:21 +0200 Subject: [PATCH 031/149] Change manage alerts list enabled / disabled select text - #1410 --- pandora_console/godmode/alerts/alert_list.list.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pandora_console/godmode/alerts/alert_list.list.php b/pandora_console/godmode/alerts/alert_list.list.php index 4b57931a2c..8a2a7c6702 100644 --- a/pandora_console/godmode/alerts/alert_list.list.php +++ b/pandora_console/godmode/alerts/alert_list.list.php @@ -132,8 +132,8 @@ $form_filter .= ""; $form_filter .= ""; $form_filter .= "".__('Enabled / Disabled').""; $ed_list = array (); -$ed_list[0] = __('Enable'); -$ed_list[1] = __('Disable'); +$ed_list[0] = __('Enabled'); +$ed_list[1] = __('Disabled'); $form_filter .= html_print_select ($ed_list, 'enabledisable', $enabledisable, '', __('All'), -1, true); $form_filter .= "".__('Standby').""; $sb_list = array (); From efd8c850a06c8118c9c95590bb90f1d9d3517973 Mon Sep 17 00:00:00 2001 From: Arturo Gonzalez Date: Wed, 25 Oct 2017 16:47:58 +0200 Subject: [PATCH 032/149] Added new filter function to snmp traps --- pandora_server/lib/PandoraFMS/SNMPServer.pm | 38 ++++++++++++++------- 1 file changed, 25 insertions(+), 13 deletions(-) diff --git a/pandora_server/lib/PandoraFMS/SNMPServer.pm b/pandora_server/lib/PandoraFMS/SNMPServer.pm index bc7b3a708a..2ea002bb1b 100644 --- a/pandora_server/lib/PandoraFMS/SNMPServer.pm +++ b/pandora_server/lib/PandoraFMS/SNMPServer.pm @@ -345,22 +345,34 @@ sub pandora_snmptrapd { sub matches_filter ($$$) { my ($dbh, $pa_config, $string) = @_; - # Get filters - my @filters = get_db_rows ($dbh, 'SELECT filter FROM tsnmp_filter'); - foreach my $filter (@filters) { - my $regexp = safe_output($filter->{'filter'}) ; - my $eval_result; + my @filter_unique_functions = get_db_rows ($dbh, 'SELECT DISTINCT(unified_filters_id) FROM tsnmp_filter ORDER BY unified_filters_id'); - # eval protects against server down (by invalid regular expressions) - $eval_result = eval { - $string =~ m/$regexp/i ; - }; + foreach my $filter_unique_func (@filter_unique_functions) { + # Get filters + my @filters = get_db_rows ($dbh, 'SELECT filter FROM tsnmp_filter WHERE unified_filters_id = ' . $filter_unique_func->{'unified_filters_id'}); - if ($eval_result) { - logger($pa_config, "Trap '$string' matches filter '$regexp'. Discarding...", 10); - return 1; - } + my $eval_acum = 1; + foreach my $filter (@filters) { + my $regexp = safe_output($filter->{'filter'}) ; + my $eval_result; + # eval protects against server down (by invalid regular expressions) + $eval_result = eval { + $string =~ m/$regexp/i ; + }; + + if ($eval_result && $eval_acum) { + $eval_acum = 1; + } + else { + $eval_acum = 0; + last; + } + } + + if ($eval_acum) { + return 1; + } } return 0; From db056100e2f7807f6c701d8887694d2904569838 Mon Sep 17 00:00:00 2001 From: Alejandro Gallardo Escobar Date: Wed, 25 Oct 2017 17:44:59 +0200 Subject: [PATCH 033/149] [Console > Tree view] Added a filter by group name and improved the filter by group id --- pandora_console/include/class/Tree.class.php | 70 +++++++++++--------- pandora_console/operation/tree.php | 21 +++--- 2 files changed, 53 insertions(+), 38 deletions(-) diff --git a/pandora_console/include/class/Tree.class.php b/pandora_console/include/class/Tree.class.php index 6dc52ea68d..21d201a6d4 100644 --- a/pandora_console/include/class/Tree.class.php +++ b/pandora_console/include/class/Tree.class.php @@ -23,6 +23,7 @@ class Tree { protected $filter = array(); protected $childrenMethod = "on_demand"; + protected $userGroupsACL; protected $userGroups; protected $strictACL = false; @@ -36,45 +37,54 @@ class Tree { $this->id = $id; $this->rootID = !empty($rootID) ? $rootID : $id; $this->serverID = $serverID; - $this->childrenMethod = $childrenMethod; - $this->access = $access; - - $userGroups = users_get_groups(false, $this->access); + $this->childrenMethod = $childrenMethod; + $this->access = $access; - if (empty($userGroups)) - $this->userGroups = false; - else - $this->userGroups = $userGroups; + $userGroupsACL = users_get_groups(false, $this->access); + $this->userGroupsACL = empty($userGroupsACL) ? false : $userGroupsACL; + $this->userGroups = $this->userGroupsACL; global $config; include_once($config['homedir']."/include/functions_servers.php"); include_once($config['homedir']."/include/functions_modules.php"); require_once($config['homedir']."/include/functions_tags.php"); - if (is_metaconsole()) - enterprise_include_once("meta/include/functions_ui_meta.php"); + if (is_metaconsole()) enterprise_include_once("meta/include/functions_ui_meta.php"); $this->strictACL = (bool) db_get_value("strict_acl", "tusuario", "id_user", $config['id_user']); $this->acltags = tags_get_user_module_and_tags($config['id_user'], $this->access); } - public function setType($type) { - $this->type = $type; - } - public function setFilter($filter) { + // Filter the user groups + if (!empty($filter['groupID'])) { + $group_id = $filter['groupID']; + $this->userGroups = isset($this->userGroupsACL[$group_id]) + ? array($group_id => $this->userGroupsACL[$group_id]) + : array(); + } + else if (!empty($filter['searchGroup'])) { + $groups = db_get_all_rows_filter('tgrupo', array('nombre' => '%' . $filter['searchGroup'] . '%')); + + // Save the groups which intersect + $userGroupsACL = $this->userGroupsACL; + $this->userGroups = array_reduce($groups, function ($userGroups, $group) use ($userGroupsACL) { + $group_id = $group['id_grupo']; + if (isset($userGroupsACL[$group_id])) { + $userGroups[$group_id] = $userGroupsACL[$group_id]; + } + + return $userGroups; + }, array()); + } + else { + $this->userGroups = $this->userGroupsACL; + } + $this->filter = $filter; } - public function isStrict () { - return $this->strictACL; - } - - public function setStrict ($value) { - $this->strictACL = (bool) $value; - } - protected function getAgentStatusFilter ($status = -1) { if ($status == -1) $status = $this->filter['statusAgent']; @@ -323,7 +333,7 @@ class Tree { case 'group': // ACL Group $user_groups_str = "-1"; - $group_acl = ""; + $group_filter = ""; if (!$this->strictACL) { if (empty($this->userGroups)) { return; @@ -338,7 +348,7 @@ class Tree { // Asking for all groups. else { $user_groups_str = implode(",", array_keys($this->userGroups)); - $group_acl = "AND ta.id_grupo IN ($user_groups_str)"; + $group_filter = "AND ta.id_grupo IN ($user_groups_str)"; } } else { @@ -356,7 +366,7 @@ class Tree { } } } - $group_acl = "AND ta.id_grupo IN ($user_groups_str)"; + $group_filter = "AND ta.id_grupo IN ($user_groups_str)"; } switch ($type) { @@ -390,7 +400,7 @@ class Tree { $module_status_join WHERE ta.disabled = 0 AND ta.id_grupo = $item_for_count - $group_acl + $group_filter $agent_search_filter $agent_status_filter"; $sql = $this->getAgentCountersSql($agent_table); @@ -411,7 +421,7 @@ class Tree { FROM tmetaconsole_agent ta WHERE ta.disabled = 0 AND ta.id_grupo = $item_for_count - $group_acl + $group_filter $agent_search_filter $agent_status_filter"; $sql = $this->getAgentCountersSql($agent_table); @@ -439,7 +449,7 @@ class Tree { $module_status_join WHERE ta.disabled = 0 AND ta.id_grupo = $rootID - $group_acl + $group_filter $agent_search_filter $agent_status_filter GROUP BY $group_by_fields @@ -456,7 +466,7 @@ class Tree { FROM tmetaconsole_agent ta WHERE ta.disabled = 0 AND ta.id_grupo = $rootID - $group_acl + $group_filter $agent_search_filter $agent_status_filter ORDER BY $order_fields"; @@ -498,7 +508,7 @@ class Tree { ON ta.disabled = 0 AND tam.id_agente = ta.id_agente AND ta.id_grupo = $rootID - $group_acl + $group_filter $agent_search_filter $agent_status_filter WHERE tam.disabled = 0 diff --git a/pandora_console/operation/tree.php b/pandora_console/operation/tree.php index c7a23fb0fd..993f95c4fe 100755 --- a/pandora_console/operation/tree.php +++ b/pandora_console/operation/tree.php @@ -18,6 +18,7 @@ global $config; $pure = get_parameter('pure', 0); $tab = get_parameter('tab', 'group'); +$search_group = get_parameter('searchGroup', ''); $search_agent = get_parameter('searchAgent', ''); $status_agent = get_parameter('statusAgent', AGENT_STATUS_ALL); $search_module = get_parameter('searchModule', ''); @@ -135,13 +136,16 @@ $agent_status_arr[AGENT_STATUS_UNKNOWN] = __('Unknown'); $agent_status_arr[AGENT_STATUS_NOT_INIT] = __('Not init'); $row = array(); +$row[] = __('Search group'); +$row[] = html_print_input_text("search_group", $search_group, '', is_metaconsole() ? 70 : 40, 30, true); + +$table->data[] = $row; + +$row = array(); +$row[] = __('Search agent'); +$row[] = html_print_input_text("search_agent", $search_agent, '', is_metaconsole() ? 70 : 40, 30, true); $row[] = __('Agent status'); $row[] = html_print_select($agent_status_arr, "status_agent", $status_agent, '', '', 0, true); -$row[] = __('Search agent'); -if (is_metaconsole()) - $row[] = html_print_input_text("search_agent", $search_agent, '', 70, 30, true); -else - $row[] = html_print_input_text("search_agent", $search_agent, '', 40, 30, true); // Button $row[] = html_print_submit_button(__('Filter'), "uptbutton", false, 'class="sub search"', true); @@ -160,10 +164,10 @@ if (!is_metaconsole()) { $module_status_arr[AGENT_MODULE_STATUS_NOT_INIT] = __('Not init'); $row = array(); - $row[] = __('Module status'); - $row[] = html_print_select($module_status_arr, "status_module", $status_module, '', '', 0, true); $row[] = __('Search module'); $row[] = html_print_input_text("search_module", $search_module, '', 40, 30, true); + $row[] = __('Module status'); + $row[] = html_print_select($module_status_arr, "status_module", $status_module, '', '', 0, true); $table->data[] = $row; } @@ -240,8 +244,9 @@ enterprise_hook('close_meta_frame'); var parameters = {}; parameters['page'] = "include/ajax/tree.ajax"; parameters['getChildren'] = 1; - parameters['filter'] = {}; parameters['type'] = ""; + parameters['filter'] = {}; + parameters['filter']['searchGroup'] = $("input#text-search_group").val(); parameters['filter']['searchAgent'] = $("input#text-search_agent").val(); parameters['filter']['statusAgent'] = $("select#status_agent").val(); parameters['filter']['searchModule'] = $("input#text-search_module").val(); From e638113f28105eb3c750e849620f79c229eab32f Mon Sep 17 00:00:00 2001 From: fermin831 Date: Wed, 25 Oct 2017 20:31:18 +0200 Subject: [PATCH 034/149] Added autodisable mode help --- .../include/help/en/help_module_definition.php | 9 +++++---- .../include/help/es/help_module_definition.php | 8 +++++--- .../include/help/ja/help_module_definition.php | 2 ++ 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/pandora_console/include/help/en/help_module_definition.php b/pandora_console/include/help/en/help_module_definition.php index 8173a8093b..81bdaf95ea 100644 --- a/pandora_console/include/help/en/help_module_definition.php +++ b/pandora_console/include/help/en/help_module_definition.php @@ -5,11 +5,12 @@ ?>

    Module definition

    -There are two modes for an agent: +There are three modes for an agent:

      -
    • Learning mode: all the modules sent by the agent are accepted. If modules are not defined, they will be automatically defined by the system. It is recommended to activate the agents in this mode and change it once the user is familiar with Pandora FMS.
      From version 4.0.3, in this mode, Pandora console collect all the configuration specified by the agent configuration file the first time and thereafter any changes should be made through console, will not catch changes in config file. -
    • +
    • Learning mode: All the modules sent by the agent are accepted. If modules are not defined, they will be automatically defined by the system. It is recommended to activate the agents in this mode and change it once the user is familiar with Pandora FMS.
      From version 4.0.3, in this mode, Pandora console collect all the configuration specified by the agent configuration file the first time and thereafter any changes should be made through console, will not catch changes in config file.

    • -
    • Normal mode: the modules in this mode must be configured manually. The self definition of the modules is not allowed in this mode.
    • +
    • Normal mode: The modules in this mode must be configured manually. The self definition of the modules is not allowed in this mode.
    • +
      +
    • Autodisable mode: It behaves exactly the same as an agent in learning mode: when the first XML reaches it, the first agent is created and, on each report, if there are new modules they can also be added automatically. Nevertheless, when all modules from an agent that are in autodisable mode are also marked as unknown, the agent is automatically disabled. In any case, if the agent reports again, it gets enabled again on its own.
    diff --git a/pandora_console/include/help/es/help_module_definition.php b/pandora_console/include/help/es/help_module_definition.php index e31ac65d6c..ff85f8b326 100644 --- a/pandora_console/include/help/es/help_module_definition.php +++ b/pandora_console/include/help/es/help_module_definition.php @@ -6,10 +6,12 @@

    Definición de módulo

    -Existen dos modos para un agente: +Existen tres modos para un agente:

      -
    • Modo aprendizaje: todos los módulos enviados por el agente se aceptan. Si los módulos no están definidos, el sistema los creará automáticamente. Se recomienda activar los agentes en este modo y cambiarlo una vez que se el operador se ha familiarizado con Pandora FMS. A partir de la versión 4.0.3, en este modo Pandora recogerá en consola toda la configuración indicada por el fichero de configuración del agente la primera vez y a partir de entonces todas las modificaciones se deberán realizar a través de consola, no cogerá cambios en el fichero de configuración.
    • +
    • Modo aprendizaje:Si el XML recibido del agente software contiene nuevos módulos, éstos serán automáticamente creados. Este es el comportamiento por defecto.

    • -
    • Modo normal: los módulos en este modo se deben configurar manualmente. No se permite la definición automática en este modo.
    • +
    • Modo normal:No se crearán nuevos módulos que lleguen en el XML si no han sido declarados previamente en la consola.
    • +
      +
    • Modo auto deshabilitado:Similar al modo aprendizaje, en este modo, además, si todos los módulos pasan a estado desconocido el agente se deshabilitará automáticamente, pasando a habilitarse de nuevo si recibe nueva información.
    diff --git a/pandora_console/include/help/ja/help_module_definition.php b/pandora_console/include/help/ja/help_module_definition.php index e7e4055d18..570c7cd236 100644 --- a/pandora_console/include/help/ja/help_module_definition.php +++ b/pandora_console/include/help/ja/help_module_definition.php @@ -11,4 +11,6 @@
  • 通常モード: このモードでは、モジュール設定を手動で実施する必要があります。自動設定は行われません。
  • +
    +
  • Autodisable mode: In terms of creating agents and modules it behaves exactly the same as an agent in learning mode: when the first XML reaches it, the first agent is created and, on each report, if there are new modules they can also be added automatically. Nevertheless, when all modules from an agent that are in autodisable mode are also marked as unknown, the agent is automatically disabled. In any case, if the agent reports again, it gets enabled again on its own.
  • From 91a39ab01e32293eac550f7c2008cb43376f3d9d Mon Sep 17 00:00:00 2001 From: Arturo Gonzalez Date: Thu, 26 Oct 2017 11:03:08 +0200 Subject: [PATCH 035/149] Added visual upgrades to filter view --- .../godmode/snmpconsole/snmp_filters.php | 151 ++++++++++++------ pandora_console/include/ajax/snmp.ajax.php | 9 ++ pandora_server/lib/PandoraFMS/SNMPServer.pm | 11 +- 3 files changed, 116 insertions(+), 55 deletions(-) diff --git a/pandora_console/godmode/snmpconsole/snmp_filters.php b/pandora_console/godmode/snmpconsole/snmp_filters.php index 3def7ed776..9316b36b05 100644 --- a/pandora_console/godmode/snmpconsole/snmp_filters.php +++ b/pandora_console/godmode/snmpconsole/snmp_filters.php @@ -45,31 +45,27 @@ else {// Overview header // Create/update filter if ($update_filter > -2) { + // UPDATE if ($update_filter > -1) { $new_unified_id = (db_get_value_sql("SELECT unified_filters_id FROM tsnmp_filter WHERE id_snmp_filter = " . $update_filter)); $elements = get_parameter('elements', array()); - if ($index_post == 1) { - $filter = get_parameter('filter_' . $update_filter); + $elements = explode(",", $elements); + foreach ($elements as $e) { + $filter = get_parameter('filter_' . $e); $values = array('description' => $description, 'filter' => $filter, 'unified_filters_id' => $new_unified_id); - $result = db_process_sql_update('tsnmp_filter', $values, array('id_snmp_filter' => $update_filter)); + $result = db_process_sql_update('tsnmp_filter', $values, array('id_snmp_filter' => $e)); } - else { - $elements = explode(",", $elements); - foreach ($elements as $e) { - $filter = get_parameter('filter_' . $e); - $values = array('description' => $description, 'filter' => $filter, 'unified_filters_id' => $new_unified_id); - $result = db_process_sql_update('tsnmp_filter', $values, array('id_snmp_filter' => $e)); - } - if (count($elements) == 1) { - $new_unified_id = (db_get_value_sql("SELECT MAX(unified_filters_id) FROM tsnmp_filter")) + 1; + if (count($elements) == 1) { + $new_unified_id = (db_get_value_sql("SELECT MAX(unified_filters_id) FROM tsnmp_filter")) + 1; - $filter = get_parameter('filter_' . $elements[0]); - $values = array('description' => $description, 'filter' => $filter, 'unified_filters_id' => $new_unified_id); - $result = db_process_sql_update('tsnmp_filter', $values, array('id_snmp_filter' => $elements[0])); - } - for ($i = 1; $i < $index_post; $i++) { - $filter = get_parameter('filter_' . $i); + $filter = get_parameter('filter_' . $elements[0]); + $values = array('description' => $description, 'filter' => $filter, 'unified_filters_id' => $new_unified_id); + $result = db_process_sql_update('tsnmp_filter', $values, array('id_snmp_filter' => $elements[0])); + } + for ($i = 1; $i < $index_post; $i++) { + $filter = get_parameter('filter_' . $i); + if ($filter != "") { $values = array( 'description' => $description, 'filter' => $filter, @@ -77,6 +73,7 @@ if ($update_filter > -2) { $result = db_process_sql_insert('tsnmp_filter', $values); } } + if ($result === false) { ui_print_error_message (__('There was a problem updating the filter')); } @@ -84,6 +81,7 @@ if ($update_filter > -2) { ui_print_success_message (__('Successfully updated')); } } + // CREATE else { $new_unified_id = (db_get_value_sql("SELECT MAX(unified_filters_id) FROM tsnmp_filter")) + 1; @@ -115,17 +113,15 @@ if ($update_filter > -2) { } } else if ($delete_filter > -1) { // Delete - $filters_to_upd = db_get_all_rows_sql("SELECT * FROM tsnmp_filter WHERE unified_filters_id = (SELECT unified_filters_id FROM tsnmp_filter WHERE id_snmp_filter = " . $delete_filter . ")"); - if (count($filters_to_upd) == 2) { - foreach ($filters_to_upd as $fil) { - if ($fil['id_snmp_filter'] != $delete_filter) { - $values = array('description' => $fil['description'], 'filter' => $fil['filter'], 'unified_filters_id' => 0); - db_process_sql_update('tsnmp_filter', $values, array('id_snmp_filter' => $fil['id_snmp_filter'])); - } - } - + $unified_id_to_delete = (db_get_value_sql("SELECT unified_filters_id FROM tsnmp_filter WHERE id_snmp_filter = " . $delete_filter)); + + if ($unified_id_to_delete == 0) { + $result = db_process_sql_delete('tsnmp_filter', array('id_snmp_filter' => $delete_filter)); } - $result = db_process_sql_delete('tsnmp_filter', array('id_snmp_filter' => $delete_filter)); + else { + $result = db_process_sql_delete('tsnmp_filter', array('unified_filters_id' => $unified_id_to_delete)); + } + if ($result === false) { ui_print_error_message (__('There was a problem deleting the filter')); } @@ -164,7 +160,11 @@ if ($edit_filter > -2) { if ($j == 1) { $table->data[$j][1] .= ui_print_help_tip (__("This field contains a substring, could be part of a IP address, a numeric OID, or a plain substring") . SEPARATOR_COLUMN, true); } + else { + $table->data[$j][1] .= html_print_image('images/cross.png', true, array('id' => 'delete_filter_' . $f['id_snmp_filter'], 'alt' => __('Click to add new filter'), 'title' => __('Click to add new filter'))); + } $j++; + $index++; } } else { @@ -196,13 +196,13 @@ if ($edit_filter > -2) { // Overview } else { - $result = db_get_all_rows_sql("SELECT * FROM tsnmp_filter ORDER BY unified_filters_id ASC"); - if ($result === false) { - $result = array (); - require_once ($config['homedir'] . "/general/firts_task/snmp_filters.php"); - return; + $result_unified = db_get_all_rows_sql("SELECT DISTINCT(unified_filters_id) FROM tsnmp_filter ORDER BY unified_filters_id ASC"); + + $aglomerate_result = array(); + foreach ($result_unified as $res) { + $aglomerate_result[$res['unified_filters_id']] = db_get_all_rows_sql("SELECT * FROM tsnmp_filter WHERE unified_filters_id = " . $res['unified_filters_id'] . " ORDER BY id_snmp_filter ASC"); } - + $table->data = array (); $table->head = array (); $table->size = array (); @@ -214,26 +214,46 @@ else { $table->head[0] = __('Description'); $table->head[1] = __('Filter'); - $table->head[2] = __('Function'); - $table->head[3] = __('Action'); - $table->size[3] = "50px"; - $table->align[3] = 'center'; - - foreach ($result as $row) { - $data = array (); - $data[0] = '' . $row['description'] . ''; - $data[1] = $row['filter']; - if ($row['unified_filters_id'] == 0) { - $data[2] = "OR"; + $table->head[2] = __('Action'); + $table->size[2] = "50px"; + $table->align[2] = 'center'; + + foreach ($aglomerate_result as $ind => $row) { + if ($ind == 0) { + foreach ($row as $r) { + $data = array (); + $data[0] = '' . $r['description'] . ''; + $data[1] = $r['filter']; + $data[2] = '' . + html_print_image("images/config.png", true, array("border" => '0', "alt" => __('Update'))) . '' . + '  ' . + html_print_image("images/cross.png", true, array("border" => '0', "alt" => __('Delete'))) . ''; + array_push ($table->data, $data); + } } else { - $data[2] = "AND (" . $row['unified_filters_id'] . ")"; + $ind2 = 0; + $compose_filter = array(); + $compose_id = ""; + $compose_action = ""; + foreach ($row as $i => $r) { + if ($ind2 == 0) { + $compose_id = '' . $r['description'] . ''; + $compose_action = '' . + html_print_image("images/config.png", true, array("border" => '0', "alt" => __('Update'))) . '' . + '  ' . + html_print_image("images/cross.png", true, array("border" => '0', "alt" => __('Delete'))) . ''; + $ind2++; + } + $compose_filter[] = $r['filter']; + } + $data = array (); + $data[0] = $compose_id; + $data[1] = implode(" AND ", $compose_filter); + $data[2] = $compose_action; + array_push ($table->data, $data); } - $data[3] = '' . - html_print_image("images/config.png", true, array("border" => '0', "alt" => __('Update'))) . '' . - '  ' . - html_print_image("images/cross.png", true, array("border" => '0', "alt" => __('Delete'))) . ''; - array_push ($table->data, $data); + } if (!empty ($table->data)) { @@ -254,11 +274,38 @@ else { $(document).ready (function () { $('#add_filter').click(function(e) { - $('#filter_table').append(''); + $('#filter_table').append('Click to delete the filter'); id++; $('#hidden-index_post').val(id); }); + + $('[id^=delete_filter_]').click(function(e) { + var elem_id = this.id; + var id_array = elem_id.split("delete_filter_"); + var id = id_array[1]; + + params = {}; + params['page'] = "include/ajax/snmp.ajax"; + params['delete_snmp_filter'] = 1; + params['filter_id'] = id; + + jQuery.ajax ({ + data: params, + type: "POST", + url: "ajax.php", + dataType: "html", + success: function(data){ + var elem = $('#hidden-elements').val(); + $('#hidden-elements').val(elem - 1); + $('#' + elem_id).parent().parent().remove(); + } + }); + }); }); + + function delete_this_row (id_row) { + $('#filter_table-' + id_row).remove(); + } diff --git a/pandora_console/include/ajax/snmp.ajax.php b/pandora_console/include/ajax/snmp.ajax.php index 7b3e45c704..a372d50e11 100644 --- a/pandora_console/include/ajax/snmp.ajax.php +++ b/pandora_console/include/ajax/snmp.ajax.php @@ -20,6 +20,7 @@ require_once("include/functions_snmp.php"); $save_snmp_translation = (bool)get_parameter('save_snmp_translation', 0); $delete_snmp_translation = (bool)get_parameter('delete_snmp_translation', 0); $update_snmp_translation = (bool)get_parameter('update_snmp_translation', 0); +$delete_snmp_filter = (bool)get_parameter('delete_snmp_filter', 0); /* skins image checks */ if ($save_snmp_translation) { @@ -56,4 +57,12 @@ if ($update_snmp_translation) { return; } + +if ($delete_snmp_filter) { + $filter_id = get_parameter('filter_id'); +html_debug($filter_id, true); + db_process_sql_delete('tsnmp_filter', array('id_snmp_filter' => $filter_id)); + + return; +} ?> diff --git a/pandora_server/lib/PandoraFMS/SNMPServer.pm b/pandora_server/lib/PandoraFMS/SNMPServer.pm index 2ea002bb1b..83af3c24ac 100644 --- a/pandora_server/lib/PandoraFMS/SNMPServer.pm +++ b/pandora_server/lib/PandoraFMS/SNMPServer.pm @@ -344,13 +344,18 @@ sub pandora_snmptrapd { ######################################################################################## sub matches_filter ($$$) { my ($dbh, $pa_config, $string) = @_; - + use Data::Dumper; + $Data::Dumper::Sortkeys = 1; my @filter_unique_functions = get_db_rows ($dbh, 'SELECT DISTINCT(unified_filters_id) FROM tsnmp_filter ORDER BY unified_filters_id'); - + Dumper("++++++++++++++++++++++"); + Dumper(@filter_unique_functions); + Dumper("++++++++++++++++++++++"); foreach my $filter_unique_func (@filter_unique_functions) { # Get filters my @filters = get_db_rows ($dbh, 'SELECT filter FROM tsnmp_filter WHERE unified_filters_id = ' . $filter_unique_func->{'unified_filters_id'}); - + Dumper("-----------------------"); + Dumper(@filters); + Dumper("-----------------------"); my $eval_acum = 1; foreach my $filter (@filters) { my $regexp = safe_output($filter->{'filter'}) ; From ecdbf9bcc436eca66c260e8eb50719feb7c613de Mon Sep 17 00:00:00 2001 From: Alejandro Gallardo Escobar Date: Thu, 26 Oct 2017 11:51:15 +0200 Subject: [PATCH 036/149] [Console] Now the modules are shown correctly into the trees that nobody use --- pandora_console/include/class/Tree.class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pandora_console/include/class/Tree.class.php b/pandora_console/include/class/Tree.class.php index 21d201a6d4..52aa2dee5c 100644 --- a/pandora_console/include/class/Tree.class.php +++ b/pandora_console/include/class/Tree.class.php @@ -1133,7 +1133,8 @@ class Tree { if (empty($data)) return array(); - if ($this->type == 'agent') { + // [26/10/2017] It seems the module hierarchy should be only available into the tree by group + if ($this->rootType == 'group' && $this->type == 'agent') { $data = $this->getProcessedModules($data); } From 3f77b3ae7d9c48c3fb00bbe001243c42e4d44eb3 Mon Sep 17 00:00:00 2001 From: Arturo Gonzalez Date: Thu, 26 Oct 2017 12:01:04 +0200 Subject: [PATCH 037/149] Added changes to snmp server to evaluate all filters in the same virtual world --- pandora_server/lib/PandoraFMS/SNMPServer.pm | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/pandora_server/lib/PandoraFMS/SNMPServer.pm b/pandora_server/lib/PandoraFMS/SNMPServer.pm index 83af3c24ac..9328f56c68 100644 --- a/pandora_server/lib/PandoraFMS/SNMPServer.pm +++ b/pandora_server/lib/PandoraFMS/SNMPServer.pm @@ -196,10 +196,10 @@ sub pandora_snmptrapd { my ($pa_config, $line, $server_id, $dbh) = @_; (my $trap_ver, $line) = split(/\[\*\*\]/, $line, 2); - +print STDERR "ANTES"; # Process SNMP filter next if (matches_filter ($dbh, $pa_config, $line) == 1); - +print STDERR "DESPUES"; logger($pa_config, "Reading trap '$line'", 10); my ($date, $time, $source, $oid, $type, $type_desc, $value, $data) = ('', '', '', '', '', '', '', ''); @@ -344,18 +344,13 @@ sub pandora_snmptrapd { ######################################################################################## sub matches_filter ($$$) { my ($dbh, $pa_config, $string) = @_; - use Data::Dumper; - $Data::Dumper::Sortkeys = 1; + my @filter_unique_functions = get_db_rows ($dbh, 'SELECT DISTINCT(unified_filters_id) FROM tsnmp_filter ORDER BY unified_filters_id'); - Dumper("++++++++++++++++++++++"); - Dumper(@filter_unique_functions); - Dumper("++++++++++++++++++++++"); + foreach my $filter_unique_func (@filter_unique_functions) { # Get filters my @filters = get_db_rows ($dbh, 'SELECT filter FROM tsnmp_filter WHERE unified_filters_id = ' . $filter_unique_func->{'unified_filters_id'}); - Dumper("-----------------------"); - Dumper(@filters); - Dumper("-----------------------"); + my $eval_acum = 1; foreach my $filter (@filters) { my $regexp = safe_output($filter->{'filter'}) ; From 3f0430ab9de7b40ef68fe831008a58d3446145cc Mon Sep 17 00:00:00 2001 From: Daniel Maya Date: Thu, 26 Oct 2017 12:12:44 +0200 Subject: [PATCH 038/149] added unit in custom graphs --- pandora_console/include/functions_graph.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pandora_console/include/functions_graph.php b/pandora_console/include/functions_graph.php index c97867733b..7e5030b24c 100644 --- a/pandora_console/include/functions_graph.php +++ b/pandora_console/include/functions_graph.php @@ -1069,6 +1069,7 @@ function graphic_combined_module ($module_list, $weight_list, $period, if(!$fullscale){ $time_format_2 = ''; $temp_range = $period; + $unit_list_aux = array(); if ($projection != false) { if ($period < $prediction_period) @@ -1317,6 +1318,10 @@ function graphic_combined_module ($module_list, $weight_list, $period, $agent_id = agents_get_agent_id ($agent_name); + if(empty($unit_list)){ + $unit_aux = modules_get_unit($agent_module_id); + array_push($unit_list_aux,$unit_aux); + } //Get and process module name $module_name = io_safe_output( modules_get_agentmodule_name ($agent_module_id)); @@ -1500,6 +1505,8 @@ function graphic_combined_module ($module_list, $weight_list, $period, if (!empty($unit_list) && $units_number == $module_number && isset($unit_list[$i])) { $unit = $unit_list[$i]; + }else{ + $unit = $unit_list_aux[$i]; } if ($projection == false or ($projection != false and $i == 0)) { From 264b91d71ee327a05e3f623d42220967e41fa01b Mon Sep 17 00:00:00 2001 From: enriquecd Date: Thu, 26 Oct 2017 12:44:25 +0200 Subject: [PATCH 039/149] Change alert macros help texts and translations - #1242 --- .../include/help/en/help_alert_config.php | 105 ++++++++------- .../include/help/en/help_alert_macros.php | 122 +++++++++--------- .../include/help/es/help_alert_config.php | 106 ++++++++------- .../include/help/es/help_alert_macros.php | 121 ++++++++--------- 4 files changed, 244 insertions(+), 210 deletions(-) diff --git a/pandora_console/include/help/en/help_alert_config.php b/pandora_console/include/help/en/help_alert_config.php index fec6b2a7bf..39bce7067a 100644 --- a/pandora_console/include/help/en/help_alert_config.php +++ b/pandora_console/include/help/en/help_alert_config.php @@ -24,51 +24,66 @@ When it comes to creating the action these are the only 3 fields we can set. Wit

    Apart from the defined module macros, the following macros are also available:

      -
    • _field1_ : User defined field 1.
    • -
    • _field2_ : User defined field 2.
    • -
    • _field3_ : User defined field 3.
    • -
    • _agent_ : Name of the agent that fired the alert.
    • -
    • _agentdescription_ : Description of the agent who fired alert.
    • -
    • _agentgroup_ : Agent group name.
    • -
    • _agentstatus_ : Current status of the agent.
    • -
    • _agentos_: Agent's operative system.
    • -
    • _address_ : Address of the agent that fired the alert.
    • -
    • _all_address_ : All address of the agent that fired the alert.
    • -
    • _address_n_ : The address of the agent that corresponds to the position indicated in "n" e.g: address_1_ , address_2_
    • -
    • _timestamp_ : Time when the alert was fired (yy-mm-dd hh:mm:ss).
    • -
    • _timezone_ : Timezone name that _timestamp_ represents in.
    • -
    • _data_ : Module data that caused the alert to fire.
    • -
    • _prevdata_ : Module data previus the alert to fire.
    • -
    • _alert_description_ : Alert description.
    • -
    • _alert_threshold_ : Alert threshold.
    • -
    • _alert_times_fired_ : Number of times the alert has been fired.
    • -
    • _module_ : Module name.
    • -
    • _modulegroup_ : Module group name.
    • -
    • _moduledescription_ : Description of the module who fired the alert.
    • -
    • _modulestatus_ : Status of the module.
    • -
    • _moduletags_ : Tags associated to the module.
    • -
    • _alert_name_ : Alert name.
    • -
    • _alert_priority_ : Numerical alert priority.
    • -
    • _alert_text_severity_ : Text alert severity (Maintenance, Informational, Normal Minor, Warning, Major, Critical).
    • -
    • _event_text_severity_ : (Only event alerts) Text event (who fire the alert) severity (Maintenance, Informational, Normal Minor, Warning, Major, Critical).
    • -
    • _event_id_ : (Only event alerts) Id of the event that fired the alert.
    • -
    • _id_agent_ : Id of agent, useful to build direct URL to redirect to a Pandora FMS console webpage.
    • -
    • _id_group_ : Id of agent group.
    • -
    • _id_module_ : Id of module.
    • -
    • _id_alert_ : Numerical ID of the alert (unique), used to correlate on third party software
    • -
    • _policy_ : Name of the policy the module belongs to (if applies).
    • -
    • _interval_ : Execution interval of the module.
    • -
    • _target_ip_ : IP address of the target of the module.
    • -
    • _target_port_ : Port number of the target of the module.
    • -
    • _plugin_parameters_ : Plug-in Parameters of the module.
    • -
    • _groupcontact_ : Group contact information. Configured when the group is created.
    • -
    • _groupother_ : Other information about the group. Configured when the group is created.
    • -
    • _email_tag_ : Emails associated to the module tags.
    • -
    • _alert_critical_instructions_: Instructions for CRITICAL status contained in the module.
    • -
    • _alert_warning_instructions_: Instructions for WARNING status contained in the module.
    • -
    • _alert_unknown_instructions_: Instructions for UNKNOWN status contained in the module.
    • -
    • _modulegraph_nh_: (Only for alerts that use the command eMail) Returns an image of a module graph with a period of n hours (eg. _modulegraph_24h_). A correct setup of the connection between the server and the console's api is required. This setup is done into the server's configuration file.
    • -
    • _homeurl_ : It is a link of the public URL this must be configured in the general options of the setup.
    • +
    • _address_: Address of the agent that triggered the alert.
    • +
    • _address_n_ : The address of the agent that corresponds to the position indicated in "n" e.g: address_1_ , address_2__
    • +
    • _agent_: Name of the agent that triggered the alert.
    • +
    • _agentcustomfield_n_: Agent custom field number n (eg. _agentcustomfield_9_).
    • +
    • _agentcustomid_: Agent custom ID.
    • +
    • _agentdescription_: Description of the agent that triggered the alert.
    • +
    • _agentgroup_ : Agent group name.
    • +
    • _agentos_: Agent's operative system.
    • +
    • _agentstatus_ : Current status of the agent.
    • +
    • _alert_critical_instructions_: Instructions for CRITICAL status contained in the module.
    • +
    • _alert_description_: Alert description.
    • +
    • _alert_name_: Alert name.
    • +
    • _alert_priority_: Alert’s numeric priority.
    • +
    • _alert_text_severity_: Priority level, in text, for the alert (Maintenance, Informational, Normal Minor, Major, Critical).
    • +
    • _alert_threshold_: Alert threshold.
    • +
    • _alert_times_fired_: Number of times the alert has been triggered.
    • +
    • _alert_unknown_instructions_: Instructions for UNKNOWN status contained in the module.
    • +
    • _alert_warning_instructions_: Instructions for WARNING status contained in the module.
    • +
    • _all_address_ : All address of the agent that fired the alert.
    • +
    • _data_: Module data that caused the alert to fire.
    • +
    • _email_tag_: Emails associated to the module’s tags.
    • +
    • _event_id_: (Only event alerts) ID of the event that triggered the alert.
    • +
    • _event_text_severity_: (Only event alerts) event text (that triggered the alert) severity (Maintenance, Informational, Normal Minor, Warning, Major, Critical).
    • +
    • _field1_: User defined field 1.
    • +
    • _field2_: User defined field 2.
    • +
    • _field3_: User defined field 3.
    • +
    • _field4_: User defined field 4.
    • +
    • _field5_: User defined field 5.
    • +
    • _field6_: User defined field 6.
    • +
    • _field7_: User defined field 7.
    • +
    • _field8_: User defined field 8.
    • +
    • _field9_: User defined field 9.
    • +
    • _field10_: User defined field 10.
    • +
    • _groupcontact_: Group’s contact information. Configured when the group is created.
    • +
    • _groupcustomid_: Group’s custom ID.
    • +
    • _groupother_: Other information about the group. Configured when the group is created.
    • +
    • _homeurl_ : It is a link of the public URL this must be configured in the general options of the setup.
    • +
    • _id_agent_: Agent’s ID, useful for building a direct URL that redirects to a Pandora FMS console webpage.
    • +
    • _id_alert_: Alert’s numeric ID (unique), used to correlate the alert with third party software.
    • +
    • _id_group_ : Agent group ID.
    • +
    • _id_module_: The module's ID.
    • +
    • _interval_: Module’s execution interval.
    • +
    • _module_: Module name.
    • +
    • _modulecustomid_: Module custom ID.
    • +
    • _moduledata_X_: Last data of module X (module name, cannot have white spaces).
    • +
    • _moduledescription_: Description of the module that triggered the alert.
    • +
    • _modulegraph_nh_: (>=6.0) (Only for alerts that use the command eMail) Returns an image encoded in base64 of a module’s graph with a period of n hours (eg. _modulegraph_24h_). A correct setup of the connection between the server and the console's API is required. This setup is done on the server's configuration file.
    • +
    • _modulegraphth_nh_:Same operation as the previous macro only with the critical and warning thresholds of the module provided they are defined.
    • +
    • _modulegroup_: Module’s group name.
    • +
    • _modulestatus_: Module status.
    • +
    • _moduletags_: URLs asociadas a los tags de módulos.
    • +
    • _name_tag_: Names of the tags related to the module.
    • +
    • _phone_tag_: Phone numbers related to the module’s tags.
    • +
    • _plugin_parameters_: Module’s Plugin parameters.
    • +
    • _policy_: Name of the policy that the module belongs to (if applies).
    • +
    • _prevdata_ : Module data previus the alert to fire.
    • +
    • _target_ip_: IP address for the module’s target.
    • +
    • _target_port_: Port number for the module’s target.
    • +
    • _timestamp_: Time and date on which the alert was triggered (yy-mm-dd hh:mm:ss).
    • +
    • _timezone_: Timezone that is represented on _timestamp_.

    diff --git a/pandora_console/include/help/en/help_alert_macros.php b/pandora_console/include/help/en/help_alert_macros.php index 5382c502ab..c305fa3730 100644 --- a/pandora_console/include/help/en/help_alert_macros.php +++ b/pandora_console/include/help/en/help_alert_macros.php @@ -8,66 +8,68 @@

    Besides the defined module macros, the following macros are available:

    -
      -
    • _field1_: User defined field 1.
    • -
    • _field2_: User defined field 2.
    • -
    • _field3_: User defined field 3.
    • -
    • _field4_: User defined field 4.
    • -
    • _field5_: User defined field 5.
    • -
    • _field6_: User defined field 6.
    • -
    • _field7_: User defined field 7.
    • -
    • _field8_: User defined field 8.
    • -
    • _field9_: User defined field 9.
    • -
    • _field10_: User defined field 10.
    • -
    • _agent_: Name of the agent that triggered the alert.
    • -
    • _agentcustomfield_n_: Agent custom field number n (eg. _agentcustomfield_9_).
    • -
    • _agentcustomid_: Agent custom ID.
    • -
    • _agentdescription_: Description of the agent that triggered the alert.
    • -
    • _agentgroup_: Agent’s group name.
    • -
    • _agentstatus_: Current agent status.
    • -
    • _agentos_: Agent's operative system.
    • -
    • _address_: Address of the agent that triggered the alert.
    • -
    • _timestamp_: Time and date on which the alert was triggered (yy-mm-dd hh:mm:ss).
    • -
    • _timezone_: Timezone that is represented on _timestamp_.
    • -
    • _data_: Module data that caused the alert to fire.
    • -
    • _prevdata_ : Module data previus the alert to fire.
    • -
    • _alert_description_: Alert description.
    • -
    • _alert_threshold_: Alert threshold.
    • -
    • _alert_times_fired_: Number of times the alert has been triggered.
    • -
    • _module_: Module name.
    • -
    • _modulecustomid_: Module custom ID.
    • -
    • _modulegroup_: Module’s group name.
    • -
    • _moduledescription_: Description of the module that triggered the alert.
    • -
    • _modulestatus_: Module status.
    • -
    • _moduledata_X_: Last data of module X (module name, cannot have white spaces).
    • -
    • _alert_name_: Alert name.
    • -
    • _alert_priority_: Alert’s numeric priority.
    • -
    • _alert_text_severity_: Priority level, in text, for the alert (Maintenance, Informational, Normal Minor, Major, Critical).
    • -
    • _event_text_severity_: (Only event alerts) Text event (which triggered the alert) severity (Maintenance, Informational, Normal Minor, Warning, Major, Critical).
    • -
    • _event_id_: (Only event alerts) ID of the event that triggered the alert.
    • -
    • _id_agent_: Agent’s ID, useful for building a direct URL that redirects to a Pandora FMS console webpage.
    • -
    • _id_group_ : Agent group ID.
    • -
    • _id_module_ : ID of module.
    • -
    • _id_alert_: Alert’s numeric ID (unique), used to correlate the alert with third party software.
    • -
    • _policy_: Name of the policy that the module belongs to (if applies).
    • -
    • _interval_: Module’s execution interval
    • -
    • _target_ip_: IP address for the module’s target.
    • -
    • _target_port_: Port number for the module’s target.
    • -
    • _plugin_parameters_: Module’s Plugin parameters.
    • -
    • _groupcontact_: Group’s contact information. Configured when the group is created.
    • -
    • _groupcustomid_: Group’s custom ID.
    • -
    • _groupother_: Other information about the group. Configured when the group is created.
    • -
    • _name_tag_: Names of the tags related to the module.
    • -
    • _email_tag_: Emails associated to the module’s tags.
    • -
    • _phone_tag_: Phone numbers related to the module’s tags.
    • -
    • _moduletags_: URLs associated to the module’s tags.
    • -
    • _alert_critical_instructions_: Instructions for CRITICAL status contained in the module.
    • -
    • _alert_warning_instructions_: Instructions for WARNING status contained in the module.
    • -
    • _alert_unknown_instructions_: Instructions for UNKNOWN status contained in the module.
    • -
    • _modulegraph_nh_: (>=6.0) (Only for alerts that use the command eMail) -Returns an image encoded in base64 of a module’s graph with a period of n hours (eg. _modulegraph_24h_). -A correct setup of the connection between the server and the console's API is required. -This setup is done on the server's configuration file.
    • +
        +
      • _address_: Address of the agent that triggered the alert.
      • +
      • _address_n_ : The address of the agent that corresponds to the position indicated in "n" e.g: address_1_ , address_2__
      • +
      • _agent_: Name of the agent that triggered the alert.
      • +
      • _agentcustomfield_n_: Agent custom field number n (eg. _agentcustomfield_9_).
      • +
      • _agentcustomid_: Agent custom ID.
      • +
      • _agentdescription_: Description of the agent that triggered the alert.
      • +
      • _agentgroup_ : Agent group name.
      • +
      • _agentos_: Agent's operative system.
      • +
      • _agentstatus_ : Current status of the agent.
      • +
      • _alert_critical_instructions_: Instructions for CRITICAL status contained in the module.
      • +
      • _alert_description_: Alert description.
      • +
      • _alert_name_: Alert name.
      • +
      • _alert_priority_: Alert’s numeric priority.
      • +
      • _alert_text_severity_: Priority level, in text, for the alert (Maintenance, Informational, Normal Minor, Major, Critical).
      • +
      • _alert_threshold_: Alert threshold.
      • +
      • _alert_times_fired_: Number of times the alert has been triggered.
      • +
      • _alert_unknown_instructions_: Instructions for UNKNOWN status contained in the module.
      • +
      • _alert_warning_instructions_: Instructions for WARNING status contained in the module.
      • +
      • _all_address_ : All address of the agent that fired the alert.
      • +
      • _data_: Module data that caused the alert to fire.
      • +
      • _email_tag_: Emails associated to the module’s tags.
      • +
      • _event_id_: (Only event alerts) ID of the event that triggered the alert.
      • +
      • _event_text_severity_: (Only event alerts) event text (that triggered the alert) severity (Maintenance, Informational, Normal Minor, Warning, Major, Critical).
      • +
      • _field1_: User defined field 1.
      • +
      • _field2_: User defined field 2.
      • +
      • _field3_: User defined field 3.
      • +
      • _field4_: User defined field 4.
      • +
      • _field5_: User defined field 5.
      • +
      • _field6_: User defined field 6.
      • +
      • _field7_: User defined field 7.
      • +
      • _field8_: User defined field 8.
      • +
      • _field9_: User defined field 9.
      • +
      • _field10_: User defined field 10.
      • +
      • _groupcontact_: Group’s contact information. Configured when the group is created.
      • +
      • _groupcustomid_: Group’s custom ID.
      • +
      • _groupother_: Other information about the group. Configured when the group is created.
      • +
      • _homeurl_ : It is a link of the public URL this must be configured in the general options of the setup.
      • +
      • _id_agent_: Agent’s ID, useful for building a direct URL that redirects to a Pandora FMS console webpage.
      • +
      • _id_alert_: Alert’s numeric ID (unique), used to correlate the alert with third party software.
      • +
      • _id_group_ : Agent group ID.
      • +
      • _id_module_: The module's ID.
      • +
      • _interval_: Module’s execution interval.
      • +
      • _module_: Module name.
      • +
      • _modulecustomid_: Module custom ID.
      • +
      • _moduledata_X_: Last data of module X (module name, cannot have white spaces).
      • +
      • _moduledescription_: Description of the module that triggered the alert.
      • +
      • _modulegraph_nh_: (>=6.0) (Only for alerts that use the command eMail) Returns an image encoded in base64 of a module’s graph with a period of n hours (eg. _modulegraph_24h_). A correct setup of the connection between the server and the console's API is required. This setup is done on the server's configuration file.
      • +
      • _modulegraphth_nh_:Same operation as the previous macro only with the critical and warning thresholds of the module provided they are defined.
      • +
      • _modulegroup_: Module’s group name.
      • +
      • _modulestatus_: Module status.
      • +
      • _moduletags_: URLs asociadas a los tags de módulos.
      • +
      • _name_tag_: Names of the tags related to the module.
      • +
      • _phone_tag_: Phone numbers related to the module’s tags.
      • +
      • _plugin_parameters_: Module’s Plugin parameters.
      • +
      • _policy_: Name of the policy that the module belongs to (if applies).
      • +
      • _prevdata_ : Module data previus the alert to fire.
      • +
      • _target_ip_: IP address for the module’s target.
      • +
      • _target_port_: Port number for the module’s target.
      • +
      • _timestamp_: Time and date on which the alert was triggered (yy-mm-dd hh:mm:ss).
      • +
      • _timezone_: Timezone that is represented on _timestamp_.
      • +

      diff --git a/pandora_console/include/help/es/help_alert_config.php b/pandora_console/include/help/es/help_alert_config.php index 5ab70b784e..8c5ce0457f 100644 --- a/pandora_console/include/help/es/help_alert_config.php +++ b/pandora_console/include/help/es/help_alert_config.php @@ -26,52 +26,66 @@ A la hora de crear la acción podemos definir únicamente estos 3 campos. Dentro Además de las macros de módulo definidas, las siguientes macros están disponibles:

        -
      • _field1_: Campo 1 definido por el usuario.
      • -
      • _field2_: Campo 2 definido por el usuario.
      • -
      • _field3_: Campo 3 definido por el usuario.
      • -
      • _agent_: Nombre del agente que disparó la alerta.
      • -
      • _agentdescription_ : Descripción del agente que disparó la alerta.
      • -
      • _agentgroup_ : Nombre del grupo del agente.
      • -
      • _agentstatus_ : Estado actual del agente.
      • -
      • _address_: Dirección del agente que disparó la alerta.
      • -
      • _all_address_ : Todas las direcciones del agente que disparo la alerta.
      • -
      • _address_n_ : La dirección del agente que corresponde a la posicion indicada en "n" ejemplo: address_1_ , address_2_
      • -
      • _agentos_: Sistema operativo del agente.
      • -
      • _timestamp_: Hora y fecha en que se disparó la alerta.
      • -
      • _timezone_: Area Nombre _timestamp_ que representa en.
      • -
      • _data_: Dato que hizo que la alerta se disparase.
      • -
      • _prevdata_: Dato previo antes de disparase la alerta.
      • -
      • _alert_description_: Descripción de la alerta.
      • -
      • _alert_threshold_: Umbral de la alerta.
      • -
      • _alert_times_fired_: Número de veces que se ha disparado la alerta.
      • -
      • _module_: Nombre del módulo
      • -
      • _modulegroup_ : Nombre del grupo del módulo.
      • -
      • _moduledescription_: Descripcion del modulo.
      • -
      • _modulestatus_ : Estado del módulo.
      • -
      • _moduletags_ : Etiquetas asociadas al módulo.
      • -
      • _alert_name_: Nombre de la alerta.
      • -
      • _alert_priority_: Prioridad numérica de la alerta.
      • -
      • _alert_text_severity_: Prioridad en texto de la alerta. (Maintenance, Informational, Normal Minor, Warning, Major, Critical)
      • -
      • _eventt_text_severity_: (Solo alertas de evento) Prioridad en texto de el evento que dispara la alerta. (Maintenance, Informational, Normal Minor, Warning, Major, Critical)
      • -
      • _event_id_ : (Solo alertas de evento) Id del evento que disparó la alerta.
      • -
      • _id_agent_: ID del agente, util para construir URL de acceso a la consola de Pandora.
      • -
      • _id_group_ : Id del grupo de agente.
      • -
      • _id_module_ : ID del módulo.
      • -
      • _id_alert_: ID de la alerta, util para correlar la alerta en herramientas de terceros.
      • -
      • _policy_: Nombre de la política a la que pertenece el módulo (si aplica).
      • -
      • _interval_ : Intervalo de la ejecución del módulo.
      • -
      • _target_ip_ : Dirección IP del objetivo del módulo.
      • -
      • _target_port_ : Puerto del objetivo del módulo.
      • -
      • _plugin_parameters_ : Parámetros del Plug-in del módulo.
      • -
      • _groupcontact_ : Información de contacto del grupo. Se configura al crear el grupo.
      • -
      • _groupother_ : Otra información sobre el grupo. Se configura al crear el grupo.
      • -
      • _email_tag_ : Emails asociados a los tags de módulos.
      • -
      • _alert_critical_instructions_: Instrucciones contenidas en el módulo para un estado CRITICAL.
      • -
      • _alert_warning_instructions_: Instrucciones contenidas en el módulo para un estado WARNING.
      • -
      • _alert_unknown_instructions_: Instrucciones contenidas en el módulo para un estado UNKNOWN.
      • -
      • _modulegraph_nh_: (Sólo para alertas que usen el comando eMail) Devuelve una imagen codificada en base64 de una gráfica del módulo con un período de n horas (eg. _modulegraph_24h_). Requiere de una configuración correcta de la conexión del servidor a la consola vía api, la cual se realiza en el fichero de configuración del servidor.
      • -
      • _modulegraphth_nh_:mismo funcionamiento que la macro anterior solo que con los umbrales critical y warning del modulo siempre que estos esten definidos
      • -
      • _homeurl_ : Es un link de la URL pública esta debe de estar configurada en las opciones generales del setup.
      • +
      • _address_: Dirección del agente que disparó la alerta.
      • +
      • _address_n_ : La dirección del agente que corresponde a la posicion indicada en "n" ejemplo: address_1_ , address_2_
      • +
      • _agent_: Nombre del agente que disparó la alerta.
      • +
      • _agentcustomfield_n_: Campo personalizado número n del agente (eg. _agentcustomfield_9_).
      • +
      • _agentcustomid_:ID personalizado del agente.
      • +
      • _agentdescription_: Descripción del agente que disparó la alerta.
      • +
      • _agentgroup_ : Nombre del grupo del agente.
      • +
      • _agentos_: Sistema operativo del agente.
      • +
      • _agentstatus_ : Estado actual del agente.
      • +
      • _alert_critical_instructions_: Instrucciones contenidas en el módulo para un estado CRITICAL.
      • +
      • _alert_description_: Descripción de la alerta.
      • +
      • _alert_name_: Nombre de la alerta.
      • +
      • _alert_priority_: Prioridad numérica de la alerta.
      • +
      • _alert_text_severity_: Prioridad en texto de la alerta (Maintenance, Informational, Normal Minor, Warning, Major, Critical).
      • +
      • _alert_threshold_: Umbral de la alerta.
      • +
      • _alert_times_fired_: Número de veces que se ha disparado la alerta.
      • +
      • _alert_unknown_instructions_: Instrucciones contenidas en el módulo para un estado UNKNOWN.
      • +
      • _alert_warning_instructions_: Instrucciones contenidas en el módulo para un estado WARNING.
      • +
      • _all_address_ : Todas las direcciones del agente que disparo la alerta.
      • +
      • _data_: Dato que hizo que la alerta se disparase.
      • +
      • _email_tag_: Emails asociados a los tags de módulos.
      • +
      • _event_id_: (Solo alertas de evento) Id del evento que disparó la alerta.
      • +
      • _event_text_severity_: (Solo alertas de evento) Texto del evento (que disparó la alerta) gravedad (Mantenimiento, Informativo, Normal Menor, Advertencia, Mayor, Crítico).
      • +
      • _field1_: Campo 1 definido por el usuario.
      • +
      • _field2_: Campo 2 definido por el usuario.
      • +
      • _field3_: Campo 3 definido por el usuario.
      • +
      • _field4_: Campo 4 definido por el usuario.
      • +
      • _field5_: Campo 5 definido por el usuario.
      • +
      • _field6_: Campo 6 definido por el usuario.
      • +
      • _field7_: Campo 7 definido por el usuario.
      • +
      • _field8_: Campo 8 definido por el usuario.
      • +
      • _field9_: Campo 9 definido por el usuario.
      • +
      • _field10_: Campo 10 definido por el usuario.
      • +
      • _groupcontact_: Información de contacto del grupo. Se configura al crear el grupo.
      • +
      • _groupcustomid_: ID personalizado del grupo.
      • +
      • _groupother_: Otra información sobre el grupo. Se configura al crear el grupo.
      • +
      • _homeurl_: Es un link de la URL pública esta debe de estar configurada en las opciones generales del setup.
      • +
      • _id_agent_: ID del agente, util para construir URL de acceso a la consola de Pandora.
      • +
      • _id_alert_: ID de la alerta, util para correlar la alerta en herramientas de terceros.
      • +
      • _id_group_ : ID del grupo de agente.
      • +
      • _id_module_: ID del módulo.
      • +
      • _interval_: Intervalo de la ejecución del módulo.
      • +
      • _module_: Nombre del módulo.
      • +
      • _modulecustomid_: ID personalizado del módulo.
      • +
      • _moduledata_X_: Último dato del módulo X (nombre del módulo, no puede tener espacios).
      • +
      • _moduledescription_: Descripcion del modulo.
      • +
      • _modulegraph_nh_: (>=6.0) (Only for alerts that use the command eMail) Returns an image encoded in base64 of a module’s graph with a period of n hours (eg. _modulegraph_24h_). A correct setup of the connection between the server and the console's API is required. This setup is done on the server's configuration file.
      • +
      • _modulegraphth_nh_: Misma operación que la macro anterior pero sólo con los umbrales crítico y de advertencia del módulo, en caso de que estén definidos.
      • +
      • _modulegroup_: Nombre del grupo del módulo.
      • +
      • _modulestatus_: Estado del módulo.
      • +
      • _moduletags_: URLs asociadas a los tags de módulos.
      • +
      • _name_tag_: Nombre de los tags asociados al módulo.
      • +
      • _phone_tag_: Teléfonos asociados a los tags de módulos.
      • +
      • _plugin_parameters_: Parámetros del Plug-in del módulo.
      • +
      • _policy_: Nombre de la política a la que pertenece el módulo (si aplica).
      • +
      • _prevdata_ : Dato previo antes de disparase la alerta.
      • +
      • _target_ip_: Dirección IP del objetivo del módulo.
      • +
      • _target_port_: Puerto del objetivo del módulo.
      • +
      • _timestamp_: Hora y fecha en que se disparó la alerta.
      • +
      • _timezone_: Area Nombre _timestamp_ que representa en.

      Ejemplo: Error en el agente _agent_: _alert_description_ diff --git a/pandora_console/include/help/es/help_alert_macros.php b/pandora_console/include/help/es/help_alert_macros.php index 74efb4582b..60fe0b97e9 100644 --- a/pandora_console/include/help/es/help_alert_macros.php +++ b/pandora_console/include/help/es/help_alert_macros.php @@ -9,65 +9,68 @@ Además de las macros de módulo definidas, las siguientes macros están disponibles:

        -
      • _field1_: Campo 1 definido por el usuario.
      • -
      • _field2_: Campo 2 definido por el usuario.
      • -
      • _field3_: Campo 3 definido por el usuario.
      • -
      • _field4_: Campo 4 definido por el usuario.
      • -
      • _field5_: Campo 5 definido por el usuario.
      • -
      • _field6_: Campo 6 definido por el usuario.
      • -
      • _field7_: Campo 7 definido por el usuario.
      • -
      • _field8_: Campo 8 definido por el usuario.
      • -
      • _field9_: Campo 9 definido por el usuario.
      • -
      • _field10_: Campo 10 definido por el usuario.
      • -
      • _agent_: Nombre del agente que disparó la alerta.
      • -
      • _agentcustomfield_n_: Campo personalizado número n del agente (eg. _agentcustomfield_9_).
      • -
      • _agentcustomid_: ID personalizado del agente.
      • -
      • _agentdescription_: Descripción del agente que disparó la alerta.
      • -
      • _agentgroup_: Nombre del grupo del agente.
      • -
      • _agentstatus_: Estado actual del agente.
      • -
      • _agentos_: Sistema operativo del agente.
      • -
      • _address_: Dirección del agente que disparó la alerta.
      • -
      • _timestamp_: Hora y fecha en que se disparó la alerta.
      • -
      • _timezone_: Area Nombre _timestamp_ que representa en.
      • -
      • _data_: Dato que hizo que la alerta se disparase.
      • -
      • _prevdata_: Dato previo antes de disparase la alerta.
      • -
      • _alert_description_: Descripción de la alerta.
      • -
      • _alert_threshold_: Umbral de la alerta.
      • -
      • _alert_times_fired_: Número de veces que se ha disparado la alerta.
      • -
      • _module_: Nombre del módulo.
      • -
      • _modulecustomid_: ID personalizado del módulo.
      • -
      • _modulegroup_: Nombre del grupo del módulo.
      • -
      • _moduledescription_: Descripcion del modulo.
      • -
      • _modulestatus_: Estado del módulo.
      • -
      • _moduledata_X_: Último dato del módulo X (nombre del módulo, no puede tener espacios).
      • -
      • _alert_name_: Nombre de la alerta.
      • -
      • _alert_priority_: Prioridad numérica de la alerta.
      • -
      • _alert_text_severity_: Prioridad en texto de la alerta (Maintenance, Informational, Normal Minor, Warning, Major, Critical).
      • -
      • _eventt_text_severity_: (Solo alertas de evento) Prioridad en texto de el evento que dispara la alerta (Maintenance, Informational, Normal Minor, Warning, Major, Critical).
      • -
      • _event_id_: (Solo alertas de evento) Id del evento que disparó la alerta.
      • -
      • _id_agent_: ID del agente, util para construir URL de acceso a la consola de Pandora.
      • -
      • _id_group_ : Id del grupo de agente.
      • -
      • _id_module_ : ID del módulo.
      • -
      • _id_alert_: ID de la alerta, util para correlar la alerta en herramientas de terceros.
      • -
      • _policy_: Nombre de la política a la que pertenece el módulo (si aplica).
      • -
      • _interval_: Intervalo de la ejecución del módulo.
      • -
      • _target_ip_: Dirección IP del objetivo del módulo.
      • -
      • _target_port_: Puerto del objetivo del módulo.
      • -
      • _plugin_parameters_: Parámetros del plugin del módulo.
      • -
      • _groupcontact_: Información de contacto del grupo. Se configura al crear el grupo.
      • -
      • _groupcustomid_: ID personalizado del grupo.
      • -
      • _groupother_: Otra información sobre el grupo. Se configura al crear el grupo.
      • -
      • _name_tag_: Nombre de los tags asociados al módulo.
      • -
      • _email_tag_: Emails asociados a los tags de módulos.
      • -
      • _phone_tag_: Teléfonos asociados a los tags de módulos.
      • -
      • _moduletags_: URLs asociadas a los tags de módulos.
      • -
      • _alert_critical_instructions_: Instrucciones contenidas en el módulo para un estado CRITICAL.
      • -
      • _alert_warning_instructions_: Instrucciones contenidas en el módulo para un estado WARNING.
      • -
      • _alert_unknown_instructions_: Instrucciones contenidas en el módulo para un estado UNKNOWN.
      • -
      • _modulegraph_nh_: (>=6.0) (Solo para alertas que usen el comando eMail) -Devuelve una imagen codificada en base64 de una gráfica del módulo con un período de n horas (eg. _modulegraph_24h_). -Requiere de una configuración correcta de la conexión del servidor a la consola vía api, -la cual se realiza en el fichero de configuración del servidor.
      • + +
      • _address_: Dirección del agente que disparó la alerta.
      • +
      • _address_n_ : La dirección del agente que corresponde a la posicion indicada en "n" ejemplo: address_1_ , address_2_
      • +
      • _agent_: Nombre del agente que disparó la alerta.
      • +
      • _agentcustomfield_n_: Campo personalizado número n del agente (eg. _agentcustomfield_9_).
      • +
      • _agentcustomid_:ID personalizado del agente.
      • +
      • _agentdescription_: Descripción del agente que disparó la alerta.
      • +
      • _agentgroup_ : Nombre del grupo del agente.
      • +
      • _agentos_: Sistema operativo del agente.
      • +
      • _agentstatus_ : Estado actual del agente.
      • +
      • _alert_critical_instructions_: Instrucciones contenidas en el módulo para un estado CRITICAL.
      • +
      • _alert_description_: Descripción de la alerta.
      • +
      • _alert_name_: Nombre de la alerta.
      • +
      • _alert_priority_: Prioridad numérica de la alerta.
      • +
      • _alert_text_severity_: Prioridad en texto de la alerta (Maintenance, Informational, Normal Minor, Warning, Major, Critical).
      • +
      • _alert_threshold_: Umbral de la alerta.
      • +
      • _alert_times_fired_: Número de veces que se ha disparado la alerta.
      • +
      • _alert_unknown_instructions_: Instrucciones contenidas en el módulo para un estado UNKNOWN.
      • +
      • _alert_warning_instructions_: Instrucciones contenidas en el módulo para un estado WARNING.
      • +
      • _all_address_ : Todas las direcciones del agente que disparo la alerta.
      • +
      • _data_: Dato que hizo que la alerta se disparase.
      • +
      • _email_tag_: Emails asociados a los tags de módulos.
      • +
      • _event_id_: (Solo alertas de evento) Id del evento que disparó la alerta.
      • +
      • _event_text_severity_: (Solo alertas de evento) Texto del evento (que disparó la alerta) de la gravedad (Mantenimiento, Informativo, Normal Menor, Advertencia, Mayor, Crítico).
      • +
      • _field1_: Campo 1 definido por el usuario.
      • +
      • _field2_: Campo 2 definido por el usuario.
      • +
      • _field3_: Campo 3 definido por el usuario.
      • +
      • _field4_: Campo 4 definido por el usuario.
      • +
      • _field5_: Campo 5 definido por el usuario.
      • +
      • _field6_: Campo 6 definido por el usuario.
      • +
      • _field7_: Campo 7 definido por el usuario.
      • +
      • _field8_: Campo 8 definido por el usuario.
      • +
      • _field9_: Campo 9 definido por el usuario.
      • +
      • _field10_: Campo 10 definido por el usuario.
      • +
      • _groupcontact_: Información de contacto del grupo. Se configura al crear el grupo.
      • +
      • _groupcustomid_: ID personalizado del grupo.
      • +
      • _groupother_: Otra información sobre el grupo. Se configura al crear el grupo.
      • +
      • _homeurl_: Es un link de la URL pública esta debe de estar configurada en las opciones generales del setup.
      • +
      • _id_agent_: ID del agente, util para construir URL de acceso a la consola de Pandora.
      • +
      • _id_alert_: ID de la alerta, util para correlar la alerta en herramientas de terceros.
      • +
      • _id_group_ : ID del grupo de agente.
      • +
      • _id_module_: ID del módulo.
      • +
      • _interval_: Intervalo de la ejecución del módulo.
      • +
      • _module_: Nombre del módulo.
      • +
      • _modulecustomid_: ID personalizado del módulo.
      • +
      • _moduledata_X_: Último dato del módulo X (nombre del módulo, no puede tener espacios).
      • +
      • _moduledescription_: Descripcion del modulo.
      • +
      • _modulegraph_nh_: (>=6.0) (Solo para alertas que usen el comando eMail) Devuelve una imagen codificada en base64 de una gráfica del módulo con un período de n horas (eg. _modulegraph_24h_). Requiere de una configuración correcta de la conexión del servidor a la consola vía api, la cual se realiza en el fichero de configuración del servidor.
      • +
      • _modulegraphth_nh_: Misma operación que la macro anterior pero sólo con los umbrales crítico y de advertencia del módulo, en caso de que estén definidos.
      • +
      • _modulegroup_: Nombre del grupo del módulo.
      • +
      • _modulestatus_: Estado del módulo.
      • +
      • _moduletags_: URLs asociadas a los tags de módulos.
      • +
      • _name_tag_: Nombre de los tags asociados al módulo.
      • +
      • _phone_tag_: Teléfonos asociados a los tags de módulos.
      • +
      • _plugin_parameters_: Parámetros del Plug-in del módulo.
      • +
      • _policy_: Nombre de la política a la que pertenece el módulo (si aplica).
      • +
      • _prevdata_ : Dato previo antes de disparase la alerta.
      • +
      • _target_ip_: Dirección IP del objetivo del módulo.
      • +
      • _target_port_: Puerto del objetivo del módulo.
      • +
      • _timestamp_: Hora y fecha en que se disparó la alerta.
      • +
      • _timezone_: Area Nombre _timestamp_ que representa en.
      • +

      From 5f58d2bce2df46da328956d763b549254417d56e Mon Sep 17 00:00:00 2001 From: fermin831 Date: Thu, 26 Oct 2017 17:58:44 +0200 Subject: [PATCH 040/149] Modified windows configuration file to fit with nsis --- pandora_agents/win32/bin/pandora_agent.conf | 328 ++++++++++++-------- 1 file changed, 200 insertions(+), 128 deletions(-) diff --git a/pandora_agents/win32/bin/pandora_agent.conf b/pandora_agents/win32/bin/pandora_agent.conf index c8c32e84d0..0a645b2027 100644 --- a/pandora_agents/win32/bin/pandora_agent.conf +++ b/pandora_agents/win32/bin/pandora_agent.conf @@ -1,5 +1,5 @@ # Base config file for Pandora FMS Windows Agent -# (c) 2006-2014 Artica Soluciones Tecnologicas +# (c) 2006-2017 Artica Soluciones Tecnologicas # Version 7.0NG.714 # This program is Free Software, you can redistribute it and/or modify it @@ -21,6 +21,13 @@ server_ip $ServerIP$ server_path /var/spool/pandora/data_in temporal "%ProgramFiles%\pandora_agent\temp" +# Group assigned for this agent (descriptive, p.e: Servers) +group $GroupName$ + +# If set to 1 allows the agent to be configured via the web console +# (only works on enterprise version). Set to 0 to disable it +remote_config 0 + #include "C:\Archivos de programa\pandora_agent\pandora_agent_alt.conf" #broker_agent name_agent @@ -43,15 +50,10 @@ agent_name_cmd __rand__ # address: Enforce to server a ip address to this agent # You can also try to detect the first IP using "auto", for example - address auto - # or setting a fixed IP address, like for example: #address 192.168.36.73 -# Group assigned for this agent (descriptive, p.e: Servers) -group Servers - # This limits operation if temporal dir has not enough free disk. #temporal_min_size 1024 @@ -80,10 +82,6 @@ server_port 41121 # Debug mode renames XML in the temp folder and continues running # debug 1 -# If set to 1 allows the agent to be configured via the web console -# (only works on enterprise version). Set to 0 to disable it -remote_config 0 - # XML encoding (ISO-8859-1 by default). Most windows servers experience problems when you set to UTF-8. Other special codepages may be specified here. #encoding ISO-8859-1 @@ -97,11 +95,15 @@ remote_config 0 # proxy_timeout 1 # Enable or disable XML buffer. -xml_buffer 1 +xml_buffer 0 # Agent mode: Learn (default), No-learn, Autodisable # agent_mode autodisable +# EHorus configuration file default full path. +#It try to find the EKID and set it like a custom field. +ehorus_conf "C:\Program Files\ehorus_agent\ehorus_agent.conf" + # Secondary server configuration # ============================== @@ -127,74 +129,166 @@ xml_buffer 1 #process_firefox_stop killall firefox #service_messenger 1 +############################################### # Module Definition # Check online documentation and module library at http://pandorafms.org # ================= -# Get Network information using Agent plugin -module_plugin cscript //B "%ProgramFiles%\Pandora_Agent\util\nettraffic.vbs" - -# Get disk occupation (percent) -module_plugin cscript.exe //B "%ProgramFiles%\Pandora_Agent\util\df_percent.vbs" - -# External inventory plugin -module_begin -module_plugin cscript.exe //B "%ProgramFiles%\Pandora_Agent\util\software_installed.vbs" -module_interval 288 -# 288 x 5min = 24 hr, one execution per day, using module_interval -module_end - -# CPU Load - +# CPU Load using WMI module_begin module_name CPU Load module_type generic_data -#module_wmiquery SELECT LoadPercentage FROM Win32_Processor -#module_wmicolumn LoadPercentage -module_cpuusage all -module_description CPU Load (%) -module_unit % -module_min_warning 80 +module_wmiquery SELECT LoadPercentage FROM Win32_Processor +module_wmicolumn LoadPercentage +module_max 100 +module_min 0 +module_description User CPU Usage (%) +module_min_warning 70 module_max_warning 90 module_min_critical 91 module_max_critical 100 +module_unit % +module_group System module_end -# Number processes +# Basic info about TCP Connection module_begin -module_name Number processes -module_type generic_data -module_exec tasklist | gawk "NR > 3 {print$0}" | wc -l -module_description Number of processes running -module_min_warning 175 -module_max_warning 249 -module_min_critical 250 -module_max_critical 300 +module_name TCP_Connections +module_type generic_data +module_exec netstat -an | find /c /v "estab" +module_description Total number of TCP connections active +module_group Networking module_end +# Example plugin to retrieve drive usage +module_plugin cscript.exe //B "%ProgramFiles%\Pandora_Agent\util\df_percent_used.vbs" + +# Example plugin to retrieve memory usage +module_plugin cscript.exe //B "%ProgramFiles%\Pandora_Agent\util\mem_percent_used.vbs" + +# Example plugin to retrieve network usage +module_plugin cscript.exe //B "%ProgramFiles%\Pandora_Agent\util\network.vbs" + +## Windows inventory module (This information will be displayed only in enterprise version) +## Please check the WMI is healthy before activate this functionality + +module_begin +module_plugin cscript.exe //B //t:20 "%PROGRAMFILES%\Pandora_Agent\util\cpuinfo.vbs" +module_crontab * 12-15 * * 1 +module_end + +module_begin +module_plugin cscript.exe //B //t:20 "%PROGRAMFILES%\Pandora_Agent\util\moboinfo.vbs" +module_crontab * 12-15 * * 1 +module_end + +module_begin +module_plugin cscript.exe //B //t:20 "%PROGRAMFILES%\Pandora_Agent\util\diskdrives.vbs" +module_crontab * 12-15 * * 1 +module_end + +module_begin +module_plugin cscript.exe //B //t:20 "%PROGRAMFILES%\Pandora_Agent\util\cdromdrives.vbs" +module_crontab * 12-15 * * 1 +module_end + +module_begin +module_plugin cscript.exe //B //t:20 "%PROGRAMFILES%\Pandora_Agent\util\videocardinfo.vbs" +module_crontab * 12-15 * * 1 +module_end + +module_begin +module_plugin cscript.exe //B //t:20 "%PROGRAMFILES%\Pandora_Agent\util\ifaces.vbs" +module_crontab * 12-15 * * 1 +module_end + +module_begin +module_plugin cscript.exe //B //t:20 "%PROGRAMFILES%\Pandora_Agent\util\monitors.vbs" +module_crontab * 12-15 * * 1 +module_end + +module_begin +module_plugin cscript.exe //B //t:20 "%PROGRAMFILES%\Pandora_Agent\util\printers.vbs" +module_crontab * 12-15 * * 1 +module_end + +module_begin +module_plugin cscript.exe //B //t:20 "%PROGRAMFILES%\Pandora_Agent\util\raminfo.vbs" +module_crontab * 12-15 * * 1 +module_end + +module_begin +module_plugin cscript.exe //B //t:20 "%PROGRAMFILES%\Pandora_Agent\util\software_installed.vbs" +module_crontab * 12-15 * * 1 +module_end + +module_begin +module_plugin cscript.exe //B //t:20 "%PROGRAMFILES%\Pandora_Agent\util\userslogged.vbs" +module_crontab * 12-15 * * 1 +module_end + +module_begin +module_plugin cscript.exe //B //t:20 "%PROGRAMFILES%\Pandora_Agent\util\productkey.vbs" +module_crontab * 12-15 * * 1 +module_end + +module_begin +module_plugin cscript.exe //B //t:20 "%PROGRAMFILES%\Pandora_Agent\util\productID.vbs" +module_crontab * 12-15 * * 1 +module_end + +######################################### +# EXAMPLES # +######################################### + +# Example: get Network information using Agent plugin +#module_plugin cscript //B "%ProgramFiles%\Pandora_Agent\util\nettraffic.vbs" + +# External inventory plugin +#module_begin +#module_plugin cscript.exe //B "%ProgramFiles%\Pandora_Agent\util\software_installed.vbs" +#module_interval 288 +## 288 x 5min = 24 hr, one execution per day, using module_interval +#module_end + # Free Memory -module_begin -module_name FreeMemory -module_type generic_data -module_freepercentmemory -module_unit % -module_description Free memory (%). -module_min_warning 21 -module_max_warning 30 -module_min_critical 0 -module_max_critical 20 -module_end +#module_begin +#module_name FreeMemory +#module_type generic_data +#module_freepercentmemory +#module_description Free memory (%). +#module_min_warning 21 +#module_max_warning 30 +#module_min_critical 0 +#module_max_critical 20 +#module_end # Log events +#module_begin +#module_name System Events (TermService) +#module_type async_string +#module_logevent +#module_description Log Events coming from Terminal Service +#module_source System +#module_application TermService +#module_end -module_begin -module_name Security Events (Invalid Login) -module_type async_string -module_description Security log events for invalid login attempt -module_logevent -module_source Security -module_eventcode 529 -module_end +#module_begin +#module_name Security Events (Invalid Login) +#module_type async_string +#module_description Security log events for invalid login attempt +#module_logevent +#module_source Security +#module_eventcode 529 +#module_end + +# Check if Dhcp service is enabled +#module_begin +#module_name DHCP Enabled +#module_type generic_proc +#module_service Dhcp +#module_description Check DCHP service enabled +#module_end #Antivirus monitoring #This modules checks the antivirus is running on your system, if there is and antivirus @@ -207,72 +301,51 @@ module_end #module_description Last update for Antivirus Signature file #module_end -## Windows inventory module (This information will be displayed only in enterprise version) -## Please check the WMI is healthy before activate this functionality +# Number processes +#module_begin +#module_name Number processes +#module_type generic_data +#module_exec tasklist | gawk "NR > 3 {print$0}" | wc -l +#module_description Number of processes running +#module_min_warning 175 +#module_max_warning 249 +#module_min_critical 250 +#module_max_critical 300 +#module_end -# module_begin -# module_plugin cscript.exe //B //t:20 "%PROGRAMFILES%\Pandora_Agent\util\cpuinfo.vbs" -# module_crontab * 12-15 * * 1 -# module_end +# Example plugin to retrieve drive usage +#module_plugin cscript.exe //B "%ProgramFiles%\Pandora_Agent\util\df.vbs" -# module_begin -# module_plugin cscript.exe //B //t:20 "%PROGRAMFILES%\Pandora_Agent\util\moboinfo.vbs" -# module_crontab * 12-15 * * 1 -# module_end +# Free space on disk C: (%) +#module_begin +#module_name FreeDiskC +#module_type generic_data +#module_freepercentdisk C: +#module_description Free space on drive C: (%) +#module_min_warning 31 +#module_max_warning 40 +#module_min_critical 0 +#module_max_critical 30 +#module_end -# module_begin -# module_plugin cscript.exe //B //t:20 "%PROGRAMFILES%\Pandora_Agent\util\diskdrives.vbs" -# module_crontab * 12-15 * * 1 -# module_end +# CPU usage percentage +#module_begin +#module_name CPUUse +#module_type generic_data +#module_cpuusage all +#module_description CPU# usage +#module_min_warning 70 +#module_max_warning 90 +#module_min_critical 91 +#module_max_critical 100 +#module_end +# Free space on disk D: (%) # module_begin -# module_plugin cscript.exe //B //t:20 "%PROGRAMFILES%\Pandora_Agent\util\cdromdrives.vbs" -# module_crontab * 12-15 * * 1 -# module_end - -# module_begin -# module_plugin cscript.exe //B //t:20 "%PROGRAMFILES%\Pandora_Agent\util\videocardinfo.vbs" -# module_crontab * 12-15 * * 1 -# module_end - -# module_begin -# module_plugin cscript.exe //B //t:20 "%PROGRAMFILES%\Pandora_Agent\util\ifaces.vbs" -# module_crontab * 12-15 * * 1 -# module_end - -# module_begin -# module_plugin cscript.exe //B //t:20 "%PROGRAMFILES%\Pandora_Agent\util\monitors.vbs" -# module_crontab * 12-15 * * 1 -# module_end - -# module_begin -# module_plugin cscript.exe //B //t:20 "%PROGRAMFILES%\Pandora_Agent\util\printers.vbs" -# module_crontab * 12-15 * * 1 -# module_end - -# module_begin -# module_plugin cscript.exe //B //t:20 "%PROGRAMFILES%\Pandora_Agent\util\raminfo.vbs" -# module_crontab * 12-15 * * 1 -# module_end - -# module_begin -# module_plugin cscript.exe //B //t:20 "%PROGRAMFILES%\Pandora_Agent\util\software_installed.vbs" -# module_crontab * 12-15 * * 1 -# module_end - -# module_begin -# module_plugin cscript.exe //B //t:20 "%PROGRAMFILES%\Pandora_Agent\util\userslogged.vbs" -# module_crontab * 12-15 * * 1 -# module_end - -# module_begin -# module_plugin cscript.exe //B //t:20 "%PROGRAMFILES%\Pandora_Agent\util\productkey.vbs" -# module_crontab * 12-15 * * 1 -# module_end - -# module_begin -# module_plugin cscript.exe //B //t:20 "%PROGRAMFILES%\Pandora_Agent\util\productID.vbs" -# module_crontab * 12-15 * * 1 +# module_name FreeDiskD +# module_type generic_data +# module_freepercentdisk D: +# module_description Free space on drive D: (%) # module_end ## Plugin example for custom fields (version, architecture, IP, IPv6, MAC) @@ -281,10 +354,9 @@ module_end # module_crontab * 12-15 * * 1 # module_end -# ---------------------------------------------------------------------------------------------------- -# This samples below need to be reconfigured and uncommented. Please read documentation -# on how to setup pandora fms windows agent at http://wiki.pandorafms.com -# ---------------------------------------------------------------------------------------------------- +# Example plugin to retrieve last 5 min events in log4x format +# module_plugin cscript.exe //B "%ProgramFiles%\Pandora_Agent\util\logevent_log4x.vbs" Aplicacion System 300 + # Sample on how to get a value from registry # This returns the last time user launch microsoft Windows update #module_begin @@ -391,11 +463,11 @@ module_end #module_description Postcondition test module #module_end -#Example of when module_native_encoding is necessary -#Dont uncomment module_native_encoding tag to see the difference +# Example of native encoding. #module_begin -#module_name Accent_example +#module_name Written Accent #module_type generic_data_string #module_exec echo Bordón #module_native_encoding OEM #module_end + From 5a2a97e94c545456826f1ac532a4b725026cf9e5 Mon Sep 17 00:00:00 2001 From: Daniel Maya Date: Fri, 27 Oct 2017 12:25:00 +0200 Subject: [PATCH 041/149] Fixed function api_set_disable_alert --- pandora_console/include/functions_agents.php | 11 +++++ pandora_console/include/functions_api.php | 48 ++++++++++++++++++-- 2 files changed, 56 insertions(+), 3 deletions(-) diff --git a/pandora_console/include/functions_agents.php b/pandora_console/include/functions_agents.php index 838fb58d55..6fd0cc84aa 100644 --- a/pandora_console/include/functions_agents.php +++ b/pandora_console/include/functions_agents.php @@ -55,6 +55,17 @@ function agents_get_agent_id_by_module_id ($id_agente_modulo) { 'id_agente_modulo', $id_agente_modulo); } +/** + * Get agent id from an agent alias. + * + * @param string $alias Agent alias. + * + * @return int Id from the agent. + */ +function agents_get_agent_id_by_alias ($alias) { + return db_get_all_rows_sql ("SELECT id_agente FROM tagente WHERE upper(alias) LIKE upper('%$alias%')"); +} + /** * Creates an agent * diff --git a/pandora_console/include/functions_api.php b/pandora_console/include/functions_api.php index 5ecac3a944..c1c7c9ca50 100644 --- a/pandora_console/include/functions_api.php +++ b/pandora_console/include/functions_api.php @@ -8531,7 +8531,7 @@ function api_set_enable_module ($agent_name, $module_name, $thrast3, $thrash4) { * @param string $template_name Name of the alert template (for example, "Warning event") * @param $thrash4 Don't use. -// http://localhost/pandora_console/include/api.php?op=set&op2=disable_alert&id=garfio&id2=Status&other=Warning%20condition +// http://localhost/pandora_console/include/api.php?op=set&op2=disable_alert&id=c2cea5860613e363e25f4ba185b54fe28f869ff8a5e8bb46343288337c903531&id2=Status&other=Warning%20condition */ function api_set_disable_alert ($agent_name, $module_name, $template_name, $thrash4) { @@ -8543,11 +8543,53 @@ function api_set_disable_alert ($agent_name, $module_name, $template_name, $thra $id_agent_module = db_get_value_filter('id_agente_modulo', 'tagente_modulo', array('id_agente' => $id_agent, 'nombre' => $module_name)); $id_template = db_get_value_filter('id', 'talert_templates', array('name' => $template_name["data"])); - db_process_sql("UPDATE talert_template_modules + $result = db_process_sql("UPDATE talert_template_modules SET disabled = 1 WHERE id_agent_module = $id_agent_module AND id_alert_template = $id_template"); - returnData('string', array('type' => 'string', 'data' => "Correct alert disable")); + if ($result) { + returnData('string', array('type' => 'string', 'data' => "Correct alert disable")); + } else { + returnData('string', array('type' => 'string', 'data' => __('Error alert disable'))); + } +} + + +/** + * Disable an alert with alias + * + * @param string $agent_alias Alias of agent (for example "myagent") + * @param string $module_name Name of the module (for example "Host alive") + * @param string $template_name Name of the alert template (for example, "Warning event") + * @param $thrash4 Don't use. + +// http://localhost/pandora_console/include/api.php?op=set&op2=disable_alert_alias&id=garfio&id2=Status&other=Warning%20condition + */ + +function api_set_disable_alert_alias ($agent_alias, $module_name, $template_name, $thrash4) { + if (defined ('METACONSOLE')) { + return; + } + + $agent_id = agents_get_agent_id_by_alias($agent_alias); + $result = false; + foreach ($agent_id as $key => $id_agent) { + $id_agent_module = db_get_value_filter('id_agente_modulo', 'tagente_modulo', array('id_agente' => $id_agent['id_agente'], 'nombre' => $module_name)); + $id_template = db_get_value_filter('id', 'talert_templates', array('name' => $template_name["data"])); + + $result = db_process_sql("UPDATE talert_template_modules + SET disabled = 1 + WHERE id_agent_module = $id_agent_module AND id_alert_template = $id_template"); + + if ($result) { + returnData('string', array('type' => 'string', 'data' => "Correct alert disable")); + return; + } + } + + if(!$result){ + returnData('string', array('type' => 'string', 'data' => __('Error alert disable'))); + } } /** From 74753918c381ee7558f930b867386a82329e828e Mon Sep 17 00:00:00 2001 From: Arturo Gonzalez Date: Fri, 27 Oct 2017 12:43:46 +0200 Subject: [PATCH 042/149] Added function to update link to other map --- pandora_console/include/functions_pandora_networkmap.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/pandora_console/include/functions_pandora_networkmap.php b/pandora_console/include/functions_pandora_networkmap.php index 0bbb4dd124..a16455462b 100644 --- a/pandora_console/include/functions_pandora_networkmap.php +++ b/pandora_console/include/functions_pandora_networkmap.php @@ -212,6 +212,7 @@ function networkmap_process_networkmap($id = 0) { $style['width'] = $node['width']; $style['height'] = $node['height']; $style['label'] = $node['text']; + $style['id_networkmap'] = $node['networkmap']; $nodes_and_relations['nodes'][$index]['style'] = json_encode($style); $index++; @@ -398,6 +399,13 @@ function networkmap_db_node_to_js_node($node, &$count, &$count_item_holding_area if (isset($node['id_map'])) { $item['map_id'] = $node['id_map']; } + + if (!isset($node['style']['id_networkmap']) || $node['style']['id_networkmap'] == '' || $node['style']['id_networkmap'] == 0) { + $item['networkmap_id'] = 0; + } + else { + $item['networkmap_id'] = $node['style']['id_networkmap']; + } $count++; From 2adf9511218f10a30cd11cc9f881ae0c937a16f7 Mon Sep 17 00:00:00 2001 From: fermin831 Date: Mon, 30 Oct 2017 15:45:31 +0100 Subject: [PATCH 043/149] Added free search values to data table --- pandora_console/include/ajax/module.php | 22 ++++++++++++------- pandora_console/include/functions_modules.php | 20 +++++++++++------ .../operation/agentes/estado_monitores.php | 6 +++++ 3 files changed, 33 insertions(+), 15 deletions(-) diff --git a/pandora_console/include/ajax/module.php b/pandora_console/include/ajax/module.php index 32de285b11..a174c84ba5 100755 --- a/pandora_console/include/ajax/module.php +++ b/pandora_console/include/ajax/module.php @@ -123,12 +123,16 @@ if ($get_module_detail) { $time_from = (string) get_parameter ('time_from', date ('h:iA')); $date_to = (string) get_parameter ('date_to', date ('Y-m-j')); $time_to = (string) get_parameter ('time_to', date ('h:iA')); + $freesearch = (string) get_parameter ('freesearch', ''); $formtable->width = '98%'; $formtable->class = "databox"; $formtable->data = array (); $formtable->size = array (); + $moduletype_name = modules_get_moduletype_name( + modules_get_agentmodule_type($module_id)); + $periods = array(SECONDS_5MINUTES =>__('5 minutes'), SECONDS_30MINUTES =>__('30 minutes'), SECONDS_1HOUR =>__('1 hour'), @@ -148,13 +152,18 @@ if ($get_module_detail) { "selection_mode", 'fromnow', '', $selection_mode, false, '', 'style="margin-right: 15px;"', true) . __("Choose a time from now"); $formtable->data[0][1] = html_print_select ($periods, 'period', $period, '', '', 0, true, false, false); - $formtable->data[0][2] = ''; + if (preg_match("/_string/", $moduletype_name)) { + $formtable->data[0][2] = __('Free search') . ' '; + $formtable->data[0][2] .= html_print_input_text ('freesearch', $freesearch, '', 25, null, true); + } else { + $freesearch = ''; + $formtable->data[0][2] = ''; + } + $formtable->cellstyle[0][3] = 'vertical-align: middle;'; $formtable->data[0][3] = "" . html_print_image ("images/refresh.png", true, array ("style" => 'vertical-align: middle;', "border" => "0" )) . ""; - $formtable->rowspan[0][3] = 2; - $formtable->cellstyle[0][3] = 'vertical-align: middle;'; $formtable->data[1][0] = html_print_radio_button_extended( "selection_mode", 'range','', $selection_mode, false, '', @@ -177,9 +186,6 @@ if ($get_module_detail) { html_print_table($formtable); - $moduletype_name = modules_get_moduletype_name( - modules_get_agentmodule_type($module_id)); - $offset = (int) get_parameter("offset"); $block_size = (int) $config["block_size"]; @@ -222,10 +228,10 @@ if ($get_module_detail) { } $count = modules_get_agentmodule_data ($module_id, $period, - $date, true, $conexion); + $date, true, $conexion, 'ASC', $freesearch); $module_data = modules_get_agentmodule_data ($module_id, $period, - $date, false, $conexion, 'DESC'); + $date, false, $conexion, 'DESC', $freesearch); if (empty($module_data)) { $result = array(); diff --git a/pandora_console/include/functions_modules.php b/pandora_console/include/functions_modules.php index bcdeb6819c..0c522ceece 100755 --- a/pandora_console/include/functions_modules.php +++ b/pandora_console/include/functions_modules.php @@ -1720,7 +1720,8 @@ function modules_get_next_data ($id_agent_module, $utimestamp = 0, $string = 0) * @return array The module value and the timestamp */ function modules_get_agentmodule_data ($id_agent_module, $period, - $date = 0, $trash=false, $conexion = false, $order = 'ASC') { + $date = 0, $trash=false, $conexion = false, $order = 'ASC', + $freesearch = '') { global $config; $module = db_get_row('tagente_modulo', 'id_agente_modulo', @@ -1742,12 +1743,17 @@ function modules_get_agentmodule_data ($id_agent_module, $period, case 17: //async_string case 23: - $sql = sprintf ("SELECT datos AS data, utimestamp - FROM tagente_datos_string - WHERE id_agente_modulo = %d - AND utimestamp > %d AND utimestamp <= %d - ORDER BY utimestamp %s", - $id_agent_module, $datelimit, $date, $order); + $sql = sprintf ( + "SELECT datos AS data, utimestamp FROM tagente_datos_string + WHERE id_agente_modulo = %d + %s + AND utimestamp > %d AND utimestamp <= %d + ORDER BY utimestamp %s", + $id_agent_module, + !empty($freesearch) ? " AND datos REGEXP '" . $freesearch . "' " : "", + $datelimit, $date, + $order + ); break; //log4x case 24: diff --git a/pandora_console/operation/agentes/estado_monitores.php b/pandora_console/operation/agentes/estado_monitores.php index f5c870dc83..0d6e9b8c6b 100755 --- a/pandora_console/operation/agentes/estado_monitores.php +++ b/pandora_console/operation/agentes/estado_monitores.php @@ -364,6 +364,12 @@ ui_require_jquery_file("ui.datepicker-" . get_user_language(), "include/javascri extra_parameters = '&selection_mode=' + selection_mode + '&date_from=' + date_from + '&date_to=' + date_to + '&time_from=' + time_from + '&time_to=' + time_to; } + + // Get the free text in both options + var freesearch = $('#text-freesearch').val(); + if (freesearch == null) freesearch = ''; + extra_parameters += '&freesearch=' + freesearch; + title = ; $.ajax({ type: "POST", From 718a2dbaffdb5c5dbe605e825fab7c7a66a991fc Mon Sep 17 00:00:00 2001 From: Daniel Maya Date: Mon, 30 Oct 2017 17:57:47 +0100 Subject: [PATCH 044/149] Fixed in visual map --- pandora_console/include/functions_events.php | 2 +- pandora_console/include/functions_reporting.php | 12 ++++++------ pandora_console/include/functions_visual_map.php | 10 +++++----- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/pandora_console/include/functions_events.php b/pandora_console/include/functions_events.php index 763f246bdf..58c11b1cc9 100644 --- a/pandora_console/include/functions_events.php +++ b/pandora_console/include/functions_events.php @@ -2080,7 +2080,7 @@ function events_page_details ($event, $server = "") { } else { $module_group = db_get_value('name', 'tmodule_group', 'id_mg', $id_module_group); - $data[1] = ''; + $data[1] = ''; $data[1] .= $module_group; $data[1] .= ''; } diff --git a/pandora_console/include/functions_reporting.php b/pandora_console/include/functions_reporting.php index 8a47d2c7d2..9dd4d4c158 100644 --- a/pandora_console/include/functions_reporting.php +++ b/pandora_console/include/functions_reporting.php @@ -7245,19 +7245,19 @@ function reporting_get_stats_modules_status($data, $graph_width = 250, $graph_he if ($links === false) { $urls = array(); $urls['monitor_critical'] = "index.php?" . - "sec=estado&sec2=operation/agentes/status_monitor&" . + "sec=view&sec2=operation/agentes/status_monitor&" . "refr=60&status=" . AGENT_MODULE_STATUS_CRITICAL_BAD . "&pure=" . $config['pure']; $urls['monitor_warning'] = "index.php?" . - "sec=estado&sec2=operation/agentes/status_monitor&" . + "sec=view&sec2=operation/agentes/status_monitor&" . "refr=60&status=" . AGENT_MODULE_STATUS_WARNING . "&pure=" . $config['pure']; $urls['monitor_ok'] = "index.php?" . - "sec=estado&sec2=operation/agentes/status_monitor&" . + "sec=view&sec2=operation/agentes/status_monitor&" . "refr=60&status=" . AGENT_MODULE_STATUS_NORMAL . "&pure=" . $config['pure']; $urls['monitor_unknown'] = "index.php?" . - "sec=estado&sec2=operation/agentes/status_monitor&" . + "sec=view&sec2=operation/agentes/status_monitor&" . "refr=60&status=" . AGENT_MODULE_STATUS_UNKNOWN . "&pure=" . $config['pure']; $urls['monitor_not_init'] = "index.php?" . - "sec=estado&sec2=operation/agentes/status_monitor&" . + "sec=view&sec2=operation/agentes/status_monitor&" . "refr=60&status=" . AGENT_MODULE_STATUS_NOT_INIT . "&pure=" . $config['pure']; } else { @@ -7357,7 +7357,7 @@ function reporting_get_stats_agents_monitors($data) { else { $urls = array(); $urls['total_agents'] = "index.php?sec=estado&sec2=operation/agentes/estado_agente&refr=60"; - $urls['monitor_checks'] = "index.php?sec=estado&sec2=operation/agentes/status_monitor&refr=60&status=-1"; + $urls['monitor_checks'] = "index.php?sec=view&sec2=operation/agentes/status_monitor&refr=60&status=-1"; } // Agents and modules table diff --git a/pandora_console/include/functions_visual_map.php b/pandora_console/include/functions_visual_map.php index ed5141cc47..822636f59e 100755 --- a/pandora_console/include/functions_visual_map.php +++ b/pandora_console/include/functions_visual_map.php @@ -433,7 +433,7 @@ function visual_map_print_item($mode = "read", $layoutData, // Link to an module if (empty($layoutData['id_metaconsole'])) { $url = $config['homeurl'] . - 'index.php?sec=estado&sec2=operation/agentes/status_monitor&id_module=' . $layoutData['id_agente_modulo']; + 'index.php?sec=view&sec2=operation/agentes/status_monitor&id_module=' . $layoutData['id_agente_modulo']; } else { $url = ui_meta_get_url_console_child( @@ -581,7 +581,7 @@ function visual_map_print_item($mode = "read", $layoutData, // Link to an module if (empty($layoutData['id_metaconsole'])) { $url = $config['homeurl'] . - 'index.php?sec=estado&sec2=operation/agentes/status_monitor&id_module=' . $layoutData['id_agente_modulo']; + 'index.php?sec=view&sec2=operation/agentes/status_monitor&id_module=' . $layoutData['id_agente_modulo']; } else { $url = ui_meta_get_url_console_child( @@ -628,11 +628,11 @@ function visual_map_print_item($mode = "read", $layoutData, $url = $server["server_url"] . - '/index.php?sec=estado&sec2=operation/agentes/status_monitor&id_module=' . $layoutData['id_agente_modulo']; + '/index.php?sec=view&sec2=operation/agentes/status_monitor&id_module=' . $layoutData['id_agente_modulo']; } else { $url = - $config['homeurl'].'/index.php?sec=estado&sec2=operation/agentes/status_monitor&id_module=' . $layoutData['id_agente_modulo']; + $config['homeurl'].'/index.php?sec=view&sec2=operation/agentes/status_monitor&id_module=' . $layoutData['id_agente_modulo']; } } else { @@ -696,7 +696,7 @@ function visual_map_print_item($mode = "read", $layoutData, else { if (empty($layoutData['id_metaconsole'])) { $url = $config['homeurl'] . - '/index.php?sec=estado&sec2=operation/agentes/status_monitor&id_module=' . $layoutData['id_agente_modulo']; + '/index.php?sec=view&sec2=operation/agentes/status_monitor&id_module=' . $layoutData['id_agente_modulo']; } else { $url = ui_meta_get_url_console_child( From 385685de8a9cf886fb21b84d2ccea568475e3311 Mon Sep 17 00:00:00 2001 From: Arturo Gonzalez Date: Tue, 31 Oct 2017 09:35:13 +0100 Subject: [PATCH 045/149] Added safe input to agent name --- pandora_console/include/functions_networkmap.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandora_console/include/functions_networkmap.php b/pandora_console/include/functions_networkmap.php index e1417ceec1..aea248e829 100644 --- a/pandora_console/include/functions_networkmap.php +++ b/pandora_console/include/functions_networkmap.php @@ -1111,7 +1111,7 @@ function networkmap_create_agent_node ($agent, $simple = 0, $font_size = 10, $cu } $node = "\n" . $agent['id_node'].' [ parent="' . $agent['id_parent'] . '", color="'.$status_color.'", fontsize='.$font_size.', style="filled", fixedsize=true, width=0.40, height=0.40, label=< -
      ' . $img_node . '
      '.io_safe_output($name).'
      >, + '.io_safe_input($name).'>, shape="doublecircle", URL="'.$url.'", tooltip="' . $url_tooltip . '"];' . "\n"; } From 3ead7ca3daeaa8edef370265ff256ab52ffa8e81 Mon Sep 17 00:00:00 2001 From: Arturo Gonzalez Date: Tue, 31 Oct 2017 11:11:30 +0100 Subject: [PATCH 046/149] Added the options in networkmap editor --- .../agentes/pandora_networkmap.editor.php | 22 ++++++++++++-- .../operation/agentes/pandora_networkmap.php | 29 +++++++++---------- .../agentes/pandora_networkmap.view.php | 10 +++++-- 3 files changed, 42 insertions(+), 19 deletions(-) diff --git a/pandora_console/operation/agentes/pandora_networkmap.editor.php b/pandora_console/operation/agentes/pandora_networkmap.editor.php index eea978db77..3c401b2985 100644 --- a/pandora_console/operation/agentes/pandora_networkmap.editor.php +++ b/pandora_console/operation/agentes/pandora_networkmap.editor.php @@ -38,6 +38,9 @@ if ($new_networkmap) { $source = 'group'; $ip_mask = ''; $dont_show_subgroups = false; + $offset_x = ""; + $offset_y = ""; + $scale_z = 0.5; } $disabled_generation_method_select = false; @@ -75,6 +78,10 @@ if ($edit_networkmap) { $description = $values['description']; $filter = json_decode($values['filter'], true); + + $offset_x = $filter['x_offs']; + $offset_y = $filter['y_offs']; + $scale_z = $filter['z_dash']; $node_radius = $filter['node_radius']; @@ -190,6 +197,17 @@ else { $table->data[3][0] = __('Description'); $table->data[3][1] = html_print_textarea ('description', 7, 25, $description, '', true); + + $table->data[4][0] = __('Position X'); + $table->data[4][1] = html_print_input_text ('pos_x', $offset_x, '', 2, 10,true); + $table->data[5][0] = __('Position Y'); + $table->data[5][1] = html_print_input_text ('pos_y', $offset_y, '', 2, 10,true); + + $table->data[6][0] = __('Zoom scale'); + if ($scale_z == "") { + $scale_z = 0.5; + } + $table->data[6][1] = html_print_input_text ('scale_z', $scale_z, '', 2, 10,true) . ui_print_help_tip (__('Introduce zoom level. 1 = Highest resolution. Figures may include decimals'), true); $table->data['source'][0] = __('Source'); $table->data['source'][1] = @@ -222,8 +240,8 @@ else { 'radial_dinamic' => 'radial dinamic' ); - $table->data[4][0] = __('Method generation networkmap'); - $table->data[4][1] = html_print_select($methods, 'method', $method, + $table->data[7][0] = __('Method generation networkmap'); + $table->data[7][1] = html_print_select($methods, 'method', $method, '', '', 'twopi', true, false, true, '', $disabled_generation_method_select); diff --git a/pandora_console/operation/agentes/pandora_networkmap.php b/pandora_console/operation/agentes/pandora_networkmap.php index 9e44b92338..d1a053f6dc 100644 --- a/pandora_console/operation/agentes/pandora_networkmap.php +++ b/pandora_console/operation/agentes/pandora_networkmap.php @@ -84,6 +84,10 @@ if ($new_networkmap || $save_networkmap) { $dont_show_subgroups = (int)get_parameter('dont_show_subgroups', 0); $node_radius = (int)get_parameter('node_radius', 40); $description = get_parameter('description', ''); + + $offset_x = get_parameter('pos_x'); + $offset_y = get_parameter('pos_y'); + $scale_z = get_parameter('scale_z', 0.5); $values = array(); $values['name'] = $name; @@ -141,6 +145,9 @@ if ($new_networkmap || $save_networkmap) { $filter = array(); $filter['dont_show_subgroups'] = $dont_show_subgroups; $filter['node_radius'] = $node_radius; + $filter['x_offs'] = $offset_x; + $filter['y_offs'] = $offset_y; + $filter['z_dash'] = $scale_z; $values['filter'] = json_encode($filter); $result = false; @@ -209,26 +216,15 @@ else if ($update_networkmap || $copy_networkmap || $delete) { 'recon_task_id', 0); $source = (string)get_parameter('source', 'group'); + + $offset_x = get_parameter('pos_x'); + $offset_y = get_parameter('pos_y'); + $scale_z = get_parameter('scale_z', 0.5); $values = array(); $values['name'] = $name; $values['id_group'] = $id_group; - /* - if ($source == 'group') { - $values['source'] = 0; - $values['source_data'] = $id_group; - } - else if ($source == 'recon_task') { - $values['source'] = 1; - $values['source_data'] = $recon_task_id; - } - else if ($source == 'ip_mask') { - $values['source'] = 2; - $values['source_data'] = $ip_mask; - } - */ - switch ($method) { case 'twopi': $values['generation_method'] = 2; @@ -262,6 +258,9 @@ else if ($update_networkmap || $copy_networkmap || $delete) { $filter = json_decode($row['filter'], true); $filter['dont_show_subgroups'] = $dont_show_subgroups; $filter['node_radius'] = $node_radius; + $filter['x_offs'] = $offset_x; + $filter['y_offs'] = $offset_y; + $filter['z_dash'] = $scale_z; $values['filter'] = json_encode($filter); diff --git a/pandora_console/operation/agentes/pandora_networkmap.view.php b/pandora_console/operation/agentes/pandora_networkmap.view.php index 5c5d2969c4..ef839b2b63 100644 --- a/pandora_console/operation/agentes/pandora_networkmap.view.php +++ b/pandora_console/operation/agentes/pandora_networkmap.view.php @@ -681,6 +681,8 @@ $id = (int) get_parameter('id_networkmap', 0); $dash_mode = 0; $map_dash_details = array(); +$networkmap = db_get_row('tmap', 'id', $id); + if (enterprise_installed()) { include_once("enterprise/dashboard/widgets/network_map.php"); if ($id_networkmap) { @@ -693,10 +695,14 @@ if (enterprise_installed()) { $map_dash_details['y_offs'] = $y_offs; $map_dash_details['z_dash'] = $z_dash; } + else { + $networkmap_filter = json_decode($networkmap['filter'], true); + $map_dash_details['x_offs'] = $networkmap_filter['x_offs']; + $map_dash_details['y_offs'] = $networkmap_filter['y_offs']; + $map_dash_details['z_dash'] = $networkmap_filter['z_dash']; + } } -$networkmap = db_get_row('tmap', 'id', $id); - if ($networkmap === false) { ui_print_page_header(__('Networkmap'), "images/bricks.png", false, "network_map_enterprise", false); From 1a04e6085a155a639881617e20d2818237752399 Mon Sep 17 00:00:00 2001 From: Arturo Gonzalez Date: Tue, 31 Oct 2017 13:17:51 +0100 Subject: [PATCH 047/149] Added empty networkmap functions --- .../include/functions_pandora_networkmap.php | 433 +++++++++++------- .../operation/agentes/pandora_networkmap.php | 137 ++++++ 2 files changed, 409 insertions(+), 161 deletions(-) diff --git a/pandora_console/include/functions_pandora_networkmap.php b/pandora_console/include/functions_pandora_networkmap.php index 0bbb4dd124..8ad6191777 100644 --- a/pandora_console/include/functions_pandora_networkmap.php +++ b/pandora_console/include/functions_pandora_networkmap.php @@ -43,7 +43,7 @@ function networkmap_process_networkmap($id = 0) { $networkmap = db_get_row_filter('tmap', array('id' => $id)); - $filter = json_decode($networkmap['filter'], true); + $map_filter = json_decode($networkmap['filter'], true); $pure = (int)get_parameter('pure', 0); @@ -95,181 +95,292 @@ function networkmap_process_networkmap($id = 0) { } $nodes_and_relations = array(); - + if (enterprise_installed() && ($numNodes > 0)) { $nodes_and_relations = get_structure_nodes($id); } else { - // Generate dot file - $graph = networkmap_generate_dot (__('Pandora FMS'), - $id_group, - $simple, - $font_size, - $layout, - $nooverlap, - $zoom, - $ranksep, - $center, - $regen, - $pure, - $id, - $show_snmp_modules, - false, //cut_names - true, // relative - '', - $ip_mask, - $dont_show_subgroups, - false, - null, - $old_mode); - - switch (PHP_OS) { - case "WIN32": - case "WINNT": - case "Windows": - $filename_dot = sys_get_temp_dir() . "\\networkmap_" . $filter; - break; - default: - $filename_dot = sys_get_temp_dir() . "/networkmap_" . $filter; - break; - } - - if ($simple) { - $filename_dot .= "_simple"; - } - if ($nooverlap) { - $filename_dot .= "_nooverlap"; - } - $filename_dot .= "_" . $id . ".dot"; + if ($map_filter['empty_map']) { + // Open Graph + $graph = networkmap_open_graph ($layout, $nooverlap, $pure, $zoom, + $ranksep, $font_size, null); + $graph .= networkmap_create_pandora_node (__('Pandora FMS'), $font_size, $simple); + $graph .= networkmap_close_graph (); - file_put_contents($filename_dot, $graph); + switch (PHP_OS) { + case "WIN32": + case "WINNT": + case "Windows": + $filename_dot = sys_get_temp_dir() . "\\networkmap_" . $filter; + break; + default: + $filename_dot = sys_get_temp_dir() . "/networkmap_" . $filter; + break; + } + + if ($simple) { + $filename_dot .= "_simple"; + } + if ($nooverlap) { + $filename_dot .= "_nooverlap"; + } + $filename_dot .= "_" . $id . ".dot"; - switch (PHP_OS) { - case "WIN32": - case "WINNT": - case "Windows": - $filename_plain = sys_get_temp_dir() . "\\plain.txt"; - - $cmd = io_safe_output($config['graphviz_bin_dir'] . "\\$filter.exe -Tplain -o " . $filename_plain . " " . - $filename_dot); - break; - default: - $filename_plain = sys_get_temp_dir() . "/plain.txt"; + file_put_contents($filename_dot, $graph); - $cmd = "$filter -Tplain -o " . $filename_plain . " " . - $filename_dot; - break; - } + switch (PHP_OS) { + case "WIN32": + case "WINNT": + case "Windows": + $filename_plain = sys_get_temp_dir() . "\\plain.txt"; + + $cmd = io_safe_output($config['graphviz_bin_dir'] . "\\$filter.exe -Tplain -o " . $filename_plain . " " . + $filename_dot); + break; + default: + $filename_plain = sys_get_temp_dir() . "/plain.txt"; - system ($cmd); - - unlink($filename_dot); - - $nodes = networkmap_loadfile($id, $filename_plain, - $relation_nodes, $graph); - - unlink($filename_plain); + $cmd = "$filter -Tplain -o " . $filename_plain . " " . + $filename_dot; + break; + } - //Set the position of modules - foreach ($nodes as $key => $node) { - if ($node['type'] == 'module') { - //Search the agent of this module for to get the - //position - foreach ($nodes as $key2 => $node2) { - if ($node2['id_agent'] != 0 && $node2['type'] == 'agent') { - if ($node2['id_agent'] == $node['id_agent']) { - $nodes[$key]['coords'][0] = - $nodes[$key2]['coords'][0] + $node['height'] / 2; - $nodes[$key]['coords'][1] = - $nodes[$key2]['coords'][1] + $node['width'] / 2; + system ($cmd); + + unlink($filename_dot); + + $nodes = networkmap_loadfile($id, $filename_plain, + $relation_nodes, $graph); + + unlink($filename_plain); + + //Set the position of modules + foreach ($nodes as $key => $node) { + if ($node['type'] == 'module') { + //Search the agent of this module for to get the + //position + foreach ($nodes as $key2 => $node2) { + if ($node2['id_agent'] != 0 && $node2['type'] == 'agent') { + if ($node2['id_agent'] == $node['id_agent']) { + $nodes[$key]['coords'][0] = + $nodes[$key2]['coords'][0] + $node['height'] / 2; + $nodes[$key]['coords'][1] = + $nodes[$key2]['coords'][1] + $node['width'] / 2; + } } } } } + + $nodes_and_relations['nodes'] = array(); + $index = 0; + foreach ($nodes as $key => $node) { + $nodes_and_relations['nodes'][$index]['id_map'] = $id; + + $nodes_and_relations['nodes'][$index]['x'] = (int)$node['coords'][0]; + $nodes_and_relations['nodes'][$index]['y'] = (int)$node['coords'][1]; + + if (($node['type'] == 'agent') || ($node['type'] == '')) { + $nodes_and_relations['nodes'][$index]['source_data'] = $node['id_agent']; + $nodes_and_relations['nodes'][$index]['type'] = 0; + } + else { + $nodes_and_relations['nodes'][$index]['source_data'] = $node['id_module']; + $nodes_and_relations['nodes'][$index]['id_agent'] = $node['id_agent']; + $nodes_and_relations['nodes'][$index]['type'] = 1; + } + + $style = array(); + $style['shape'] = 'circle'; + $style['image'] = $node['image']; + $style['width'] = $node['width']; + $style['height'] = $node['height']; + $style['label'] = $node['text']; + $nodes_and_relations['nodes'][$index]['style'] = json_encode($style); + + $index++; + } + + $nodes_and_relations['relations'] = array(); + + if (enterprise_installed()) { + enterprise_include_once("include/functions_pandora_networkmap.php"); + save_generate_nodes($id, $nodes_and_relations); + } + } + else { + // Generate dot file + $graph = networkmap_generate_dot (__('Pandora FMS'), + $id_group, + $simple, + $font_size, + $layout, + $nooverlap, + $zoom, + $ranksep, + $center, + $regen, + $pure, + $id, + $show_snmp_modules, + false, //cut_names + true, // relative + '', + $ip_mask, + $dont_show_subgroups, + false, + null, + $old_mode); + + switch (PHP_OS) { + case "WIN32": + case "WINNT": + case "Windows": + $filename_dot = sys_get_temp_dir() . "\\networkmap_" . $filter; + break; + default: + $filename_dot = sys_get_temp_dir() . "/networkmap_" . $filter; + break; + } + + if ($simple) { + $filename_dot .= "_simple"; + } + if ($nooverlap) { + $filename_dot .= "_nooverlap"; + } + $filename_dot .= "_" . $id . ".dot"; + + file_put_contents($filename_dot, $graph); + + switch (PHP_OS) { + case "WIN32": + case "WINNT": + case "Windows": + $filename_plain = sys_get_temp_dir() . "\\plain.txt"; + + $cmd = io_safe_output($config['graphviz_bin_dir'] . "\\$filter.exe -Tplain -o " . $filename_plain . " " . + $filename_dot); + break; + default: + $filename_plain = sys_get_temp_dir() . "/plain.txt"; + + $cmd = "$filter -Tplain -o " . $filename_plain . " " . + $filename_dot; + break; + } + + system ($cmd); + + unlink($filename_dot); + + $nodes = networkmap_loadfile($id, $filename_plain, + $relation_nodes, $graph); + + unlink($filename_plain); + + //Set the position of modules + foreach ($nodes as $key => $node) { + if ($node['type'] == 'module') { + //Search the agent of this module for to get the + //position + foreach ($nodes as $key2 => $node2) { + if ($node2['id_agent'] != 0 && $node2['type'] == 'agent') { + if ($node2['id_agent'] == $node['id_agent']) { + $nodes[$key]['coords'][0] = + $nodes[$key2]['coords'][0] + $node['height'] / 2; + $nodes[$key]['coords'][1] = + $nodes[$key2]['coords'][1] + $node['width'] / 2; + } + } + } + } + } + + $nodes_and_relations['nodes'] = array(); + $index = 0; + foreach ($nodes as $key => $node) { + $nodes_and_relations['nodes'][$index]['id_map'] = $id; + + $nodes_and_relations['nodes'][$index]['x'] = (int)$node['coords'][0]; + $nodes_and_relations['nodes'][$index]['y'] = (int)$node['coords'][1]; + + if (($node['type'] == 'agent') || ($node['type'] == '')) { + $nodes_and_relations['nodes'][$index]['source_data'] = $node['id_agent']; + $nodes_and_relations['nodes'][$index]['type'] = 0; + } + else { + $nodes_and_relations['nodes'][$index]['source_data'] = $node['id_module']; + $nodes_and_relations['nodes'][$index]['id_agent'] = $node['id_agent']; + $nodes_and_relations['nodes'][$index]['type'] = 1; + } + + $style = array(); + $style['shape'] = 'circle'; + $style['image'] = $node['image']; + $style['width'] = $node['width']; + $style['height'] = $node['height']; + $style['label'] = $node['text']; + $nodes_and_relations['nodes'][$index]['style'] = json_encode($style); + + $index++; + } + + $nodes_and_relations['relations'] = array(); + $index = 0; + foreach ($relation_nodes as $relation) { + $nodes_and_relations['relations'][$index]['id_map'] = $id; + + if (($relation['parent_type'] == 'agent') || ($relation['parent_type'] == '')) { + $nodes_and_relations['relations'][$index]['id_parent'] = $relation['id_parent']; + $nodes_and_relations['relations'][$index]['id_parent_source_data'] = $nodes[$relation['id_parent']]['id_agent']; + $nodes_and_relations['relations'][$index]['parent_type'] = 0; + } + else if ($relation['parent_type'] == 'module') { + $nodes_and_relations['relations'][$index]['id_parent'] = $relation['id_parent']; + $nodes_and_relations['relations'][$index]['id_parent_source_data'] = $nodes[$relation['id_parent']]['id_module']; + $nodes_and_relations['relations'][$index]['parent_type'] = 1; + } + else { + $nodes_and_relations['relations'][$index]['id_parent'] = $relation['id_parent']; + $nodes_and_relations['relations'][$index]['id_child_source_data'] = -2; + $nodes_and_relations['relations'][$index]['parent_type'] = 3; + } + + if (($relation['child_type'] == 'agent') || ($relation['child_type'] == '')) { + $nodes_and_relations['relations'][$index]['id_child'] = $relation['id_child']; + $nodes_and_relations['relations'][$index]['id_child_source_data'] = $nodes[$relation['id_child']]['id_agent']; + $nodes_and_relations['relations'][$index]['child_type'] = 0; + } + else if ($relation['child_type'] == 'module') { + $nodes_and_relations['relations'][$index]['id_child'] = $relation['id_child']; + $nodes_and_relations['relations'][$index]['id_child_source_data'] = $nodes[$relation['id_child']]['id_module']; + $nodes_and_relations['relations'][$index]['child_type'] = 1; + } + else { + $nodes_and_relations['relations'][$index]['id_child'] = $relation['id_child']; + $nodes_and_relations['relations'][$index]['id_child_source_data'] = -2; + $nodes_and_relations['relations'][$index]['child_type'] = 3; + } + + $index++; + } + + if (enterprise_installed()) { + enterprise_include_once("include/functions_pandora_networkmap.php"); + save_generate_nodes($id, $nodes_and_relations); + } + + $pandorafms_node = $nodes_and_relations['nodes'][0]; + $center = array('x' => $pandorafms_node['x'], 'y' => $pandorafms_node['y']); + + $networkmap['center_x'] = $center['x']; + $networkmap['center_y'] = $center['y']; + db_process_sql_update('tmap', + array('center_x' => $networkmap['center_x'], 'center_y' => $networkmap['center_y']), + array('id' => $id)); } - $nodes_and_relations['nodes'] = array(); - $index = 0; - foreach ($nodes as $key => $node) { - $nodes_and_relations['nodes'][$index]['id_map'] = $id; - - $nodes_and_relations['nodes'][$index]['x'] = (int)$node['coords'][0]; - $nodes_and_relations['nodes'][$index]['y'] = (int)$node['coords'][1]; - - if (($node['type'] == 'agent') || ($node['type'] == '')) { - $nodes_and_relations['nodes'][$index]['source_data'] = $node['id_agent']; - $nodes_and_relations['nodes'][$index]['type'] = 0; - } - else { - $nodes_and_relations['nodes'][$index]['source_data'] = $node['id_module']; - $nodes_and_relations['nodes'][$index]['id_agent'] = $node['id_agent']; - $nodes_and_relations['nodes'][$index]['type'] = 1; - } - - $style = array(); - $style['shape'] = 'circle'; - $style['image'] = $node['image']; - $style['width'] = $node['width']; - $style['height'] = $node['height']; - $style['label'] = $node['text']; - $nodes_and_relations['nodes'][$index]['style'] = json_encode($style); - - $index++; - } - - $nodes_and_relations['relations'] = array(); - $index = 0; - foreach ($relation_nodes as $relation) { - $nodes_and_relations['relations'][$index]['id_map'] = $id; - - if (($relation['parent_type'] == 'agent') || ($relation['parent_type'] == '')) { - $nodes_and_relations['relations'][$index]['id_parent'] = $relation['id_parent']; - $nodes_and_relations['relations'][$index]['id_parent_source_data'] = $nodes[$relation['id_parent']]['id_agent']; - $nodes_and_relations['relations'][$index]['parent_type'] = 0; - } - else if ($relation['parent_type'] == 'module') { - $nodes_and_relations['relations'][$index]['id_parent'] = $relation['id_parent']; - $nodes_and_relations['relations'][$index]['id_parent_source_data'] = $nodes[$relation['id_parent']]['id_module']; - $nodes_and_relations['relations'][$index]['parent_type'] = 1; - } - else { - $nodes_and_relations['relations'][$index]['id_parent'] = $relation['id_parent']; - $nodes_and_relations['relations'][$index]['id_child_source_data'] = -2; - $nodes_and_relations['relations'][$index]['parent_type'] = 3; - } - - if (($relation['child_type'] == 'agent') || ($relation['child_type'] == '')) { - $nodes_and_relations['relations'][$index]['id_child'] = $relation['id_child']; - $nodes_and_relations['relations'][$index]['id_child_source_data'] = $nodes[$relation['id_child']]['id_agent']; - $nodes_and_relations['relations'][$index]['child_type'] = 0; - } - else if ($relation['child_type'] == 'module') { - $nodes_and_relations['relations'][$index]['id_child'] = $relation['id_child']; - $nodes_and_relations['relations'][$index]['id_child_source_data'] = $nodes[$relation['id_child']]['id_module']; - $nodes_and_relations['relations'][$index]['child_type'] = 1; - } - else { - $nodes_and_relations['relations'][$index]['id_child'] = $relation['id_child']; - $nodes_and_relations['relations'][$index]['id_child_source_data'] = -2; - $nodes_and_relations['relations'][$index]['child_type'] = 3; - } - - $index++; - } - - if (enterprise_installed()) { - enterprise_include_once("include/functions_pandora_networkmap.php"); - save_generate_nodes($id, $nodes_and_relations); - } - - $pandorafms_node = $nodes_and_relations['nodes'][0]; - $center = array('x' => $pandorafms_node['x'], 'y' => $pandorafms_node['y']); - - $networkmap['center_x'] = $center['x']; - $networkmap['center_y'] = $center['y']; - db_process_sql_update('tmap', - array('center_x' => $networkmap['center_x'], 'center_y' => $networkmap['center_y']), - array('id' => $id)); } return $nodes_and_relations; diff --git a/pandora_console/operation/agentes/pandora_networkmap.php b/pandora_console/operation/agentes/pandora_networkmap.php index 9e44b92338..cbe97ba403 100644 --- a/pandora_console/operation/agentes/pandora_networkmap.php +++ b/pandora_console/operation/agentes/pandora_networkmap.php @@ -33,10 +33,138 @@ include_once("include/functions_pandora_networkmap.php"); $new_networkmap = (bool) get_parameter('new_networkmap', false); $save_networkmap = (bool) get_parameter('save_networkmap', false); +$save_empty_networkmap = (bool) get_parameter('save_empty_networkmap', false); +$update_empty_networkmap = (bool) get_parameter('save_empty_networkmap', false); $update_networkmap = (bool) get_parameter('update_networkmap', false); $copy_networkmap = (bool) get_parameter('copy_networkmap', false); $delete = (bool) get_parameter('delete', false); $tab = (string) get_parameter('tab', 'list'); +$new_empty_networkmap = get_parameter('new_empty_networkmap', false); + +if (enterprise_installed()) { + if ($new_empty_networkmap) { + if ($networkmaps_write || $networkmaps_manage) { + require ($config["homedir"]."/enterprise/godmode/agentes/pandora_networkmap_empty.editor.php"); + require('pandora_networkmap_empty.editor.php'); + return; + } + } + + if ($save_empty_networkmap) { + $id_group = (int) get_parameter('id_group', 0); + + // ACL for the network map + // $networkmap_read = check_acl ($config['id_user'], $id_group, "MR"); + $networkmap_write = check_acl ($config['id_user'], $id_group, "MW"); + $networkmap_manage = check_acl ($config['id_user'], $id_group, "MM"); + + if (!$networkmap_write && !$networkmap_manage) { + db_pandora_audit("ACL Violation", + "Trying to access networkmap"); + require ("general/noaccess.php"); + return; + } + + $name = (string) get_parameter('name', ''); + + // Default size values + $width = 4000; + $height = 4000; + + $method = (string) get_parameter('method', 'fdp'); + + $dont_show_subgroups = 0; + $node_radius = (int)get_parameter('node_radius', 40); + $description = get_parameter('description', ''); + + $values = array(); + $values['name'] = $name; + $values['id_group'] = $id_group; + $values['source_period'] = 60; + $values['width'] = $width; + $values['height'] = $height; + $values['id_user'] = $config['id_user']; + $values['description'] = $description; + $values['source'] = 0; + $values['source_data'] = $id_group; + + + if (!$networkmap_write && !$networkmap_manage) { + db_pandora_audit("ACL Violation", + "Trying to access networkmap"); + require ("general/noaccess.php"); + return; + } + + $filter = array(); + $filter['dont_show_subgroups'] = $dont_show_subgroups; + $filter['node_radius'] = $node_radius; + $filter['empty_map'] = 1; + $values['filter'] = json_encode($filter); + + $result = false; + if (!empty($name)) { + $result = db_process_sql_insert('tmap', + $values); + } + + $result_txt = ui_print_result_message($result, + __('Succesfully created'), __('Could not be created'), '', + true); + + // Force the tab = 'list' + $tab = "list"; + } + else if ($update_empty_networkmap) { + $id_group = (int) get_parameter('id_group', 0); + + // ACL for the new network map + $networkmap_write_new = check_acl ($config['id_user'], $id_group, "MW"); + $networkmap_manage_new = check_acl ($config['id_user'], $id_group, "MM"); + + if (!$networkmap_write && !$networkmap_manage) { + db_pandora_audit("ACL Violation", + "Trying to access networkmap"); + require ("general/noaccess.php"); + return; + } + + $name = (string) get_parameter('name', ''); + + $recon_task_id = (int) get_parameter( + 'recon_task_id', 0); + + $source = (string)get_parameter('source', 'group'); + + $values = array(); + $values['name'] = $name; + $values['id_group'] = $id_group; + + $values['generation_method'] = 4; + + $description = get_parameter('description', ''); + $values['description'] = $description; + + $dont_show_subgroups = 0; + $node_radius = (int)get_parameter('node_radius', 40); + $row = db_get_row('tmap', 'id', $id); + $filter = json_decode($row['filter'], true); + $filter['dont_show_subgroups'] = $dont_show_subgroups; + $filter['node_radius'] = $node_radius; + + $values['filter'] = json_encode($filter); + + $result = false; + if (!empty($name)) { + $result = db_process_sql_update('tmap', + $values, array('id' => $id)); + } + + $result_txt = ui_print_result_message($result, + __('Succesfully updated'), __('Could not be updated'), '', + true); + } +} $result_txt = ''; // The networkmap doesn't exist yet @@ -546,6 +674,15 @@ switch ($tab) { html_print_submit_button (__('Create networkmap'), 'crt', false, 'class="sub next" style="float: right;"'); echo ""; echo "

    "; + + if (enterprise_installed()) { + echo "
    "; + echo '
    '; + html_print_input_hidden ('new_empty_networkmap', 1); + html_print_submit_button (__('Create empty networkmap'), 'crt', false, 'class="sub next" style="float: right; margin-right:20px;"'); + echo "
    "; + echo "
    "; + } } break; From 15c87bdd67b2c4b43b9ec59ce1043f28db414a69 Mon Sep 17 00:00:00 2001 From: Alejandro Gallardo Escobar Date: Tue, 31 Oct 2017 16:43:49 +0100 Subject: [PATCH 048/149] [Console > Events view] Removed the events graph to improve ~75% the render time --- .../operation/events/events_list.php | 108 ------------------ 1 file changed, 108 deletions(-) diff --git a/pandora_console/operation/events/events_list.php b/pandora_console/operation/events/events_list.php index a9574b21bf..a4d773fde7 100644 --- a/pandora_console/operation/events/events_list.php +++ b/pandora_console/operation/events/events_list.php @@ -13,7 +13,6 @@ // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. - // Load global vars global $config; @@ -671,8 +670,6 @@ if ($event_w || $event_m) { $data[0] .= '' . html_print_image("images/load.png", true, array("border" => '0', "title" => __('Load filter'), "alt" => __('Load filter'))) . '  '; -$data[0] .= '' . - html_print_image('images/chart_curve.png', true, array('title' => __('Show events graph'))) . '
    '; $data[0] .= '
    '; @@ -787,8 +784,6 @@ elseif ($group_rep == 2) { $history); } - - // Active filter tag view call (only enterprise version) // It is required to pass some references to enterprise function // to translate the active filters @@ -803,87 +798,6 @@ enterprise_hook('print_event_tags_active_filters', ) ); -if (!empty($result)) { - if ($group_rep == 0) { - $sql = "SELECT COUNT(id_evento) - FROM $event_table - WHERE 1=1 " . $sql_post; - } - elseif ($group_rep == 1) { - switch ($config["dbtype"]) { - case "mysql": - case "postgresql": - $sql = "SELECT COUNT(1) - FROM (SELECT 1 - FROM $event_table - WHERE 1=1 " . $sql_post . " - GROUP BY evento, id_agentmodule) t"; - break; - case "oracle": - $sql = "SELECT COUNT(1) - FROM (SELECT 1 - FROM $event_table - WHERE 1=1 " . $sql_post . " - GROUP BY to_char(evento), id_agentmodule) t"; - break; - } - } - elseif ($group_rep == 2) { - - } - $limit = (int) db_get_sql ($sql); - - if ($group_rep == 0) { - switch ($config["dbtype"]) { - case "mysql": - $sql = "SELECT *, 1 event_rep - FROM $event_table - WHERE 1=1 " . $sql_post . " - ORDER BY utimestamp DESC LIMIT 0,".$limit; - break; - case "postgresql": - $sql = "SELECT *, 1 event_rep - FROM $event_table - WHERE 1=1 " . $sql_post . " - ORDER BY utimestamp DESC LIMIT ".$limit." OFFSET 0"; - break; - case "oracle": - $set = array(); - $set['limit'] = $pagination; - $set['offset'] = $offset; - $sql = "SELECT $event_table.*, 1 event_rep - FROM $event_table - WHERE 1=1 " . $sql_post . " - ORDER BY utimestamp DESC"; - $sql = oracle_recode_query ($sql, $set); - break; - } - - //Extract the events by filter (or not) from db - $results_graph = db_get_all_rows_sql ($sql); - } - elseif ($group_rep == 1) { - $results_graph = events_get_events_grouped($sql_post, - 0, - $limit, - $meta, - $history); - } - elseif ($group_rep == 2) { - - } - - if (($group_rep == 1) OR ($group_rep == 0)) { - $graph = '
    ' . - grafico_eventos_agente(350, 185, - $results_graph, $meta, $history, $tags_acls_condition,$limit) . - '
    '; - html_print_div(array('id' => 'events_graph', - 'hidden' => true, 'content' => $graph)); - } -} - - if (!empty($result)) { //~ Checking the event tags exactly. The event query filters approximated tags to keep events //~ with several tags @@ -986,11 +900,6 @@ $(document).ready( function() { $("#text-date_from, #text-date_to").datepicker({dateFormat: ""}); - // If the events are not charged, dont show graphs link - if ($('#events_graph').val() == undefined) { - $('#events_graph_link').hide(); - } - // Don't collapse filter if update button has been pushed if ($("#hidden-open_filter").val() == 'true') { $("#event_control").toggle(); @@ -1658,23 +1567,6 @@ function reorder_tags_inputs() { } } -// Show the modal window of an module -function show_events_graph_dialog() { - $("#events_graph").hide () - .dialog ({ - resizable: true, - draggable: true, - title: '', - modal: true, - overlay: { - opacity: 0.5, - background: "black" - }, - width: 450, - height: 380 - }) - .show (); -} /* ]]> */ //function datetime From 92c7eb59f504502f47abf1736869f8fb74ccfeeb Mon Sep 17 00:00:00 2001 From: fermin831 Date: Tue, 31 Oct 2017 19:48:56 +0100 Subject: [PATCH 049/149] Fixed public dashboard permissions --- pandora_console/include/ajax/visual_console.ajax.php | 5 ++++- .../operation/agentes/pandora_networkmap.view.php | 6 ++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/pandora_console/include/ajax/visual_console.ajax.php b/pandora_console/include/ajax/visual_console.ajax.php index 789398139c..2e95d16fca 100644 --- a/pandora_console/include/ajax/visual_console.ajax.php +++ b/pandora_console/include/ajax/visual_console.ajax.php @@ -15,7 +15,10 @@ // Login check global $config; -check_login (); +// Public dashboards have not user. Try to get from URL +if (!isset($config['id_user'])) { + $config['id_user'] = get_parameter('id_user'); +} // Fix: IW was the old ACL to check for report editing, now is RW if (! check_acl ($config['id_user'], 0, "VR")) { diff --git a/pandora_console/operation/agentes/pandora_networkmap.view.php b/pandora_console/operation/agentes/pandora_networkmap.view.php index 5c5d2969c4..e20eaec9a7 100644 --- a/pandora_console/operation/agentes/pandora_networkmap.view.php +++ b/pandora_console/operation/agentes/pandora_networkmap.view.php @@ -13,8 +13,10 @@ // Load global variables global $config; -// Check user credentials -check_login(); +// Public dashboards have not user. Try to get from URL +if (!isset($config['id_user'])) { + $config['id_user'] = get_parameter('id_user'); +} require_once ('include/functions_pandora_networkmap.php'); enterprise_include_once('include/functions_policies.php'); From 443163515db7856a998f81d60d9ac2bfee1601ec Mon Sep 17 00:00:00 2001 From: fermin831 Date: Thu, 2 Nov 2017 15:51:37 +0100 Subject: [PATCH 050/149] Added checkbox to free search on agents data view --- pandora_console/include/ajax/module.php | 28 ++++++++++++------- pandora_console/include/functions_modules.php | 20 ++++++++++++- .../operation/agentes/estado_monitores.php | 11 ++++++-- 3 files changed, 46 insertions(+), 13 deletions(-) diff --git a/pandora_console/include/ajax/module.php b/pandora_console/include/ajax/module.php index a174c84ba5..7daf28fcd1 100755 --- a/pandora_console/include/ajax/module.php +++ b/pandora_console/include/ajax/module.php @@ -124,6 +124,7 @@ if ($get_module_detail) { $date_to = (string) get_parameter ('date_to', date ('Y-m-j')); $time_to = (string) get_parameter ('time_to', date ('h:iA')); $freesearch = (string) get_parameter ('freesearch', ''); + $free_checkbox = (bool) get_parameter ('free_checkbox', false); $formtable->width = '98%'; $formtable->class = "databox"; @@ -152,18 +153,13 @@ if ($get_module_detail) { "selection_mode", 'fromnow', '', $selection_mode, false, '', 'style="margin-right: 15px;"', true) . __("Choose a time from now"); $formtable->data[0][1] = html_print_select ($periods, 'period', $period, '', '', 0, true, false, false); - if (preg_match("/_string/", $moduletype_name)) { - $formtable->data[0][2] = __('Free search') . ' '; - $formtable->data[0][2] .= html_print_input_text ('freesearch', $freesearch, '', 25, null, true); - } else { - $freesearch = ''; - $formtable->data[0][2] = ''; - } - $formtable->cellstyle[0][3] = 'vertical-align: middle;'; + $formtable->data[0][2] = ''; $formtable->data[0][3] = "" . html_print_image ("images/refresh.png", true, array ("style" => 'vertical-align: middle;', "border" => "0" )) . ""; + $formtable->rowspan[0][3] = 2; + $formtable->cellstyle[0][3] = 'vertical-align: middle;'; $formtable->data[1][0] = html_print_radio_button_extended( "selection_mode", 'range','', $selection_mode, false, '', @@ -184,6 +180,18 @@ if ($get_module_detail) { $formtable->data[1][2] .= html_print_input_text('time_to', $time_to, '', 9, 7, true); + $freesearch_object = ''; + if (preg_match("/_string/", $moduletype_name)) { + $formtable->data[2][0] = __('Free search') . ' '; + $formtable->data[2][1] = html_print_input_text ('freesearch', $freesearch, '', 20, null, true); + $formtable->data[2][2] = html_print_checkbox('free_checkbox', 1, $free_checkbox, true) . + $formtable->data[2][2] .= ' ' . __('Exact phrase'); + $freesearch_object = json_encode( array( + 'value' => io_safe_output($freesearch), + 'exact' => (bool)$free_checkbox + )); + } + html_print_table($formtable); $offset = (int) get_parameter("offset"); @@ -228,10 +236,10 @@ if ($get_module_detail) { } $count = modules_get_agentmodule_data ($module_id, $period, - $date, true, $conexion, 'ASC', $freesearch); + $date, true, $conexion, 'ASC', $freesearch_object); $module_data = modules_get_agentmodule_data ($module_id, $period, - $date, false, $conexion, 'DESC', $freesearch); + $date, false, $conexion, 'DESC', $freesearch_object); if (empty($module_data)) { $result = array(); diff --git a/pandora_console/include/functions_modules.php b/pandora_console/include/functions_modules.php index 0c522ceece..6d09e2d9a9 100755 --- a/pandora_console/include/functions_modules.php +++ b/pandora_console/include/functions_modules.php @@ -1716,6 +1716,13 @@ function modules_get_next_data ($id_agent_module, $utimestamp = 0, $string = 0) * @param int Agent module id * @param int Period of time to check (in seconds) * @param int Top date to check the values. Default current time. + * @param + * @param + * @param string 'ASC' od 'DESC' + * @param string with a json with parameters to filter data + * string object: + * value: Text to search + * exact: Boolean. True if search exact phrase or false to content * * @return array The module value and the timestamp */ @@ -1743,6 +1750,17 @@ function modules_get_agentmodule_data ($id_agent_module, $period, case 17: //async_string case 23: + // Free search is a json with value and exact modifier + $freesearch = json_decode($freesearch, true); + $freesearch_sql = ''; + if (isset($freesearch['value']) && !empty($freesearch['value'])) { + $freesearch_sql = " AND datos "; + if ($freesearch['exact']){ + $freesearch_sql .= "='" . $freesearch['value'] . "' "; + } else { + $freesearch_sql .= " LIKE '%" . $freesearch['value'] . "%' "; + } + } $sql = sprintf ( "SELECT datos AS data, utimestamp FROM tagente_datos_string WHERE id_agente_modulo = %d @@ -1750,7 +1768,7 @@ function modules_get_agentmodule_data ($id_agent_module, $period, AND utimestamp > %d AND utimestamp <= %d ORDER BY utimestamp %s", $id_agent_module, - !empty($freesearch) ? " AND datos REGEXP '" . $freesearch . "' " : "", + $freesearch_sql, $datelimit, $date, $order ); diff --git a/pandora_console/operation/agentes/estado_monitores.php b/pandora_console/operation/agentes/estado_monitores.php index 0d6e9b8c6b..3fceedda4e 100755 --- a/pandora_console/operation/agentes/estado_monitores.php +++ b/pandora_console/operation/agentes/estado_monitores.php @@ -367,8 +367,15 @@ ui_require_jquery_file("ui.datepicker-" . get_user_language(), "include/javascri // Get the free text in both options var freesearch = $('#text-freesearch').val(); - if (freesearch == null) freesearch = ''; - extra_parameters += '&freesearch=' + freesearch; + if (freesearch != null && freesearch !== '') { + var free_checkbox = $('input[name=free_checkbox]:checked').val(); + extra_parameters += '&freesearch=' + freesearch; + if (free_checkbox == 1) { + extra_parameters += '&free_checkbox=1'; + } else { + extra_parameters += '&free_checkbox=0'; + } + } title = ; $.ajax({ From 24e93d0cd6ec82a6d359f76db0e390fc47c12625 Mon Sep 17 00:00:00 2001 From: fermin831 Date: Thu, 2 Nov 2017 18:11:54 +0100 Subject: [PATCH 051/149] Fixed style code --- pandora_console/include/ajax/module.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandora_console/include/ajax/module.php b/pandora_console/include/ajax/module.php index 7daf28fcd1..66063ed5ab 100755 --- a/pandora_console/include/ajax/module.php +++ b/pandora_console/include/ajax/module.php @@ -184,7 +184,7 @@ if ($get_module_detail) { if (preg_match("/_string/", $moduletype_name)) { $formtable->data[2][0] = __('Free search') . ' '; $formtable->data[2][1] = html_print_input_text ('freesearch', $freesearch, '', 20, null, true); - $formtable->data[2][2] = html_print_checkbox('free_checkbox', 1, $free_checkbox, true) . + $formtable->data[2][2] = html_print_checkbox('free_checkbox', 1, $free_checkbox, true); $formtable->data[2][2] .= ' ' . __('Exact phrase'); $freesearch_object = json_encode( array( 'value' => io_safe_output($freesearch), From cffbfd3fb30d9554e1e8e94b3a2bdd8645afed54 Mon Sep 17 00:00:00 2001 From: enriquecd Date: Mon, 6 Nov 2017 12:19:31 +0100 Subject: [PATCH 052/149] Add visual console macros - #1413 --- pandora_console/include/functions_visual_map.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/pandora_console/include/functions_visual_map.php b/pandora_console/include/functions_visual_map.php index 2391dc30a5..c1869798b5 100755 --- a/pandora_console/include/functions_visual_map.php +++ b/pandora_console/include/functions_visual_map.php @@ -3275,7 +3275,7 @@ function visual_map_print_visual_map ($id_layout, $show_links = true, 'proportion_width' => $proportion_width); } - $layout_data['label'] = visual_map_macro($layout_data['label']); + $layout_data['label'] = visual_map_macro($layout_data['label'],$layout_data["id_agente_modulo"]); switch ($layout_data['type']) { case LINE_ITEM: @@ -3661,9 +3661,14 @@ function visual_map_type_in_js($type) { } } -function visual_map_macro($label){ +function visual_map_macro($label,$module){ $label = str_replace('_date_',strftime("%x"),$label); $label = str_replace('_time_',strftime("%T"),$label); + $label = str_replace('_agent_',agents_get_alias(modules_get_agentmodule_agent($module)),$label); + $label = str_replace('_module_',modules_get_agentmodule_name($module),$label); + $label = str_replace('_agentdescription_',agents_get_description(modules_get_agentmodule_agent($module)),$label); + $label = str_replace('_address_',agents_get_address(modules_get_agentmodule_agent($module)),$label); + $label = str_replace('_moduledescription_',modules_get_agentmodule_descripcion($module),$label); return $label; } From a4469975348b1e43a26233b8f6f3fd4dca7194b1 Mon Sep 17 00:00:00 2001 From: fermin831 Date: Mon, 6 Nov 2017 18:45:53 +0100 Subject: [PATCH 053/149] Added wux modules to monitor view --- pandora_console/operation/agentes/status_monitor.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/pandora_console/operation/agentes/status_monitor.php b/pandora_console/operation/agentes/status_monitor.php index 27baeced96..7ac2ef21d7 100644 --- a/pandora_console/operation/agentes/status_monitor.php +++ b/pandora_console/operation/agentes/status_monitor.php @@ -365,6 +365,9 @@ else { $prediction_available = db_get_sql ("SELECT count(*) FROM tserver WHERE server_type = 5"); //POSTGRESQL AND ORACLE COMPATIBLE + $wux_available = db_get_sql ("SELECT count(*) + FROM tserver + WHERE server_type = 17"); //POSTGRESQL AND ORACLE COMPATIBLE // Development mode to use all servers if ($develop_bypass) { @@ -386,6 +389,9 @@ else { $typemodules[5] = __('Prediction server module'); if (enterprise_installed()) { $typemodules[7] = __('Web server module'); + if ($wux_available) { + $typemodules[8] = __('Wux server module'); + } } @@ -443,6 +449,11 @@ else { FROM ttipo_modulo WHERE categoria = 0'); break; + case 8: + $sql = sprintf ('SELECT id_tipo, descripcion + FROM ttipo_modulo + WHERE nombre = \'web_analysis\''); + break; case '': $sql = sprintf ('SELECT id_tipo, descripcion FROM ttipo_modulo'); From fa419aa36787c2bf8443b6766a02be65292ea5fe Mon Sep 17 00:00:00 2001 From: enriquecd Date: Tue, 7 Nov 2017 11:00:33 +0100 Subject: [PATCH 054/149] Change agent events bar height - #1550 --- pandora_console/operation/agentes/estado_generalagente.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandora_console/operation/agentes/estado_generalagente.php b/pandora_console/operation/agentes/estado_generalagente.php index 78f3dd06a4..ae7bcef432 100755 --- a/pandora_console/operation/agentes/estado_generalagente.php +++ b/pandora_console/operation/agentes/estado_generalagente.php @@ -625,7 +625,7 @@ $data[0][0] .= __('Events (24h)') . '' . '
    ' . - graph_graphic_agentevents ($id_agente, 450, 15, SECONDS_1DAY, '', true, true) . + graph_graphic_agentevents ($id_agente, 450, 40, SECONDS_1DAY, '', true, true) . '
    ' . ''; From 092ec0acf6f20db4894f4e61c6d6bdae678e8b42 Mon Sep 17 00:00:00 2001 From: enriquecd Date: Tue, 7 Nov 2017 11:19:31 +0100 Subject: [PATCH 055/149] Disable autorefresh on new dashboard view - #1527 --- pandora_console/general/header.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pandora_console/general/header.php b/pandora_console/general/header.php index e228c1eca4..2ac1e34df4 100644 --- a/pandora_console/general/header.php +++ b/pandora_console/general/header.php @@ -388,6 +388,12 @@ config_check(); $do_refresh = false; } } + + $new_dashboard = get_parameter('new_dashboard',0); + + if ($_GET['sec2'] == 'enterprise/dashboard/main_dashboard' && $new_dashboard) { + $do_refresh = false; + } if ($do_refresh) { ?> From 35ec64e2eae0c132ce2a7bb1a6dd97cddf4203c5 Mon Sep 17 00:00:00 2001 From: Arturo Gonzalez Date: Tue, 7 Nov 2017 11:41:40 +0100 Subject: [PATCH 056/149] Changed flow --- pandora_console/operation/agentes/pandora_networkmap.php | 6 ++++-- .../operation/agentes/pandora_networkmap.view.php | 4 +++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/pandora_console/operation/agentes/pandora_networkmap.php b/pandora_console/operation/agentes/pandora_networkmap.php index 9e44b92338..5f83ca4b9a 100644 --- a/pandora_console/operation/agentes/pandora_networkmap.php +++ b/pandora_console/operation/agentes/pandora_networkmap.php @@ -153,8 +153,10 @@ if ($new_networkmap || $save_networkmap) { __('Succesfully created'), __('Could not be created'), '', true); - // Force the tab = 'list' - $tab = "list"; + $id = $result; + + // Force the tab = 'view' + $tab = "view"; } } // The networkmap exists diff --git a/pandora_console/operation/agentes/pandora_networkmap.view.php b/pandora_console/operation/agentes/pandora_networkmap.view.php index 2ebc1447d2..31acea9986 100644 --- a/pandora_console/operation/agentes/pandora_networkmap.view.php +++ b/pandora_console/operation/agentes/pandora_networkmap.view.php @@ -677,7 +677,9 @@ if (is_ajax ()) { } } //--------------END AJAX------------------------------------------------ -$id = (int) get_parameter('id_networkmap', 0); +if ($id == 0) { + $id = (int) get_parameter('id_networkmap', 0); +} $dash_mode = 0; $map_dash_details = array(); From bff2213e45a7b9c220f191fd8ef41f25a8b7547c Mon Sep 17 00:00:00 2001 From: fermin831 Date: Tue, 7 Nov 2017 14:47:34 +0100 Subject: [PATCH 057/149] Update fired alert when delete it --- pandora_console/include/functions_alerts.php | 23 +++++++++++++------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/pandora_console/include/functions_alerts.php b/pandora_console/include/functions_alerts.php index 8e87eee5b3..577dfe82f1 100644 --- a/pandora_console/include/functions_alerts.php +++ b/pandora_console/include/functions_alerts.php @@ -1039,14 +1039,16 @@ function alerts_delete_alert_agent_module ($id_alert_agent_module, $filter = fal $filter = array (); if ($id_alert_agent_module) $filter['id'] = $id_alert_agent_module; - - // Get the modules of the fired alerts that will be deleted to update counts - $filter_get = $filter; - - $filter_get['group'] = 'id_agent_module'; - $filter_get['times_fired'] = '>0'; - - $fired_alert_modules = db_get_all_rows_filter('talert_template_modules', $filter_get, array('id_agent_module', 'COUNT(*) alerts')); + + // Get the id agent to update the fired alert counts + $agent_id = false; + if (isset ($filter['id_agent_module'])){ + $agent_id = modules_get_agentmodule_agent ($filter["id_agent_module"]); + } + else if (isset ($filter['id'])){ + $alert = alerts_get_alert_agent_module($id_alert_agent_module); + $agent_id = modules_get_agentmodule_agent ($alert["id_agent_module"]); + } /* The deletion of actions from talert_template_module_actions, @@ -1054,6 +1056,11 @@ function alerts_delete_alert_agent_module ($id_alert_agent_module, $filter = fal a foreing key and delete on cascade. */ if (@db_process_sql_delete ('talert_template_modules', $filter) !== false) { + // Update fired alert count on the agent + // It will only occur if is specified the alert id or the id_agent_module + if ($agent_id !== false) { + db_process_sql(sprintf('UPDATE tagente SET update_alert_count=1 WHERE id_agente = %d', $agent_id)); + } return true; } From 0f68366e3beff4ba98e8826f0a84e4ee46910e32 Mon Sep 17 00:00:00 2001 From: fermin831 Date: Tue, 7 Nov 2017 14:55:59 +0100 Subject: [PATCH 058/149] Modified xml_buffer to 1 and comment inventory modules on default windows agent --- pandora_agents/win32/bin/pandora_agent.conf | 108 ++++++++++---------- 1 file changed, 54 insertions(+), 54 deletions(-) diff --git a/pandora_agents/win32/bin/pandora_agent.conf b/pandora_agents/win32/bin/pandora_agent.conf index 0a645b2027..8ba3b48e60 100644 --- a/pandora_agents/win32/bin/pandora_agent.conf +++ b/pandora_agents/win32/bin/pandora_agent.conf @@ -1,6 +1,6 @@ # Base config file for Pandora FMS Windows Agent # (c) 2006-2017 Artica Soluciones Tecnologicas -# Version 7.0NG.714 +# Version 7.0NG.714 # This program is Free Software, you can redistribute it and/or modify it # under the terms of the GNU General Public Licence as published by the Free Software @@ -95,7 +95,7 @@ server_port 41121 # proxy_timeout 1 # Enable or disable XML buffer. -xml_buffer 0 +xml_buffer 1 # Agent mode: Learn (default), No-learn, Autodisable # agent_mode autodisable @@ -172,70 +172,70 @@ module_plugin cscript.exe //B "%ProgramFiles%\Pandora_Agent\util\network.vbs" ## Windows inventory module (This information will be displayed only in enterprise version) ## Please check the WMI is healthy before activate this functionality -module_begin -module_plugin cscript.exe //B //t:20 "%PROGRAMFILES%\Pandora_Agent\util\cpuinfo.vbs" -module_crontab * 12-15 * * 1 -module_end +#module_begin +#module_plugin cscript.exe //B //t:20 "%PROGRAMFILES%\Pandora_Agent\util\cpuinfo.vbs" +#module_crontab * 12-15 * * 1 +#module_end -module_begin -module_plugin cscript.exe //B //t:20 "%PROGRAMFILES%\Pandora_Agent\util\moboinfo.vbs" -module_crontab * 12-15 * * 1 -module_end +#module_begin +#module_plugin cscript.exe //B //t:20 "%PROGRAMFILES%\Pandora_Agent\util\moboinfo.vbs" +#module_crontab * 12-15 * * 1 +#module_end -module_begin -module_plugin cscript.exe //B //t:20 "%PROGRAMFILES%\Pandora_Agent\util\diskdrives.vbs" -module_crontab * 12-15 * * 1 -module_end +#module_begin +#module_plugin cscript.exe //B //t:20 "%PROGRAMFILES%\Pandora_Agent\util\diskdrives.vbs" +#module_crontab * 12-15 * * 1 +#module_end -module_begin -module_plugin cscript.exe //B //t:20 "%PROGRAMFILES%\Pandora_Agent\util\cdromdrives.vbs" -module_crontab * 12-15 * * 1 -module_end +#module_begin +#module_plugin cscript.exe //B //t:20 "%PROGRAMFILES%\Pandora_Agent\util\cdromdrives.vbs" +#module_crontab * 12-15 * * 1 +#module_end -module_begin -module_plugin cscript.exe //B //t:20 "%PROGRAMFILES%\Pandora_Agent\util\videocardinfo.vbs" -module_crontab * 12-15 * * 1 -module_end +#module_begin +#module_plugin cscript.exe //B //t:20 "%PROGRAMFILES%\Pandora_Agent\util\videocardinfo.vbs" +#module_crontab * 12-15 * * 1 +#module_end -module_begin -module_plugin cscript.exe //B //t:20 "%PROGRAMFILES%\Pandora_Agent\util\ifaces.vbs" -module_crontab * 12-15 * * 1 -module_end +#module_begin +#module_plugin cscript.exe //B //t:20 "%PROGRAMFILES%\Pandora_Agent\util\ifaces.vbs" +#module_crontab * 12-15 * * 1 +#module_end -module_begin -module_plugin cscript.exe //B //t:20 "%PROGRAMFILES%\Pandora_Agent\util\monitors.vbs" -module_crontab * 12-15 * * 1 -module_end +#module_begin +#module_plugin cscript.exe //B //t:20 "%PROGRAMFILES%\Pandora_Agent\util\monitors.vbs" +#module_crontab * 12-15 * * 1 +#module_end -module_begin -module_plugin cscript.exe //B //t:20 "%PROGRAMFILES%\Pandora_Agent\util\printers.vbs" -module_crontab * 12-15 * * 1 -module_end +#module_begin +#module_plugin cscript.exe //B //t:20 "%PROGRAMFILES%\Pandora_Agent\util\printers.vbs" +#module_crontab * 12-15 * * 1 +#module_end -module_begin -module_plugin cscript.exe //B //t:20 "%PROGRAMFILES%\Pandora_Agent\util\raminfo.vbs" -module_crontab * 12-15 * * 1 -module_end +#module_begin +#module_plugin cscript.exe //B //t:20 "%PROGRAMFILES%\Pandora_Agent\util\raminfo.vbs" +#module_crontab * 12-15 * * 1 +#module_end -module_begin -module_plugin cscript.exe //B //t:20 "%PROGRAMFILES%\Pandora_Agent\util\software_installed.vbs" -module_crontab * 12-15 * * 1 -module_end +#module_begin +#module_plugin cscript.exe //B //t:20 "%PROGRAMFILES%\Pandora_Agent\util\software_installed.vbs" +#module_crontab * 12-15 * * 1 +#module_end -module_begin -module_plugin cscript.exe //B //t:20 "%PROGRAMFILES%\Pandora_Agent\util\userslogged.vbs" -module_crontab * 12-15 * * 1 -module_end +#module_begin +#module_plugin cscript.exe //B //t:20 "%PROGRAMFILES%\Pandora_Agent\util\userslogged.vbs" +#module_crontab * 12-15 * * 1 +#module_end -module_begin -module_plugin cscript.exe //B //t:20 "%PROGRAMFILES%\Pandora_Agent\util\productkey.vbs" -module_crontab * 12-15 * * 1 -module_end +#module_begin +#module_plugin cscript.exe //B //t:20 "%PROGRAMFILES%\Pandora_Agent\util\productkey.vbs" +#module_crontab * 12-15 * * 1 +#module_end -module_begin -module_plugin cscript.exe //B //t:20 "%PROGRAMFILES%\Pandora_Agent\util\productID.vbs" -module_crontab * 12-15 * * 1 -module_end +#module_begin +#module_plugin cscript.exe //B //t:20 "%PROGRAMFILES%\Pandora_Agent\util\productID.vbs" +#module_crontab * 12-15 * * 1 +#module_end ######################################### # EXAMPLES # From 7b956e8ef660cd3c445aff661a3e5fe668b70135 Mon Sep 17 00:00:00 2001 From: Arturo Gonzalez Date: Tue, 7 Nov 2017 15:05:31 +0100 Subject: [PATCH 059/149] Added new option to networkmap, reset --- pandora_console/images/reset.png | Bin 0 -> 545 bytes .../include/functions_pandora_networkmap.php | 6 + .../functions_pandora_networkmap.js | 132 ++++++++++++++++++ .../include/javascript/jquery.contextMenu.css | 1 + 4 files changed, 139 insertions(+) create mode 100644 pandora_console/images/reset.png diff --git a/pandora_console/images/reset.png b/pandora_console/images/reset.png new file mode 100644 index 0000000000000000000000000000000000000000..a3304f8263f6ed232286716f630f1bce240b54ca GIT binary patch literal 545 zcmV++0^a?JP)?*) z<^wqiKr9Fp_<$pAECj_NOtJu*+n^rWKy0!RV1Wj_0Z``wEDGQrgr(~JIIM+vED@eS zFmnkc^+P?25{@9x^rNXw1e&^lq?iE+Fct#7Re*-EK2kaW1?NFfkReA7&V&y&C;&*! zM=}Hy-Wx#)3d#prwNR~JPEx3R!4GBPlSO7Wg5Q;ZwOc+2dH3X#^CZwbSOX`ip z7zmBR4?t`PjY0)znq`26X&_W!0ny0|)$j#Sz1YK)j1o@(8or=14D517w6t^q>K#%I zy^j>Jg~$=r0J9A}Ht`sk08J@i!+?4wU@J=npo(D0
    ").dialog ({ + resizable: true, + draggable: true, + modal: true, + overlay: { + opacity: 0.5, + background: 'black' + }, + width: 600, + height: 250, + buttons: [ + { + text: ok_button, + click: function () { + $(this).dialog("close"); + proceed_to_restart_map(map_id); + } + }, + { + text:cancel_button, + click: function () { + $(this).dialog("close"); + } + } + ] + }); + + var dialog_confirm_text = "
    "; + dialog_confirm_text = dialog_confirm_text + "
    "; + dialog_confirm_text = dialog_confirm_text + "

    " + warning_message + "

    "; + dialog_confirm_text = dialog_confirm_text + "

    " + message_to_confirm + "

    "; + dialog_confirm_text = dialog_confirm_text + "
    "; + + $('#restart_map_confirm').html(dialog_confirm_text); + $('#restart_map_confirm').dialog('open'); +} + +function proceed_to_restart_map (map_id) { + $("
    ").dialog ({ + resizable: true, + draggable: true, + modal: true, + overlay: { + opacity: 0.5, + background: 'black' + }, + width: 600, + height: 450, + buttons: [ + { + text: ok_button, + click: function () { + $(this).dialog("close"); + var new_elements = []; + new_elements[0] = $("#text-name").val(); + new_elements[1] = $("#id_group").val(); + new_elements[2] = $("#text-node_radius").val(); + new_elements[3] = $("#textarea_description").val(); + new_elements[4] = $("input[name=source]:checked").val(); + if (new_elements[4] == 'group') { + new_elements[5] = $("#checkbox-dont_show_subgroups").is(':checked'); + } + else if (new_elements[4] == 'recon_task') { + new_elements[5] = $("#recon_task_id").val(); + } + else { + new_elements[5] = $("#text-ip_mask").val(); + } + new_elements[6] = $("#method").val(); + reset_map_from_form(map_id, new_elements); + } + }, + { + text:cancel_button, + click: function () { + $(this).dialog("close"); + } + } + ] + }); + + var params = []; + params.push("get_reset_map_form=1"); + params.push("map_id=" + map_id); + params.push("page=enterprise/operation/agentes/pandora_networkmap.view"); + jQuery.ajax({ + data: params.join("&"), + dataType: 'html', + type: 'POST', + url: action = "ajax.php", + success: function (data) { + $('#restart_map_form').html(data); + $('#restart_map_form').dialog('open'); + } + }); +} + +function reset_map_from_form (map_id, new_elements) { + var params = []; + params.push("reset_map=1"); + params.push("map_id=" + map_id); + params.push("elems[]=" + new_elements) + params.push("page=enterprise/operation/agentes/pandora_networkmap.view"); + jQuery.ajax({ + data: params.join("&"), + dataType: 'json', + type: 'POST', + url: action = "ajax.php", + success: function (data) { + if (!data['error']) { + location.reload(true); + } + } + }); +} + function set_parent(parent_data) { if (enterprise_installed) { var selection = d3.selectAll('.node_children'); diff --git a/pandora_console/include/javascript/jquery.contextMenu.css b/pandora_console/include/javascript/jquery.contextMenu.css index 3a844d4a7e..b0b04223bf 100644 --- a/pandora_console/include/javascript/jquery.contextMenu.css +++ b/pandora_console/include/javascript/jquery.contextMenu.css @@ -117,6 +117,7 @@ .context-menu-item.icon-set_parent { background-image: url(../../images/father.png); } .context-menu-item.icon-add_node { background-image: url(../../images/add.png); } .context-menu-item.icon-refresh_holding_area { background-image: url(../../images/refresh_holding_area.png); } +.context-menu-item.icon-restart_map { background-image: url(../../images/reset.png); } .context-menu-item.icon-interface_link_children { background-image: url(../../images/icono_link_hijo.png); } .context-menu-item.icon-interface_link_parent { background-image: url(../../images/icono_link_padre.png); } .context-menu-item.icon-interface_link_cancel { background-image: url(../../images/link_abortar.png); } From 130349e95529d43dae9cfc031d7d526037e5cd0e Mon Sep 17 00:00:00 2001 From: enriquecd Date: Tue, 7 Nov 2017 18:45:08 +0100 Subject: [PATCH 060/149] Put togehter error and info messages in db_status extension - #1530 --- pandora_console/extensions/db_status.php | 116 ++++++++++------------- 1 file changed, 48 insertions(+), 68 deletions(-) diff --git a/pandora_console/extensions/db_status.php b/pandora_console/extensions/db_status.php index 2b0e281993..d184850a34 100755 --- a/pandora_console/extensions/db_status.php +++ b/pandora_console/extensions/db_status.php @@ -259,80 +259,60 @@ function extension_db_check_tables_differences($connection_test, $field_system = $fields_system[$name_field]; $diff = array_diff($field_test, $field_system); + if (!empty($diff)) { - foreach ($diff as $config_field => $value) { - switch ($config_field) { - case 'type': - ui_print_error_message( - __('Unsuccessful the field %s in the table %s must be set the type with %s.', - $name_field, $table, $value)); - ui_print_info_message( - __('You can execute this SQL query for to fix.') . "
    " . - '
    ' .
    -										"ALTER TABLE " . $table . " MODIFY COLUMN " . $name_field . " " . $value . ";" .
    -									'
    ' - ); - break; - case 'null': - ui_print_error_message( - __('Unsuccessful the field %s in the table %s must be null: (%s).', - $name_field, $table, $value)); + $info_message = ""; + $error_message = ""; + if($diff['type']){ + $error_message .= "Unsuccessful the field ".$name_field." in the table ".$table." must be set the type with ".$diff['type']."
    "; + } + + if($diff['null']){ + $error_message .= "Unsuccessful the field $name_field in the table $table must be null: (".$diff['null'].").
    "; + } + + if($diff['default']){ + $error_message .= "Unsuccessful the field $name_field in the table $table must be set ".$diff['default']." as default value.
    "; + } + + if($field_test['null'] == "YES" || !isset($field_test['null']) || $field_test['null'] == ""){ + $null_defect = " NULL"; + } + else{ + $null_defect = " NOT NULL"; + } + + if(!isset($field_test['default']) || $field_test['default'] == ""){ + $default_value = ""; + } + else{ + $default_value = " DEFAULT ".$field_test['default']; + } + + if($diff['type'] || $diff['null'] || $diff['default']){ + $info_message .= "ALTER TABLE " . $table . " MODIFY COLUMN " . $name_field . " " . $field_test['type'] . $null_defect . $default_value.";"; + } + + if($diff['key']){ + $error_message .= "Unsuccessful the field $name_field in the table $table must be set the key as defined in the SQL file.
    "; + $info_message .= "

    Please check the SQL file for to know the kind of key needed."; + } + + if($diff['extra']){ + $error_message .= "Unsuccessful the field $name_field in the table $table must be set as defined in the SQL file.
    "; + $info_message .= "

    Please check the SQL file for to know the kind of extra config needed."; + } + + ui_print_error_message( + __($error_message)); - if ($value == "YES") { - ui_print_info_message( - __('You can execute this SQL query for to fix.') . "
    " . - '
    ' .
    -											"ALTER TABLE " . $table . " MODIFY COLUMN " . $name_field . " "  . $field_test['type'] . " NULL;" .
    -										'
    ' - ); - } - else { - ui_print_info_message( - __('You can execute this SQL query for to fix.') . "
    " . - '
    ' .
    -											"ALTER TABLE " . $table . " MODIFY COLUMN " . $name_field . " " . $field_test['type'] . " NOT NULL;" .
    -										'
    ' - ); - } + ui_print_info_message( + __($info_message)); - break; - case 'key': - ui_print_error_message( - __('Unsuccessful the field %s in the table %s must be set the key as defined in the SQL file.', - $name_field, $table)); - ui_print_info_message( - __('Please check the SQL file for to know the kind of key needed.')); - break; - case 'default': - if($field_test['null'] == "YES" || !isset($field_test['null']) || $field_test['null'] == ""){ - $null_defect = " NULL"; - } - else{ - $null_defect = " NOT NULL"; - } - ui_print_error_message( - __('Unsuccessful the field %s in the table %s must be set %s as default value.', - $name_field, $table, $value)); - ui_print_info_message( - __('You can execute this SQL query for to fix.') . "
    " . - '
    ' .
    -											"ALTER TABLE " . $table . " MODIFY COLUMN " . $name_field . " "  . $field_test['type'] . $null_defect . " DEFAULT " . $value . ";" .
    -										'
    ' - ); - break; - case 'extra': - ui_print_error_message( - __('Unsuccessful the field %s in the table %s must be set as defined in the SQL file.', - $name_field, $table)); - ui_print_info_message( - __('Please check the SQL file for to know the kind of extra config needed.')); - break; } } } } - } - } if ($correct_fields) { ui_print_success_message( @@ -366,4 +346,4 @@ function extension_db_status_execute_sql_file($url, $connection) { extensions_add_godmode_function('extension_db_status'); extensions_add_godmode_menu_option(__('DB Schema check'), 'DM', 'gextensions', null, "v1r1", 'gdbman'); -?> \ No newline at end of file +?> From cea0f901174de7652d74622412d2518c358f4f91 Mon Sep 17 00:00:00 2001 From: Ramon Novoa Date: Wed, 8 Nov 2017 09:14:26 +0100 Subject: [PATCH 061/149] Remove HTML entities from the SNMP community. Ref. pandora_enterprise#1565. --- pandora_console/include/functions.php | 2 +- pandora_console/include/functions_snmp_browser.php | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/pandora_console/include/functions.php b/pandora_console/include/functions.php index f8edfd1d27..4edfe2c512 100644 --- a/pandora_console/include/functions.php +++ b/pandora_console/include/functions.php @@ -1594,7 +1594,7 @@ function get_snmpwalk($ip_target, $snmp_version, $snmp_community = '', case '2c': case '1': default: - $command_str = $snmpwalk_bin . ' -m ALL -Oa -v ' . escapeshellarg($snmp_version) . ' -c ' . escapeshellarg($snmp_community) . ' ' . escapeshellarg($ip_target) . ' ' . $base_oid . ' 2> ' . $error_redir_dir; + $command_str = $snmpwalk_bin . ' -m ALL -Oa -v ' . escapeshellarg($snmp_version) . ' -c ' . escapeshellarg(io_safe_output($snmp_community)) . ' ' . escapeshellarg($ip_target) . ' ' . $base_oid . ' 2> ' . $error_redir_dir; break; } diff --git a/pandora_console/include/functions_snmp_browser.php b/pandora_console/include/functions_snmp_browser.php index b98d66789b..1f80421fa5 100644 --- a/pandora_console/include/functions_snmp_browser.php +++ b/pandora_console/include/functions_snmp_browser.php @@ -196,7 +196,7 @@ function snmp_browser_get_tree ($target_ip, $community, $starting_oid = '.', $ve } } else { - $command = $snmpwalk_bin . " -m ALL -M +" . escapeshellarg($config['homedir'] . "/attachment/mibs") . " -Cc -c " . escapeshellarg($community) . " -v " . escapeshellarg($version) . " " . escapeshellarg($target_ip) . " " . escapeshellarg($starting_oid) . " 2> " . $error_redir_dir; + $command = $snmpwalk_bin . " -m ALL -M +" . escapeshellarg($config['homedir'] . "/attachment/mibs") . " -Cc -c " . escapeshellarg(io_safe_output($community)) . " -v " . escapeshellarg($version) . " " . escapeshellarg($target_ip) . " " . escapeshellarg($starting_oid) . " 2> " . $error_redir_dir; } exec("ssh pandora_exec_proxy@" . $server_data['ip_address'] . " \"" . $command . "\"", $output, $rc); } @@ -216,7 +216,7 @@ function snmp_browser_get_tree ($target_ip, $community, $starting_oid = '.', $ve } } else { - exec ($snmpwalk_bin . ' -m ALL -M +' . escapeshellarg($config['homedir'] . '/attachment/mibs') . ' -Cc -c ' . escapeshellarg($community) . ' -v ' . escapeshellarg($version) . ' ' . escapeshellarg($target_ip) . ' ' . escapeshellarg($starting_oid) . ' 2> ' . $error_redir_dir, $output, $rc); + exec ($snmpwalk_bin . ' -m ALL -M +' . escapeshellarg($config['homedir'] . '/attachment/mibs') . ' -Cc -c ' . escapeshellarg(io_safe_output($community)) . ' -v ' . escapeshellarg($version) . ' ' . escapeshellarg($target_ip) . ' ' . escapeshellarg($starting_oid) . ' 2> ' . $error_redir_dir, $output, $rc); } } } @@ -236,7 +236,7 @@ function snmp_browser_get_tree ($target_ip, $community, $starting_oid = '.', $ve } } else { - exec ($snmpwalk_bin . ' -m ALL -M +' . escapeshellarg($config['homedir'] . '/attachment/mibs') . ' -Cc -c ' . escapeshellarg($community) . ' -v ' . escapeshellarg($version) . ' ' . escapeshellarg($target_ip) . ' ' . escapeshellarg($starting_oid) . ' 2> ' . $error_redir_dir, $output, $rc); + exec ($snmpwalk_bin . ' -m ALL -M +' . escapeshellarg($config['homedir'] . '/attachment/mibs') . ' -Cc -c ' . escapeshellarg(io_safe_output($community)) . ' -v ' . escapeshellarg($version) . ' ' . escapeshellarg($target_ip) . ' ' . escapeshellarg($starting_oid) . ' 2> ' . $error_redir_dir, $output, $rc); } } @@ -348,7 +348,7 @@ function snmp_browser_get_oid ($target_ip, $community, $target_oid, $version = ' exec ($snmpget_bin . ' -m ALL -v 3 -u ' . escapeshellarg($snmp3_auth_user) . ' -A ' . escapeshellarg($snmp3_auth_pass) . ' -l ' . escapeshellarg($snmp3_security_level) . ' -a ' . escapeshellarg($snmp3_auth_method) . ' -x ' . escapeshellarg($snmp3_privacy_method) . ' -X ' . escapeshellarg($snmp3_privacy_pass) . ' ' . escapeshellarg($target_ip) . ' ' . escapeshellarg($target_oid) . ' 2> ' . $error_redir_dir, $output, $rc); } else { - exec ($snmpget_bin . ' -m ALL -M +' . escapeshellarg($config['homedir'] . '/attachment/mibs') . ' -On -c ' . escapeshellarg($community) . ' -v ' . escapeshellarg($version) . ' ' . escapeshellarg($target_ip) . ' ' . escapeshellarg($target_oid) . ' 2> ' . $error_redir_dir, $output, $rc); + exec ($snmpget_bin . ' -m ALL -M +' . escapeshellarg($config['homedir'] . '/attachment/mibs') . ' -On -c ' . escapeshellarg(io_safe_output($community)) . ' -v ' . escapeshellarg($version) . ' ' . escapeshellarg($target_ip) . ' ' . escapeshellarg($target_oid) . ' 2> ' . $error_redir_dir, $output, $rc); } if ($rc != 0) { From c9d1fab03690d85e5408cbdda60a121eb5f7d1d5 Mon Sep 17 00:00:00 2001 From: Arturo Gonzalez Date: Wed, 8 Nov 2017 12:49:03 +0100 Subject: [PATCH 062/149] Added new system of calculate status if user set a parent weight --- .../pandoradb_migrate_6.0_to_7.0.mysql.sql | 1 + .../visual_console_builder.editor.js | 7 ++ .../ajax/visual_console_builder.ajax.php | 12 +++- .../include/functions_visual_map.php | 67 ++++++++++++++++--- .../include/functions_visual_map_editor.php | 44 +++++++++++- pandora_console/pandoradb.sql | 1 + 6 files changed, 119 insertions(+), 13 deletions(-) diff --git a/pandora_console/extras/pandoradb_migrate_6.0_to_7.0.mysql.sql b/pandora_console/extras/pandoradb_migrate_6.0_to_7.0.mysql.sql index 159eb466f9..52299f75c9 100644 --- a/pandora_console/extras/pandoradb_migrate_6.0_to_7.0.mysql.sql +++ b/pandora_console/extras/pandoradb_migrate_6.0_to_7.0.mysql.sql @@ -1239,6 +1239,7 @@ ALTER TABLE tlayout ADD `background_color` varchar(50) NOT NULL default '#FFF'; ALTER TABLE tlayout_data ADD `type_graph` varchar(50) NOT NULL default 'area'; ALTER TABLE tlayout_data ADD `label_position` varchar(50) NOT NULL default 'down'; ALTER TABLE tlayout_data ADD COLUMN `show_statistics` tinyint(2) NOT NULL default '0'; +ALTER TABLE tlayout_data ADD COLUMN `id_layout_linked_weight` int(10) NOT NULL default '0'; -- --------------------------------------------------------------------- -- Table `tagent_custom_fields` diff --git a/pandora_console/godmode/reporting/visual_console_builder.editor.js b/pandora_console/godmode/reporting/visual_console_builder.editor.js index ebd2427ce3..8adb70be5f 100755 --- a/pandora_console/godmode/reporting/visual_console_builder.editor.js +++ b/pandora_console/godmode/reporting/visual_console_builder.editor.js @@ -815,6 +815,7 @@ function readFields() { values['bars_graph_type'] = $("select[name=bars_graph_type]").val(); values['parent'] = $("select[name=parent]").val(); values['map_linked'] = $("select[name=map_linked]").val(); + values['map_linked_weight'] = $("select[name=map_linked_weight]").val(); values['width_percentile'] = $("input[name=width_percentile]").val(); values['max_percentile'] = parseInt($("input[name=max_percentile]").val()); values['width_module_graph'] = $("input[name=width_module_graph]").val(); @@ -1489,6 +1490,8 @@ function loadFieldsFromDB(item) { $("select[name=parent]").val(val); if (key == 'id_layout_linked') $("select[name=map_linked]").val(val); + if (key == 'id_layout_linked_weight') + $("select[name=map_linked_weight]").val(val); if (key == 'width_percentile') $("input[name=width_percentile]").val(val); if (key == 'max_percentile') @@ -1771,6 +1774,9 @@ function hiddenFields(item) { $("#map_linked_row").css('display', 'none'); $("#map_linked_row." + item).css('display', ''); + $("#map_linked_weight").css('display', 'none'); + $("#map_linked_weight." + item).css('display', ''); + $("#module_graph_size_row").css('display', 'none'); $("#module_graph_size_row." + item).css('display', ''); @@ -1848,6 +1854,7 @@ function cleanFields(item) { $("input[name=height]").val(0); $("select[name=parent]").val(''); $("select[name=map_linked]").val(''); + $("select[name=map_linked_weight]").val(''); $("input[name=width_module_graph]").val(300); $("input[name=height_module_graph]").val(180); $("input[name='width_box']").val(300); diff --git a/pandora_console/include/ajax/visual_console_builder.ajax.php b/pandora_console/include/ajax/visual_console_builder.ajax.php index c7e4484a27..33044a53fd 100755 --- a/pandora_console/include/ajax/visual_console_builder.ajax.php +++ b/pandora_console/include/ajax/visual_console_builder.ajax.php @@ -100,6 +100,7 @@ $width = get_parameter('width', null); $height = get_parameter('height', null); $parent = get_parameter('parent', null); $map_linked = get_parameter('map_linked', null); +$map_linked_weight = get_parameter('map_linked_weight', null); $width_percentile = get_parameter('width_percentile', null); $max_percentile = get_parameter('max_percentile', null); $height_module_graph = get_parameter('height_module_graph', null); @@ -378,7 +379,7 @@ switch ($action) { // Linked to other layout ?? - Only if not module defined if ($layoutData['id_layout_linked'] != 0) { - $status = visual_map_get_layout_status ($layoutData['id_layout_linked']); + $status = visual_map_get_layout_status ($layoutData['id_layout_linked'], $layoutData['id_layout_linked_weight']); // Single object } @@ -552,8 +553,6 @@ switch ($action) { break; } - - if (defined('METACONSOLE') && $metaconsole) { if ($server_name !== null) { $values['id_metaconsole'] = db_get_value('id', @@ -568,6 +567,9 @@ switch ($action) { $values['id_agent'] = $id_agent; } } + else if ($id_agent == 0) { + $values['id_agent'] = 0; + } else if (!empty($id_agent)) { $values['id_agent'] = $id_agent; } @@ -584,6 +586,9 @@ switch ($action) { if ($map_linked !== null) { $values['id_layout_linked'] = $map_linked; } + if ($map_linked_weight !== null) { + $values['id_layout_linked_weight'] = $map_linked_weight; + } switch ($type) { // -- line_item ------------------------------------ case 'handler_start': @@ -982,6 +987,7 @@ switch ($action) { } $values['id_agente_modulo'] = $id_module; $values['id_layout_linked'] = $map_linked; + $values['id_layout_linked_weight'] = $map_linked_weight; $values['parent_item'] = $parent; $values['enable_link'] = $enable_link; $values['image'] = $background_color; diff --git a/pandora_console/include/functions_visual_map.php b/pandora_console/include/functions_visual_map.php index f6293d8743..9388356be4 100755 --- a/pandora_console/include/functions_visual_map.php +++ b/pandora_console/include/functions_visual_map.php @@ -2923,7 +2923,26 @@ function visual_map_get_status_element($layoutData) { //Linked to other layout ?? - Only if not module defined if ($layoutData['id_layout_linked'] != 0) { - $status = visual_map_get_layout_status ($layoutData['id_layout_linked']); + if ($layoutData['id_layout_linked_weight'] != 0) { + $calculate_weight = true; + } + else { + $calculate_weight = false; + } + $status = visual_map_get_layout_status ($layoutData['id_layout_linked'], 0, 0, $calculate_weight); + + if ($layoutData['id_layout_linked_weight'] > 0) { + $elements_to_compare = db_get_all_rows_sql("SELECT id FROM tlayout_data WHERE type = 0 AND id_layout = " . $layoutData['id_layout_linked']); + + $aux_weight = ($status['elements_in_critical'] / count($elements_to_compare)) * 100; + + if ($aux_weight >= $layoutData['id_layout_linked_weight']) { + $status = $status['temp_total']; + } + else { + $status = VISUAL_MAP_STATUS_NORMAL; + } + } } else { switch ($layoutData["type"]) { @@ -3367,7 +3386,7 @@ function visual_map_get_user_layouts ($id_user = 0, $only_names = false, $filter * * @return bool The status of the given layout. True if it's OK, false if not. */ -function visual_map_get_layout_status ($id_layout = 0, $depth = 0) { +function visual_map_get_layout_status ($id_layout = 0, $depth = 0, $elements_in_critical = 0, $calculate_weight = false) { $temp_status = VISUAL_MAP_STATUS_NORMAL; $temp_total = VISUAL_MAP_STATUS_NORMAL; $depth++; // For recursion depth checking @@ -3387,7 +3406,10 @@ function visual_map_get_layout_status ($id_layout = 0, $depth = 0) { 'parent_item', 'id_layout_linked', 'id_agent', - 'type')); + 'type', + 'id_layout_linked_weight', + 'id', + 'id_layout')); if ($result === false) return VISUAL_MAP_STATUS_NORMAL; @@ -3429,12 +3451,29 @@ function visual_map_get_layout_status ($id_layout = 0, $depth = 0) { // Other Layout (Recursive!) if (($data["id_layout_linked"] != 0) && ($data["id_agente_modulo"] == 0)) { - $status = visual_map_get_layout_status($data["id_layout_linked"], $depth); + if ($data['id_layout_linked_weight'] > 0) { + $calculate_weight_c = true; + } + else { + $calculate_weight_c = false; + } + $status = visual_map_get_layout_status($data["id_layout_linked"], $depth, 0, $calculate_weight_c); + + $elements_in_child = db_get_all_rows_sql("SELECT id FROM tlayout_data WHERE type = 0 AND id_layout = " . $data['id_layout_linked']); + if ($calculate_weight_c) { + $aux_weight = ($status['elements_in_critical'] / count($elements_in_child)) * 100; + + if ($aux_weight >= $data['id_layout_linked_weight']) { + $status = $status['temp_total']; + } + else { + $status = VISUAL_MAP_STATUS_NORMAL; + } + } } // Module elseif ($data["id_agente_modulo"] != 0) { $status = modules_get_agentmodule_status($data["id_agente_modulo"]); - } // Agent else { @@ -3448,11 +3487,23 @@ function visual_map_get_layout_status ($id_layout = 0, $depth = 0) { break; } - if ($status == VISUAL_MAP_STATUS_CRITICAL_BAD) - return VISUAL_MAP_STATUS_CRITICAL_BAD; + if ($calculate_weight) { + if ($status == VISUAL_MAP_STATUS_CRITICAL_BAD || $status == VISUAL_MAP_STATUS_WARNING) { + $elements_in_critical++; + } + } + else { + if ($status == VISUAL_MAP_STATUS_CRITICAL_BAD) { + return VISUAL_MAP_STATUS_CRITICAL_BAD; + } - if ($status > $temp_total) + } + if ($status > $temp_total) { $temp_total = $status; + } + } + if ($calculate_weight) { + return array('elements_in_critical' => $elements_in_critical, 'temp_total' => $temp_total); } return $temp_total; diff --git a/pandora_console/include/functions_visual_map_editor.php b/pandora_console/include/functions_visual_map_editor.php index 513c6ccc32..48f13e3022 100755 --- a/pandora_console/include/functions_visual_map_editor.php +++ b/pandora_console/include/functions_visual_map_editor.php @@ -621,11 +621,37 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) { WHERE id != ' . $visualConsole_id, 'map_linked', '', '', 'None', '0', true) . ''; + $form_items_advance['map_linked_weight'] = array(); + $form_items_advance['map_linked_weight']['items'] = array('static_graph'); + $form_items_advance['map_linked_weight']['html'] = ''. + __('Map linked weight') . '' . + '' . html_print_select(array('10' => '10%', + '20' => '20%', + '30' => '30%', + '40' => '40%', + '50' => '50%', + '60' => '60%', + '70' => '70%', + '80' => '80%', + '90' => '90%', + '100' => '100%'), + 'map_linked_weight', '', '', __('By default'), 0, true) . + ui_print_help_tip ( + __("This percentage value specifies the number of items that must be present in the visual + console for it to transmit its status to the icon linked here. For example, if 20% is + specified and there are five elements in the console, it would be enough if you were in + WARNING or CRITICAL to pass that value to the icon. If it were 40%, you would need at + least two elements to be in CRITICAL or WARNING to go into that status. If it had one + element in critical and another in warning, it would not forward any status to the icon + associated with the visual console. If we had three in warning and one in critical, + it would only convey the warning status. If there were two in warning and two in critical, + it would show the CRITICAL because it is more serious. The same applies to unknown status."), true) . + ''; + $form_items_advance['line_case']['items'] = array('line_item'); $form_items_advance['line_case']['html'] = ' ' . __('Lines haven\'t advanced options') . ''; - //Insert and modify before the buttons to create or update. if (enterprise_installed()) { enterprise_visual_map_editor_modify_form_items_advance_palette($form_items_advance); @@ -806,4 +832,18 @@ function visual_map_editor_print_hack_translate_strings() { echo ''; } -?> \ No newline at end of file +?> + + diff --git a/pandora_console/pandoradb.sql b/pandora_console/pandoradb.sql index 28fb2575cf..3a7210560f 100644 --- a/pandora_console/pandoradb.sql +++ b/pandora_console/pandoradb.sql @@ -1362,6 +1362,7 @@ CREATE TABLE IF NOT EXISTS `tlayout_data` ( `border_color` varchar(200) DEFAULT "", `fill_color` varchar(200) DEFAULT "", `show_statistics` tinyint(2) NOT NULL default '0', + `id_layout_linked_weight` int(10) NOT NULL default '0', PRIMARY KEY(`id`) ) ENGINE = InnoDB DEFAULT CHARSET=utf8; From fac066debddfdaa975f4a1f7ccfd79f9914f2dbc Mon Sep 17 00:00:00 2001 From: Arturo Gonzalez Date: Wed, 8 Nov 2017 15:01:44 +0100 Subject: [PATCH 063/149] Added groups acl in all visual console elements --- .../extras/pandoradb_migrate_6.0_to_7.0.mysql.sql | 1 + .../reporting/visual_console_builder.editor.js | 15 +++++++-------- .../include/ajax/visual_console_builder.ajax.php | 5 +++++ pandora_console/include/functions_visual_map.php | 5 +++++ .../include/functions_visual_map_editor.php | 10 ++++++++++ pandora_console/pandoradb.sql | 1 + 6 files changed, 29 insertions(+), 8 deletions(-) diff --git a/pandora_console/extras/pandoradb_migrate_6.0_to_7.0.mysql.sql b/pandora_console/extras/pandoradb_migrate_6.0_to_7.0.mysql.sql index 159eb466f9..851a5b4535 100644 --- a/pandora_console/extras/pandoradb_migrate_6.0_to_7.0.mysql.sql +++ b/pandora_console/extras/pandoradb_migrate_6.0_to_7.0.mysql.sql @@ -1239,6 +1239,7 @@ ALTER TABLE tlayout ADD `background_color` varchar(50) NOT NULL default '#FFF'; ALTER TABLE tlayout_data ADD `type_graph` varchar(50) NOT NULL default 'area'; ALTER TABLE tlayout_data ADD `label_position` varchar(50) NOT NULL default 'down'; ALTER TABLE tlayout_data ADD COLUMN `show_statistics` tinyint(2) NOT NULL default '0'; +ALTER TABLE tlayout_data ADD COLUMN `element_group` int(10) NOT NULL default '0'; -- --------------------------------------------------------------------- -- Table `tagent_custom_fields` diff --git a/pandora_console/godmode/reporting/visual_console_builder.editor.js b/pandora_console/godmode/reporting/visual_console_builder.editor.js index ebd2427ce3..148cc7be27 100755 --- a/pandora_console/godmode/reporting/visual_console_builder.editor.js +++ b/pandora_console/godmode/reporting/visual_console_builder.editor.js @@ -815,6 +815,7 @@ function readFields() { values['bars_graph_type'] = $("select[name=bars_graph_type]").val(); values['parent'] = $("select[name=parent]").val(); values['map_linked'] = $("select[name=map_linked]").val(); + values['element_group'] = $("select[name=element_group]").val(); values['width_percentile'] = $("input[name=width_percentile]").val(); values['max_percentile'] = parseInt($("input[name=max_percentile]").val()); values['width_module_graph'] = $("input[name=width_module_graph]").val(); @@ -1489,6 +1490,8 @@ function loadFieldsFromDB(item) { $("select[name=parent]").val(val); if (key == 'id_layout_linked') $("select[name=map_linked]").val(val); + if (key == 'element_group') + $("select[name=element_group]").val(val); if (key == 'width_percentile') $("input[name=width_percentile]").val(val); if (key == 'max_percentile') @@ -1771,6 +1774,9 @@ function hiddenFields(item) { $("#map_linked_row").css('display', 'none'); $("#map_linked_row." + item).css('display', ''); + $("#element_group_row").css('display', 'none'); + $("#element_group_row." + item).css('display', ''); + $("#module_graph_size_row").css('display', 'none'); $("#module_graph_size_row." + item).css('display', ''); @@ -1821,14 +1827,6 @@ function hiddenFields(item) { if (typeof(enterprise_hiddenFields) == 'function') { enterprise_hiddenFields(item); } - - //~ var code_control = tinyMCE.activeEditor.controlManager.controls['text-label_code']; - //~ if (item == 'label') { - //~ code_control.setDisabled(false); - //~ } - //~ else { - //~ code_control.setDisabled(true); - //~ } } function cleanFields(item) { @@ -1848,6 +1846,7 @@ function cleanFields(item) { $("input[name=height]").val(0); $("select[name=parent]").val(''); $("select[name=map_linked]").val(''); + $("select[name=element_group]").val(''); $("input[name=width_module_graph]").val(300); $("input[name=height_module_graph]").val(180); $("input[name='width_box']").val(300); diff --git a/pandora_console/include/ajax/visual_console_builder.ajax.php b/pandora_console/include/ajax/visual_console_builder.ajax.php index c7e4484a27..9c3b32611e 100755 --- a/pandora_console/include/ajax/visual_console_builder.ajax.php +++ b/pandora_console/include/ajax/visual_console_builder.ajax.php @@ -100,6 +100,7 @@ $width = get_parameter('width', null); $height = get_parameter('height', null); $parent = get_parameter('parent', null); $map_linked = get_parameter('map_linked', null); +$element_group = get_parameter('element_group', null); $width_percentile = get_parameter('width_percentile', null); $max_percentile = get_parameter('max_percentile', null); $height_module_graph = get_parameter('height_module_graph', null); @@ -584,6 +585,9 @@ switch ($action) { if ($map_linked !== null) { $values['id_layout_linked'] = $map_linked; } + if ($element_group !== null) { + $values['element_group'] = $element_group; + } switch ($type) { // -- line_item ------------------------------------ case 'handler_start': @@ -982,6 +986,7 @@ switch ($action) { } $values['id_agente_modulo'] = $id_module; $values['id_layout_linked'] = $map_linked; + $values['element_group'] = $element_group; $values['parent_item'] = $parent; $values['enable_link'] = $enable_link; $values['image'] = $background_color; diff --git a/pandora_console/include/functions_visual_map.php b/pandora_console/include/functions_visual_map.php index f6293d8743..f2715047df 100755 --- a/pandora_console/include/functions_visual_map.php +++ b/pandora_console/include/functions_visual_map.php @@ -3248,6 +3248,11 @@ function visual_map_print_visual_map ($id_layout, $show_links = true, foreach ($layout_datas as $layout_data) { + $layout_group = $layout_data['element_group']; + if (!check_acl ($config['id_user'], $layout_group, "VR")) { + continue; + } + //Check the items are from disabled or pending delete modules if ($layout_data['id_agente_modulo'] != 0 && (($layout_data['type'] != LABEL) diff --git a/pandora_console/include/functions_visual_map_editor.php b/pandora_console/include/functions_visual_map_editor.php index 513c6ccc32..32876e99a7 100755 --- a/pandora_console/include/functions_visual_map_editor.php +++ b/pandora_console/include/functions_visual_map_editor.php @@ -625,6 +625,16 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) { $form_items_advance['line_case']['html'] = ' ' . __('Lines haven\'t advanced options') . ''; + $user_groups = users_get_groups($config['id_user']); + $form_items_advance['element_group_row'] = array(); + $form_items_advance['element_group_row']['items'] = array( + 'group_item', 'static_graph', 'percentile_bar', + 'percentile_item', 'module_graph', 'simple_value', + 'icon', 'label', 'datos'); + $form_items_advance['element_group_row']['html'] = ''. + __('Element group') . '' . + '' . html_print_select($user_groups, 'element_group', '', '', '', 0, true) . + ''; //Insert and modify before the buttons to create or update. if (enterprise_installed()) { diff --git a/pandora_console/pandoradb.sql b/pandora_console/pandoradb.sql index 28fb2575cf..ad89ce2b8c 100644 --- a/pandora_console/pandoradb.sql +++ b/pandora_console/pandoradb.sql @@ -1362,6 +1362,7 @@ CREATE TABLE IF NOT EXISTS `tlayout_data` ( `border_color` varchar(200) DEFAULT "", `fill_color` varchar(200) DEFAULT "", `show_statistics` tinyint(2) NOT NULL default '0', + `element_group` int(10) NOT NULL default '0', PRIMARY KEY(`id`) ) ENGINE = InnoDB DEFAULT CHARSET=utf8; From fa50ac5cdf84b78af5d64fefca173a8421b9ed34 Mon Sep 17 00:00:00 2001 From: Arturo Gonzalez Date: Fri, 10 Nov 2017 11:05:53 +0100 Subject: [PATCH 064/149] Added link color --- .../include/functions_pandora_networkmap.php | 30 ++++++++++++++++++- .../functions_pandora_networkmap.js | 1 + 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/pandora_console/include/functions_pandora_networkmap.php b/pandora_console/include/functions_pandora_networkmap.php index e09a20f3bc..53cd5125ec 100644 --- a/pandora_console/include/functions_pandora_networkmap.php +++ b/pandora_console/include/functions_pandora_networkmap.php @@ -518,6 +518,7 @@ function networkmap_links_to_js_links($relations, $nodes_graph) { $item['id_agent_start'] = (int)$id_source_agent; $item['id_module_end'] = 0; $item['id_agent_end'] = (int)$id_target_agent; + $item['link_color'] = "#999"; $item['target'] = -1; $item['source'] = -1; @@ -572,14 +573,42 @@ function networkmap_links_to_js_links($relations, $nodes_graph) { $agent2 = 0; if (($relation['parent_type'] == 1) && ($relation['child_type'] == 1)) { + $mod1_status = db_get_value_filter('estado', 'tagente_estado', array('id_agente_modulo' => $relation['id_parent_source_data'])); + $mod2_status = db_get_value_filter('estado', 'tagente_estado', array('id_agente_modulo' => $relation['id_child_source_data'])); + + if (($mod1_status == AGENT_MODULE_STATUS_CRITICAL_BAD) || ($mod2_status == AGENT_MODULE_STATUS_CRITICAL_BAD)) { + $item['link_color'] = "#FC4444"; + } + else if (($mod1_status == AGENT_MODULE_STATUS_WARNING) || ($mod2_status == AGENT_MODULE_STATUS_WARNING)) { + $item['link_color'] = "#FAD403"; + } + $agent = agents_get_agent_id_by_module_id($relation['id_parent_source_data']); $agent2 = agents_get_agent_id_by_module_id($relation['id_child_source_data']); } else if ($relation['child_type'] == 1) { + $mod1_status = db_get_value_filter('estado', 'tagente_estado', array('id_agente_modulo' => $relation['id_child_source_data'])); + + if ($mod1_status == AGENT_MODULE_STATUS_CRITICAL_BAD) { + $item['link_color'] = "#FC4444"; + } + else if ($mod1_status == AGENT_MODULE_STATUS_WARNING) { + $item['link_color'] = "#FAD403"; + } + $agent = $relation['id_parent_source_data']; $agent2 = agents_get_agent_id_by_module_id($relation['id_child_source_data']); } else if ($relation['parent_type'] == 1) { + $mod1_status = db_get_value_filter('estado', 'tagente_estado', array('id_agente_modulo' => $relation['id_parent_source_data'])); + + if ($mod1_status == AGENT_MODULE_STATUS_CRITICAL_BAD) { + $item['link_color'] = "#FC4444"; + } + else if ($mod1_status == AGENT_MODULE_STATUS_WARNING) { + $item['link_color'] = "#FAD403"; + } + $agent = agents_get_agent_id_by_module_id($relation['id_parent_source_data']); $agent2 = $relation['id_child_source_data']; } @@ -1335,7 +1364,6 @@ function show_networkmap($id = 0, $user_readonly = false, $nodes_and_relations = } .link { - stroke: #999; stroke-opacity: .6; } diff --git a/pandora_console/include/javascript/functions_pandora_networkmap.js b/pandora_console/include/javascript/functions_pandora_networkmap.js index 6b4cd0d415..41f5dbcc1d 100644 --- a/pandora_console/include/javascript/functions_pandora_networkmap.js +++ b/pandora_console/include/javascript/functions_pandora_networkmap.js @@ -3063,6 +3063,7 @@ function draw_elements_graph() { "id_module_start_" + d.id_module_start + " " + "id_module_end_" + d.id_module_end; }) + .attr("stroke", function (d) { return d.link_color; }) .attr("stroke-width", 3) .attr("d", null) .attr('marker-start', function (d) { From 555dc3744dded3a3fabfc4a59a9bcba55be33806 Mon Sep 17 00:00:00 2001 From: vgilc Date: Fri, 10 Nov 2017 12:24:01 +0100 Subject: [PATCH 065/149] =?UTF-8?q?Revert=20"Merge=20branch=E2=80=A6"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts merge request !1045 --- pandora_console/include/functions_db.php | 71 +++++++----------------- 1 file changed, 21 insertions(+), 50 deletions(-) diff --git a/pandora_console/include/functions_db.php b/pandora_console/include/functions_db.php index eac5299982..a156538b9a 100644 --- a/pandora_console/include/functions_db.php +++ b/pandora_console/include/functions_db.php @@ -481,6 +481,9 @@ function db_get_all_rows_sql($sql, $search_history_db = false, $cache = true, $d } } + + + /** * * Returns the time the module is in unknown status (by events) @@ -511,6 +514,7 @@ function db_get_module_ranges_unknown($id_agente_modulo, $tstart = false, $tend return false; } + // Retrieve going unknown events in range $query = "SELECT utimestamp,event_type FROM tevento WHERE id_agentmodule = " . $id_agente_modulo; $query .= " AND event_type like 'going_%' "; @@ -523,7 +527,7 @@ function db_get_module_ranges_unknown($id_agente_modulo, $tstart = false, $tend return false; } - $last_status = $events[0]["event_type"] != "going_unknown" ? 1:0; + $last_status = 0; // normal $return = array(); $i=0; foreach ($events as $event) { @@ -551,9 +555,6 @@ function db_get_module_ranges_unknown($id_agente_modulo, $tstart = false, $tend } } } - if(!isset($return[0])){ - return false; - } return $return; } @@ -572,16 +573,6 @@ function db_get_module_ranges_unknown($id_agente_modulo, $tstart = false, $tend * * Note: All "unknown" data are marked as NULL * Warning: Be careful with the amount of data, check your RAM size available - * We'll return a bidimensional array - * Structure returned: schema: - * - * uncompressed_data => - * pool_id (int) - * utimestamp (start of current slice) - * data - * array - * datos - * utimestamp * */ function db_uncompress_module_data($id_agente_modulo, $tstart = false, $tend = false) { @@ -628,7 +619,6 @@ function db_uncompress_module_data($id_agente_modulo, $tstart = false, $tend = f $query .= " AND utimestamp=" . $first_utimestamp; $data = db_get_all_rows_sql($query,$search_historydb); - if ($data === false) { // first utimestamp not found in active database // SEARCH HISTORY DB @@ -653,9 +643,7 @@ function db_uncompress_module_data($id_agente_modulo, $tstart = false, $tend = f // Retrieve all data from module in given range $raw_data = db_get_all_rows_sql($query, $search_historydb); - $module_interval = modules_get_interval ($id_agente_modulo); - - if (($raw_data === false) && ( ($first_utimestamp < $tstart - (SECONDS_1DAY + 2*$module_interval)) ) ) { + if (($raw_data === false) && ($first_utimestamp === $tstart)) { // No data return false; } @@ -663,45 +651,28 @@ function db_uncompress_module_data($id_agente_modulo, $tstart = false, $tend = f // Retrieve going unknown events in range $unknown_events = db_get_module_ranges_unknown($id_agente_modulo, $tstart, $tend, $search_historydb); - $previous_unknown_events = db_get_module_ranges_unknown( - $id_agente_modulo, - $tstart - (SECONDS_1DAY + 2*$module_interval), - $tstart, - $search_historydb - ); - - //don't show graph if graph is inside unknown - if( $previous_unknown_events && - !isset($previous_unknown_events[count($previous_unknown_events) -1]['time_to']) && - $unknown_events === false && $raw_data === false){ - return false; - } - - //if time to is missing in last event force time to outside range time - if( $unknown_events && !isset($unknown_events[count($unknown_events) -1]['time_to']) ){ - $unknown_events[count($unknown_events) -1]['time_to'] = $tend + $module_interval; - } - - //if time to is missing in first event force time to outside range time - if ($first_data["datos"] === false) { - $last_inserted_value = false; - }elseif( $unknown_events && !isset($unknown_events[0]['time_from']) || - $first_utimestamp < $tstart - (SECONDS_1DAY + 2*$module_interval) ){ - $last_inserted_value = null; - } - else{ - $last_inserted_value = $first_data["datos"]; - } - // Retrieve module_interval to build the template + $module_interval = modules_get_interval ($id_agente_modulo); $slice_size = $module_interval; + // We'll return a bidimensional array + // Structure returned: schema: + // + // uncompressed_data => + // pool_id (int) + // utimestamp (start of current slice) + // data + // array + // utimestamp + // datos + $return = array(); // Point current_timestamp to begin of the set and initialize flags $current_timestamp = $tstart; + $last_inserted_value = $first_data["datos"]; $last_timestamp = $first_data["utimestamp"]; - $last_value = $first_data["datos"]; + $last_value = $first_data["datos"]; // Build template $pool_id = 0; @@ -761,7 +732,7 @@ function db_uncompress_module_data($id_agente_modulo, $tstart = false, $tend = f ($current_timestamp_end >= $current_unknown['time_from']) ) || ($current_timestamp_end >= $current_unknown['time_to']) ) ) { - if( ( $current_timestamp <= $current_unknown['time_from']) && + if( ( $current_timestamp < $current_unknown['time_from']) && ( $current_timestamp_end >= $current_unknown['time_from'] ) ){ // Add unknown state detected $tmp_data["utimestamp"] = $current_unknown["time_from"]; From 68a10343fbd292d02ea19e8530a4d9f26edaf5d0 Mon Sep 17 00:00:00 2001 From: vgilc Date: Fri, 10 Nov 2017 12:24:33 +0100 Subject: [PATCH 066/149] =?UTF-8?q?Revert=20"Merge=20branch=E2=80=A6"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts merge request !1025 --- pandora_console/include/ajax/events.php | 11 +- pandora_console/include/db/mysql.php | 4 +- pandora_console/include/functions_db.php | 345 +++++++++++------- pandora_console/include/functions_graph.php | 337 ++++++++--------- pandora_console/include/functions_modules.php | 83 ++--- .../include/graphs/flot/pandora.flot.js | 20 +- .../operation/agentes/stat_win.php | 17 +- 7 files changed, 464 insertions(+), 353 deletions(-) diff --git a/pandora_console/include/ajax/events.php b/pandora_console/include/ajax/events.php index d431a83dd7..cad5efae1a 100644 --- a/pandora_console/include/ajax/events.php +++ b/pandora_console/include/ajax/events.php @@ -478,13 +478,10 @@ if ($get_extended_event) { if ($get_events_details) { $event_ids = explode(',',get_parameter ('event_ids')); - $events = db_get_all_rows_filter ( - 'tevento', - array ('id_evento' => $event_ids,'order' => 'utimestamp ASC'), - array ('evento', 'utimestamp', 'estado', 'criticity', 'id_usuario'), - 'AND', - true - ); + $events = db_get_all_rows_filter ('tevento', + array ('id_evento' => $event_ids, + 'order' => 'utimestamp ASC'), + array ('evento', 'utimestamp', 'estado', 'criticity', 'id_usuario')); $out = ''; $out .= ''; diff --git a/pandora_console/include/db/mysql.php b/pandora_console/include/db/mysql.php index 7101f960de..7da9316c65 100644 --- a/pandora_console/include/db/mysql.php +++ b/pandora_console/include/db/mysql.php @@ -738,7 +738,7 @@ function mysql_db_get_row_sql ($sql, $search_history_db = false) { * * @return mixed Array of the row or false in case of error. */ -function mysql_db_get_row_filter ($table, $filter, $fields = false, $where_join = 'AND', $historydb = false) { +function mysql_db_get_row_filter ($table, $filter, $fields = false, $where_join = 'AND') { if (empty ($fields)) { $fields = '*'; } @@ -758,7 +758,7 @@ function mysql_db_get_row_filter ($table, $filter, $fields = false, $where_join $sql = sprintf ('SELECT %s FROM %s %s', $fields, $table, $filter); - return db_get_row_sql ($sql, $historydb); + return db_get_row_sql ($sql); } /** diff --git a/pandora_console/include/functions_db.php b/pandora_console/include/functions_db.php index a156538b9a..06c85ef194 100644 --- a/pandora_console/include/functions_db.php +++ b/pandora_console/include/functions_db.php @@ -416,12 +416,12 @@ function db_get_row ($table, $field_search, $condition, $fields = false) { * * @return mixed Array of the row or false in case of error. */ -function db_get_row_filter($table, $filter, $fields = false, $where_join = 'AND', $historydb = false) { +function db_get_row_filter($table, $filter, $fields = false, $where_join = 'AND') { global $config; switch ($config["dbtype"]) { case "mysql": - return mysql_db_get_row_filter($table, $filter, $fields, $where_join, $historydb); + return mysql_db_get_row_filter($table, $filter, $fields, $where_join); break; case "postgresql": return postgresql_db_get_row_filter($table, $filter, $fields, $where_join); @@ -493,7 +493,7 @@ function db_get_all_rows_sql($sql, $search_history_db = false, $cache = true, $d * @param int $tend end of search * */ -function db_get_module_ranges_unknown($id_agente_modulo, $tstart = false, $tend = false, $historydb = false) { +function db_get_module_ranges_unknown($id_agente_modulo, $tstart = false, $tend = false) { global $config; if (!isset($id_agente_modulo)) { @@ -521,7 +521,7 @@ function db_get_module_ranges_unknown($id_agente_modulo, $tstart = false, $tend $query .= " AND utimestamp >= $tstart AND utimestamp <= $tend "; $query .= " ORDER BY utimestamp ASC"; - $events = db_get_all_rows_sql($query, $historydb); + $events = db_get_all_rows_sql($query); if (! is_array($events)){ return false; @@ -582,6 +582,17 @@ function db_uncompress_module_data($id_agente_modulo, $tstart = false, $tend = f return false; } + if ((!isset($tstart)) || ($tstart === false)) { + // Return data from the begining + // Get first available utimestamp in active DB + $query_first_man_time = " SELECT utimestamp FROM tagente_datos "; + $query_first_man_time .= " WHERE id_agente_modulo = $id_agente_modulo"; + $query_first_man_time .= " ORDER BY utimestamp ASC LIMIT 1"; + + $first_man_time = db_get_all_rows_sql( $query_first_man_time, false); + $tstart = $first_man_time[0]['utimestamp']; + } + if ((!isset($tend)) || ($tend === false)) { // Return data until now $tend = time(); @@ -605,51 +616,53 @@ function db_uncompress_module_data($id_agente_modulo, $tstart = false, $tend = f $table = "tagente_datos_string"; } - $result = modules_get_first_date($id_agente_modulo,$tstart); - $first_utimestamp = $result["first_utimestamp"]; - $search_historydb = $result["search_historydb"]; + // Get first available utimestamp in active DB + $query = " SELECT utimestamp, datos FROM $table "; + $query .= " WHERE id_agente_modulo=$id_agente_modulo AND utimestamp < $tstart"; + $query .= " ORDER BY utimestamp DESC LIMIT 1"; - if ($first_utimestamp === false) { - $first_data["utimestamp"] = $tstart; + $ret = db_get_all_rows_sql( $query , $search_historydb); + + if ( ( $ret === false ) || (( isset($ret[0]["utimestamp"]) && ($ret[0]["utimestamp"] > $tstart )))) { + // Value older than first retrieved from active DB + $search_historydb = true; + + $ret = db_get_all_rows_sql( $query , $search_historydb); + + if ($ret) { + $tstart = $ret[0]["utimestamp"]; + } + } + else { + $first_data["utimestamp"] = $ret[0]["utimestamp"]; + $first_data["datos"] = $ret[0]["datos"]; + } + + if ( ( $ret === false ) || (( isset($ret[0]["utimestamp"]) && ($ret[0]["utimestamp"] > $tstart )))) { + // No previous data. -> not init + // Avoid false unknown status + $first_data["utimestamp"] = time(); $first_data["datos"] = false; } else { - $query = "SELECT datos,utimestamp FROM $table "; - $query .= " WHERE id_agente_modulo=$id_agente_modulo "; - $query .= " AND utimestamp=" . $first_utimestamp; - - $data = db_get_all_rows_sql($query,$search_historydb); - if ($data === false) { - // first utimestamp not found in active database - // SEARCH HISTORY DB - $search_historydb = true; - $data = db_get_all_rows_sql($query,$search_historydb); - } - - if ($data === false) { // Not init - $first_data["utimestamp"] = $tstart; - $first_data["datos"] = false; - } - else { - $first_data["utimestamp"] = $data[0]["utimestamp"]; - $first_data["datos"] = $data[0]["datos"]; - - } + $first_data["utimestamp"] = $ret[0]["utimestamp"]; + $first_data["datos"] = $ret[0]["datos"]; } $query = " SELECT utimestamp, datos FROM $table "; $query .= " WHERE id_agente_modulo=$id_agente_modulo AND utimestamp >= $tstart AND utimestamp <= $tend"; $query .= " ORDER BY utimestamp ASC"; + // Retrieve all data from module in given range $raw_data = db_get_all_rows_sql($query, $search_historydb); - if (($raw_data === false) && ($first_utimestamp === $tstart)) { + if (($raw_data === false) && ($ret === false)) { // No data return false; } // Retrieve going unknown events in range - $unknown_events = db_get_module_ranges_unknown($id_agente_modulo, $tstart, $tend, $search_historydb); + $unknown_events = db_get_module_ranges_unknown($id_agente_modulo, $tstart, $tend); // Retrieve module_interval to build the template $module_interval = modules_get_interval ($id_agente_modulo); @@ -672,115 +685,197 @@ function db_uncompress_module_data($id_agente_modulo, $tstart = false, $tend = f $current_timestamp = $tstart; $last_inserted_value = $first_data["datos"]; $last_timestamp = $first_data["utimestamp"]; - $last_value = $first_data["datos"]; + $data_found = 0; // Build template $pool_id = 0; $now = time(); - $current_unknown = array_shift($unknown_events); - $current_raw_data = array_shift($raw_data); - + $in_unknown_status = 0; + if (is_array($unknown_events)) { + $current_unknown = array_shift($unknown_events); + } while ( $current_timestamp < $tend ) { + $expected_data_generated = 0; + $return[$pool_id]["data"] = array(); $tmp_data = array(); - $current_timestamp_end = $current_timestamp + $slice_size; + $data_found = 0; - if ( ( $current_timestamp > $now) || - ( ($current_timestamp_end - $last_timestamp) > - (SECONDS_1DAY + 2*$module_interval) ) ) { - $tmp_data["utimestamp"] = $last_timestamp + SECONDS_1DAY + 2*$module_interval; - - //check not init - $tmp_data["datos"] = $last_value === false ? false : null; - - // debug purpose - //$tmp_data["obs"] = "unknown extra"; - array_push($return[$pool_id]["data"], $tmp_data); - } - - //insert first slice data - $tmp_data["utimestamp"] = $current_timestamp; - $tmp_data["datos"] = $last_inserted_value; - // debug purpose - //$tmp_data["obs"] = "virtual data"; - - $return[$pool_id]["utimestamp"] = $current_timestamp; - array_push($return[$pool_id]["data"], $tmp_data); - - //insert raw data - while ( ($current_raw_data != null) && - ( ($current_timestamp_end >= $current_raw_data['utimestamp']) && - ($current_timestamp < $current_raw_data['utimestamp']) ) ) { - - // Add unknown state detected - $tmp_data["utimestamp"] = $current_raw_data["utimestamp"]; - $tmp_data["datos"] = $current_raw_data["datos"]; - // debug purpose - //$tmp_data["obs"] = "real data"; - array_push($return[$pool_id]["data"], $tmp_data); - - $last_value = $current_raw_data["datos"]; - $last_timestamp = $current_raw_data["utimestamp"]; - $current_raw_data = array_shift($raw_data); - } - - //unknown - $data_slices = $return[$pool_id]["data"]; - while ( ($current_unknown != null) && - ( ( ($current_unknown['time_from'] != null) && - ($current_timestamp_end >= $current_unknown['time_from']) ) || - ($current_timestamp_end >= $current_unknown['time_to']) ) ) { - - if( ( $current_timestamp < $current_unknown['time_from']) && - ( $current_timestamp_end >= $current_unknown['time_from'] ) ){ - // Add unknown state detected - $tmp_data["utimestamp"] = $current_unknown["time_from"]; - $tmp_data["datos"] = null; - // debug purpose - //$tmp_data["obs"] = "event data unknown from"; - array_push($return[$pool_id]["data"], $tmp_data); - $current_unknown["time_from"] = null; - } - - if( ($current_timestamp < $current_unknown['time_to']) && - ($current_timestamp_end >= $current_unknown['time_to'] ) ){ - $tmp_data["utimestamp"] = $current_unknown["time_to"]; - $i = count($data_slices) - 1; - while ($i >= 0) { - if($data_slices[$i]['utimestamp'] <= $current_unknown["time_to"]){ - $tmp_data["datos"] = - $data_slices[$i]['datos'] == null - ? $last_value - : $data_slices[$i]['datos']; - break; - } - $i--; + if (is_array($unknown_events)) { + $i = 0; + while ($current_timestamp >= $unknown_events[$i]["time_to"] ) { + // Skip unknown events in past + array_splice($unknown_events, $i,1); + $i++; + if (!isset($unknown_events[$i])) { + break; } - - // debug purpose - //$tmp_data["obs"] = "event data unknown to"; - array_push($return[$pool_id]["data"], $tmp_data); - $current_unknown = array_shift($unknown_events); } + if (isset($current_unknown)) { + + // check if recovered from unknown status + if(is_array($unknown_events) && isset($current_unknown)) { + if ( (($current_timestamp+$slice_size) > $current_unknown["time_to"]) + && ($current_timestamp < $current_unknown["time_to"]) + && ($in_unknown_status == 1) ) { + // Recovered from unknown + + if ( ($current_unknown["time_to"] > $current_timestamp) + && ($expected_data_generated == 0) ) { + // also add the "expected" data + $tmp_data["utimestamp"] = $current_timestamp; + if ($in_unknown_status == 1) { + $tmp_data["datos"] = null; + } + else { + $tmp_data["datos"] = $last_inserted_value; + } + $return[$pool_id]["utimestamp"] = $current_timestamp; + array_push($return[$pool_id]["data"], $tmp_data); + $expected_data_generated = 1; + } + + + $tmp_data["utimestamp"] = $current_unknown["time_to"]; + $tmp_data["datos"] = $last_inserted_value; + // debug purpose + //$tmp_data["obs"] = "event recovery data"; + + $return[$pool_id]["utimestamp"] = $current_timestamp; + array_push($return[$pool_id]["data"], $tmp_data); + $data_found = 1; + $in_unknown_status = 0; + } + + if ( (($current_timestamp+$slice_size) > $current_unknown["time_from"]) + && (($current_timestamp+$slice_size) < $current_unknown["time_to"]) + && ($in_unknown_status == 0) ) { + // Add unknown state detected + + if ( $current_unknown["time_from"] < ($current_timestamp+$slice_size)) { + if ( ($current_unknown["time_from"] > $current_timestamp) + && ($expected_data_generated == 0) ) { + // also add the "expected" data + $tmp_data["utimestamp"] = $current_timestamp; + if ($in_unknown_status == 1) { + $tmp_data["datos"] = null; + } + else { + $tmp_data["datos"] = $last_inserted_value; + } + $return[$pool_id]["utimestamp"] = $current_timestamp; + array_push($return[$pool_id]["data"], $tmp_data); + $expected_data_generated = 1; + } + + $tmp_data["utimestamp"] = $current_unknown["time_from"]; + $tmp_data["datos"] = null; + // debug purpose + //$tmp_data["obs"] = "event data"; + $return[$pool_id]["utimestamp"] = $current_timestamp; + array_push($return[$pool_id]["data"], $tmp_data); + $data_found = 1; + } + $in_unknown_status = 1; + } + + if ( ($in_unknown_status == 0) && ($current_timestamp >= $current_unknown["time_to"]) ) { + $current_unknown = array_shift($unknown_events); + } + } + } // unknown events handle } - //sort current slice - usort( - $return[$pool_id]['data'], - function ($a, $b) { - if ($a['utimestamp'] == $b['utimestamp']) return 0; - return ($a['utimestamp'] < $b['utimestamp']) ? -1 : 1; + // Search for data + $i=0; + if (is_array($raw_data)) { + foreach ($raw_data as $data) { + if ( ($data["utimestamp"] >= $current_timestamp) + && ($data["utimestamp"] < ($current_timestamp+$slice_size)) ) { + // Data in block, push in, and remove from $raw_data (processed) + + if ( ($data["utimestamp"] > $current_timestamp) + && ($expected_data_generated == 0) ) { + // also add the "expected" data + $tmp_data["utimestamp"] = $current_timestamp; + if ($in_unknown_status == 1) { + $tmp_data["datos"] = null; + } + else { + $tmp_data["datos"] = $last_inserted_value; + } + //$tmp_data["obs"] = "expected data"; + $return[$pool_id]["utimestamp"] = $current_timestamp; + array_push($return[$pool_id]["data"], $tmp_data); + $expected_data_generated = 1; + } + + $tmp_data["utimestamp"] = intval($data["utimestamp"]); + $tmp_data["datos"] = $data["datos"]; + // debug purpose + //$tmp_data["obs"] = "real data"; + + $return[$pool_id]["utimestamp"] = $current_timestamp; + array_push($return[$pool_id]["data"], $tmp_data); + + $last_inserted_value = $data["datos"]; + $last_timestamp = intval($data["utimestamp"]); + + unset($raw_data[$i]); + $data_found = 1; + $in_unknown_status = 0; + } + elseif ($data["utimestamp"] > ($current_timestamp+$slice_size)) { + // Data in future, stop searching new ones + break; + } } - ); - //put the last slice data like first element of next slice - $last_inserted_value = end($return[$pool_id]['data']); - $last_inserted_value = $last_inserted_value['datos']; - - //increment + $i++; + } + + if ($data_found == 0) { + // No data found, lug the last_value until SECONDS_1DAY + 2*modules_get_interval + // UNKNOWN! + + if (($current_timestamp > $now) || (($current_timestamp - $last_timestamp) > (SECONDS_1DAY + 2*$module_interval))) { + if (isset($last_inserted_value)) { + // unhandled unknown status control + $unhandled_time_unknown = $current_timestamp - (SECONDS_1DAY + 2*$module_interval) - $last_timestamp; + if ($unhandled_time_unknown > 0) { + // unhandled unknown status detected. Add to previous pool + $tmp_data["utimestamp"] = intval($last_timestamp) + (SECONDS_1DAY + 2*$module_interval); + $tmp_data["datos"] = null; + // debug purpose + //$tmp_data["obs"] = "unknown extra"; + // add to previous pool if needed + if (isset($return[$pool_id-1])) { + array_push($return[$pool_id-1]["data"], $tmp_data); + } + } + } + $last_inserted_value = null; + } + + $tmp_data["utimestamp"] = $current_timestamp; + + if ($in_unknown_status == 1) { + $tmp_data["datos"] = null; + } + else { + $tmp_data["datos"] = $last_inserted_value; + } + // debug purpose + //$tmp_data["obs"] = "virtual data"; + + $return[$pool_id]["utimestamp"] = $current_timestamp; + array_push($return[$pool_id]["data"], $tmp_data); + } + $pool_id++; - $current_timestamp = $current_timestamp_end; + $current_timestamp += $slice_size; } + return $return; } diff --git a/pandora_console/include/functions_graph.php b/pandora_console/include/functions_graph.php index c91e71c07a..0c9bd6ebfb 100644 --- a/pandora_console/include/functions_graph.php +++ b/pandora_console/include/functions_graph.php @@ -550,6 +550,8 @@ function grafico_modulo_sparse_data ($agent_module_id, $period, $show_events, $datelimit = $date - $period; $search_in_history_db = db_search_in_history_db($datelimit); + + if($force_interval){ $resolution = $period/$time_interval; } @@ -580,29 +582,18 @@ function grafico_modulo_sparse_data ($agent_module_id, $period, $show_events, // Get event data (contains alert data too) $events = array(); if ($show_unknown == 1 || $show_events == 1 || $show_alerts == 1) { - $events = db_get_all_rows_filter ( - 'tevento', + $events = db_get_all_rows_filter ('tevento', array ('id_agentmodule' => $agent_module_id, "utimestamp > $datelimit", "utimestamp < $date", 'order' => 'utimestamp ASC'), - array ('id_evento', 'evento', 'utimestamp', 'event_type'), - 'AND', - $search_in_history_db - ); + array ('id_evento', 'evento', 'utimestamp', 'event_type')); // Get the last event after inverval to know if graph start on unknown - $prev_event = db_get_row_filter ( - 'tevento', + $prev_event = db_get_row_filter ('tevento', array ('id_agentmodule' => $agent_module_id, "utimestamp <= $datelimit", - 'order' => 'utimestamp DESC' - ), - false, - 'AND', - $search_in_history_db - ); - + 'order' => 'utimestamp DESC')); if (isset($prev_event['event_type']) && $prev_event['event_type'] == 'going_unknown') { $start_unknown = true; } @@ -1127,7 +1118,7 @@ function graphic_combined_module ($module_list, $weight_list, $period, global $config; global $graphic_type; - + if(!$fullscale){ $time_format_2 = ''; $temp_range = $period; @@ -1354,6 +1345,21 @@ function graphic_combined_module ($module_list, $weight_list, $period, continue; } + // if(empty($aux_array)){ + // foreach ($data as $key => $value) { + // $aux_array[$value['utimestamp']] = $value['datos']; + // } + // } else { + // foreach ($data as $key => $value) { + // if(array_key_exists($value['utimestamp'],$aux_array)){ + // $aux_array[$value['utimestamp']] = $aux_array[$value['utimestamp']] + $value['datos']; + // } else { + // $aux_array[$value['utimestamp']] = $value['datos']; + // } + // } + // } + + // html_debug($aux_array); if (!empty($name_list) && $names_number == $module_number && isset($name_list[$i])) { if ($labels[$agent_module_id] != '') $module_name_list[$i] = $labels[$agent_module_id]; @@ -3986,33 +3992,22 @@ function grafico_modulo_boolean_data ($agent_module_id, $period, $show_events, if ($uncompressed_module) { $avg_only = 1; } + $search_in_history_db = db_search_in_history_db($datelimit); // Get event data (contains alert data too) if ($show_unknown == 1 || $show_events == 1 || $show_alerts == 1) { - $events = db_get_all_rows_filter( - 'tevento', + $events = db_get_all_rows_filter('tevento', array ('id_agentmodule' => $agent_module_id, "utimestamp > $datelimit", "utimestamp < $date", - 'order' => 'utimestamp ASC' - ), - array ('evento', 'utimestamp', 'event_type', 'id_evento'), - 'AND', - $search_in_history_db - ); + 'order' => 'utimestamp ASC'), + array ('evento', 'utimestamp', 'event_type', 'id_evento')); // Get the last event after inverval to know if graph start on unknown - $prev_event = db_get_row_filter ( - 'tevento', + $prev_event = db_get_row_filter ('tevento', array ('id_agentmodule' => $agent_module_id, "utimestamp <= $datelimit", - 'order' => 'utimestamp DESC' - ), - false, - 'AND', - $search_in_history_db - ); - + 'order' => 'utimestamp DESC')); if (isset($prev_event['event_type']) && $prev_event['event_type'] == 'going_unknown') { $start_unknown = true; } @@ -4117,7 +4112,7 @@ function grafico_modulo_boolean_data ($agent_module_id, $period, $show_events, $zero = 0; $total = 0; $count = 0; - + $is_unknown = false; // Read data that falls in the current interval while (isset ($data[$j]) && $data[$j]['utimestamp'] >= $timestamp && @@ -4150,7 +4145,7 @@ function grafico_modulo_boolean_data ($agent_module_id, $period, $show_events, // Is the first point of a unknown interval $first_unknown = false; - $check_unknown = false; + $event_ids = array(); $alert_ids = array(); while (isset ($events[$k]) && @@ -4169,15 +4164,10 @@ function grafico_modulo_boolean_data ($agent_module_id, $period, $show_events, if ($is_unknown == false) { $first_unknown = true; } - else{ - $first_unknown = false; - } - $check_unknown = true; $is_unknown = true; } else if (substr ($events[$k]['event_type'], 0, 5) == 'going') { $is_unknown = false; - $first_unknown = false; } } $k++; @@ -4260,12 +4250,6 @@ function grafico_modulo_boolean_data ($agent_module_id, $period, $show_events, $chart[$timestamp]['unknown'.$series_suffix] = 0; } $chart[$timestamp]['unknown'.$series_suffix] = $unknown_value; - - if($unknown_value == 0 && $check_unknown == true){ - $chart[$timestamp]['unknown'.$series_suffix] = 1; - $check_unknown = false; - } - $series_type['unknown'.$series_suffix] = 'area'; } @@ -4396,138 +4380,165 @@ function fullscale_data ( &$chart_data, &$chart_extra_data, &$long_index, global $min_value; global $series_type; global $chart_extra_data; + + $ranges_unknown = db_get_module_ranges_unknown($agent_module_id, $datelimit, $date); - $first_data = 0; + $table = "tagente_datos"; + $module_type_str = modules_get_type_name ($agent_module_id); + if (strstr ($module_type_str, 'string') !== false) { + $table = "tagente_datos_string"; + } + $query = " SELECT utimestamp, datos FROM $table "; + $query .= " WHERE id_agente_modulo=$agent_module_id "; + $query .= " ORDER BY utimestamp ASC LIMIT 1"; + + $ret = db_get_all_rows_sql( $query , true); + + $first_data = $ret[0]['utimestamp']; $data_uncompress = db_uncompress_module_data($agent_module_id, $datelimit, $date); - - $chart_data = array(); - - $min_value = PHP_INT_MAX-1; - $max_value = PHP_INT_MIN+1; - $previous_data = $first_data; - $previous_unknown = 0; - - $i=0; - $current_event = $events[0]; - $prueba = array(); - foreach ($data_uncompress as $k) { - foreach ($k["data"] as $v) { - $real_date = date("Y M d H:i:s", $v['utimestamp']); - - if(!$flash_chart){ - $real_date = date("Y/M/d", $v['utimestamp']); - $real_date .= "\n"; - $real_date .= date(" H:i:s", $v['utimestamp']); - } - - $event_ids = array(); - $alert_ids = array(); - while (isset($current_event) && ($v['utimestamp'] >= $current_event["utimestamp"]) ) { - $event_date = date("Y M d H:i:s", $current_event['utimestamp']); + $i = 0; + $max_value = 0; + $min_value = 0; + $timestamp_second = 0; + if(is_array($data_uncompress)){ + foreach ($data_uncompress as $v) { + foreach ($v['data'] as $key => $value) { + $real_date = date("Y M d H:i:s", $value['utimestamp']); if(!$flash_chart){ - $event_date = date("Y/M/d", $current_event['utimestamp']); - $event_date .= "\n"; - $event_date .= date(" H:i:s", $current_event['utimestamp']); + $real_date = date("Y/M/d", $value['utimestamp']); + $real_date .= "\n"; + $real_date .= date(" H:i:s", $value['utimestamp']); } - - if ($show_events && (strpos($current_event["event_type"], "going") !== false)) { - $event_ids[$event_date][] = $current_event["id_evento"]; - - $chart_data[$event_date]["event" . $series_suffix] = 1; - $chart_data[$event_date]["alert" . $series_suffix] = NULL; - $chart_extra_data[count($chart_data)-1]['events'] = implode (',', $event_ids[$event_date]); + // Read events and alerts that fall in the current interval + $event_value = 0; + $alert_value = 0; + $unknown_value = 0; + $event_i = 0; + // Is the first point of a unknown interval + $first_unknown = false; + + $event_ids = array(); + $alert_ids = array(); + + // + if($timestamp_second == 0){ + $timestamp_second = $value['utimestamp']; } - elseif ($show_alerts && (strpos($current_event["event_type"], "alert") !== false)) { - $alert_ids[$event_date][] = $current_event["id_evento"]; - - $chart_data[$event_date]["event" . $series_suffix] = NULL; - $chart_data[$event_date]["alert" . $series_suffix] = 1; - $chart_extra_data[count($chart_data)-1]['alerts'] = implode (',', $alert_ids[$event_date]); + $timestamp_first = $timestamp_second; + $timestamp_second = $value['utimestamp']; + + foreach ($events as $key => $val) { + if( $val['utimestamp'] > $timestamp_first && + $val['utimestamp'] <= $timestamp_second ){ + if ($show_events == 1) { + $event_ids[] = $val['id_evento']; + $event_value++; + } + if ($show_alerts == 1 && substr ($val['event_type'], 0, 5) == 'alert') { + $alert_ids[] = $val['id_evento']; + $alert_value++; + } + if ($show_unknown) { + if ($val['event_type'] == 'going_unknown') { + if ($is_unknown == false) { + $first_unknown = true; + } + $is_unknown = true; + } + else if (substr ($val['event_type'], 0, 5) == 'going') { + $is_unknown = false; + } + } + } + } + + if(empty($value['datos'])){ + if($value['utimestamp'] < $first_data){ + //$chart_data[$real_date]['unknown'.$series_suffix] = 0; + $is_unknown = false; + } + else{ + //$chart_data[$real_date]['unknown'.$series_suffix] = 1; + $first_unknown = true; + } + } + + $timestamp_short = date("Y M d H:i:s", $value['utimestamp']); + + if(!$flash_chart){ + $timestamp_short = date("Y/M/d", $value['utimestamp']); + $timestamp_short .= "\n"; + $timestamp_short .= date(" H:i:s", $value['utimestamp']); + } + + + $long_index[$timestamp_short] = date( + html_entity_decode($config['date_format'], ENT_QUOTES, "UTF-8"), $value['utimestamp']); + // In some cases, can be marked as known because a recovery event + // was found in same interval. For this cases first_unknown is + // checked too + if ($is_unknown || $first_unknown) { + $unknown_value++; + } + + // Data + if ($show_events) { + if (!isset($chart_data[$real_date]['event'.$series_suffix])) { + $chart_data[$real_date]['event'.$series_suffix] = 0; + } + + $chart_data[$real_date]['event'.$series_suffix] += $event_value; + + $series_type['event'.$series_suffix] = 'points'; + } + + if ($show_alerts) { + if (!isset($chart_data[$real_date]['alert'.$series_suffix])) { + $chart_data[$real_date]['alert'.$series_suffix] = 0; + } + + $chart_data[$real_date]['alert'.$series_suffix] += $alert_value; + + $series_type['alert'.$series_suffix] = 'points'; + } + + $chart_data[$real_date]['sum'.$series_suffix] = $value['datos']; + + if($value['datos'] > $max_value){ + $max_value = $value['datos']; + } + + if($value['datos'] < $min_value){ + $min_value = $value['datos']; } - $chart_data[$event_date]["sum" . $series_suffix] = $previous_data; - if($show_unknown) { - $chart_data[$event_date]["unknown" . $series_suffix] = $previous_unknown; - } - $current_event = $events[$i++]; - } - - if ($v["datos"] === NULL) { - // Unknown - if (!isset($chart_data[$real_date]["event" . $series_suffix])) { - if($show_events) { - $chart_data[$real_date]["event" . $series_suffix] = NULL; - } - if($show_alerts) { - $chart_data[$real_date]["alert" . $series_suffix] = NULL; - } - } - - $chart_data[$real_date]["sum" . $series_suffix] = $previous_data; - if($show_unknown) { - $chart_data[$real_date]["unknown" . $series_suffix] = "1"; - } - $previous_unknown = "1"; - } - elseif($v["datos"] === false) { - // Not Init - $previous_data = $v["datos"]; - if (!isset($chart_data[$real_date]["event" . $series_suffix])) { - if ($show_events) { - $chart_data[$real_date]["event" . $series_suffix] = NULL; - } - if ($show_alerts) { - $chart_data[$real_date]["alert" . $series_suffix] = NULL; - } + if ($show_unknown) { + if (!isset($chart_data[$real_date]['unknown'.$series_suffix])) { + $chart_data[$real_date]['unknown'.$series_suffix] = 0; + } + $chart_data[$real_date]['unknown'.$series_suffix] = $unknown_value; + $series_type['unknown'.$series_suffix] = 'area'; } - $chart_data[$real_date]["sum" . $series_suffix] = $v["datos"]; - - if($v['datos'] >= $max_value){ - $max_value = $v['datos']; + if (!empty($event_ids)) { + $chart_extra_data[count($chart_data)-1]['events'] = implode(',',$event_ids); } - - if($v['datos'] <= $min_value){ - $min_value = $v['datos']; - } - - if($show_unknown) { - $chart_data[$real_date]["unknown" . $series_suffix] = NULL; - $previous_unknown = NULL; + if (!empty($alert_ids)) { + $chart_extra_data[count($chart_data)-1]['alerts'] = implode(',',$alert_ids); } } - else { - $previous_data = $v["datos"]; - if (!isset($chart_data[$real_date]["event" . $series_suffix])) { - if ($show_events) { - $chart_data[$real_date]["event" . $series_suffix] = NULL; - } - if ($show_alerts) { - $chart_data[$real_date]["alert" . $series_suffix] = NULL; - } - } - - $chart_data[$real_date]["sum" . $series_suffix] = $v["datos"]; - - if($v['datos'] >= $max_value){ - $max_value = $v['datos']; - } - - if($v['datos'] <= $min_value){ - $min_value = $v['datos']; - } - - if($show_unknown) { - $chart_data[$real_date]["unknown" . $series_suffix] = NULL; - $previous_unknown = NULL; - } - } + } + + if (!is_null($percentil) && $percentil) { + $avg = array_map(function($item) { return $item['sum']; }, $chart_data); + $percentil_result = get_percentile($percentil, $avg); + //Fill the data of chart + array_walk($chart_data, function(&$item) use ($percentil_result, $series_suffix) { + $item['percentil' . $series_suffix] = $percentil_result; }); + $series_type['percentil' . $series_suffix] = 'line'; } } - $series_type['event'.$series_suffix] = 'points'; - $series_type['alert'.$series_suffix] = 'points'; - $series_type['unknown'.$series_suffix] = 'area'; } function grafico_modulo_boolean ($agent_module_id, $period, $show_events, diff --git a/pandora_console/include/functions_modules.php b/pandora_console/include/functions_modules.php index 03f63e624c..bcdeb6819c 100755 --- a/pandora_console/include/functions_modules.php +++ b/pandora_console/include/functions_modules.php @@ -2261,53 +2261,50 @@ function modules_change_relation_lock ($id_relation) { return ($result !== false ? $new_value : $old_value); } -/* - * @return utimestamp with the first contact of the module or first contact before datelimit, false if not-init - */ -function modules_get_first_date($id_agent_module, $datelimit = 0) { + + +function modules_get_count_datas($id_agent_module, $date_init, $date_end) { + $interval = modules_get_interval ($id_agent_module); + + // TODO REMOVE THE TIME IN PLANNED DOWNTIME + + if (!is_numeric($date_init)) { + $date_init = strtotime($date_init); + } + + if (!is_numeric($date_end)) { + $date_end = strtotime($date_end); + } + + + + $first_date = modules_get_first_contact_date($id_agent_module); + + + + if ($date_init < $first_date) { + $date_init = $first_date; + } + + $diff = $date_end - $date_init; + + + return ($diff / $interval); +} + + +function modules_get_first_contact_date($id_agent_module) { global $config; - //check datatype string or normal - $table = "tagente_datos"; - $module_type_str = modules_get_type_name ($id_agent_module); - if (strstr ($module_type_str, 'string') !== false) { - $table = "tagente_datos_string"; - } - - $search_historydb = false; - - // tagente_estado.first_utimestamp is not valid or is not updated. Scan DBs for first utimestamp - if ($datelimit > 0) { - // get last data before datelimit - $query = " SELECT max(utimestamp) as utimestamp FROM $table "; - $query .= " WHERE id_agente_modulo=$id_agent_module "; - $query .= " AND utimestamp < $datelimit "; + // TODO REMOVE THE TIME IN PLANNED DOWNTIME - } - else { - // get first utimestamp - $query = " SELECT min(utimestamp) as utimestamp FROM $table "; - $query .= " WHERE id_agente_modulo=$id_agent_module "; - } + // TODO FOR OTHER KIND OF DATA - - // SEARCH ACTIVE DB - $data = db_get_all_rows_sql($query,$search_historydb); - if (($data === false) || ($data[0]["utimestamp"] === NULL) || ($data[0]["utimestamp"] <= 0)) { - // first utimestamp not found in active database - // SEARCH HISTORY DB - $search_historydb = true; - $data = db_get_all_rows_sql($query,$search_historydb); - } - - if (($data === false) || ($data[0]["utimestamp"] === NULL) || ($data[0]["utimestamp"] <= 0)) { - // Nor active DB nor history DB have the data, the module is not-init - return array ("first_utimestamp" => false, "search_historydb" => $search_historydb); - } - - // The data has been found - return array ("first_utimestamp" => $data[0]["utimestamp"], "search_historydb" => $search_historydb); - + $first_date = db_get_value('utimestamp', 'tagente_datos', + 'id_agente_modulo', $id_agent_module, + $config['history_db_enabled']); + + return $first_date; } /** diff --git a/pandora_console/include/graphs/flot/pandora.flot.js b/pandora_console/include/graphs/flot/pandora.flot.js index e6f97bc829..6fe97ae606 100644 --- a/pandora_console/include/graphs/flot/pandora.flot.js +++ b/pandora_console/include/graphs/flot/pandora.flot.js @@ -1767,11 +1767,9 @@ function pandoraFlotArea(graph_id, values, labels, labels_long, legend, if (timesize+timenewpos > canvaslimit) { $('#timestamp_'+graph_id).css('left', timenewpos - timesize); - $('#timestamp_'+graph_id).css('top', 50); } else { $('#timestamp_'+graph_id).css('left', timenewpos); - $('#timestamp_'+graph_id).css('top', 50); } } else { @@ -1814,16 +1812,24 @@ function pandoraFlotArea(graph_id, values, labels, labels_long, legend, plot.unhighlight(); if (item && item.series.label != '' && (item.series.label == legend_events || item.series.label == legend_events+series_suffix_str || item.series.label == legend_alerts || item.series.label == legend_alerts+series_suffix_str)) { plot.unhighlight(); + var canvaslimit = parseInt(plot.offset().left + plot.width()); var dataset = plot.getData(); + var timenewpos = parseInt(dataset[0].xaxis.p2c(pos.x)+plot.offset().left); + var extrasize = parseInt($('#extra_'+graph_id).css('width').split('px')[0]); + + var left_pos; + if (extrasize+timenewpos > canvaslimit) { + left_pos = timenewpos - extrasize - 20; + } + else { + left_pos = timenewpos - (extrasize / 2); + } var extra_info = 'No info to show'; var extra_show = false; - var coord_x = (item.dataIndex/item.series.xaxis.datamax)* (event.target.clientWidth - event.target.offsetLeft + 1) + event.target.offsetLeft; - - - $('#extra_'+graph_id).css('left',coord_x); - $('#extra_'+graph_id).css('top', event.target.offsetTop + 55 ); + $('#extra_'+graph_id).css('left',left_pos); + $('#extra_'+graph_id).css('top',plot.offset().top + 25); switch(item.series.label) { case legend_alerts+series_suffix_str: diff --git a/pandora_console/operation/agentes/stat_win.php b/pandora_console/operation/agentes/stat_win.php index f0fdf37082..ba7965fd63 100644 --- a/pandora_console/operation/agentes/stat_win.php +++ b/pandora_console/operation/agentes/stat_win.php @@ -111,6 +111,8 @@ $alias = db_get_value ("alias","tagente","id_agente",$id_agent); $id = (int) get_parameter ("id", 0); // Agent id $agent_id = (int) modules_get_agentmodule_agent($id); + // Kind module + $type_module = modules_get_agentmodule_kind($id); if (empty($id) || empty($agent_id)) { ui_print_error_message(__('There was a problem locating the source of the graph')); @@ -169,6 +171,7 @@ $alias = db_get_value ("alias","tagente","id_agente",$id_agent); $time_compare_overlapped = get_parameter ("time_compare_overlapped", 0); $unknown_graph = get_parameter_checkbox ("unknown_graph", 1); + //$type_module == 'predictionserver'; $fullscale_sent = get_parameter ("fullscale_sent", 0); if(!$fullscale_sent){ if(!isset($config['full_scale_option']) || $config['full_scale_option'] == 0){ @@ -420,12 +423,14 @@ $alias = db_get_value ("alias","tagente","id_agente",$id_agent); break; } - $data = array(); - $data[0] = __('Show full scale graph (TIP)'); - $data[1] = html_print_checkbox ("fullscale", 1, (bool) $fullscale, - true, false); - $table->data[] = $data; - $table->rowclass[] = ''; + if($type_module != 'predictionserver'){ + $data = array(); + $data[0] = __('Show full scale graph (TIP)'); + $data[1] = html_print_checkbox ("fullscale", 1, (bool) $fullscale, + true, false); + $table->data[] = $data; + $table->rowclass[] = ''; + } $form_table = html_print_table($table, true); From f77693bce95c5a0da22303a6c2f3330417e26fc3 Mon Sep 17 00:00:00 2001 From: danielmaya Date: Fri, 10 Nov 2017 13:19:23 +0100 Subject: [PATCH 067/149] Fixed margin left and top in visual console --- .../operation/visual_console/public_console.php | 5 +++++ pandora_console/operation/visual_console/pure_ajax.php | 5 ++++- pandora_console/operation/visual_console/render_view.php | 7 +++++-- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/pandora_console/operation/visual_console/public_console.php b/pandora_console/operation/visual_console/public_console.php index 5b955def1f..21bf94fe65 100755 --- a/pandora_console/operation/visual_console/public_console.php +++ b/pandora_console/operation/visual_console/public_console.php @@ -208,6 +208,11 @@ $ignored_params['refr'] = ''; $(".overlay").removeClass("overlay").addClass("overlaydisabled"); + // Start the map fetch + //~ fetchMap(); + }); + + $(window).load (function () { $('.item:not(.icon) img:not(.b64img)').each( function() { if ($(this).css('float')=='left' || $(this).css('float')=='right') { if( $(this).parent()[0].tagName == 'DIV'){ diff --git a/pandora_console/operation/visual_console/pure_ajax.php b/pandora_console/operation/visual_console/pure_ajax.php index 08b5460067..58e920550f 100644 --- a/pandora_console/operation/visual_console/pure_ajax.php +++ b/pandora_console/operation/visual_console/pure_ajax.php @@ -183,7 +183,10 @@ $ignored_params['refr'] = ''; }); $(".overlay").removeClass("overlay").addClass("overlaydisabled"); - + + }); + + $(window).load (function () { $('.item:not(.icon) img').each(function(){ diff --git a/pandora_console/operation/visual_console/render_view.php b/pandora_console/operation/visual_console/render_view.php index 261205818b..885f326238 100755 --- a/pandora_console/operation/visual_console/render_view.php +++ b/pandora_console/operation/visual_console/render_view.php @@ -279,7 +279,10 @@ $ignored_params['refr'] = ''; }); $(".overlay").removeClass("overlay").addClass("overlaydisabled"); - + + }); + + $(window).load (function () { $('.item:not(.icon) img:not(.b64img)').each( function() { if ($(this).css('float')=='left' || $(this).css('float')=='right') { if( $(this).parent()[0].tagName == 'DIV'){ @@ -332,6 +335,6 @@ $ignored_params['refr'] = ''; height = parseInt($(this).css("height")) - 30; $(this).css('height', height); }); - + }); \ No newline at end of file From de65e7cf27553a442a61811cc3716790b5941897 Mon Sep 17 00:00:00 2001 From: Arturo Gonzalez Date: Fri, 10 Nov 2017 14:43:31 +0100 Subject: [PATCH 068/149] Fixed element name and leyend separator --- pandora_console/include/functions_visual_map.php | 6 +++--- pandora_console/include/functions_visual_map_editor.php | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pandora_console/include/functions_visual_map.php b/pandora_console/include/functions_visual_map.php index f6293d8743..647e603a51 100755 --- a/pandora_console/include/functions_visual_map.php +++ b/pandora_console/include/functions_visual_map.php @@ -2583,7 +2583,7 @@ function get_donut_module_data ($id_module) { $total = 0; foreach ($values as $val) { if ($index < $max_elements) { - $data = explode(":", $val); + $data = explode(",", $val); $values_to_return[$index]['tag_name'] = $data[0] . ", " . $data[1]; $values_to_return[$index]['color'] = $colors[$index]; $values_to_return[$index]['value'] = (int)$data[1]; @@ -2591,7 +2591,7 @@ function get_donut_module_data ($id_module) { $index++; } else { - $data = explode(":", $val); + $data = explode(",", $val); $values_to_return[$index]['tag_name'] = __('Others') . ", " . $data[1]; $values_to_return[$index]['color'] = $colors[$index]; $values_to_return[$index]['value'] += (int)$data[1]; @@ -2602,7 +2602,7 @@ function get_donut_module_data ($id_module) { foreach ($values_to_return as $ind => $donut_data) { $values_to_return[$ind]['percent'] = ($donut_data['value'] * 100) / $total; } - + return $values_to_return; } diff --git a/pandora_console/include/functions_visual_map_editor.php b/pandora_console/include/functions_visual_map_editor.php index 513c6ccc32..82d6382343 100755 --- a/pandora_console/include/functions_visual_map_editor.php +++ b/pandora_console/include/functions_visual_map_editor.php @@ -731,7 +731,7 @@ function visual_map_editor_print_toolbox() { visual_map_print_button_editor('static_graph', __('Static Graph'), 'left', false, 'camera_min', true); visual_map_print_button_editor('percentile_item', __('Percentile Item'), 'left', false, 'percentile_item_min', true); visual_map_print_button_editor('module_graph', __('Module Graph'), 'left', false, 'graph_min', true); - visual_map_print_button_editor('donut_graph', __('Donut Graph'), 'left', false, 'donut_graph_min', true); + visual_map_print_button_editor('donut_graph', __('Serialized pie graph'), 'left', false, 'donut_graph_min', true); visual_map_print_button_editor('bars_graph', __('Bars Graph'), 'left', false, 'bars_graph_min', true); visual_map_print_button_editor('auto_sla_graph', __('Auto SLA Graph'), 'left', false, 'auto_sla_graph_min', true); visual_map_print_button_editor('simple_value', __('Simple Value'), 'left', false, 'binary_min', true); From eb39d25c4b137115b6d65a7ee733b987df4a1b88 Mon Sep 17 00:00:00 2001 From: Arturo Gonzalez Date: Fri, 10 Nov 2017 15:03:52 +0100 Subject: [PATCH 069/149] Added field to get string modules --- .../visual_console_builder.editor.js | 15 ++++++-- .../ajax/visual_console_builder.ajax.php | 5 ++- pandora_console/include/functions_ui.php | 9 +++++ .../include/functions_visual_map_editor.php | 35 ++++++++++++++++++- .../operation/agentes/ver_agente.php | 5 +++ 5 files changed, 65 insertions(+), 4 deletions(-) diff --git a/pandora_console/godmode/reporting/visual_console_builder.editor.js b/pandora_console/godmode/reporting/visual_console_builder.editor.js index ebd2427ce3..291c3abd38 100755 --- a/pandora_console/godmode/reporting/visual_console_builder.editor.js +++ b/pandora_console/godmode/reporting/visual_console_builder.editor.js @@ -800,6 +800,8 @@ function readFields() { values['top'] = $("input[name=top]").val(); values['agent'] = $("input[name=agent]").val(); values['id_agent'] = $("input[name=id_agent]").val(); + values['agent_string'] = $("input[name=agent_string]").val(); + values['id_agent_string'] = $("input[name=id_agent_string]").val(); values['module'] = $("select[name=module]").val(); values['process_simple_value'] = $("select[name=process_value]").val(); values['background'] = $("#background_image").val(); @@ -910,7 +912,7 @@ function create_button_palette_callback() { } break; case 'donut_graph': - if ((values['agent'] == '')) { + if ((values['agent_string'] == '')) { alert($("#message_alert_no_agent").html()); validate = false; } @@ -1442,11 +1444,16 @@ function loadFieldsFromDB(item) { if (key == 'pos_y') $("input[name=top]").val(val); if (key == 'agent_name') { $("input[name=agent]").val(val); + $("input[name=agent_string]").val(val); //Reload no-sincrone the select of modules } + if (key == 'id_agent') { $("input[name=id_agent]").val(val); } + if (key == 'id_agent_string') { + $("input[name=id_agent_string]").val(val); + } if (key == 'modules_html') { $("select[name=module]").empty().html(val); $("select[name=module]").val(moduleId); @@ -1714,6 +1721,9 @@ function hiddenFields(item) { $("#agent_row").css('display', 'none'); $("#agent_row." + item).css('display', ''); + $("#agent_row_string").css('display', 'none'); + $("#agent_row_string." + item).css('display', ''); + $("#module_row").css('display', 'none'); $("#module_row." + item).css('display', ''); @@ -1838,6 +1848,7 @@ function cleanFields(item) { $("input[name=left]").val(0); $("input[name=top]").val(0); $("input[name=agent]").val(''); + $("input[name=agent_string]").val(''); $("select[name=module]").val(''); $("select[name=process_value]").val(0); $("select[name=background_image]").val(''); @@ -2452,7 +2463,7 @@ function setDonutsGraph (id_data, values) { parameter.push ({name: "page", value: "include/ajax/visual_console_builder.ajax"}); parameter.push ({name: "action", value: "get_module_type_string"}); - parameter.push ({name: "id_agent", value: values['id_agent']}); + parameter.push ({name: "id_agent", value: values['id_agent_string']}); parameter.push ({name: "module", value: values['module']}); parameter.push ({name: "id_element", value: id_data}); parameter.push ({name: "id_visual_console", value: id_visual_console}); diff --git a/pandora_console/include/ajax/visual_console_builder.ajax.php b/pandora_console/include/ajax/visual_console_builder.ajax.php index c7e4484a27..07a51af3bb 100755 --- a/pandora_console/include/ajax/visual_console_builder.ajax.php +++ b/pandora_console/include/ajax/visual_console_builder.ajax.php @@ -113,6 +113,7 @@ $metaconsole = get_parameter('metaconsole', 0); $server_name = get_parameter('server_name', null); $server_id = (int)get_parameter('server_id', 0); $id_agent = get_parameter('id_agent', null); +$id_agent_string = get_parameter('id_agent_string', null); $id_metaconsole = get_parameter('id_metaconsole', null); $id_group = (int)get_parameter('id_group', 0); $id_custom_graph = get_parameter('id_custom_graph', null); @@ -179,7 +180,7 @@ switch ($action) { } $is_string = db_get_value_filter ('id_tipo_modulo', 'tagente_modulo', - array ('id_agente' => $id_agent, + array ('id_agente' => _string, 'id_agente_modulo' => $id_module)); if ($layoutData['id_metaconsole'] != 0) { @@ -611,6 +612,7 @@ switch ($action) { } $values['border_color'] = $resume_color; $values['type'] = DONUT_GRAPH; + $values['id_agent'] = $id_agent_string; break; case 'box_item': @@ -1013,6 +1015,7 @@ switch ($action) { $values['width'] = $width; $values['height'] = $height; $values['border_color'] = $resume_color; + $values['id_agent'] = $id_agent_string; break; case 'module_graph': $values['type'] = MODULE_GRAPH; diff --git a/pandora_console/include/functions_ui.php b/pandora_console/include/functions_ui.php index 11395a37ba..e76ba9399f 100755 --- a/pandora_console/include/functions_ui.php +++ b/pandora_console/include/functions_ui.php @@ -2973,6 +2973,11 @@ function ui_print_agent_autocomplete_input($parameters) { else $metaconsole_enabled = false; } + + $get_only_string_modules = false; + if (isset($parameters['get_only_string_modules'])) { + $get_only_string_modules = true; + } $spinner_image = html_print_image('images/spinner.gif', true, false, true); if (isset($parameters['spinner_image'])) { @@ -3128,6 +3133,10 @@ function ui_print_agent_autocomplete_input($parameters) { if (' . ((int) $get_order_json) . ') { inputs.push ("get_order_json=1"); } + + if (' . ((int) $get_only_string_modules) . ') { + inputs.push ("get_only_string_modules=1"); + } if (' . ((int)$metaconsole_enabled) . ') { if ((' . ((int)$use_input_server) . ') diff --git a/pandora_console/include/functions_visual_map_editor.php b/pandora_console/include/functions_visual_map_editor.php index 82d6382343..f4d99e5bfa 100755 --- a/pandora_console/include/functions_visual_map_editor.php +++ b/pandora_console/include/functions_visual_map_editor.php @@ -290,7 +290,7 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) { $form_items['agent_row'] = array(); $form_items['agent_row']['items'] = array('static_graph', 'percentile_bar', 'percentile_item', 'module_graph', - 'simple_value', 'datos', 'auto_sla_graph', 'bars_graph', 'donut_graph'); + 'simple_value', 'datos', 'auto_sla_graph', 'bars_graph'); $form_items['agent_row']['html'] = ''; $params = array(); @@ -320,6 +320,39 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) { $form_items['agent_row']['html'] .= ''; + + $form_items['agent_row_string'] = array(); + $form_items['agent_row_string']['items'] = array('donut_graph'); + $form_items['agent_row_string']['html'] = ''; + $params = array(); + $params['return'] = true; + $params['show_helptip'] = true; + $params['input_name'] = 'agent_string'; + $params['size'] = 30; + $params['selectbox_id'] = 'module'; + $params['javascript_is_function_select'] = true; + $params['use_hidden_input_idagent'] = true; + $params['print_hidden_input_idagent'] = true; + $params['hidden_input_idagent_name'] = 'id_agent_string'; + $params['get_order_json'] = true; + $params['get_only_string_modules'] = true; + if (defined('METACONSOLE')) { + $params['javascript_ajax_page'] = '../../ajax.php'; + $params['disabled_javascript_on_blur_function'] = true; + + $params['print_input_server'] = true; + $params['print_input_id_server'] = true; + $params['input_server_id'] = 'id_server_name'; + $params['input_id_server_name'] = 'id_server_metaconsole'; + $params['input_server_value'] = ''; + $params['use_input_id_server'] = true; + $params['metaconsole_enabled'] = true; + $params['print_hidden_input_idagent'] = true; + } + $form_items['agent_row_string']['html'] .= ''; $form_items['module_row'] = array(); $form_items['module_row']['items'] = array('static_graph', diff --git a/pandora_console/operation/agentes/ver_agente.php b/pandora_console/operation/agentes/ver_agente.php index 97c4f01720..b2479fec88 100644 --- a/pandora_console/operation/agentes/ver_agente.php +++ b/pandora_console/operation/agentes/ver_agente.php @@ -589,6 +589,11 @@ if (is_ajax ()) { if (empty($filter)) $filter = false; + $get_only_string_modules = get_parameter('get_only_string_modules', false); + if ($get_only_string_modules) { + $filter['tagente_modulo.id_tipo_modulo IN'] = "(17,23,3,10,33)"; + } + // Status selector if ($status_modulo == AGENT_MODULE_STATUS_NORMAL) { //Normal $sql_conditions .= ' estado = 0 AND utimestamp > 0 ) From b8e6d7927e46eaf1d770b4fa371fe7c8e0eebb80 Mon Sep 17 00:00:00 2001 From: artica Date: Sat, 11 Nov 2017 00:01:10 +0100 Subject: [PATCH 070/149] Auto-updated build strings. --- pandora_agents/unix/DEBIAN/control | 2 +- pandora_agents/unix/DEBIAN/make_deb_package.sh | 2 +- pandora_agents/unix/pandora_agent | 2 +- pandora_agents/unix/pandora_agent.redhat.spec | 2 +- pandora_agents/unix/pandora_agent.spec | 2 +- pandora_agents/unix/pandora_agent_installer | 2 +- pandora_agents/win32/installer/pandora.mpi | 2 +- pandora_agents/win32/pandora.cc | 2 +- pandora_agents/win32/versioninfo.rc | 2 +- pandora_console/DEBIAN/control | 2 +- pandora_console/DEBIAN/make_deb_package.sh | 2 +- pandora_console/include/config_process.php | 2 +- pandora_console/install.php | 2 +- pandora_console/pandora_console.redhat.spec | 2 +- pandora_console/pandora_console.spec | 2 +- pandora_server/DEBIAN/control | 2 +- pandora_server/DEBIAN/make_deb_package.sh | 2 +- pandora_server/lib/PandoraFMS/Config.pm | 2 +- pandora_server/pandora_server.redhat.spec | 2 +- pandora_server/pandora_server.spec | 2 +- pandora_server/pandora_server_installer | 2 +- pandora_server/util/pandora_db.pl | 2 +- pandora_server/util/pandora_manage.pl | 2 +- 23 files changed, 23 insertions(+), 23 deletions(-) diff --git a/pandora_agents/unix/DEBIAN/control b/pandora_agents/unix/DEBIAN/control index 48192919a2..156268ce8c 100644 --- a/pandora_agents/unix/DEBIAN/control +++ b/pandora_agents/unix/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-agent-unix -Version: 7.0NG.715-171110 +Version: 7.0NG.715-171111 Architecture: all Priority: optional Section: admin diff --git a/pandora_agents/unix/DEBIAN/make_deb_package.sh b/pandora_agents/unix/DEBIAN/make_deb_package.sh index 1b335438a9..31f95327c0 100644 --- a/pandora_agents/unix/DEBIAN/make_deb_package.sh +++ b/pandora_agents/unix/DEBIAN/make_deb_package.sh @@ -14,7 +14,7 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -pandora_version="7.0NG.715-171110" +pandora_version="7.0NG.715-171111" echo "Test if you has the tools for to make the packages." whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null diff --git a/pandora_agents/unix/pandora_agent b/pandora_agents/unix/pandora_agent index a5743df259..f4e44d7d0b 100755 --- a/pandora_agents/unix/pandora_agent +++ b/pandora_agents/unix/pandora_agent @@ -41,7 +41,7 @@ my $Sem = undef; my $ThreadSem = undef; use constant AGENT_VERSION => '7.0NG.715'; -use constant AGENT_BUILD => '171110'; +use constant AGENT_BUILD => '171111'; # Agent log default file size maximum and instances use constant DEFAULT_MAX_LOG_SIZE => 600000; diff --git a/pandora_agents/unix/pandora_agent.redhat.spec b/pandora_agents/unix/pandora_agent.redhat.spec index 7071e4655d..bf9d45ae00 100644 --- a/pandora_agents/unix/pandora_agent.redhat.spec +++ b/pandora_agents/unix/pandora_agent.redhat.spec @@ -3,7 +3,7 @@ # %define name pandorafms_agent_unix %define version 7.0NG.715 -%define release 171110 +%define release 171111 Summary: Pandora FMS Linux agent, PERL version Name: %{name} diff --git a/pandora_agents/unix/pandora_agent.spec b/pandora_agents/unix/pandora_agent.spec index a3ce74230c..2bc5799319 100644 --- a/pandora_agents/unix/pandora_agent.spec +++ b/pandora_agents/unix/pandora_agent.spec @@ -3,7 +3,7 @@ # %define name pandorafms_agent_unix %define version 7.0NG.715 -%define release 171110 +%define release 171111 Summary: Pandora FMS Linux agent, PERL version Name: %{name} diff --git a/pandora_agents/unix/pandora_agent_installer b/pandora_agents/unix/pandora_agent_installer index e75fffdc2b..b2f66323ec 100755 --- a/pandora_agents/unix/pandora_agent_installer +++ b/pandora_agents/unix/pandora_agent_installer @@ -10,7 +10,7 @@ # ********************************************************************** PI_VERSION="7.0NG.715" -PI_BUILD="171110" +PI_BUILD="171111" OS_NAME=`uname -s` FORCE=0 diff --git a/pandora_agents/win32/installer/pandora.mpi b/pandora_agents/win32/installer/pandora.mpi index 1269e3108d..719bd89c90 100644 --- a/pandora_agents/win32/installer/pandora.mpi +++ b/pandora_agents/win32/installer/pandora.mpi @@ -186,7 +186,7 @@ UpgradeApplicationID {} Version -{171110} +{171111} ViewReadme {Yes} diff --git a/pandora_agents/win32/pandora.cc b/pandora_agents/win32/pandora.cc index 80142ca894..167574bdf9 100644 --- a/pandora_agents/win32/pandora.cc +++ b/pandora_agents/win32/pandora.cc @@ -30,7 +30,7 @@ using namespace Pandora; using namespace Pandora_Strutils; #define PATH_SIZE _MAX_PATH+1 -#define PANDORA_VERSION ("7.0NG.715(Build 171110)") +#define PANDORA_VERSION ("7.0NG.715(Build 171111)") string pandora_path; string pandora_dir; diff --git a/pandora_agents/win32/versioninfo.rc b/pandora_agents/win32/versioninfo.rc index 5d9e664a8f..013d3b0c13 100644 --- a/pandora_agents/win32/versioninfo.rc +++ b/pandora_agents/win32/versioninfo.rc @@ -11,7 +11,7 @@ BEGIN VALUE "LegalCopyright", "Artica ST" VALUE "OriginalFilename", "PandoraAgent.exe" VALUE "ProductName", "Pandora FMS Windows Agent" - VALUE "ProductVersion", "(7.0NG.715(Build 171110))" + VALUE "ProductVersion", "(7.0NG.715(Build 171111))" VALUE "FileVersion", "1.0.0.0" END END diff --git a/pandora_console/DEBIAN/control b/pandora_console/DEBIAN/control index fe0cfc6bdc..b32834625c 100644 --- a/pandora_console/DEBIAN/control +++ b/pandora_console/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-console -Version: 7.0NG.715-171110 +Version: 7.0NG.715-171111 Architecture: all Priority: optional Section: admin diff --git a/pandora_console/DEBIAN/make_deb_package.sh b/pandora_console/DEBIAN/make_deb_package.sh index b80b89eccd..1e48ffbcac 100644 --- a/pandora_console/DEBIAN/make_deb_package.sh +++ b/pandora_console/DEBIAN/make_deb_package.sh @@ -14,7 +14,7 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -pandora_version="7.0NG.715-171110" +pandora_version="7.0NG.715-171111" package_pear=0 package_pandora=1 diff --git a/pandora_console/include/config_process.php b/pandora_console/include/config_process.php index 7a81d1d4f7..040784099a 100644 --- a/pandora_console/include/config_process.php +++ b/pandora_console/include/config_process.php @@ -22,7 +22,7 @@ /** * Pandora build version and version */ -$build_version = 'PC171110'; +$build_version = 'PC171111'; $pandora_version = 'v7.0NG.715'; // Do not overwrite default timezone set if defined. diff --git a/pandora_console/install.php b/pandora_console/install.php index 53b50bb05a..706c533462 100755 --- a/pandora_console/install.php +++ b/pandora_console/install.php @@ -71,7 +71,7 @@
    Date: Sun, 12 Nov 2017 00:01:08 +0100 Subject: [PATCH 071/149] Auto-updated build strings. --- pandora_agents/unix/DEBIAN/control | 2 +- pandora_agents/unix/DEBIAN/make_deb_package.sh | 2 +- pandora_agents/unix/pandora_agent | 2 +- pandora_agents/unix/pandora_agent.redhat.spec | 2 +- pandora_agents/unix/pandora_agent.spec | 2 +- pandora_agents/unix/pandora_agent_installer | 2 +- pandora_agents/win32/installer/pandora.mpi | 2 +- pandora_agents/win32/pandora.cc | 2 +- pandora_agents/win32/versioninfo.rc | 2 +- pandora_console/DEBIAN/control | 2 +- pandora_console/DEBIAN/make_deb_package.sh | 2 +- pandora_console/include/config_process.php | 2 +- pandora_console/install.php | 2 +- pandora_console/pandora_console.redhat.spec | 2 +- pandora_console/pandora_console.spec | 2 +- pandora_server/DEBIAN/control | 2 +- pandora_server/DEBIAN/make_deb_package.sh | 2 +- pandora_server/lib/PandoraFMS/Config.pm | 2 +- pandora_server/pandora_server.redhat.spec | 2 +- pandora_server/pandora_server.spec | 2 +- pandora_server/pandora_server_installer | 2 +- pandora_server/util/pandora_db.pl | 2 +- pandora_server/util/pandora_manage.pl | 2 +- 23 files changed, 23 insertions(+), 23 deletions(-) diff --git a/pandora_agents/unix/DEBIAN/control b/pandora_agents/unix/DEBIAN/control index 156268ce8c..db41c07d03 100644 --- a/pandora_agents/unix/DEBIAN/control +++ b/pandora_agents/unix/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-agent-unix -Version: 7.0NG.715-171111 +Version: 7.0NG.715-171112 Architecture: all Priority: optional Section: admin diff --git a/pandora_agents/unix/DEBIAN/make_deb_package.sh b/pandora_agents/unix/DEBIAN/make_deb_package.sh index 31f95327c0..67a638c16c 100644 --- a/pandora_agents/unix/DEBIAN/make_deb_package.sh +++ b/pandora_agents/unix/DEBIAN/make_deb_package.sh @@ -14,7 +14,7 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -pandora_version="7.0NG.715-171111" +pandora_version="7.0NG.715-171112" echo "Test if you has the tools for to make the packages." whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null diff --git a/pandora_agents/unix/pandora_agent b/pandora_agents/unix/pandora_agent index f4e44d7d0b..6e6db74d26 100755 --- a/pandora_agents/unix/pandora_agent +++ b/pandora_agents/unix/pandora_agent @@ -41,7 +41,7 @@ my $Sem = undef; my $ThreadSem = undef; use constant AGENT_VERSION => '7.0NG.715'; -use constant AGENT_BUILD => '171111'; +use constant AGENT_BUILD => '171112'; # Agent log default file size maximum and instances use constant DEFAULT_MAX_LOG_SIZE => 600000; diff --git a/pandora_agents/unix/pandora_agent.redhat.spec b/pandora_agents/unix/pandora_agent.redhat.spec index bf9d45ae00..0fc59b5059 100644 --- a/pandora_agents/unix/pandora_agent.redhat.spec +++ b/pandora_agents/unix/pandora_agent.redhat.spec @@ -3,7 +3,7 @@ # %define name pandorafms_agent_unix %define version 7.0NG.715 -%define release 171111 +%define release 171112 Summary: Pandora FMS Linux agent, PERL version Name: %{name} diff --git a/pandora_agents/unix/pandora_agent.spec b/pandora_agents/unix/pandora_agent.spec index 2bc5799319..21c5766d9d 100644 --- a/pandora_agents/unix/pandora_agent.spec +++ b/pandora_agents/unix/pandora_agent.spec @@ -3,7 +3,7 @@ # %define name pandorafms_agent_unix %define version 7.0NG.715 -%define release 171111 +%define release 171112 Summary: Pandora FMS Linux agent, PERL version Name: %{name} diff --git a/pandora_agents/unix/pandora_agent_installer b/pandora_agents/unix/pandora_agent_installer index b2f66323ec..1a751158f3 100755 --- a/pandora_agents/unix/pandora_agent_installer +++ b/pandora_agents/unix/pandora_agent_installer @@ -10,7 +10,7 @@ # ********************************************************************** PI_VERSION="7.0NG.715" -PI_BUILD="171111" +PI_BUILD="171112" OS_NAME=`uname -s` FORCE=0 diff --git a/pandora_agents/win32/installer/pandora.mpi b/pandora_agents/win32/installer/pandora.mpi index 719bd89c90..0b08db5814 100644 --- a/pandora_agents/win32/installer/pandora.mpi +++ b/pandora_agents/win32/installer/pandora.mpi @@ -186,7 +186,7 @@ UpgradeApplicationID {} Version -{171111} +{171112} ViewReadme {Yes} diff --git a/pandora_agents/win32/pandora.cc b/pandora_agents/win32/pandora.cc index 167574bdf9..099535ced0 100644 --- a/pandora_agents/win32/pandora.cc +++ b/pandora_agents/win32/pandora.cc @@ -30,7 +30,7 @@ using namespace Pandora; using namespace Pandora_Strutils; #define PATH_SIZE _MAX_PATH+1 -#define PANDORA_VERSION ("7.0NG.715(Build 171111)") +#define PANDORA_VERSION ("7.0NG.715(Build 171112)") string pandora_path; string pandora_dir; diff --git a/pandora_agents/win32/versioninfo.rc b/pandora_agents/win32/versioninfo.rc index 013d3b0c13..bae828cff6 100644 --- a/pandora_agents/win32/versioninfo.rc +++ b/pandora_agents/win32/versioninfo.rc @@ -11,7 +11,7 @@ BEGIN VALUE "LegalCopyright", "Artica ST" VALUE "OriginalFilename", "PandoraAgent.exe" VALUE "ProductName", "Pandora FMS Windows Agent" - VALUE "ProductVersion", "(7.0NG.715(Build 171111))" + VALUE "ProductVersion", "(7.0NG.715(Build 171112))" VALUE "FileVersion", "1.0.0.0" END END diff --git a/pandora_console/DEBIAN/control b/pandora_console/DEBIAN/control index b32834625c..4598c56e02 100644 --- a/pandora_console/DEBIAN/control +++ b/pandora_console/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-console -Version: 7.0NG.715-171111 +Version: 7.0NG.715-171112 Architecture: all Priority: optional Section: admin diff --git a/pandora_console/DEBIAN/make_deb_package.sh b/pandora_console/DEBIAN/make_deb_package.sh index 1e48ffbcac..2e90f69351 100644 --- a/pandora_console/DEBIAN/make_deb_package.sh +++ b/pandora_console/DEBIAN/make_deb_package.sh @@ -14,7 +14,7 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -pandora_version="7.0NG.715-171111" +pandora_version="7.0NG.715-171112" package_pear=0 package_pandora=1 diff --git a/pandora_console/include/config_process.php b/pandora_console/include/config_process.php index 040784099a..82c28e09c4 100644 --- a/pandora_console/include/config_process.php +++ b/pandora_console/include/config_process.php @@ -22,7 +22,7 @@ /** * Pandora build version and version */ -$build_version = 'PC171111'; +$build_version = 'PC171112'; $pandora_version = 'v7.0NG.715'; // Do not overwrite default timezone set if defined. diff --git a/pandora_console/install.php b/pandora_console/install.php index 706c533462..265d9d3c36 100755 --- a/pandora_console/install.php +++ b/pandora_console/install.php @@ -71,7 +71,7 @@
    Date: Mon, 13 Nov 2017 00:01:08 +0100 Subject: [PATCH 072/149] Auto-updated build strings. --- pandora_agents/unix/DEBIAN/control | 2 +- pandora_agents/unix/DEBIAN/make_deb_package.sh | 2 +- pandora_agents/unix/pandora_agent | 2 +- pandora_agents/unix/pandora_agent.redhat.spec | 2 +- pandora_agents/unix/pandora_agent.spec | 2 +- pandora_agents/unix/pandora_agent_installer | 2 +- pandora_agents/win32/installer/pandora.mpi | 2 +- pandora_agents/win32/pandora.cc | 2 +- pandora_agents/win32/versioninfo.rc | 2 +- pandora_console/DEBIAN/control | 2 +- pandora_console/DEBIAN/make_deb_package.sh | 2 +- pandora_console/include/config_process.php | 2 +- pandora_console/install.php | 2 +- pandora_console/pandora_console.redhat.spec | 2 +- pandora_console/pandora_console.spec | 2 +- pandora_server/DEBIAN/control | 2 +- pandora_server/DEBIAN/make_deb_package.sh | 2 +- pandora_server/lib/PandoraFMS/Config.pm | 2 +- pandora_server/pandora_server.redhat.spec | 2 +- pandora_server/pandora_server.spec | 2 +- pandora_server/pandora_server_installer | 2 +- pandora_server/util/pandora_db.pl | 2 +- pandora_server/util/pandora_manage.pl | 2 +- 23 files changed, 23 insertions(+), 23 deletions(-) diff --git a/pandora_agents/unix/DEBIAN/control b/pandora_agents/unix/DEBIAN/control index db41c07d03..d2f1d23070 100644 --- a/pandora_agents/unix/DEBIAN/control +++ b/pandora_agents/unix/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-agent-unix -Version: 7.0NG.715-171112 +Version: 7.0NG.715-171113 Architecture: all Priority: optional Section: admin diff --git a/pandora_agents/unix/DEBIAN/make_deb_package.sh b/pandora_agents/unix/DEBIAN/make_deb_package.sh index 67a638c16c..69e3c2ffcb 100644 --- a/pandora_agents/unix/DEBIAN/make_deb_package.sh +++ b/pandora_agents/unix/DEBIAN/make_deb_package.sh @@ -14,7 +14,7 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -pandora_version="7.0NG.715-171112" +pandora_version="7.0NG.715-171113" echo "Test if you has the tools for to make the packages." whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null diff --git a/pandora_agents/unix/pandora_agent b/pandora_agents/unix/pandora_agent index 6e6db74d26..aaa878e973 100755 --- a/pandora_agents/unix/pandora_agent +++ b/pandora_agents/unix/pandora_agent @@ -41,7 +41,7 @@ my $Sem = undef; my $ThreadSem = undef; use constant AGENT_VERSION => '7.0NG.715'; -use constant AGENT_BUILD => '171112'; +use constant AGENT_BUILD => '171113'; # Agent log default file size maximum and instances use constant DEFAULT_MAX_LOG_SIZE => 600000; diff --git a/pandora_agents/unix/pandora_agent.redhat.spec b/pandora_agents/unix/pandora_agent.redhat.spec index 0fc59b5059..b1a9037142 100644 --- a/pandora_agents/unix/pandora_agent.redhat.spec +++ b/pandora_agents/unix/pandora_agent.redhat.spec @@ -3,7 +3,7 @@ # %define name pandorafms_agent_unix %define version 7.0NG.715 -%define release 171112 +%define release 171113 Summary: Pandora FMS Linux agent, PERL version Name: %{name} diff --git a/pandora_agents/unix/pandora_agent.spec b/pandora_agents/unix/pandora_agent.spec index 21c5766d9d..d673c5303c 100644 --- a/pandora_agents/unix/pandora_agent.spec +++ b/pandora_agents/unix/pandora_agent.spec @@ -3,7 +3,7 @@ # %define name pandorafms_agent_unix %define version 7.0NG.715 -%define release 171112 +%define release 171113 Summary: Pandora FMS Linux agent, PERL version Name: %{name} diff --git a/pandora_agents/unix/pandora_agent_installer b/pandora_agents/unix/pandora_agent_installer index 1a751158f3..fd036c8408 100755 --- a/pandora_agents/unix/pandora_agent_installer +++ b/pandora_agents/unix/pandora_agent_installer @@ -10,7 +10,7 @@ # ********************************************************************** PI_VERSION="7.0NG.715" -PI_BUILD="171112" +PI_BUILD="171113" OS_NAME=`uname -s` FORCE=0 diff --git a/pandora_agents/win32/installer/pandora.mpi b/pandora_agents/win32/installer/pandora.mpi index 0b08db5814..f5497c337e 100644 --- a/pandora_agents/win32/installer/pandora.mpi +++ b/pandora_agents/win32/installer/pandora.mpi @@ -186,7 +186,7 @@ UpgradeApplicationID {} Version -{171112} +{171113} ViewReadme {Yes} diff --git a/pandora_agents/win32/pandora.cc b/pandora_agents/win32/pandora.cc index 099535ced0..43c57250fd 100644 --- a/pandora_agents/win32/pandora.cc +++ b/pandora_agents/win32/pandora.cc @@ -30,7 +30,7 @@ using namespace Pandora; using namespace Pandora_Strutils; #define PATH_SIZE _MAX_PATH+1 -#define PANDORA_VERSION ("7.0NG.715(Build 171112)") +#define PANDORA_VERSION ("7.0NG.715(Build 171113)") string pandora_path; string pandora_dir; diff --git a/pandora_agents/win32/versioninfo.rc b/pandora_agents/win32/versioninfo.rc index bae828cff6..13d29a9a76 100644 --- a/pandora_agents/win32/versioninfo.rc +++ b/pandora_agents/win32/versioninfo.rc @@ -11,7 +11,7 @@ BEGIN VALUE "LegalCopyright", "Artica ST" VALUE "OriginalFilename", "PandoraAgent.exe" VALUE "ProductName", "Pandora FMS Windows Agent" - VALUE "ProductVersion", "(7.0NG.715(Build 171112))" + VALUE "ProductVersion", "(7.0NG.715(Build 171113))" VALUE "FileVersion", "1.0.0.0" END END diff --git a/pandora_console/DEBIAN/control b/pandora_console/DEBIAN/control index 4598c56e02..1f8f167a7e 100644 --- a/pandora_console/DEBIAN/control +++ b/pandora_console/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-console -Version: 7.0NG.715-171112 +Version: 7.0NG.715-171113 Architecture: all Priority: optional Section: admin diff --git a/pandora_console/DEBIAN/make_deb_package.sh b/pandora_console/DEBIAN/make_deb_package.sh index 2e90f69351..f713415073 100644 --- a/pandora_console/DEBIAN/make_deb_package.sh +++ b/pandora_console/DEBIAN/make_deb_package.sh @@ -14,7 +14,7 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -pandora_version="7.0NG.715-171112" +pandora_version="7.0NG.715-171113" package_pear=0 package_pandora=1 diff --git a/pandora_console/include/config_process.php b/pandora_console/include/config_process.php index 82c28e09c4..41b5293d1c 100644 --- a/pandora_console/include/config_process.php +++ b/pandora_console/include/config_process.php @@ -22,7 +22,7 @@ /** * Pandora build version and version */ -$build_version = 'PC171112'; +$build_version = 'PC171113'; $pandora_version = 'v7.0NG.715'; // Do not overwrite default timezone set if defined. diff --git a/pandora_console/install.php b/pandora_console/install.php index 265d9d3c36..c5695928bb 100755 --- a/pandora_console/install.php +++ b/pandora_console/install.php @@ -71,7 +71,7 @@
    Date: Mon, 13 Nov 2017 09:35:24 +0100 Subject: [PATCH 073/149] Added the last change to load string modules --- .../visual_console_builder.editor.js | 2 +- .../ajax/visual_console_builder.ajax.php | 22 +++++++++++++++---- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/pandora_console/godmode/reporting/visual_console_builder.editor.js b/pandora_console/godmode/reporting/visual_console_builder.editor.js index 291c3abd38..2e328b2077 100755 --- a/pandora_console/godmode/reporting/visual_console_builder.editor.js +++ b/pandora_console/godmode/reporting/visual_console_builder.editor.js @@ -2486,7 +2486,7 @@ function setDonutsGraph (id_data, values) { else { $("#" + id_data + " img").attr('src', url_hack_metaconsole + 'images/console/signes/donut-graph.png'); - if($('#text-width').val() == 0 || $('#text-height').val() == 0){ + if($('#text-width_percentile').val() == 0){ // Image size } else{ diff --git a/pandora_console/include/ajax/visual_console_builder.ajax.php b/pandora_console/include/ajax/visual_console_builder.ajax.php index 07a51af3bb..827f92a512 100755 --- a/pandora_console/include/ajax/visual_console_builder.ajax.php +++ b/pandora_console/include/ajax/visual_console_builder.ajax.php @@ -180,7 +180,7 @@ switch ($action) { } $is_string = db_get_value_filter ('id_tipo_modulo', 'tagente_modulo', - array ('id_agente' => _string, + array ('id_agente' => $id_agent, 'id_agente_modulo' => $id_module)); if ($layoutData['id_metaconsole'] != 0) { @@ -613,7 +613,6 @@ switch ($action) { $values['border_color'] = $resume_color; $values['type'] = DONUT_GRAPH; $values['id_agent'] = $id_agent_string; - break; case 'box_item': $values['border_width'] = $border_width; @@ -751,6 +750,7 @@ switch ($action) { case 'donut_graph': unset($values['border_color']); unset($values['width']); + unset($values['id_agent']); break; case 'box_item': unset($values['border_width']); @@ -895,6 +895,20 @@ switch ($action) { case 'donut_graph': $elementFields['width_percentile'] = $elementFields['width']; $elementFields['resume_color'] = $elementFields['border_color']; + $elementFields['id_agent_string'] = $elementFields['id_agent']; + if (($elementFields['id_agent_string'] != 0) + && ($elementFields['id_layout_linked'] == 0)) { + $modules = agents_get_modules( + $elementFields['id_agent'], false, + array('disabled' => 0, + 'id_agente' => $elementFields['id_agent'], + 'tagente_modulo.id_tipo_modulo IN' => "(17,23,3,10,33)")); + + $elementFields['modules_html'] = ''; + foreach ($modules as $id => $name) { + $elementFields['modules_html'] .= ''; + } + } break; case 'module_graph': @@ -1012,8 +1026,8 @@ switch ($action) { break; case 'donut_graph': $values['type'] = DONUT_GRAPH; - $values['width'] = $width; - $values['height'] = $height; + $values['width'] = $width_percentile; + $values['height'] = $width_percentile; $values['border_color'] = $resume_color; $values['id_agent'] = $id_agent_string; break; From 49df1e448aeb8589450d449780b70fd74a5e7142 Mon Sep 17 00:00:00 2001 From: Arturo Gonzalez Date: Mon, 13 Nov 2017 09:59:00 +0100 Subject: [PATCH 074/149] Added changes from donut graph --- .../visual_console_builder.editor.js | 32 +- .../ajax/visual_console_builder.ajax.php | 18 + .../include/functions_visual_map.php | 346 ++++++++---------- .../include/functions_visual_map_editor.php | 4 +- 4 files changed, 181 insertions(+), 219 deletions(-) diff --git a/pandora_console/godmode/reporting/visual_console_builder.editor.js b/pandora_console/godmode/reporting/visual_console_builder.editor.js index 2e328b2077..6637654f00 100755 --- a/pandora_console/godmode/reporting/visual_console_builder.editor.js +++ b/pandora_console/godmode/reporting/visual_console_builder.editor.js @@ -985,7 +985,7 @@ function create_button_palette_callback() { } break; case 'bars_graph': - if ((values['agent'] == '')) { + if ((values['agent_string'] == '')) { alert($("#message_alert_no_agent").html()); validate = false; } @@ -2029,7 +2029,7 @@ function setBarsGraph(id_data, values) { parameter.push ({name: "page", value: "include/ajax/visual_console_builder.ajax"}); parameter.push ({name: "action", value: "get_module_type_string"}); - parameter.push ({name: "id_agent", value: values['id_agent']}); + parameter.push ({name: "id_agent", value: values['id_agent_string']}); parameter.push ({name: "module", value: values['module']}); parameter.push ({name: "id_element", value: id_data}); parameter.push ({name: "id_visual_console", value: id_visual_console}); @@ -2039,28 +2039,16 @@ function setBarsGraph(id_data, values) { type: "POST", dataType: 'json', success: function (data) { - if (data['no_data'] == true) { - if (values['width_percentile'] == "0") { - $("#" + id_data + " img").attr('src', url_hack_metaconsole + 'images/console/signes/barras-no.png'); - } - else { - $("#" + id_data + " img").attr('src', url_hack_metaconsole + 'images/console/signes/barras-no.png'); - $("#" + id_data + " img").css('width', width_percentile + 'px'); - $("#" + id_data + " img").css('height', width_percentile + 'px'); - } + $("#" + id_data + " img").attr('src', url_hack_metaconsole + 'images/console/signes/barras.png'); + + if (values['width_percentile'] == "0") { + // Image size } - else { - $("#" + id_data + " img").attr('src', url_hack_metaconsole + 'images/console/signes/barras.png'); - - if (values['width_percentile'] == "0") { - // Image size - } - else{ - $("#" + id_data + " img").css('width', width_percentile+'px'); - $("#" + id_data + " img").css('height', width_percentile+'px'); - } + else{ + $("#" + id_data + " img").css('width', width_percentile+'px'); + $("#" + id_data + " img").css('height', width_percentile+'px'); } - + if($('#'+id_data+' table').css('float') == 'right' || $('#'+id_data+ ' table').css('float') == 'left'){ $('#'+id_data+ ' img').css('margin-top', parseInt($('#'+id_data).css('height'))/2 - parseInt($('#'+id_data+ ' img').css('height'))/2); } diff --git a/pandora_console/include/ajax/visual_console_builder.ajax.php b/pandora_console/include/ajax/visual_console_builder.ajax.php index 827f92a512..9b3fd183e2 100755 --- a/pandora_console/include/ajax/visual_console_builder.ajax.php +++ b/pandora_console/include/ajax/visual_console_builder.ajax.php @@ -664,6 +664,7 @@ switch ($action) { if ($grid_color !== null) { $values['border_color'] = $grid_color; } + $values['id_agent'] = $id_agent_string; break; case 'percentile_item': case 'percentile_bar': @@ -746,6 +747,8 @@ switch ($action) { unset($values['image']); unset($values['type_graph']); unset($values['border_color']); + unset($values['width']); + unset($values['id_agent']); break; case 'donut_graph': unset($values['border_color']); @@ -919,6 +922,20 @@ switch ($action) { $elementFields['width_percentile'] = $elementFields['width']; $elementFields['bars_graph_type'] = $elementFields['type_graph']; $elementFields['grid_color'] = $elementFields['border_color']; + $elementFields['id_agent_string'] = $elementFields['id_agent']; + if (($elementFields['id_agent_string'] != 0) + && ($elementFields['id_layout_linked'] == 0)) { + $modules = agents_get_modules( + $elementFields['id_agent'], false, + array('disabled' => 0, + 'id_agente' => $elementFields['id_agent'], + 'tagente_modulo.id_tipo_modulo IN' => "(17,23,3,10,33)")); + + $elementFields['modules_html'] = ''; + foreach ($modules as $id => $name) { + $elementFields['modules_html'] .= ''; + } + } break; case 'box_item': $elementFields['width_box'] = $elementFields['width']; @@ -1074,6 +1091,7 @@ switch ($action) { $values['type_graph'] = $bars_graph_type; $values['image'] = $background_color; $values['border_color'] = $grid_color; + $values['id_agent'] = $id_agent_string; break; case 'auto_sla_graph': $values['type'] = AUTO_SLA_GRAPH; diff --git a/pandora_console/include/functions_visual_map.php b/pandora_console/include/functions_visual_map.php index 647e603a51..b9b92a65da 100755 --- a/pandora_console/include/functions_visual_map.php +++ b/pandora_console/include/functions_visual_map.php @@ -1140,224 +1140,180 @@ function visual_map_print_item($mode = "read", $layoutData, if ( (get_parameter('action') == 'edit') || (get_parameter('operation') == 'edit_visualmap') ) { if($width == 0){ - if (($is_string == 17) || ($is_string == 23) || ($is_string == 3) || - ($is_string == 10) || ($is_string == 33)) { - if ($layoutData['id_metaconsole'] != 0) { - $img = ''; - } - else{ - $img = ''; - } + if ($layoutData['id_metaconsole'] != 0) { + $img = ''; } - else { - if ($layoutData['id_metaconsole'] != 0) { - $img = ''; - } - else{ - $img = ''; - } + else{ + $img = ''; } } else{ - if (($is_string == 17) || ($is_string == 23) || ($is_string == 3) || - ($is_string == 10) || ($is_string == 33)) { - if ($layoutData['id_metaconsole'] != 0) { - $img = ''; - } - else{ - $img = ''; - } + if ($layoutData['id_metaconsole'] != 0) { + $img = ''; } - else { - if ($layoutData['id_metaconsole'] != 0) { - $img = ''; - } - else{ - $img = ''; - } + else{ + $img = ''; } } } else { - if (($is_string == 17) || ($is_string == 23) || ($is_string == 3) || - ($is_string == 10) || ($is_string == 33)) { + $color = array(); - $color = array(); - - $color[0] = array('border' => '#000000', - 'color' => $config['graph_color1'], - 'alpha' => CHART_DEFAULT_ALPHA); - $color[1] = array('border' => '#000000', - 'color' => $config['graph_color2'], - 'alpha' => CHART_DEFAULT_ALPHA); - $color[2] = array('border' => '#000000', - 'color' => $config['graph_color3'], - 'alpha' => CHART_DEFAULT_ALPHA); - $color[3] = array('border' => '#000000', - 'color' => $config['graph_color4'], - 'alpha' => CHART_DEFAULT_ALPHA); - $color[4] = array('border' => '#000000', - 'color' => $config['graph_color5'], - 'alpha' => CHART_DEFAULT_ALPHA); - $color[5] = array('border' => '#000000', - 'color' => $config['graph_color6'], - 'alpha' => CHART_DEFAULT_ALPHA); - $color[6] = array('border' => '#000000', - 'color' => $config['graph_color7'], - 'alpha' => CHART_DEFAULT_ALPHA); - $color[7] = array('border' => '#000000', - 'color' => $config['graph_color8'], - 'alpha' => CHART_DEFAULT_ALPHA); - $color[8] = array('border' => '#000000', - 'color' => $config['graph_color9'], - 'alpha' => CHART_DEFAULT_ALPHA); - $color[9] = array('border' => '#000000', - 'color' => $config['graph_color10'], - 'alpha' => CHART_DEFAULT_ALPHA); - $color[11] = array('border' => '#000000', - 'color' => COL_GRAPH9, - 'alpha' => CHART_DEFAULT_ALPHA); - $color[12] = array('border' => '#000000', - 'color' => COL_GRAPH10, - 'alpha' => CHART_DEFAULT_ALPHA); - $color[13] = array('border' => '#000000', - 'color' => COL_GRAPH11, - 'alpha' => CHART_DEFAULT_ALPHA); - $color[14] = array('border' => '#000000', - 'color' => COL_GRAPH12, - 'alpha' => CHART_DEFAULT_ALPHA); - $color[15] = array('border' => '#000000', - 'color' => COL_GRAPH13, - 'alpha' => CHART_DEFAULT_ALPHA); + $color[0] = array('border' => '#000000', + 'color' => $config['graph_color1'], + 'alpha' => CHART_DEFAULT_ALPHA); + $color[1] = array('border' => '#000000', + 'color' => $config['graph_color2'], + 'alpha' => CHART_DEFAULT_ALPHA); + $color[2] = array('border' => '#000000', + 'color' => $config['graph_color3'], + 'alpha' => CHART_DEFAULT_ALPHA); + $color[3] = array('border' => '#000000', + 'color' => $config['graph_color4'], + 'alpha' => CHART_DEFAULT_ALPHA); + $color[4] = array('border' => '#000000', + 'color' => $config['graph_color5'], + 'alpha' => CHART_DEFAULT_ALPHA); + $color[5] = array('border' => '#000000', + 'color' => $config['graph_color6'], + 'alpha' => CHART_DEFAULT_ALPHA); + $color[6] = array('border' => '#000000', + 'color' => $config['graph_color7'], + 'alpha' => CHART_DEFAULT_ALPHA); + $color[7] = array('border' => '#000000', + 'color' => $config['graph_color8'], + 'alpha' => CHART_DEFAULT_ALPHA); + $color[8] = array('border' => '#000000', + 'color' => $config['graph_color9'], + 'alpha' => CHART_DEFAULT_ALPHA); + $color[9] = array('border' => '#000000', + 'color' => $config['graph_color10'], + 'alpha' => CHART_DEFAULT_ALPHA); + $color[11] = array('border' => '#000000', + 'color' => COL_GRAPH9, + 'alpha' => CHART_DEFAULT_ALPHA); + $color[12] = array('border' => '#000000', + 'color' => COL_GRAPH10, + 'alpha' => CHART_DEFAULT_ALPHA); + $color[13] = array('border' => '#000000', + 'color' => COL_GRAPH11, + 'alpha' => CHART_DEFAULT_ALPHA); + $color[14] = array('border' => '#000000', + 'color' => COL_GRAPH12, + 'alpha' => CHART_DEFAULT_ALPHA); + $color[15] = array('border' => '#000000', + 'color' => COL_GRAPH13, + 'alpha' => CHART_DEFAULT_ALPHA); - $module_data = get_bars_module_data($id_module); - $water_mark = array('file' => '/var/www/html/pandora_console/images/logo_vertical_water.png', - 'url' => 'http://localhost/pandora_console/images/logo_vertical_water.png'); - - if ($width == 0) { - if ($layoutData['label_position']=='left') { - if ($layoutData['type_graph'] == 'horizontal') { - $img = '
    '. - hbar_graph(true, $module_data, - 400, 400, $color, array(), array(), - ui_get_full_url("images/image_problem.opaque.png", false, false, false), - "", "", $water_mark, $config['fontpath'], 6, - "", 0, $config['homeurl'], $layoutData['image'], $layoutData['border_color']) . '
    '; - } - else { - $img = '
    '. - vbar_graph(true, $module_data, - 400, 400, $color, array(), array(), - ui_get_full_url("images/image_problem.opaque.png", false, false, false), - "", "", $water_mark, $config['fontpath'], 6, - "", 0, $config['homeurl'], $layoutData['image'], true, false, $layoutData['border_color']) . '
    '; - } - } - elseif($layoutData['label_position']=='right') { - if ($layoutData['type_graph'] == 'horizontal') { - $img = '
    '. - hbar_graph(true, $module_data, - 400, 400, $color, array(), array(), - ui_get_full_url("images/image_problem.opaque.png", false, false, false), - "", "", $water_mark, $config['fontpath'], 6, - "", 0, $config['homeurl'], $layoutData['image'], $layoutData['border_color']) . '
    '; - } - else { - $img = '
    '. - vbar_graph(true, $module_data, - 400, 400, $color, array(), array(), - ui_get_full_url("images/image_problem.opaque.png", false, false, false), - "", "", $water_mark, $config['fontpath'], 6, - "", 0, $config['homeurl'], $layoutData['image'], true, false, $layoutData['border_color']) . '
    '; - } + $module_data = get_bars_module_data($id_module); + $water_mark = array('file' => '/var/www/html/pandora_console/images/logo_vertical_water.png', + 'url' => 'http://localhost/pandora_console/images/logo_vertical_water.png'); + + if ($width == 0) { + if ($layoutData['label_position']=='left') { + if ($layoutData['type_graph'] == 'horizontal') { + $img = '
    '. + hbar_graph(true, $module_data, + 400, 400, $color, array(), array(), + ui_get_full_url("images/image_problem.opaque.png", false, false, false), + "", "", $water_mark, $config['fontpath'], 6, + "", 0, $config['homeurl'], $layoutData['image'], $layoutData['border_color']) . '
    '; } else { - if ($layoutData['type_graph'] == 'horizontal') { - $img = hbar_graph(true, $module_data, - 400, 400, $color, array(), array(), - ui_get_full_url("images/image_problem.opaque.png", false, false, false), - "", "", $water_mark, $config['fontpath'], 6, - "", 0, $config['homeurl'], $layoutData['image'], $layoutData['border_color']); - } - else { - $img = vbar_graph(true, $module_data, - 400, 400, $color, array(), array(), - ui_get_full_url("images/image_problem.opaque.png", false, false, false), - "", "", $water_mark, $config['fontpath'], 6, - "", 0, $config['homeurl'], $layoutData['image'], true, false, $layoutData['border_color']); - } + $img = '
    '. + vbar_graph(true, $module_data, + 400, 400, $color, array(), array(), + ui_get_full_url("images/image_problem.opaque.png", false, false, false), + "", "", $water_mark, $config['fontpath'], 6, + "", 0, $config['homeurl'], $layoutData['image'], true, false, $layoutData['border_color']) . '
    '; } } - else{ - if ($layoutData['label_position']=='left') { - if ($layoutData['type_graph'] == 'horizontal') { - $img = '
    '. - hbar_graph(true, $module_data, - $width, $width, $color, array(), array(), - ui_get_full_url("images/image_problem.opaque.png", false, false, false), - "", "", $water_mark, $config['fontpath'], 6, - "", 0, $config['homeurl'], $layoutData['image'], $layoutData['border_color']) . '
    '; - } - else { - $img = '
    '. - vbar_graph(true, $module_data, - $width, $width, $color, array(), array(), - ui_get_full_url("images/image_problem.opaque.png", false, false, false), - "", "", $water_mark, $config['fontpath'], 6, - "", 0, $config['homeurl'], $layoutData['image'], true, false, $layoutData['border_color']) . '
    '; - } - } - elseif($layoutData['label_position']=='right') { - if ($layoutData['type_graph'] == 'horizontal') { - $img = '
    '. - hbar_graph(true, $module_data, - $width, $width, $color, array(), array(), - ui_get_full_url("images/image_problem.opaque.png", false, false, false), - "", "", $water_mark, $config['fontpath'], 6, - "", 0, $config['homeurl'], $layoutData['image'], $layoutData['border_color']) . '
    '; - } - else { - $img = '
    '. - vbar_graph(true, $module_data, - $width, $width, $color, array(), array(), - ui_get_full_url("images/image_problem.opaque.png", false, false, false), - "", "", $water_mark, $config['fontpath'], 6, - "", 0, $config['homeurl'], $layoutData['image'], true, false, $layoutData['border_color']) . '
    '; - } + elseif($layoutData['label_position']=='right') { + if ($layoutData['type_graph'] == 'horizontal') { + $img = '
    '. + hbar_graph(true, $module_data, + 400, 400, $color, array(), array(), + ui_get_full_url("images/image_problem.opaque.png", false, false, false), + "", "", $water_mark, $config['fontpath'], 6, + "", 0, $config['homeurl'], $layoutData['image'], $layoutData['border_color']) . '
    '; } else { - if ($layoutData['type_graph'] == 'horizontal') { - $img = hbar_graph(true, $module_data, - $width, $width, $color, array(), array(), - ui_get_full_url("images/image_problem.opaque.png", false, false, false), - "", "", $water_mark, $config['fontpath'], 6, - "", 0, $config['homeurl'], $layoutData['image'], $layoutData['border_color']); - } - else { - $img = vbar_graph(true, $module_data, - $width, $width, $color, array(), array(), - ui_get_full_url("images/image_problem.opaque.png", false, false, false), - "", "", $water_mark, $config['fontpath'], 6, - "", 0, $config['homeurl'], $layoutData['image'], true, false, $layoutData['border_color']); - } + $img = '
    '. + vbar_graph(true, $module_data, + 400, 400, $color, array(), array(), + ui_get_full_url("images/image_problem.opaque.png", false, false, false), + "", "", $water_mark, $config['fontpath'], 6, + "", 0, $config['homeurl'], $layoutData['image'], true, false, $layoutData['border_color']) . '
    '; + } + } + else { + if ($layoutData['type_graph'] == 'horizontal') { + $img = hbar_graph(true, $module_data, + 400, 400, $color, array(), array(), + ui_get_full_url("images/image_problem.opaque.png", false, false, false), + "", "", $water_mark, $config['fontpath'], 6, + "", 0, $config['homeurl'], $layoutData['image'], $layoutData['border_color']); + } + else { + $img = vbar_graph(true, $module_data, + 400, 400, $color, array(), array(), + ui_get_full_url("images/image_problem.opaque.png", false, false, false), + "", "", $water_mark, $config['fontpath'], 6, + "", 0, $config['homeurl'], $layoutData['image'], true, false, $layoutData['border_color']); } } } - else { - if($width == 0){ - if ($layoutData['id_metaconsole'] != 0) { - $img = ''; + else{ + if ($layoutData['label_position']=='left') { + if ($layoutData['type_graph'] == 'horizontal') { + $img = '
    '. + hbar_graph(true, $module_data, + $width, $width, $color, array(), array(), + ui_get_full_url("images/image_problem.opaque.png", false, false, false), + "", "", $water_mark, $config['fontpath'], 6, + "", 0, $config['homeurl'], $layoutData['image'], $layoutData['border_color']) . '
    '; } - else{ - $img = ''; + else { + $img = '
    '. + vbar_graph(true, $module_data, + $width, $width, $color, array(), array(), + ui_get_full_url("images/image_problem.opaque.png", false, false, false), + "", "", $water_mark, $config['fontpath'], 6, + "", 0, $config['homeurl'], $layoutData['image'], true, false, $layoutData['border_color']) . '
    '; } } - else{ - if ($layoutData['id_metaconsole'] != 0) { - $img = ''; + elseif($layoutData['label_position']=='right') { + if ($layoutData['type_graph'] == 'horizontal') { + $img = '
    '. + hbar_graph(true, $module_data, + $width, $width, $color, array(), array(), + ui_get_full_url("images/image_problem.opaque.png", false, false, false), + "", "", $water_mark, $config['fontpath'], 6, + "", 0, $config['homeurl'], $layoutData['image'], $layoutData['border_color']) . '
    '; } - else{ - $img = ''; + else { + $img = '
    '. + vbar_graph(true, $module_data, + $width, $width, $color, array(), array(), + ui_get_full_url("images/image_problem.opaque.png", false, false, false), + "", "", $water_mark, $config['fontpath'], 6, + "", 0, $config['homeurl'], $layoutData['image'], true, false, $layoutData['border_color']) . '
    '; + } + } + else { + if ($layoutData['type_graph'] == 'horizontal') { + $img = hbar_graph(true, $module_data, + $width, $width, $color, array(), array(), + ui_get_full_url("images/image_problem.opaque.png", false, false, false), + "", "", $water_mark, $config['fontpath'], 6, + "", 0, $config['homeurl'], $layoutData['image'], $layoutData['border_color']); + } + else { + $img = vbar_graph(true, $module_data, + $width, $width, $color, array(), array(), + ui_get_full_url("images/image_problem.opaque.png", false, false, false), + "", "", $water_mark, $config['fontpath'], 6, + "", 0, $config['homeurl'], $layoutData['image'], true, false, $layoutData['border_color']); } } } @@ -2182,7 +2138,7 @@ function get_bars_module_data ($id_module) { $color_index = 0; $total = 0; foreach ($values as $val) { - $data = explode(":", $val); + $data = explode(",", $val); $values_to_return[$data[0]] = array('g' =>$data[1]); } diff --git a/pandora_console/include/functions_visual_map_editor.php b/pandora_console/include/functions_visual_map_editor.php index f4d99e5bfa..787275330a 100755 --- a/pandora_console/include/functions_visual_map_editor.php +++ b/pandora_console/include/functions_visual_map_editor.php @@ -290,7 +290,7 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) { $form_items['agent_row'] = array(); $form_items['agent_row']['items'] = array('static_graph', 'percentile_bar', 'percentile_item', 'module_graph', - 'simple_value', 'datos', 'auto_sla_graph', 'bars_graph'); + 'simple_value', 'datos', 'auto_sla_graph'); $form_items['agent_row']['html'] = '
    '; $params = array(); @@ -322,7 +322,7 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) { ''; $form_items['agent_row_string'] = array(); - $form_items['agent_row_string']['items'] = array('donut_graph'); + $form_items['agent_row_string']['items'] = array('donut_graph', 'bars_graph'); $form_items['agent_row_string']['html'] = ''; $params = array(); From 86a5599aadb35b8da10deb8be90978d98257ee69 Mon Sep 17 00:00:00 2001 From: vgilc Date: Mon, 13 Nov 2017 10:20:58 +0100 Subject: [PATCH 075/149] Revert "Fixed traces" This reverts commit 173efae22d0a97ab727299a9bb7707521933190e --- pandora_console/include/functions_reporting.php | 3 +++ pandora_console/include/graphs/functions_flot.php | 1 + 2 files changed, 4 insertions(+) diff --git a/pandora_console/include/functions_reporting.php b/pandora_console/include/functions_reporting.php index c058d94188..c8e2d00d99 100644 --- a/pandora_console/include/functions_reporting.php +++ b/pandora_console/include/functions_reporting.php @@ -3848,6 +3848,9 @@ function reporting_value($report, $content, $type,$pdf) { $return['agent_name'] = $agent_name; $return['module_name'] = $module_name; + html_debug($pdf,true); + html_debug($only_image,true); + if($pdf){ $only_image = 1; } diff --git a/pandora_console/include/graphs/functions_flot.php b/pandora_console/include/graphs/functions_flot.php index 200033901b..a0da140dbd 100644 --- a/pandora_console/include/graphs/functions_flot.php +++ b/pandora_console/include/graphs/functions_flot.php @@ -185,6 +185,7 @@ function flot_area_graph($chart_data, $width, $height, $color, $legend, include_javascript_dependencies_flot_graph(); $menu = (int)$menu; + html_debug($legend); // Get a unique identifier to graph $graph_id = uniqid('graph_'); From 3493b9c15cd87ae66f97bbf8da10e7dc0b4a4177 Mon Sep 17 00:00:00 2001 From: vgilc Date: Mon, 13 Nov 2017 10:21:38 +0100 Subject: [PATCH 076/149] Revert "code backup" This reverts commit b9851a3a7150084029740f99f01eab294f4e18d7 --- .../pandoradb_migrate_6.0_to_7.0.mysql.sql | 2 - .../godmode/reporting/graph_builder.main.php | 13 ----- .../godmode/reporting/graph_builder.php | 12 +--- .../include/functions_custom_graphs.php | 8 +-- pandora_console/include/functions_events.php | 2 +- pandora_console/include/functions_graph.php | 57 ++----------------- .../include/functions_reporting.php | 12 ++-- .../include/graphs/functions_flot.php | 3 +- pandora_console/pandoradb.sql | 2 - 9 files changed, 17 insertions(+), 94 deletions(-) diff --git a/pandora_console/extras/pandoradb_migrate_6.0_to_7.0.mysql.sql b/pandora_console/extras/pandoradb_migrate_6.0_to_7.0.mysql.sql index 159eb466f9..9fcc5f70c4 100644 --- a/pandora_console/extras/pandoradb_migrate_6.0_to_7.0.mysql.sql +++ b/pandora_console/extras/pandoradb_migrate_6.0_to_7.0.mysql.sql @@ -1256,8 +1256,6 @@ UPDATE tagente_modulo SET cron_interval = '' WHERE cron_interval LIKE '% %'; -- Table `tgraph` -- --------------------------------------------------------------------- ALTER TABLE tgraph ADD COLUMN `percentil` int(4) unsigned default '0'; -ALTER TABLE tgraph ADD COLUMN `summatory_series` tinyint(1) UNSIGNED NOT NULL default '0'; -ALTER TABLE tgraph ADD COLUMN `average_series` tinyint(1) UNSIGNED NOT NULL default '0'; -- --------------------------------------------------------------------- -- Table `tnetflow_filter` diff --git a/pandora_console/godmode/reporting/graph_builder.main.php b/pandora_console/godmode/reporting/graph_builder.main.php index 53f8d47835..9c95f2263b 100644 --- a/pandora_console/godmode/reporting/graph_builder.main.php +++ b/pandora_console/godmode/reporting/graph_builder.main.php @@ -66,8 +66,6 @@ if ($edit_graph) { $height = $graphInTgraph['height']; $check = false; $percentil = $graphInTgraph['percentil']; - $summatory_series = $graphInTgraph['summatory_series']; - $average_series = $graphInTgraph['average_series']; if ($stacked == CUSTOM_GRAPH_BULLET_CHART_THRESHOLD){ $stacked = CUSTOM_GRAPH_BULLET_CHART; @@ -86,8 +84,6 @@ else { $stacked = 4; $check = false; $percentil = 0; - $summatory_series = 0; - $average_series = 0; } @@ -178,15 +174,6 @@ echo ""; echo ""; -echo ""; -echo " -"; -echo ""; - echo ""; echo ""; diff --git a/pandora_console/godmode/reporting/graph_builder.php b/pandora_console/godmode/reporting/graph_builder.php index 0d4cdcc2f9..317f562e6f 100644 --- a/pandora_console/godmode/reporting/graph_builder.php +++ b/pandora_console/godmode/reporting/graph_builder.php @@ -87,8 +87,6 @@ if ($add_graph) { $period = get_parameter_post ("period"); $threshold = get_parameter('threshold'); $percentil = get_parameter ("percentil", 0); - $summatory_series = get_parameter ("summatory_series", 0); - $average_series = get_parameter ("average_series", 0); if ($threshold == CUSTOM_GRAPH_BULLET_CHART_THRESHOLD){ $stacked = $threshold; @@ -105,9 +103,7 @@ if ($add_graph) { 'private' => 0, 'id_group' => $idGroup, 'stacked' => $stacked, - 'percentil' => $percentil, - 'summatory_series' => $summatory_series, - 'average_series' => $average_series + 'percentil' => $percentil ); if (trim($name) != "") { @@ -135,8 +131,6 @@ if ($update_graph) { $period = get_parameter('period'); $stacked = get_parameter('stacked'); $percentil = get_parameter('percentil'); - $summatory_series = get_parameter ("summatory_series"); - $average_series = get_parameter ("average_series"); $alerts = get_parameter('alerts'); $threshold = get_parameter('threshold'); @@ -147,9 +141,7 @@ if ($update_graph) { if (trim($name) != "") { $success = db_process_sql_update('tgraph', - array('name' => $name, 'id_group' => $id_group, 'description' => $description, - 'width' => $width, 'height' => $height, 'period' => $period, 'stacked' => $stacked, - 'percentil' => $percentil, 'summatory_series' => $summatory_series, 'average_series' => $average_series), + array('name' => $name, 'id_group' => $id_group, 'description' => $description, 'width' => $width, 'height' => $height, 'period' => $period, 'stacked' => $stacked, 'percentil' => $percentil ), array('id_graph' => $id_graph)); if ($success !== false) db_pandora_audit("Report management", "Update graph #$id_graph"); diff --git a/pandora_console/include/functions_custom_graphs.php b/pandora_console/include/functions_custom_graphs.php index f61a7ee944..adf077ec6a 100644 --- a/pandora_console/include/functions_custom_graphs.php +++ b/pandora_console/include/functions_custom_graphs.php @@ -202,10 +202,6 @@ function custom_graphs_print($id_graph, $height, $width, $period, $sources = db_get_all_rows_field_filter('tgraph_source', 'id_graph', $id_graph); - $series = db_get_all_rows_sql('SELECT summatory_series,average_series FROM tgraph WHERE id_graph = '.$id_graph); - $summatory = $series[0]['summatory_series']; - $average = $series[0]['average_series']; - $modules = array (); $weights = array (); $labels = array (); @@ -266,9 +262,7 @@ function custom_graphs_print($id_graph, $height, $width, $period, $percentil, $from_interface, $id_widget_dashboard, - $fullscale, - $summatory, - $average); + $fullscale); if ($return) return $output; diff --git a/pandora_console/include/functions_events.php b/pandora_console/include/functions_events.php index 58c11b1cc9..763f246bdf 100644 --- a/pandora_console/include/functions_events.php +++ b/pandora_console/include/functions_events.php @@ -2080,7 +2080,7 @@ function events_page_details ($event, $server = "") { } else { $module_group = db_get_value('name', 'tmodule_group', 'id_mg', $id_module_group); - $data[1] = ''; + $data[1] = ''; $data[1] .= $module_group; $data[1] .= ''; } diff --git a/pandora_console/include/functions_graph.php b/pandora_console/include/functions_graph.php index 0c9bd6ebfb..ccad237208 100644 --- a/pandora_console/include/functions_graph.php +++ b/pandora_console/include/functions_graph.php @@ -1114,11 +1114,11 @@ function graphic_combined_module ($module_list, $weight_list, $period, $name_list = array(), $unit_list = array(), $show_last = true, $show_max = true, $show_min = true, $show_avg = true, $labels = array(), $dashboard = false, $vconsole = false, $percentil = null, $from_interface = false, - $id_widget_dashboard=false, $fullscale = false, $summatory = 0, $average = 0) { + $id_widget_dashboard=false, $fullscale = false) { global $config; global $graphic_type; - + if(!$fullscale){ $time_format_2 = ''; $temp_range = $period; @@ -1204,8 +1204,7 @@ function graphic_combined_module ($module_list, $weight_list, $period, $weight_list[$i] = 1; } } - - $aux_array = array(); + // Set data containers for ($i = 0; $i < $resolution; $i++) { $timestamp = $datelimit + ($interval * $i);/* @@ -1257,12 +1256,12 @@ function graphic_combined_module ($module_list, $weight_list, $period, // If its a projection graph, // first module will be data and second will be the projection - if ($projection != false && $i != 0) { if ($automatic_custom_graph_meta) $agent_module_id = $module_list[0]['module']; else $agent_module_id = $module_list[0]; + $id_module_type = modules_get_agentmodule_type ($agent_module_id); $module_type = modules_get_moduletype_name ($id_module_type); $uncompressed_module = is_module_uncompressed ($module_type); @@ -1273,6 +1272,7 @@ function graphic_combined_module ($module_list, $weight_list, $period, else $agent_module_id = $module_list[$i]; + $id_module_type = modules_get_agentmodule_type ($agent_module_id); $module_type = modules_get_moduletype_name ($id_module_type); $uncompressed_module = is_module_uncompressed ($module_type); @@ -1345,21 +1345,6 @@ function graphic_combined_module ($module_list, $weight_list, $period, continue; } - // if(empty($aux_array)){ - // foreach ($data as $key => $value) { - // $aux_array[$value['utimestamp']] = $value['datos']; - // } - // } else { - // foreach ($data as $key => $value) { - // if(array_key_exists($value['utimestamp'],$aux_array)){ - // $aux_array[$value['utimestamp']] = $aux_array[$value['utimestamp']] + $value['datos']; - // } else { - // $aux_array[$value['utimestamp']] = $value['datos']; - // } - // } - // } - - // html_debug($aux_array); if (!empty($name_list) && $names_number == $module_number && isset($name_list[$i])) { if ($labels[$agent_module_id] != '') $module_name_list[$i] = $labels[$agent_module_id]; @@ -2122,37 +2107,7 @@ function graphic_combined_module ($module_list, $weight_list, $period, $threshold_data['red_inverse'] = (bool)$red_inverse; } } - - //summatory and average series - if($stacked == CUSTOM_GRAPH_AREA || $stacked == CUSTOM_GRAPH_LINE) { - if($summatory && $average){ - foreach ($graph_values as $key => $value) { - $cont = count($value); - $summ = array_sum($value); - array_push($value,$summ); - array_push($value,$summ/$cont); - $graph_values[$key] = $value; - } - array_push($module_name_list,'' . __('summatory'). ''); - array_push($module_name_list,'' . __('average'). ''); - - } elseif($summatory) { - foreach ($graph_values as $key => $value) { - array_push($value,array_sum($value)); - $graph_values[$key] = $value; - } - array_push($module_name_list,'' . __('summatory'). ''); - - } elseif($average) { - foreach ($graph_values as $key => $value) { - $summ = array_sum($value) / count($value); - array_push($value,$summ); - $graph_values[$key] = $value; - } - array_push($module_name_list,'' . __('average'). ''); - } - } - + switch ($stacked) { case CUSTOM_GRAPH_AREA: return area_graph($flash_charts, $graph_values, $width, diff --git a/pandora_console/include/functions_reporting.php b/pandora_console/include/functions_reporting.php index c8e2d00d99..26ea84367a 100644 --- a/pandora_console/include/functions_reporting.php +++ b/pandora_console/include/functions_reporting.php @@ -7763,19 +7763,19 @@ function reporting_get_stats_modules_status($data, $graph_width = 250, $graph_he if ($links === false) { $urls = array(); $urls['monitor_critical'] = "index.php?" . - "sec=view&sec2=operation/agentes/status_monitor&" . + "sec=estado&sec2=operation/agentes/status_monitor&" . "refr=60&status=" . AGENT_MODULE_STATUS_CRITICAL_BAD . "&pure=" . $config['pure']; $urls['monitor_warning'] = "index.php?" . - "sec=view&sec2=operation/agentes/status_monitor&" . + "sec=estado&sec2=operation/agentes/status_monitor&" . "refr=60&status=" . AGENT_MODULE_STATUS_WARNING . "&pure=" . $config['pure']; $urls['monitor_ok'] = "index.php?" . - "sec=view&sec2=operation/agentes/status_monitor&" . + "sec=estado&sec2=operation/agentes/status_monitor&" . "refr=60&status=" . AGENT_MODULE_STATUS_NORMAL . "&pure=" . $config['pure']; $urls['monitor_unknown'] = "index.php?" . - "sec=view&sec2=operation/agentes/status_monitor&" . + "sec=estado&sec2=operation/agentes/status_monitor&" . "refr=60&status=" . AGENT_MODULE_STATUS_UNKNOWN . "&pure=" . $config['pure']; $urls['monitor_not_init'] = "index.php?" . - "sec=view&sec2=operation/agentes/status_monitor&" . + "sec=estado&sec2=operation/agentes/status_monitor&" . "refr=60&status=" . AGENT_MODULE_STATUS_NOT_INIT . "&pure=" . $config['pure']; } else { @@ -7875,7 +7875,7 @@ function reporting_get_stats_agents_monitors($data) { else { $urls = array(); $urls['total_agents'] = "index.php?sec=estado&sec2=operation/agentes/estado_agente&refr=60"; - $urls['monitor_checks'] = "index.php?sec=view&sec2=operation/agentes/status_monitor&refr=60&status=-1"; + $urls['monitor_checks'] = "index.php?sec=estado&sec2=operation/agentes/status_monitor&refr=60&status=-1"; } // Agents and modules table diff --git a/pandora_console/include/graphs/functions_flot.php b/pandora_console/include/graphs/functions_flot.php index a0da140dbd..4f8943ed8f 100644 --- a/pandora_console/include/graphs/functions_flot.php +++ b/pandora_console/include/graphs/functions_flot.php @@ -185,7 +185,7 @@ function flot_area_graph($chart_data, $width, $height, $color, $legend, include_javascript_dependencies_flot_graph(); $menu = (int)$menu; - html_debug($legend); + // Get a unique identifier to graph $graph_id = uniqid('graph_'); @@ -500,7 +500,6 @@ function flot_area_graph($chart_data, $width, $height, $color, $legend, $short_data = false; } - // Javascript code $return .= " diff --git a/pandora_console/operation/agentes/pandora_networkmap.php b/pandora_console/operation/agentes/pandora_networkmap.php index 53478a65c5..a944803d3f 100644 --- a/pandora_console/operation/agentes/pandora_networkmap.php +++ b/pandora_console/operation/agentes/pandora_networkmap.php @@ -218,6 +218,16 @@ if ($new_networkmap || $save_networkmap) { $offset_x = get_parameter('pos_x'); $offset_y = get_parameter('pos_y'); $scale_z = get_parameter('scale_z', 0.5); + + $node_sep = get_parameter('node_sep', "0.25"); + if ($method == "twopi") { + $rank_sep = get_parameter('rank_sep', "1.0"); + } + else { + $rank_sep = get_parameter('rank_sep', "0.5"); + } + $mindist = get_parameter('mindist', "1.0"); + $kval = get_parameter('kval', "0.3"); $values = array(); $values['name'] = $name; @@ -278,6 +288,11 @@ if ($new_networkmap || $save_networkmap) { $filter['x_offs'] = $offset_x; $filter['y_offs'] = $offset_y; $filter['z_dash'] = $scale_z; + $filter['node_sep'] = $node_sep; + $filter['rank_sep'] = $rank_sep; + $filter['mindist'] = $mindist; + $filter['kval'] = $kval; + $values['filter'] = json_encode($filter); $result = false; From 21bbfb557b4f3e0bea7df6b87c65b904eb71ed95 Mon Sep 17 00:00:00 2001 From: Arturo Gonzalez Date: Mon, 27 Nov 2017 15:00:59 +0100 Subject: [PATCH 139/149] Added lost code --- .../include/functions_pandora_networkmap.php | 9 +++++++- .../functions_pandora_networkmap.js | 23 ++++++++++++++++--- 2 files changed, 28 insertions(+), 4 deletions(-) diff --git a/pandora_console/include/functions_pandora_networkmap.php b/pandora_console/include/functions_pandora_networkmap.php index ac83389c23..c161d3a3f2 100644 --- a/pandora_console/include/functions_pandora_networkmap.php +++ b/pandora_console/include/functions_pandora_networkmap.php @@ -342,6 +342,7 @@ function networkmap_db_node_to_js_node($node, &$count, &$count_item_holding_area $item['py'] = (int)$node['y']; $item['z'] = (int)$node['z']; $item['state'] = $node['state']; + $item['deleted'] = $node['deleted']; if ($item['state'] == 'holding_area') { //40 = DEFAULT NODE RADIUS //30 = for to align @@ -520,6 +521,7 @@ function networkmap_links_to_js_links($relations, $nodes_graph) { $item['id_agent_end'] = (int)$id_target_agent; $item['target'] = -1; $item['source'] = -1; + $item['deleted'] = $relation['deleted']; if (enterprise_installed()) { $target_and_source = array(); @@ -717,7 +719,9 @@ function networkmap_write_js_array($id, $nodes_and_relations = array(), $map_das $item = networkmap_db_node_to_js_node( $node, $count, $count_item_holding_area); - + if ($item['deleted']) { + continue; + } echo "networkmap.nodes.push(" . json_encode($item) . ");\n"; $nodes_graph[$item['id']] = $item; } @@ -733,6 +737,9 @@ function networkmap_write_js_array($id, $nodes_and_relations = array(), $map_das $links_js = networkmap_links_to_js_links($relations, $nodes_graph); foreach ($links_js as $link_js) { + if ($link_js['deleted']) { + continue; + } if ($link_js['target'] == -1) continue; if ($link_js['source'] == -1) diff --git a/pandora_console/include/javascript/functions_pandora_networkmap.js b/pandora_console/include/javascript/functions_pandora_networkmap.js index 97714ec69b..05ebe8e9d9 100644 --- a/pandora_console/include/javascript/functions_pandora_networkmap.js +++ b/pandora_console/include/javascript/functions_pandora_networkmap.js @@ -2155,6 +2155,7 @@ function refresh_holding_area() { temp_node['image_url'] = node['image_url']; temp_node['image_width'] = node['image_width']; temp_node['image_height'] = node['image_width']; + temp_node['deleted'] = false; graph.nodes.push(temp_node); }); @@ -3149,9 +3150,18 @@ function myMouseoutRhombusFunction(node_id) { } function draw_elements_graph() { - link = link.data(force.links(), function (d) { - return d.source.id + networkmap_id + "-" + d.target.id + networkmap_id + Math.random(); + link = link.data(force.links().filter(function(d, i) { + if (d['deleted']) { + return false; + } + else { + return true; + } + }), + function (d) { + return d.source.id + networkmap_id + "-" + d.target.id + networkmap_id + Math.random(); }); + link_temp = link.enter() .append("g") @@ -3333,7 +3343,14 @@ function draw_elements_graph() { return (Array(25).join(" ")) + text_link; }); - node = node.data(force.nodes(), function (d) { return d.id; }); + node = node.data(force.nodes().filter(function(d, i) { + if (d['deleted']) { + return false; + } + else { + return true; + } + }), function (d) { return d.id; }); node_temp = node.enter() .append("g") From 459a5825ca8a417e354653a44a1d533e55befe20 Mon Sep 17 00:00:00 2001 From: Arturo Gonzalez Date: Mon, 27 Nov 2017 16:42:32 +0100 Subject: [PATCH 140/149] Fixed error generated in issue pandora_enterprise#110 --- pandora_console/operation/visual_console/render_view.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pandora_console/operation/visual_console/render_view.php b/pandora_console/operation/visual_console/render_view.php index 885f326238..0f2a2b9750 100755 --- a/pandora_console/operation/visual_console/render_view.php +++ b/pandora_console/operation/visual_console/render_view.php @@ -244,10 +244,11 @@ $ignored_params['refr'] = ''; $('div.vc-countdown').countdown('destroy'); //cb(); url = js_html_entity_decode( href ) + duration; - //$(document).attr ("location", url); - $.post(window.location.href.replace("refr=300","refr="+new_count), function(respuestaSolicitud){ + $(document).attr ("location", url); + /*$.post(window.location.href.replace("refr=300","refr="+new_count), function(respuestaSolicitud){ $('#background_').html(respuestaSolicitud); }); + */ $("#main_pure").css('background-color',''); } From 406c69d5bea4abb254a1f819f0e276b2983c66f0 Mon Sep 17 00:00:00 2001 From: artica Date: Tue, 28 Nov 2017 00:01:13 +0100 Subject: [PATCH 141/149] Auto-updated build strings. --- pandora_agents/unix/DEBIAN/control | 2 +- pandora_agents/unix/DEBIAN/make_deb_package.sh | 2 +- pandora_agents/unix/pandora_agent | 2 +- pandora_agents/unix/pandora_agent.redhat.spec | 2 +- pandora_agents/unix/pandora_agent.spec | 2 +- pandora_agents/unix/pandora_agent_installer | 2 +- pandora_agents/win32/installer/pandora.mpi | 4 ++-- pandora_agents/win32/pandora.cc | 2 +- pandora_agents/win32/versioninfo.rc | 2 +- pandora_console/DEBIAN/control | 2 +- pandora_console/DEBIAN/make_deb_package.sh | 2 +- pandora_console/include/config_process.php | 2 +- pandora_console/install.php | 2 +- pandora_console/pandora_console.redhat.spec | 2 +- pandora_console/pandora_console.spec | 2 +- pandora_server/DEBIAN/control | 2 +- pandora_server/DEBIAN/make_deb_package.sh | 2 +- pandora_server/lib/PandoraFMS/Config.pm | 2 +- pandora_server/pandora_server.redhat.spec | 2 +- pandora_server/pandora_server.spec | 2 +- pandora_server/pandora_server_installer | 2 +- pandora_server/util/pandora_db.pl | 2 +- pandora_server/util/pandora_manage.pl | 2 +- 23 files changed, 24 insertions(+), 24 deletions(-) diff --git a/pandora_agents/unix/DEBIAN/control b/pandora_agents/unix/DEBIAN/control index e64ead78c5..776744c727 100644 --- a/pandora_agents/unix/DEBIAN/control +++ b/pandora_agents/unix/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-agent-unix -Version: 7.0NG.716 +Version: 7.0NG.716-171128 Architecture: all Priority: optional Section: admin diff --git a/pandora_agents/unix/DEBIAN/make_deb_package.sh b/pandora_agents/unix/DEBIAN/make_deb_package.sh index e60e1a622a..4f4fe622f8 100644 --- a/pandora_agents/unix/DEBIAN/make_deb_package.sh +++ b/pandora_agents/unix/DEBIAN/make_deb_package.sh @@ -14,7 +14,7 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -pandora_version="7.0NG.716" +pandora_version="7.0NG.716-171128" echo "Test if you has the tools for to make the packages." whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null diff --git a/pandora_agents/unix/pandora_agent b/pandora_agents/unix/pandora_agent index 4711a5c153..b2a9dba514 100755 --- a/pandora_agents/unix/pandora_agent +++ b/pandora_agents/unix/pandora_agent @@ -41,7 +41,7 @@ my $Sem = undef; my $ThreadSem = undef; use constant AGENT_VERSION => '7.0NG.716'; -use constant AGENT_BUILD => '171127'; +use constant AGENT_BUILD => '171128'; # Agent log default file size maximum and instances use constant DEFAULT_MAX_LOG_SIZE => 600000; diff --git a/pandora_agents/unix/pandora_agent.redhat.spec b/pandora_agents/unix/pandora_agent.redhat.spec index 5f0204a70d..4fea203def 100644 --- a/pandora_agents/unix/pandora_agent.redhat.spec +++ b/pandora_agents/unix/pandora_agent.redhat.spec @@ -3,7 +3,7 @@ # %define name pandorafms_agent_unix %define version 7.0NG.716 -%define release 1 +%define release 171128 Summary: Pandora FMS Linux agent, PERL version Name: %{name} diff --git a/pandora_agents/unix/pandora_agent.spec b/pandora_agents/unix/pandora_agent.spec index 73988daaf6..64a15bc050 100644 --- a/pandora_agents/unix/pandora_agent.spec +++ b/pandora_agents/unix/pandora_agent.spec @@ -3,7 +3,7 @@ # %define name pandorafms_agent_unix %define version 7.0NG.716 -%define release 1 +%define release 171128 Summary: Pandora FMS Linux agent, PERL version Name: %{name} diff --git a/pandora_agents/unix/pandora_agent_installer b/pandora_agents/unix/pandora_agent_installer index 74d2b71fa6..5741a331db 100755 --- a/pandora_agents/unix/pandora_agent_installer +++ b/pandora_agents/unix/pandora_agent_installer @@ -10,7 +10,7 @@ # ********************************************************************** PI_VERSION="7.0NG.716" -PI_BUILD="171127" +PI_BUILD="171128" OS_NAME=`uname -s` FORCE=0 diff --git a/pandora_agents/win32/installer/pandora.mpi b/pandora_agents/win32/installer/pandora.mpi index f392a705ea..ae1b350306 100644 --- a/pandora_agents/win32/installer/pandora.mpi +++ b/pandora_agents/win32/installer/pandora.mpi @@ -186,7 +186,7 @@ UpgradeApplicationID {} Version -{171127} +{171128} ViewReadme {Yes} @@ -2387,7 +2387,7 @@ Windows,BuildSeparateArchives {No} Windows,Executable -{<%AppName%>-Setup<%Ext%>} +{<%AppName%>-<%Version%>-Setup<%Ext%>} Windows,FileDescription {<%AppName%> <%Version%> Setup} diff --git a/pandora_agents/win32/pandora.cc b/pandora_agents/win32/pandora.cc index 6b71f9d369..745224cf53 100644 --- a/pandora_agents/win32/pandora.cc +++ b/pandora_agents/win32/pandora.cc @@ -30,7 +30,7 @@ using namespace Pandora; using namespace Pandora_Strutils; #define PATH_SIZE _MAX_PATH+1 -#define PANDORA_VERSION ("7.0NG.716(Build 171127)") +#define PANDORA_VERSION ("7.0NG.716(Build 171128)") string pandora_path; string pandora_dir; diff --git a/pandora_agents/win32/versioninfo.rc b/pandora_agents/win32/versioninfo.rc index a27695f270..a27ac6ccb5 100644 --- a/pandora_agents/win32/versioninfo.rc +++ b/pandora_agents/win32/versioninfo.rc @@ -11,7 +11,7 @@ BEGIN VALUE "LegalCopyright", "Artica ST" VALUE "OriginalFilename", "PandoraAgent.exe" VALUE "ProductName", "Pandora FMS Windows Agent" - VALUE "ProductVersion", "(7.0NG.716(Build 171127))" + VALUE "ProductVersion", "(7.0NG.716(Build 171128))" VALUE "FileVersion", "1.0.0.0" END END diff --git a/pandora_console/DEBIAN/control b/pandora_console/DEBIAN/control index f2618e0753..ffe49812c4 100644 --- a/pandora_console/DEBIAN/control +++ b/pandora_console/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-console -Version: 7.0NG.716 +Version: 7.0NG.716-171128 Architecture: all Priority: optional Section: admin diff --git a/pandora_console/DEBIAN/make_deb_package.sh b/pandora_console/DEBIAN/make_deb_package.sh index de844dfc44..19fe90c158 100644 --- a/pandora_console/DEBIAN/make_deb_package.sh +++ b/pandora_console/DEBIAN/make_deb_package.sh @@ -14,7 +14,7 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -pandora_version="7.0NG.716" +pandora_version="7.0NG.716-171128" package_pear=0 package_pandora=1 diff --git a/pandora_console/include/config_process.php b/pandora_console/include/config_process.php index 0018c5f0b8..ae3496c9aa 100644 --- a/pandora_console/include/config_process.php +++ b/pandora_console/include/config_process.php @@ -22,7 +22,7 @@ /** * Pandora build version and version */ -$build_version = 'PC171127'; +$build_version = 'PC171128'; $pandora_version = 'v7.0NG.716'; // Do not overwrite default timezone set if defined. diff --git a/pandora_console/install.php b/pandora_console/install.php index c74851511c..024861da8f 100755 --- a/pandora_console/install.php +++ b/pandora_console/install.php @@ -71,7 +71,7 @@
    Date: Tue, 28 Nov 2017 12:06:45 +0100 Subject: [PATCH 142/149] Added lost map info --- pandora_console/operation/agentes/pandora_networkmap.view.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/pandora_console/operation/agentes/pandora_networkmap.view.php b/pandora_console/operation/agentes/pandora_networkmap.view.php index d6e9fb1e62..d2a7830f83 100644 --- a/pandora_console/operation/agentes/pandora_networkmap.view.php +++ b/pandora_console/operation/agentes/pandora_networkmap.view.php @@ -702,7 +702,7 @@ else { $dash_mode = 0; $map_dash_details = array(); - +$networkmap = db_get_row('tmap', 'id', $id); if (enterprise_installed()) { include_once("enterprise/dashboard/widgets/network_map.php"); if ($id_networkmap) { @@ -718,8 +718,6 @@ if (enterprise_installed()) { $networkmap = db_get_row('tmap', 'id', $id); } else { - $networkmap = db_get_row('tmap', 'id', $id); - $networkmap_filter = json_decode($networkmap['filter'], true); if ($networkmap_filter['x_offs'] != null) { $map_dash_details['x_offs'] = $networkmap_filter['x_offs']; From 64b926e482299e39d676751a0a9bb628f1780505 Mon Sep 17 00:00:00 2001 From: Arturo Gonzalez Date: Tue, 28 Nov 2017 13:36:33 +0100 Subject: [PATCH 143/149] Added qw perms --- pandora_console/include/functions_filemanager.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pandora_console/include/functions_filemanager.php b/pandora_console/include/functions_filemanager.php index 1297ea50b2..a27d7d2ec2 100644 --- a/pandora_console/include/functions_filemanager.php +++ b/pandora_console/include/functions_filemanager.php @@ -151,7 +151,7 @@ if ($upload_file) { check_login (); - if (! check_acl ($config['id_user'], 0, "PM")) { + if (! check_acl ($config['id_user'], 0, "AW")) { db_pandora_audit("ACL Violation", "Trying to access File manager"); require ("general/noaccess.php"); return; @@ -219,7 +219,7 @@ if ($create_text_file) { check_login (); - if (! check_acl ($config['id_user'], 0, "PM")) { + if (! check_acl ($config['id_user'], 0, "AW")) { db_pandora_audit("ACL Violation", "Trying to access File manager"); require ("general/noaccess.php"); return; @@ -279,7 +279,7 @@ if ($upload_zip) { check_login (); - if (! check_acl ($config['id_user'], 0, "PM")) { + if (! check_acl ($config['id_user'], 0, "AW")) { db_pandora_audit("ACL Violation", "Trying to access File manager"); require ("general/noaccess.php"); return; From 0df9ae47cea44db17a378fa8dcfc0785f29303c9 Mon Sep 17 00:00:00 2001 From: artica Date: Wed, 29 Nov 2017 00:01:11 +0100 Subject: [PATCH 144/149] Auto-updated build strings. --- pandora_agents/unix/DEBIAN/control | 2 +- pandora_agents/unix/DEBIAN/make_deb_package.sh | 2 +- pandora_agents/unix/pandora_agent | 2 +- pandora_agents/unix/pandora_agent.redhat.spec | 2 +- pandora_agents/unix/pandora_agent.spec | 2 +- pandora_agents/unix/pandora_agent_installer | 2 +- pandora_agents/win32/installer/pandora.mpi | 2 +- pandora_agents/win32/pandora.cc | 2 +- pandora_agents/win32/versioninfo.rc | 2 +- pandora_console/DEBIAN/control | 2 +- pandora_console/DEBIAN/make_deb_package.sh | 2 +- pandora_console/include/config_process.php | 2 +- pandora_console/install.php | 2 +- pandora_console/pandora_console.redhat.spec | 2 +- pandora_console/pandora_console.spec | 2 +- pandora_server/DEBIAN/control | 2 +- pandora_server/DEBIAN/make_deb_package.sh | 2 +- pandora_server/lib/PandoraFMS/Config.pm | 2 +- pandora_server/pandora_server.redhat.spec | 2 +- pandora_server/pandora_server.spec | 2 +- pandora_server/pandora_server_installer | 2 +- pandora_server/util/pandora_db.pl | 2 +- pandora_server/util/pandora_manage.pl | 2 +- 23 files changed, 23 insertions(+), 23 deletions(-) diff --git a/pandora_agents/unix/DEBIAN/control b/pandora_agents/unix/DEBIAN/control index 776744c727..6c6465beaf 100644 --- a/pandora_agents/unix/DEBIAN/control +++ b/pandora_agents/unix/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-agent-unix -Version: 7.0NG.716-171128 +Version: 7.0NG.716-171129 Architecture: all Priority: optional Section: admin diff --git a/pandora_agents/unix/DEBIAN/make_deb_package.sh b/pandora_agents/unix/DEBIAN/make_deb_package.sh index 4f4fe622f8..46667e4ec7 100644 --- a/pandora_agents/unix/DEBIAN/make_deb_package.sh +++ b/pandora_agents/unix/DEBIAN/make_deb_package.sh @@ -14,7 +14,7 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -pandora_version="7.0NG.716-171128" +pandora_version="7.0NG.716-171129" echo "Test if you has the tools for to make the packages." whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null diff --git a/pandora_agents/unix/pandora_agent b/pandora_agents/unix/pandora_agent index b2a9dba514..50e570e2e5 100755 --- a/pandora_agents/unix/pandora_agent +++ b/pandora_agents/unix/pandora_agent @@ -41,7 +41,7 @@ my $Sem = undef; my $ThreadSem = undef; use constant AGENT_VERSION => '7.0NG.716'; -use constant AGENT_BUILD => '171128'; +use constant AGENT_BUILD => '171129'; # Agent log default file size maximum and instances use constant DEFAULT_MAX_LOG_SIZE => 600000; diff --git a/pandora_agents/unix/pandora_agent.redhat.spec b/pandora_agents/unix/pandora_agent.redhat.spec index 4fea203def..45bf73aa6f 100644 --- a/pandora_agents/unix/pandora_agent.redhat.spec +++ b/pandora_agents/unix/pandora_agent.redhat.spec @@ -3,7 +3,7 @@ # %define name pandorafms_agent_unix %define version 7.0NG.716 -%define release 171128 +%define release 171129 Summary: Pandora FMS Linux agent, PERL version Name: %{name} diff --git a/pandora_agents/unix/pandora_agent.spec b/pandora_agents/unix/pandora_agent.spec index 64a15bc050..f73c761f4e 100644 --- a/pandora_agents/unix/pandora_agent.spec +++ b/pandora_agents/unix/pandora_agent.spec @@ -3,7 +3,7 @@ # %define name pandorafms_agent_unix %define version 7.0NG.716 -%define release 171128 +%define release 171129 Summary: Pandora FMS Linux agent, PERL version Name: %{name} diff --git a/pandora_agents/unix/pandora_agent_installer b/pandora_agents/unix/pandora_agent_installer index 5741a331db..bd1033168b 100755 --- a/pandora_agents/unix/pandora_agent_installer +++ b/pandora_agents/unix/pandora_agent_installer @@ -10,7 +10,7 @@ # ********************************************************************** PI_VERSION="7.0NG.716" -PI_BUILD="171128" +PI_BUILD="171129" OS_NAME=`uname -s` FORCE=0 diff --git a/pandora_agents/win32/installer/pandora.mpi b/pandora_agents/win32/installer/pandora.mpi index ae1b350306..af6f1f63a3 100644 --- a/pandora_agents/win32/installer/pandora.mpi +++ b/pandora_agents/win32/installer/pandora.mpi @@ -186,7 +186,7 @@ UpgradeApplicationID {} Version -{171128} +{171129} ViewReadme {Yes} diff --git a/pandora_agents/win32/pandora.cc b/pandora_agents/win32/pandora.cc index 745224cf53..3efb7124c4 100644 --- a/pandora_agents/win32/pandora.cc +++ b/pandora_agents/win32/pandora.cc @@ -30,7 +30,7 @@ using namespace Pandora; using namespace Pandora_Strutils; #define PATH_SIZE _MAX_PATH+1 -#define PANDORA_VERSION ("7.0NG.716(Build 171128)") +#define PANDORA_VERSION ("7.0NG.716(Build 171129)") string pandora_path; string pandora_dir; diff --git a/pandora_agents/win32/versioninfo.rc b/pandora_agents/win32/versioninfo.rc index a27ac6ccb5..7a3f16fdaa 100644 --- a/pandora_agents/win32/versioninfo.rc +++ b/pandora_agents/win32/versioninfo.rc @@ -11,7 +11,7 @@ BEGIN VALUE "LegalCopyright", "Artica ST" VALUE "OriginalFilename", "PandoraAgent.exe" VALUE "ProductName", "Pandora FMS Windows Agent" - VALUE "ProductVersion", "(7.0NG.716(Build 171128))" + VALUE "ProductVersion", "(7.0NG.716(Build 171129))" VALUE "FileVersion", "1.0.0.0" END END diff --git a/pandora_console/DEBIAN/control b/pandora_console/DEBIAN/control index ffe49812c4..b40d8460f2 100644 --- a/pandora_console/DEBIAN/control +++ b/pandora_console/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-console -Version: 7.0NG.716-171128 +Version: 7.0NG.716-171129 Architecture: all Priority: optional Section: admin diff --git a/pandora_console/DEBIAN/make_deb_package.sh b/pandora_console/DEBIAN/make_deb_package.sh index 19fe90c158..f6285eab5f 100644 --- a/pandora_console/DEBIAN/make_deb_package.sh +++ b/pandora_console/DEBIAN/make_deb_package.sh @@ -14,7 +14,7 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -pandora_version="7.0NG.716-171128" +pandora_version="7.0NG.716-171129" package_pear=0 package_pandora=1 diff --git a/pandora_console/include/config_process.php b/pandora_console/include/config_process.php index ae3496c9aa..b88c0ab537 100644 --- a/pandora_console/include/config_process.php +++ b/pandora_console/include/config_process.php @@ -22,7 +22,7 @@ /** * Pandora build version and version */ -$build_version = 'PC171128'; +$build_version = 'PC171129'; $pandora_version = 'v7.0NG.716'; // Do not overwrite default timezone set if defined. diff --git a/pandora_console/install.php b/pandora_console/install.php index 024861da8f..6f44556e63 100755 --- a/pandora_console/install.php +++ b/pandora_console/install.php @@ -71,7 +71,7 @@
    Date: Wed, 29 Nov 2017 14:00:27 +0100 Subject: [PATCH 145/149] Added mr file --- pandora_console/extras/mr/10.sql | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 pandora_console/extras/mr/10.sql diff --git a/pandora_console/extras/mr/10.sql b/pandora_console/extras/mr/10.sql new file mode 100644 index 0000000000..e27f4fccf1 --- /dev/null +++ b/pandora_console/extras/mr/10.sql @@ -0,0 +1,5 @@ +START TRANSACTION; + +ALTER TABLE tsnmp_filter ADD unified_filters_id int(10) NOT NULL DEFAULT 0; + +COMMIT; \ No newline at end of file From aeb3e73221db4b37cf79448555d5638de63dcbe1 Mon Sep 17 00:00:00 2001 From: danielmaya Date: Wed, 29 Nov 2017 17:42:57 +0100 Subject: [PATCH 146/149] Fixed last contact in metaconsole users_setup --- pandora_console/godmode/users/user_list.php | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/pandora_console/godmode/users/user_list.php b/pandora_console/godmode/users/user_list.php index 71acc33881..2a10e8c7b8 100644 --- a/pandora_console/godmode/users/user_list.php +++ b/pandora_console/godmode/users/user_list.php @@ -76,11 +76,11 @@ switch ($sortField) { switch ($sort) { case 'up': $selectLastConnectUp = $selected; - $order = array('field' => 'fullname', 'order' => 'ASC'); + $order = array('field' => 'last_connect', 'order' => 'ASC'); break; case 'down': $selectLastConnectDown = $selected; - $order = array('field' => 'fullname', 'order' => 'DESC'); + $order = array('field' => 'last_connect', 'order' => 'DESC'); break; } break; @@ -494,10 +494,4 @@ echo '
    '; enterprise_hook('close_meta_frame'); ?> - From 3adb9909700b30c3251e7d5ff9c193cb840070ea Mon Sep 17 00:00:00 2001 From: danielmaya Date: Wed, 29 Nov 2017 18:11:40 +0100 Subject: [PATCH 147/149] Fixed redeclare function --- pandora_console/include/functions_agents.php | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/pandora_console/include/functions_agents.php b/pandora_console/include/functions_agents.php index 63a264fee3..9c38157300 100644 --- a/pandora_console/include/functions_agents.php +++ b/pandora_console/include/functions_agents.php @@ -1317,24 +1317,6 @@ function agents_get_agent_id ($agent_name, $io_safe_input = false) { return (int) db_get_value ('id_agente', 'tagente', 'nombre', $agent_name); } -/** - * Get agents id from an agent alias. - * - * @param string $agent_alias Agent alias to get its id. - * @param boolean $io_safe_input If it is true transform to safe string, by default false. - * - * @return int Id from the agent of the given alias. - */ -function agents_get_agent_id_by_alias ($alias, $io_safe_input = false) { - if ($io_safe_input) { - $alias = io_safe_input($alias); - } - $sql = sprintf("SELECT tagente.id_agente FROM tagente WHERE alias LIKE '%s' ",$alias); - $agent_id = db_get_all_rows_sql($sql); - - return $agent_id; -} - /** * Get name of an agent. * From d8ee188b952dfcb8a5682a8f684e54724eef53dc Mon Sep 17 00:00:00 2001 From: artica Date: Thu, 30 Nov 2017 00:01:12 +0100 Subject: [PATCH 148/149] Auto-updated build strings. --- pandora_agents/unix/DEBIAN/control | 2 +- pandora_agents/unix/DEBIAN/make_deb_package.sh | 2 +- pandora_agents/unix/pandora_agent | 2 +- pandora_agents/unix/pandora_agent.redhat.spec | 2 +- pandora_agents/unix/pandora_agent.spec | 2 +- pandora_agents/unix/pandora_agent_installer | 2 +- pandora_agents/win32/bin/pandora_agent.conf | 2 +- pandora_agents/win32/installer/pandora.mpi | 2 +- pandora_agents/win32/pandora.cc | 2 +- pandora_agents/win32/versioninfo.rc | 2 +- pandora_console/DEBIAN/control | 2 +- pandora_console/DEBIAN/make_deb_package.sh | 2 +- pandora_console/include/config_process.php | 2 +- pandora_console/install.php | 2 +- pandora_console/pandora_console.redhat.spec | 2 +- pandora_console/pandora_console.spec | 2 +- pandora_server/DEBIAN/control | 2 +- pandora_server/DEBIAN/make_deb_package.sh | 2 +- pandora_server/lib/PandoraFMS/Config.pm | 2 +- pandora_server/pandora_server.redhat.spec | 2 +- pandora_server/pandora_server.spec | 2 +- pandora_server/pandora_server_installer | 2 +- pandora_server/util/pandora_db.pl | 2 +- pandora_server/util/pandora_manage.pl | 2 +- 24 files changed, 24 insertions(+), 24 deletions(-) diff --git a/pandora_agents/unix/DEBIAN/control b/pandora_agents/unix/DEBIAN/control index 6c6465beaf..f07a12ded5 100644 --- a/pandora_agents/unix/DEBIAN/control +++ b/pandora_agents/unix/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-agent-unix -Version: 7.0NG.716-171129 +Version: 7.0NG.716-171130 Architecture: all Priority: optional Section: admin diff --git a/pandora_agents/unix/DEBIAN/make_deb_package.sh b/pandora_agents/unix/DEBIAN/make_deb_package.sh index 46667e4ec7..097ef3b63f 100644 --- a/pandora_agents/unix/DEBIAN/make_deb_package.sh +++ b/pandora_agents/unix/DEBIAN/make_deb_package.sh @@ -14,7 +14,7 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -pandora_version="7.0NG.716-171129" +pandora_version="7.0NG.716-171130" echo "Test if you has the tools for to make the packages." whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null diff --git a/pandora_agents/unix/pandora_agent b/pandora_agents/unix/pandora_agent index 7ee9868b87..7c1cbe610c 100755 --- a/pandora_agents/unix/pandora_agent +++ b/pandora_agents/unix/pandora_agent @@ -41,7 +41,7 @@ my $Sem = undef; my $ThreadSem = undef; use constant AGENT_VERSION => '7.0NG.716'; -use constant AGENT_BUILD => '171129'; +use constant AGENT_BUILD => '171130'; # Agent log default file size maximum and instances use constant DEFAULT_MAX_LOG_SIZE => 600000; diff --git a/pandora_agents/unix/pandora_agent.redhat.spec b/pandora_agents/unix/pandora_agent.redhat.spec index 45bf73aa6f..582cba7a4c 100644 --- a/pandora_agents/unix/pandora_agent.redhat.spec +++ b/pandora_agents/unix/pandora_agent.redhat.spec @@ -3,7 +3,7 @@ # %define name pandorafms_agent_unix %define version 7.0NG.716 -%define release 171129 +%define release 171130 Summary: Pandora FMS Linux agent, PERL version Name: %{name} diff --git a/pandora_agents/unix/pandora_agent.spec b/pandora_agents/unix/pandora_agent.spec index f73c761f4e..1e91878da6 100644 --- a/pandora_agents/unix/pandora_agent.spec +++ b/pandora_agents/unix/pandora_agent.spec @@ -3,7 +3,7 @@ # %define name pandorafms_agent_unix %define version 7.0NG.716 -%define release 171129 +%define release 171130 Summary: Pandora FMS Linux agent, PERL version Name: %{name} diff --git a/pandora_agents/unix/pandora_agent_installer b/pandora_agents/unix/pandora_agent_installer index bd1033168b..696fa280a0 100755 --- a/pandora_agents/unix/pandora_agent_installer +++ b/pandora_agents/unix/pandora_agent_installer @@ -10,7 +10,7 @@ # ********************************************************************** PI_VERSION="7.0NG.716" -PI_BUILD="171129" +PI_BUILD="171130" OS_NAME=`uname -s` FORCE=0 diff --git a/pandora_agents/win32/bin/pandora_agent.conf b/pandora_agents/win32/bin/pandora_agent.conf index b01a9d3519..5cbf2b0876 100644 --- a/pandora_agents/win32/bin/pandora_agent.conf +++ b/pandora_agents/win32/bin/pandora_agent.conf @@ -1,6 +1,6 @@ # Base config file for Pandora FMS Windows Agent # (c) 2006-2017 Artica Soluciones Tecnologicas -# Version 7.0NG.716 +# Version 7.0NG.716 # This program is Free Software, you can redistribute it and/or modify it # under the terms of the GNU General Public Licence as published by the Free Software diff --git a/pandora_agents/win32/installer/pandora.mpi b/pandora_agents/win32/installer/pandora.mpi index af6f1f63a3..d3ca83843f 100644 --- a/pandora_agents/win32/installer/pandora.mpi +++ b/pandora_agents/win32/installer/pandora.mpi @@ -186,7 +186,7 @@ UpgradeApplicationID {} Version -{171129} +{171130} ViewReadme {Yes} diff --git a/pandora_agents/win32/pandora.cc b/pandora_agents/win32/pandora.cc index 3efb7124c4..7b1eb275ba 100644 --- a/pandora_agents/win32/pandora.cc +++ b/pandora_agents/win32/pandora.cc @@ -30,7 +30,7 @@ using namespace Pandora; using namespace Pandora_Strutils; #define PATH_SIZE _MAX_PATH+1 -#define PANDORA_VERSION ("7.0NG.716(Build 171129)") +#define PANDORA_VERSION ("7.0NG.716(Build 171130)") string pandora_path; string pandora_dir; diff --git a/pandora_agents/win32/versioninfo.rc b/pandora_agents/win32/versioninfo.rc index 7a3f16fdaa..9bc83625c4 100644 --- a/pandora_agents/win32/versioninfo.rc +++ b/pandora_agents/win32/versioninfo.rc @@ -11,7 +11,7 @@ BEGIN VALUE "LegalCopyright", "Artica ST" VALUE "OriginalFilename", "PandoraAgent.exe" VALUE "ProductName", "Pandora FMS Windows Agent" - VALUE "ProductVersion", "(7.0NG.716(Build 171129))" + VALUE "ProductVersion", "(7.0NG.716(Build 171130))" VALUE "FileVersion", "1.0.0.0" END END diff --git a/pandora_console/DEBIAN/control b/pandora_console/DEBIAN/control index b40d8460f2..b9efaf31e9 100644 --- a/pandora_console/DEBIAN/control +++ b/pandora_console/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-console -Version: 7.0NG.716-171129 +Version: 7.0NG.716-171130 Architecture: all Priority: optional Section: admin diff --git a/pandora_console/DEBIAN/make_deb_package.sh b/pandora_console/DEBIAN/make_deb_package.sh index f6285eab5f..43009ec1fd 100644 --- a/pandora_console/DEBIAN/make_deb_package.sh +++ b/pandora_console/DEBIAN/make_deb_package.sh @@ -14,7 +14,7 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -pandora_version="7.0NG.716-171129" +pandora_version="7.0NG.716-171130" package_pear=0 package_pandora=1 diff --git a/pandora_console/include/config_process.php b/pandora_console/include/config_process.php index b88c0ab537..609cde2096 100644 --- a/pandora_console/include/config_process.php +++ b/pandora_console/include/config_process.php @@ -22,7 +22,7 @@ /** * Pandora build version and version */ -$build_version = 'PC171129'; +$build_version = 'PC171130'; $pandora_version = 'v7.0NG.716'; // Do not overwrite default timezone set if defined. diff --git a/pandora_console/install.php b/pandora_console/install.php index 6f44556e63..b4ccf7cadf 100755 --- a/pandora_console/install.php +++ b/pandora_console/install.php @@ -71,7 +71,7 @@
    Date: Thu, 30 Nov 2017 11:55:11 +0100 Subject: [PATCH 149/149] 1326 / 1382 - Mr 10 changes --- pandora_console/extras/mr/10.sql | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pandora_console/extras/mr/10.sql b/pandora_console/extras/mr/10.sql index e27f4fccf1..2b58ce08c4 100644 --- a/pandora_console/extras/mr/10.sql +++ b/pandora_console/extras/mr/10.sql @@ -1,5 +1,7 @@ START TRANSACTION; ALTER TABLE tsnmp_filter ADD unified_filters_id int(10) NOT NULL DEFAULT 0; +ALTER TABLE treport_content_template ADD COLUMN hide_no_data tinyint(1) DEFAULT 0; +ALTER TABLE tgraph_source ADD COLUMN `order` int(10) NOT NULL default 0; COMMIT; \ No newline at end of file
    ' . __('Agent') . '' . ui_print_agent_autocomplete_input($params) . '' . + __('Agent') . '' . + ui_print_agent_autocomplete_input($params) . + '' . __('Agent') . '' . __('Agent') . '
    ".__('Add summatory series')."" . - ui_print_help_tip (__("This will add a synthetic series to the graph, - using all series to give a SUM or an average of all present series values - in each interval. This feature could be used instead synthetic modules - if you only want to see a graph"), true)."" . html_print_checkbox ("summatory_series", 1, $summatory_series, true) . "".__('Add average series')."" . html_print_checkbox ("average_series", 1, $average_series, true) . "
    ".__('Percentil')."" . html_print_checkbox ("percentil", 1, $percentil, true) . "