From 90b9ace749a3f4fcaabacf15e4c69de9988c96f3 Mon Sep 17 00:00:00 2001 From: alejandro-campos <alejandro.campos@artica.es> Date: Fri, 4 Dec 2020 13:41:06 +0100 Subject: [PATCH 01/61] added number limitation for operation of adding agents to policy in metaconsole --- pandora_console/include/constants.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pandora_console/include/constants.php b/pandora_console/include/constants.php index 66b784d712..a186e656cf 100644 --- a/pandora_console/include/constants.php +++ b/pandora_console/include/constants.php @@ -476,6 +476,8 @@ define('MODULE_LINKED', 1); define('MODULE_PENDING_UNLINK', 10); define('MODULE_PENDING_LINK', 11); +define('POLICY_ADD_MAX_AGENTS', 200); + // EVENTS. define('EVENTS_GOING_UNKNOWN', 'going_unknown'); define('EVENTS_UNKNOWN', 'unknown'); From c4eb3dd088cd1d03c6b3cc486bc6d52cdcd8ebe6 Mon Sep 17 00:00:00 2001 From: Luis Calvo <luis.calvo@artica.es> Date: Mon, 14 Dec 2020 10:52:12 +0100 Subject: [PATCH 02/61] Added log on deleting tgraph_source data in pandora_db --- pandora_server/util/pandora_db.pl | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pandora_server/util/pandora_db.pl b/pandora_server/util/pandora_db.pl index fc72c2f4ff..07498b6e2d 100755 --- a/pandora_server/util/pandora_db.pl +++ b/pandora_server/util/pandora_db.pl @@ -404,8 +404,10 @@ sub pandora_purgedb ($$) { } # Delete old tgraph_source data + log_message ('PURGE', 'Deleting old tgraph_source data.'); db_do ($dbh,"DELETE FROM tgraph_source WHERE id_graph NOT IN (SELECT id_graph FROM tgraph)"); + # Delete network traffic old data. log_message ('PURGE', 'Deleting old network matrix data.'); if ($conf->{'_delete_old_network_matrix'} > 0) { From 010dc65dd4f1b89f1f982035f0c7b0bca2825ce1 Mon Sep 17 00:00:00 2001 From: Jose Gonzalez <jose.gonzalez@artica.es> Date: Wed, 16 Dec 2020 14:09:54 +0100 Subject: [PATCH 03/61] WIP: Backup upload --- pandora_console/godmode/menu.php | 3 + pandora_console/godmode/setup/setup.php | 15 ++ .../godmode/setup/setup_net_tools.php | 36 +++++ .../include/class/NetTools.class.php | 147 ++++++++++++++++++ 4 files changed, 201 insertions(+) create mode 100644 pandora_console/godmode/setup/setup_net_tools.php create mode 100644 pandora_console/include/class/NetTools.class.php diff --git a/pandora_console/godmode/menu.php b/pandora_console/godmode/menu.php index ddea5fcafd..b71e44ea54 100644 --- a/pandora_console/godmode/menu.php +++ b/pandora_console/godmode/menu.php @@ -351,6 +351,9 @@ if (check_acl($config['id_user'], 0, 'PM')) { $sub2['godmode/setup/setup&section=websocket_engine']['text'] = __('Websocket Engine'); $sub2['godmode/setup/setup&section=websocket_engine']['refr'] = 0; + $sub2['godmode/setup/setup&section=nettools']['text'] = __('Network Tools'); + $sub2['godmode/setup/setup&section=nettools']['refr'] = 0; + if ($config['activate_gis']) { $sub2['godmode/setup/setup&section=gis']['text'] = __('Map conections GIS'); } diff --git a/pandora_console/godmode/setup/setup.php b/pandora_console/godmode/setup/setup.php index 9e4fb13a9c..7bfa1709f4 100644 --- a/pandora_console/godmode/setup/setup.php +++ b/pandora_console/godmode/setup/setup.php @@ -145,6 +145,11 @@ $buttons['websocket_engine'] = [ 'text' => '<a href="'.ui_get_full_url('index.php?sec=gsetup&sec2=godmode/setup/setup§ion=websocket_engine').'">'.html_print_image('images/websocket_small.png', true, ['title' => __('Websocket engine')]).'</a>', ]; +$buttons['nettools'] = [ + 'active' => false, + 'text' => '<a href="'.ui_get_full_url('index.php?sec=gsetup&sec2=godmode/setup/setup§ion=nettools').'">'.html_print_image('images/nettool.png', true, ['title' => __('Websocket engine')]).'</a>', +]; + if ($config['activate_gis']) { $buttons['gis'] = [ 'active' => false, @@ -220,6 +225,12 @@ switch ($section) { $help_header = 'quickshell_settings'; break; + case 'nettools': + $buttons['nettools']['active'] = true; + $subpage = ' » '.__('Network Tools'); + $help_header = 'Network_Tools'; + break; + case 'enterprise': $buttons['enterprise']['active'] = true; $subpage = ' » '.__('Enterprise'); @@ -292,6 +303,10 @@ switch ($section) { include_once $config['homedir'].'/godmode/setup/setup_websocket_engine.php'; break; + case 'nettools': + include_once $config['homedir'].'/godmode/setup/setup_net_tools.php'; + break; + default: enterprise_hook('setup_enterprise_select_tab', [$section]); break; diff --git a/pandora_console/godmode/setup/setup_net_tools.php b/pandora_console/godmode/setup/setup_net_tools.php new file mode 100644 index 0000000000..9f5c88fb8a --- /dev/null +++ b/pandora_console/godmode/setup/setup_net_tools.php @@ -0,0 +1,36 @@ +<?php +/** + * Network Tools Setup Tab. + * + * @category Operations + * @package Pandora FMS + * @subpackage Opensource + * @version 1.0.0 + * @license See below + * + * ______ ___ _______ _______ ________ + * | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __| + * | __/| _ | | _ || _ | _| _ | | ___| |__ | + * |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______| + * + * ============================================================================ + * Copyright (c) 2005-2021 Artica Soluciones Tecnologicas + * Please see http://pandorafms.org for full contribution list + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation for version 2. + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * ============================================================================ + */ + +// Begin. +global $config; +// Requires. +require_once $config['homedir'].'/include/functions.php'; + +// Require needed class. +// require_once $config['homedir'].'/include/class/NetTools.class.php'; +hd('MIS HUEVOS EN VINAGRETA'); diff --git a/pandora_console/include/class/NetTools.class.php b/pandora_console/include/class/NetTools.class.php new file mode 100644 index 0000000000..1bed9fc0bf --- /dev/null +++ b/pandora_console/include/class/NetTools.class.php @@ -0,0 +1,147 @@ +<?php +/** + * Net Tools view Class. + * + * @category Class + * @package Pandora FMS + * @subpackage Setup + * @version 1.0.0 + * @license See below + * + * ______ ___ _______ _______ ________ + * | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __| + * | __/| _ | | _ || _ | _| _ | | ___| |__ | + * |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______| + * + * ============================================================================ + * Copyright (c) 2005-2021 Artica Soluciones Tecnologicas + * Please see http://pandorafms.org for full contribution list + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation for version 2. + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * ============================================================================ + */ + +// Get global data. +global $config; + +// Necessary classes for extends. +require_once $config['homedir'].'/include/class/HTML.class.php'; + +/** + * NetTools class + */ +class NetTools extends HTML +{ + + + /** + * Class constructor + */ + public function __construct() + { + + } + + + /** + * Add option. + * + * @return void + */ + function godmode_net_tools() + { + global $config; + + check_login(); + + if (! check_acl($config['id_user'], 0, 'PM')) { + db_pandora_audit( + 'ACL Violation', + 'Trying to access Profile Management' + ); + include 'general/noaccess.php'; + return; + } + + ui_print_page_header( + __('Config Network Tools'), + '', + false, + 'network_tools_tab' + ); + + $update_traceroute = (bool) get_parameter('update_traceroute', 0); + + $traceroute_path = (string) get_parameter('traceroute_path', ''); + $ping_path = (string) get_parameter('ping_path', ''); + $nmap_path = (string) get_parameter('nmap_path', ''); + $dig_path = (string) get_parameter('dig_path', ''); + $snmpget_path = (string) get_parameter('snmpget_path', ''); + + if ($update_traceroute) { + $network_tools_config = []; + $network_tools_config['traceroute_path'] = $traceroute_path; + $network_tools_config['ping_path'] = $ping_path; + $network_tools_config['nmap_path'] = $nmap_path; + $network_tools_config['dig_path'] = $dig_path; + $network_tools_config['snmpget_path'] = $snmpget_path; + + $result = config_update_value('network_tools_config', json_encode($network_tools_config)); + + ui_print_result_message( + $result, + __('Set the paths.'), + __('Set the paths.') + ); + } else { + if (isset($config['network_tools_config'])) { + $network_tools_config_output = io_safe_output($config['network_tools_config']); + $network_tools_config = json_decode($network_tools_config_output, true); + $traceroute_path = $network_tools_config['traceroute_path']; + $ping_path = $network_tools_config['ping_path']; + $nmap_path = $network_tools_config['nmap_path']; + $dig_path = $network_tools_config['dig_path']; + $snmpget_path = $network_tools_config['snmpget_path']; + } + } + + $table = new stdClass(); + $table->width = '100%'; + + $table->data = []; + + $table->data[0][0] = __('Traceroute path'); + $table->data[0][1] = html_print_input_text('traceroute_path', $traceroute_path, '', 40, 255, true); + + $table->data[1][0] = __('Ping path'); + $table->data[1][1] = html_print_input_text('ping_path', $ping_path, '', 40, 255, true); + + $table->data[2][0] = __('Nmap path'); + $table->data[2][1] = html_print_input_text('nmap_path', $nmap_path, '', 40, 255, true); + + $table->data[3][0] = __('Dig path'); + $table->data[3][1] = html_print_input_text('dig_path', $dig_path, '', 40, 255, true); + + $table->data[4][0] = __('Snmpget path'); + $table->data[4][1] = html_print_input_text('snmpget_path', $snmpget_path, '', 40, 255, true); + + echo '<form id="form_setup" method="post" >'; + echo '<fieldset>'; + echo '<legend>'.__('Options').'</legend>'; + html_print_input_hidden('update_traceroute', 1); + html_print_table($table); + echo '</fieldset>'; + + echo '<div class="action-buttons" style="width: '.$table->width.'">'; + html_print_submit_button(__('Update'), 'update_button', false, 'class="sub upd"'); + echo '</div>'; + echo '</form>'; + } + + +} From 6da8f33e2010a1317ab2a25d6bfab3bcf63b844f Mon Sep 17 00:00:00 2001 From: Jose Gonzalez <jose.gonzalez@artica.es> Date: Wed, 16 Dec 2020 14:26:32 +0100 Subject: [PATCH 04/61] WIP --- .../godmode/setup/setup_net_tools.php | 3 +- .../include/class/NetTools.class.php | 29 ++++++++++++------- 2 files changed, 19 insertions(+), 13 deletions(-) diff --git a/pandora_console/godmode/setup/setup_net_tools.php b/pandora_console/godmode/setup/setup_net_tools.php index 9f5c88fb8a..0f1b246626 100644 --- a/pandora_console/godmode/setup/setup_net_tools.php +++ b/pandora_console/godmode/setup/setup_net_tools.php @@ -32,5 +32,4 @@ global $config; require_once $config['homedir'].'/include/functions.php'; // Require needed class. -// require_once $config['homedir'].'/include/class/NetTools.class.php'; -hd('MIS HUEVOS EN VINAGRETA'); +require_once $config['homedir'].'/include/class/NetTools.class.php'; diff --git a/pandora_console/include/class/NetTools.class.php b/pandora_console/include/class/NetTools.class.php index 1bed9fc0bf..aeac561c7b 100644 --- a/pandora_console/include/class/NetTools.class.php +++ b/pandora_console/include/class/NetTools.class.php @@ -44,7 +44,7 @@ class NetTools extends HTML */ public function __construct() { - + echo 'Estoy funcionando'; } @@ -130,17 +130,24 @@ class NetTools extends HTML $table->data[4][0] = __('Snmpget path'); $table->data[4][1] = html_print_input_text('snmpget_path', $snmpget_path, '', 40, 255, true); - echo '<form id="form_setup" method="post" >'; - echo '<fieldset>'; - echo '<legend>'.__('Options').'</legend>'; - html_print_input_hidden('update_traceroute', 1); - html_print_table($table); - echo '</fieldset>'; + $form = '<form id="form_setup" method="post" >'; + $form .= '<fieldset>'; + $form .= '<legend>'.__('Options').'</legend>'; + $form .= html_print_input_hidden('update_traceroute', 1, true); + $form .= html_print_table($table); + $form .= '</fieldset>'; + $form .= html_print_div( + [ + 'id' => '', + 'class' => 'action-buttons', + 'style' => 'width: 100%', + 'content' => html_print_submit_button(__('Update'), 'update_button', false, 'class="sub upd"'), + ] + ); - echo '<div class="action-buttons" style="width: '.$table->width.'">'; - html_print_submit_button(__('Update'), 'update_button', false, 'class="sub upd"'); - echo '</div>'; - echo '</form>'; + $form .= '</form>'; + + echo $form; } From 959fbd4764fed0fabb406312d5982284056b38cb Mon Sep 17 00:00:00 2001 From: Jose Gonzalez <jose.gonzalez@artica.es> Date: Thu, 17 Dec 2020 13:04:21 +0100 Subject: [PATCH 05/61] WIP: Backup upload --- .../godmode/setup/setup_net_tools.php | 13 + .../include/class/NetTools.class.php | 557 ++++++++++++++++-- .../operation/agentes/net_tools.php | 48 ++ .../operation/agentes/ver_agente.php | 17 +- 4 files changed, 585 insertions(+), 50 deletions(-) create mode 100644 pandora_console/operation/agentes/net_tools.php diff --git a/pandora_console/godmode/setup/setup_net_tools.php b/pandora_console/godmode/setup/setup_net_tools.php index 0f1b246626..4dafb6e39c 100644 --- a/pandora_console/godmode/setup/setup_net_tools.php +++ b/pandora_console/godmode/setup/setup_net_tools.php @@ -33,3 +33,16 @@ require_once $config['homedir'].'/include/functions.php'; // Require needed class. require_once $config['homedir'].'/include/class/NetTools.class.php'; + +// Control call flow for debug window. +try { + // User access and validation is being processed on class constructor. + $obj = new NetTools('setup'); +} catch (Exception $e) { + echo '[NetTools]'.$e->getMessage(); + + // Stop this execution, but continue 'globally'. + return; +} + +$obj->run(); diff --git a/pandora_console/include/class/NetTools.class.php b/pandora_console/include/class/NetTools.class.php index aeac561c7b..1e3e3343dd 100644 --- a/pandora_console/include/class/NetTools.class.php +++ b/pandora_console/include/class/NetTools.class.php @@ -40,56 +40,98 @@ class NetTools extends HTML /** - * Class constructor + * Undocumented function + * + * @param string $origin Origin of the request. */ - public function __construct() + public function __construct(string $origin) { - echo 'Estoy funcionando'; + global $config; + + // Check if the user can access here. + check_login(); + // Setting the origin. + $this->origin = $origin; + + if ($this->origin === 'agent') { + if (check_acl($config['id_user'], 0, 'AR') === false) { + db_pandora_audit( + 'ACL Violation', + 'Trying to access Agent Management' + ); + include 'general/noaccess.php'; + return; + } + + // Capture needed parameter for agent form. + $this->operation = get_parameter('operation', 0); + $this->community = get_parameter('community', 'public'); + $this->ip = get_parameter('select_ips'); + $this->snmp_version = get_parameter('select_version'); + + // Show form. + $this->id_agente = get_parameter('id_agente', 0); + + // Capture needed parameters for agent executions. + } else if ($this->origin === 'setup') { + if (check_acl($config['id_user'], 0, 'PM') === false) { + db_pandora_audit( + 'ACL Violation', + 'Trying to access Profile Management' + ); + include 'general/noaccess.php'; + return; + } + + // Capture needed parameters for setup form. + $this->updatePaths = (bool) get_parameter('update_paths', 0); + // Capture paths. + $this->pathTraceroute = (string) get_parameter('traceroute_path'); + $this->pathPing = (string) get_parameter('ping_path'); + $this->pathNmap = (string) get_parameter('nmap_path'); + $this->pathDig = (string) get_parameter('dig_path'); + $this->pathSnmpget = (string) get_parameter('snmpget_path'); + } + + return $this; + } /** - * Add option. + * Undocumented function * * @return void */ - function godmode_net_tools() + public function run() { - global $config; - - check_login(); - - if (! check_acl($config['id_user'], 0, 'PM')) { - db_pandora_audit( - 'ACL Violation', - 'Trying to access Profile Management' - ); - include 'general/noaccess.php'; - return; + if ($this->origin === 'agent') { + // Print tool form. + $this->agentNetToolsForm(); + } else if ($this->origin === 'setup') { + // Print setup form. + $this->setupNetToolsForm(); } - ui_print_page_header( - __('Config Network Tools'), - '', - false, - 'network_tools_tab' - ); + // Anyway, load JS. + $this->loadJS(); + } - $update_traceroute = (bool) get_parameter('update_traceroute', 0); - $traceroute_path = (string) get_parameter('traceroute_path', ''); - $ping_path = (string) get_parameter('ping_path', ''); - $nmap_path = (string) get_parameter('nmap_path', ''); - $dig_path = (string) get_parameter('dig_path', ''); - $snmpget_path = (string) get_parameter('snmpget_path', ''); - - if ($update_traceroute) { + /** + * Print the form for setup the network tools. + * + * @return void + */ + private function setupNetToolsForm() + { + if ($this->updatePaths === true) { $network_tools_config = []; - $network_tools_config['traceroute_path'] = $traceroute_path; - $network_tools_config['ping_path'] = $ping_path; - $network_tools_config['nmap_path'] = $nmap_path; - $network_tools_config['dig_path'] = $dig_path; - $network_tools_config['snmpget_path'] = $snmpget_path; + $network_tools_config['traceroute_path'] = $this->pathTraceroute; + $network_tools_config['ping_path'] = $this->pathPing; + $network_tools_config['nmap_path'] = $this->pathNmap; + $network_tools_config['dig_path'] = $this->pathDig; + $network_tools_config['snmpget_path'] = $this->pathSnmpget; $result = config_update_value('network_tools_config', json_encode($network_tools_config)); @@ -102,47 +144,50 @@ class NetTools extends HTML if (isset($config['network_tools_config'])) { $network_tools_config_output = io_safe_output($config['network_tools_config']); $network_tools_config = json_decode($network_tools_config_output, true); - $traceroute_path = $network_tools_config['traceroute_path']; - $ping_path = $network_tools_config['ping_path']; - $nmap_path = $network_tools_config['nmap_path']; - $dig_path = $network_tools_config['dig_path']; - $snmpget_path = $network_tools_config['snmpget_path']; + // Setting paths. + $this->pathTraceroute = $network_tools_config['traceroute_path']; + $this->pathPing = $network_tools_config['ping_path']; + $this->pathNmap = $network_tools_config['nmap_path']; + $this->pathDig = $network_tools_config['dig_path']; + $this->pathSnmpget = $network_tools_config['snmpget_path']; } } + // Make the table for show the form. $table = new stdClass(); $table->width = '100%'; $table->data = []; $table->data[0][0] = __('Traceroute path'); - $table->data[0][1] = html_print_input_text('traceroute_path', $traceroute_path, '', 40, 255, true); + $table->data[0][1] = html_print_input_text('traceroute_path', $this->pathTraceroute, '', 40, 255, true); $table->data[1][0] = __('Ping path'); - $table->data[1][1] = html_print_input_text('ping_path', $ping_path, '', 40, 255, true); + $table->data[1][1] = html_print_input_text('ping_path', $this->pathPing, '', 40, 255, true); $table->data[2][0] = __('Nmap path'); - $table->data[2][1] = html_print_input_text('nmap_path', $nmap_path, '', 40, 255, true); + $table->data[2][1] = html_print_input_text('nmap_path', $this->pathNmap, '', 40, 255, true); $table->data[3][0] = __('Dig path'); - $table->data[3][1] = html_print_input_text('dig_path', $dig_path, '', 40, 255, true); + $table->data[3][1] = html_print_input_text('dig_path', $this->pathDig, '', 40, 255, true); $table->data[4][0] = __('Snmpget path'); - $table->data[4][1] = html_print_input_text('snmpget_path', $snmpget_path, '', 40, 255, true); + $table->data[4][1] = html_print_input_text('snmpget_path', $this->pathSnmpget, '', 40, 255, true); $form = '<form id="form_setup" method="post" >'; $form .= '<fieldset>'; $form .= '<legend>'.__('Options').'</legend>'; - $form .= html_print_input_hidden('update_traceroute', 1, true); - $form .= html_print_table($table); + $form .= html_print_input_hidden('update_paths', 1, true); + $form .= html_print_table($table, true); $form .= '</fieldset>'; $form .= html_print_div( [ 'id' => '', 'class' => 'action-buttons', 'style' => 'width: 100%', - 'content' => html_print_submit_button(__('Update'), 'update_button', false, 'class="sub upd"'), - ] + 'content' => html_print_submit_button(__('Update'), 'update_button', false, 'class="sub upd"', true), + ], + true ); $form .= '</form>'; @@ -151,4 +196,418 @@ class NetTools extends HTML } + /** + * Print the form for use the network tools. + * + * @return void + */ + private function agentNetToolsForm() + { + $principal_ip = db_get_sql( + sprintf( + 'SELECT direccion FROM tagente WHERE id_agente = %d', + $this->id_agente + ) + ); + + $list_address = db_get_all_rows_sql( + sprintf( + 'SELECT id_a FROM taddress_agent WHERE id_agent = %d', + $this->id_agente + ) + ); + foreach ($list_address as $address) { + $ids[] = join(',', $address); + } + + $ips = db_get_all_rows_sql( + sprintf( + 'SELECT ip FROM taddress WHERE id_a IN (%s)', + join(',', $ids) + ) + ); + + // Must be an a IP at least for work. + if (empty($ips) === true) { + html_print_div( + [ + 'class' => 'error', + 'style' => 'margin-top:5px', + 'content' => __('The agent hasn\'t got IP'), + ] + ); + return; + } + + // Make the data for show in table. + $ipsSelect = array_reduce( + $ips, + function ($carry, $item) { + $carry[$item['ip']] = $item['ip']; + return $carry; + } + ); + + // Form table. + $table = new StdClass(); + $table->class = 'databox filters w100p'; + $table->id = 'netToolTable'; + + $table->data = []; + + $table->data[0][0] = __('Operation'); + + $table->data[0][1] = html_print_select( + [ + 1 => __('Traceroute'), + 2 => __('Ping host & Latency'), + 3 => __('SNMP Interface status'), + 4 => __('Basic TCP Port Scan'), + 5 => __('DiG/Whois Lookup'), + ], + 'operation', + $this->operation, + 'mostrarColumns(this.value)', + __('Please select'), + 0, + true + ); + + $table->data[0][2] = __('IP Adress'); + $table->data[0][3] = html_print_select( + $ipsSelect, + 'select_ips', + $principal_ip, + '', + '', + 0, + true + ); + + $table->cellclass[0][4] = 'snmpcolumn'; + $table->data[0][4] = __('SNMP Version'); + $table->data[0][4] .= ' '; + $table->data[0][4] .= html_print_select( + [ + '1' => 'v1', + '2c' => 'v2c', + ], + 'select_version', + $this->snmp_version, + '', + '', + 0, + true + ); + + $table->cellclass[0][5] = 'snmpcolumn'; + $table->data[0][5] = __('SNMP Community'); + $table->data[0][5] .= ' '; + $table->data[0][5] .= html_print_input_text( + 'community', + $this->community, + '', + 50, + 255, + true + ); + + $table->data[0][6] = "<input style='margin:0px;' name=submit type=submit class='sub next' value='".__('Execute')."'>"; + + // Output string. + $output = ''; + $output .= "<form name='actionbox' method='post'>"; + $output .= html_print_table($table, true); + $output .= '</form>'; + + html_print_div( + [ + 'class' => '', + 'style' => 'width: 100%', + 'content' => $output, + ] + ); + + if ($this->operation === true) { + // Execute form. + $executionResult = $this->netToolsExecution($this->operation, $this->ip, $this->community, $this->snmp_version); + echo $executionResult; + } + + echo '</div>'; + + } + + + /** + * Searchs for command. + * + * @param string $command Command. + * + * @return string Path. + */ + private function whereIsTheCommand($command) + { + global $config; + + if (isset($config['network_tools_config'])) { + $network_tools_config = json_decode($config['network_tools_config'], true); + $traceroute_path = $network_tools_config['traceroute_path']; + $ping_path = $network_tools_config['ping_path']; + $nmap_path = $network_tools_config['nmap_path']; + $dig_path = $network_tools_config['dig_path']; + $snmpget_path = $network_tools_config['snmpget_path']; + + switch ($command) { + case 'traceroute': + if (!empty($traceroute_path)) { + return $traceroute_path; + } + break; + + case 'ping': + if (!empty($ping_path)) { + return $ping_path; + } + break; + + case 'nmap': + if (!empty($nmap_path)) { + return $nmap_path; + } + break; + + case 'dig': + if (!empty($dig_path)) { + return $dig_path; + } + break; + + case 'snmpget': + if (!empty($snmpget_path)) { + return $snmpget_path; + } + break; + + default: + return null; + } + } + + ob_start(); + system('whereis '.$command); + $output = ob_get_clean(); + $result = explode(':', $output); + $result = trim($result[1]); + + if (empty($result)) { + return null; + } + + $result = explode(' ', $result); + $fullpath = trim($result[0]); + + if (! file_exists($fullpath)) { + return null; + } + + return $fullpath; + } + + + /** + * Execute net tools action. + * + * @param integer $operation Operation. + * @param string $ip Ip. + * @param string $community Community. + * @param string $snmp_version SNMP version. + * + * @return string String formed result of execution. + */ + public function netToolsExecution(int $operation, string $ip, string $community, string $snmp_version) + { + $output = ''; + + if (!validate_address($ip)) { + $output .= ui_print_error_message( + __('The ip or dns name entered cannot be resolved'), + '', + true + ); + } else { + switch ($operation) { + case 1: + $traceroute = $this->whereIsTheCommand('traceroute'); + if (empty($traceroute)) { + ui_print_error_message(__('Traceroute executable does not exist.')); + } else { + echo '<h3>'.__('Traceroute to ').$ip.'</h3>'; + echo '<pre>'; + echo system($traceroute.' '.$ip); + echo '</pre>'; + } + break; + + case 2: + $ping = $this->whereIsTheCommand('ping'); + if (empty($ping)) { + ui_print_error_message(__('Ping executable does not exist.')); + } else { + echo '<h3>'.__('Ping to %s', $ip).'</h3>'; + echo '<pre>'; + echo system($ping.' -c 5 '.$ip); + echo '</pre>'; + } + break; + + case 4: + $nmap = $this->whereIsTheCommand('nmap'); + if (empty($nmap)) { + ui_print_error_message(__('Nmap executable does not exist.')); + } else { + echo '<h3>'.__('Basic TCP Scan on ').$ip.'</h3>'; + echo '<pre>'; + echo system($nmap.' -F '.$ip); + echo '</pre>'; + } + break; + + case 5: + echo '<h3>'.__('Domain and IP information for ').$ip.'</h3>'; + + $dig = $this->whereIsTheCommand('dig'); + if (empty($dig)) { + ui_print_error_message(__('Dig executable does not exist.')); + } else { + echo '<pre>'; + echo system('dig '.$ip); + echo '</pre>'; + } + + $whois = $this->whereIsTheCommand('whois'); + if (empty($whois)) { + ui_print_error_message(__('Whois executable does not exist.')); + } else { + echo '<pre>'; + echo system('whois '.$ip); + echo '</pre>'; + } + break; + + case 3: + $snmp_obj = [ + 'ip_target' => $ip, + 'snmp_version' => $snmp_version, + 'snmp_community' => $community, + 'format' => '-Oqn', + ]; + + $snmp_obj['base_oid'] = '.1.3.6.1.2.1.1.3.0'; + $result = get_h_snmpwalk($snmp_obj); + echo '<h3>'.__('SNMP information for ').$ip.'</h3>'; + echo '<h4>'.__('Uptime').'</h4>'; + echo '<pre>'; + if (empty($result)) { + ui_print_error_message(__('Target unreachable.')); + break; + } else { + echo array_pop($result); + } + + echo '</pre>'; + echo '<h4>'.__('Device info').'</h4>'; + echo '<pre>'; + $snmp_obj['base_oid'] = '.1.3.6.1.2.1.1.1.0'; + $result = get_h_snmpwalk($snmp_obj); + if (empty($result)) { + ui_print_error_message(__('Target unreachable.')); + break; + } else { + echo array_pop($result); + } + + echo '</pre>'; + + echo '<h4>Interface Information</h4>'; + + $table = new StdClass(); + $table->class = 'databox'; + $table->head = []; + $table->head[] = __('Interface'); + $table->head[] = __('Status'); + + $i = 0; + + $base_oid = '.1.3.6.1.2.1.2.2.1'; + $idx_oids = '.1'; + $names_oids = '.2'; + $status_oids = '.8'; + + $snmp_obj['base_oid'] = $base_oid.$idx_oids; + $idx = get_h_snmpwalk($snmp_obj); + + $snmp_obj['base_oid'] = $base_oid.$names_oids; + $names = get_h_snmpwalk($snmp_obj); + + $snmp_obj['base_oid'] = $base_oid.$status_oids; + $statuses = get_h_snmpwalk($snmp_obj); + + foreach ($idx as $k => $v) { + $index = str_replace($base_oid.$idx_oids, '', $k); + $name = $names[$base_oid.$names_oids.$index]; + + $status = $statuses[$base_oid.$status_oids.$index]; + + $table->data[$i][0] = $name; + $table->data[$i++][1] = $status; + } + + html_print_table($table); + break; + + default: + // Ignore. + break; + } + } + + return $output; + + } + + + /** + * Load the JS and attach + * + * @return string Formed script string. + */ + private function loadJS() + { + $str = ''; + ob_start(); + ?> + <script type='text/javascript'> + $(document).ready(function(){ + mostrarColumns($('#operation :selected').val()); + }); + + function mostrarColumns(value) { + if (value == 3) { + $('.snmpcolumn').show(); + } + else { + $('.snmpcolumn').hide(); + } + } + </script> + <?php + // Get the JS script. + $str = ob_get_clean(); + // Return the loaded JS. + echo $str; + return $str; + } + + } diff --git a/pandora_console/operation/agentes/net_tools.php b/pandora_console/operation/agentes/net_tools.php new file mode 100644 index 0000000000..a5eba9d171 --- /dev/null +++ b/pandora_console/operation/agentes/net_tools.php @@ -0,0 +1,48 @@ +<?php +/** + * Network Tools view for agents. + * + * @category Network tools for agents. + * @package Pandora FMS + * @subpackage Classic agent management view. + * @version 1.0.0 + * @license See below + * + * ______ ___ _______ _______ ________ + * | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __| + * | __/| _ | | _ || _ | _| _ | | ___| |__ | + * |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______| + * + * ============================================================================ + * Copyright (c) 2005-2021 Artica Soluciones Tecnologicas + * Please see http://pandorafms.org for full contribution list + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation for version 2. + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * ============================================================================ + */ + +// Begin. +global $config; + +require_once 'include/functions_agents.php'; + +// Require needed class. +require_once $config['homedir'].'/include/class/NetTools.class.php'; + +// Control call flow for debug window. +try { + // User access and validation is being processed on class constructor. + $obj = new NetTools('agent'); +} catch (Exception $e) { + echo '[NetTools]'.$e->getMessage(); + + // Stop this execution, but continue 'globally'. + return; +} + +$obj->run(); diff --git a/pandora_console/operation/agentes/ver_agente.php b/pandora_console/operation/agentes/ver_agente.php index df5146711c..72b4ee4389 100644 --- a/pandora_console/operation/agentes/ver_agente.php +++ b/pandora_console/operation/agentes/ver_agente.php @@ -1351,6 +1351,13 @@ if ($is_sap) { $saptab = ''; } +// Network Tools tab. +$nettools['text'] = '<a href="index.php?sec=estado&sec2=operation/agentes/ver_agente&tab=nettools&id_agente='.$id_agente.'">'.html_print_image('images/nettool.png', true, ['title' => __('Network Tools')]).'</a>'; +if ($tab == 'nettools') { + $nettools['active'] = true; +} else { + $nettools['active'] = false; +} $onheader = [ 'manage' => $managetab, @@ -1366,7 +1373,7 @@ $onheader = [ 'wux_console' => $wux_console_tab, 'url_route_analyzer' => $url_route_analyzer_tab, 'sap_view' => $saptab, - + 'nettools' => $nettools, ]; // Added after it exists @@ -1536,6 +1543,10 @@ switch ($tab) { $tab_name = 'SAP View'; break; + case 'nettools': + $tab_name = 'Net Tools'; + break; + default: $tab_name = ''; $help_header = ''; @@ -1656,6 +1667,10 @@ switch ($tab) { include 'general/sap_view.php'; break; + case 'nettools': + include 'net_tools.php'; + break; + case 'extension': $found = false; foreach ($config['extensions'] as $extension) { From 7d5f4f8f65471067158ecee39de787f4f3f14c9c Mon Sep 17 00:00:00 2001 From: Jose Gonzalez <jose.gonzalez@artica.es> Date: Thu, 17 Dec 2020 16:51:05 +0100 Subject: [PATCH 06/61] WIP: Backup upload --- pandora_console/godmode/setup/setup.php | 2 +- .../include/class/NetTools.class.php | 330 ++++++++++-------- pandora_console/include/constants.php | 7 + 3 files changed, 189 insertions(+), 150 deletions(-) diff --git a/pandora_console/godmode/setup/setup.php b/pandora_console/godmode/setup/setup.php index 7bfa1709f4..7fae0afa3b 100644 --- a/pandora_console/godmode/setup/setup.php +++ b/pandora_console/godmode/setup/setup.php @@ -147,7 +147,7 @@ $buttons['websocket_engine'] = [ $buttons['nettools'] = [ 'active' => false, - 'text' => '<a href="'.ui_get_full_url('index.php?sec=gsetup&sec2=godmode/setup/setup§ion=nettools').'">'.html_print_image('images/nettool.png', true, ['title' => __('Websocket engine')]).'</a>', + 'text' => '<a href="'.ui_get_full_url('index.php?sec=gsetup&sec2=godmode/setup/setup§ion=nettools').'">'.html_print_image('images/nettool.png', true, ['title' => __('Network Tools')]).'</a>', ]; if ($config['activate_gis']) { diff --git a/pandora_console/include/class/NetTools.class.php b/pandora_console/include/class/NetTools.class.php index 1e3e3343dd..779ddca25e 100644 --- a/pandora_console/include/class/NetTools.class.php +++ b/pandora_console/include/class/NetTools.class.php @@ -40,7 +40,7 @@ class NetTools extends HTML /** - * Undocumented function + * Constructor. * * @param string $origin Origin of the request. */ @@ -64,15 +64,11 @@ class NetTools extends HTML } // Capture needed parameter for agent form. - $this->operation = get_parameter('operation', 0); - $this->community = get_parameter('community', 'public'); - $this->ip = get_parameter('select_ips'); - $this->snmp_version = get_parameter('select_version'); - - // Show form. - $this->id_agente = get_parameter('id_agente', 0); - - // Capture needed parameters for agent executions. + $this->id_agente = (int) get_parameter('id_agente', 0); + $this->operation = (int) get_parameter('operation', 0); + $this->community = (string) get_parameter('community', 'public'); + $this->ip = (string) get_parameter('select_ips'); + $this->snmp_version = (string) get_parameter('select_version'); } else if ($this->origin === 'setup') { if (check_acl($config['id_user'], 0, 'PM') === false) { db_pandora_audit( @@ -99,7 +95,7 @@ class NetTools extends HTML /** - * Undocumented function + * Run action. * * @return void */ @@ -133,7 +129,10 @@ class NetTools extends HTML $network_tools_config['dig_path'] = $this->pathDig; $network_tools_config['snmpget_path'] = $this->pathSnmpget; - $result = config_update_value('network_tools_config', json_encode($network_tools_config)); + $result = config_update_value( + 'network_tools_config', + json_encode($network_tools_config) + ); ui_print_result_message( $result, @@ -259,11 +258,11 @@ class NetTools extends HTML $table->data[0][1] = html_print_select( [ - 1 => __('Traceroute'), - 2 => __('Ping host & Latency'), - 3 => __('SNMP Interface status'), - 4 => __('Basic TCP Port Scan'), - 5 => __('DiG/Whois Lookup'), + COMMAND_TRACEROUTE => __('Traceroute'), + COMMAND_PING => __('Ping host & Latency'), + COMMAND_SNMP => __('SNMP Interface status'), + COMMAND_NMAP => __('Basic TCP Port Scan'), + COMMAND_DIGWHOIS => __('DiG/Whois Lookup'), ], 'operation', $this->operation, @@ -316,7 +315,7 @@ class NetTools extends HTML // Output string. $output = ''; - $output .= "<form name='actionbox' method='post'>"; + $output .= '<form name="actionbox" method="post">'; $output .= html_print_table($table, true); $output .= '</form>'; @@ -328,14 +327,10 @@ class NetTools extends HTML ] ); - if ($this->operation === true) { + if ($this->operation !== 0) { // Execute form. - $executionResult = $this->netToolsExecution($this->operation, $this->ip, $this->community, $this->snmp_version); - echo $executionResult; + echo $this->netToolsExecution($this->operation, $this->ip, $this->community, $this->snmp_version); } - - echo '</div>'; - } @@ -346,45 +341,45 @@ class NetTools extends HTML * * @return string Path. */ - private function whereIsTheCommand($command) + private function whereIsTheCommand(string $command) { global $config; if (isset($config['network_tools_config'])) { - $network_tools_config = json_decode($config['network_tools_config'], true); + $network_tools_config = json_decode(io_safe_output($config['network_tools_config']), true); $traceroute_path = $network_tools_config['traceroute_path']; - $ping_path = $network_tools_config['ping_path']; - $nmap_path = $network_tools_config['nmap_path']; - $dig_path = $network_tools_config['dig_path']; - $snmpget_path = $network_tools_config['snmpget_path']; + $ping_path = $network_tools_config['ping_path']; + $nmap_path = $network_tools_config['nmap_path']; + $dig_path = $network_tools_config['dig_path']; + $snmpget_path = $network_tools_config['snmpget_path']; switch ($command) { case 'traceroute': - if (!empty($traceroute_path)) { + if (empty($traceroute_path) === false) { return $traceroute_path; } break; case 'ping': - if (!empty($ping_path)) { + if (empty($ping_path) === false) { return $ping_path; } break; case 'nmap': - if (!empty($nmap_path)) { + if (empty($nmap_path) === false) { return $nmap_path; } break; case 'dig': - if (!empty($dig_path)) { + if (empty($dig_path) === false) { return $dig_path; } break; case 'snmpget': - if (!empty($snmpget_path)) { + if (empty($snmpget_path) === false) { return $snmpget_path; } break; @@ -415,6 +410,44 @@ class NetTools extends HTML } + /** + * Create the output for show. + * + * @param string $command Command for execute. + * @param string $caption Description of the execution. + * + * @return void + */ + private function performExecution(string $command='', string $caption='') + { + $output = ''; + + try { + // If caption is not added, don't show anything. + if (empty($caption) === false) { + $output .= sprintf('<h3>%s</h3>', $caption); + } + + $output .= '<pre>'; + + // Only perform an execution if command is passed. Avoid errors. + if (empty($command) === false) { + ob_start(); + system($command); + $output .= ob_get_clean(); + } else { + $output .= __('No command for perform'); + } + + $output .= '</pre>'; + } catch (\Throwable $th) { + $output = __('Something went wrong while perform the execution. Please check the configuration.'); + } + + echo $output; + } + + /** * Execute net tools action. * @@ -429,146 +462,145 @@ class NetTools extends HTML { $output = ''; - if (!validate_address($ip)) { + if (validate_address($ip) === false) { $output .= ui_print_error_message( __('The ip or dns name entered cannot be resolved'), '', true ); } else { - switch ($operation) { - case 1: - $traceroute = $this->whereIsTheCommand('traceroute'); - if (empty($traceroute)) { - ui_print_error_message(__('Traceroute executable does not exist.')); - } else { - echo '<h3>'.__('Traceroute to ').$ip.'</h3>'; - echo '<pre>'; - echo system($traceroute.' '.$ip); - echo '</pre>'; - } - break; + if ($operation === COMMAND_SNMP) { + $snmp_obj = [ + 'ip_target' => $ip, + 'snmp_version' => $snmp_version, + 'snmp_community' => $community, + 'format' => '-Oqn', + ]; - case 2: - $ping = $this->whereIsTheCommand('ping'); - if (empty($ping)) { - ui_print_error_message(__('Ping executable does not exist.')); - } else { - echo '<h3>'.__('Ping to %s', $ip).'</h3>'; - echo '<pre>'; - echo system($ping.' -c 5 '.$ip); - echo '</pre>'; - } - break; + echo '<h3>'.__('SNMP information for ').$ip.'</h3>'; - case 4: - $nmap = $this->whereIsTheCommand('nmap'); - if (empty($nmap)) { - ui_print_error_message(__('Nmap executable does not exist.')); - } else { - echo '<h3>'.__('Basic TCP Scan on ').$ip.'</h3>'; - echo '<pre>'; - echo system($nmap.' -F '.$ip); - echo '</pre>'; - } - break; - - case 5: - echo '<h3>'.__('Domain and IP information for ').$ip.'</h3>'; - - $dig = $this->whereIsTheCommand('dig'); - if (empty($dig)) { - ui_print_error_message(__('Dig executable does not exist.')); - } else { - echo '<pre>'; - echo system('dig '.$ip); - echo '</pre>'; - } - - $whois = $this->whereIsTheCommand('whois'); - if (empty($whois)) { - ui_print_error_message(__('Whois executable does not exist.')); - } else { - echo '<pre>'; - echo system('whois '.$ip); - echo '</pre>'; - } - break; - - case 3: - $snmp_obj = [ - 'ip_target' => $ip, - 'snmp_version' => $snmp_version, - 'snmp_community' => $community, - 'format' => '-Oqn', - ]; - - $snmp_obj['base_oid'] = '.1.3.6.1.2.1.1.3.0'; - $result = get_h_snmpwalk($snmp_obj); - echo '<h3>'.__('SNMP information for ').$ip.'</h3>'; + $snmp_obj['base_oid'] = '.1.3.6.1.2.1.1.3.0'; + $result = get_h_snmpwalk($snmp_obj); + if (empty($result) === true) { + ui_print_error_message(__('Target unreachable.')); + return null; + } else { echo '<h4>'.__('Uptime').'</h4>'; echo '<pre>'; - if (empty($result)) { - ui_print_error_message(__('Target unreachable.')); - break; - } else { - echo array_pop($result); - } - + echo array_pop($result); echo '</pre>'; + } + + $snmp_obj['base_oid'] = '.1.3.6.1.2.1.1.1.0'; + $result = get_h_snmpwalk($snmp_obj); + if (empty($result) === true) { + ui_print_error_message(__('Target unreachable.')); + return null; + } else { echo '<h4>'.__('Device info').'</h4>'; echo '<pre>'; - $snmp_obj['base_oid'] = '.1.3.6.1.2.1.1.1.0'; - $result = get_h_snmpwalk($snmp_obj); - if (empty($result)) { - ui_print_error_message(__('Target unreachable.')); - break; - } else { - echo array_pop($result); - } - + echo array_pop($result); echo '</pre>'; + } - echo '<h4>Interface Information</h4>'; + echo '<h4>Interface Information</h4>'; - $table = new StdClass(); - $table->class = 'databox'; - $table->head = []; - $table->head[] = __('Interface'); - $table->head[] = __('Status'); + $table = new StdClass(); + $table->class = 'databox'; + $table->head = []; + $table->head[] = __('Interface'); + $table->head[] = __('Status'); - $i = 0; + $i = 0; - $base_oid = '.1.3.6.1.2.1.2.2.1'; - $idx_oids = '.1'; - $names_oids = '.2'; - $status_oids = '.8'; + $base_oid = '.1.3.6.1.2.1.2.2.1'; + $idx_oids = '.1'; + $names_oids = '.2'; + $status_oids = '.8'; - $snmp_obj['base_oid'] = $base_oid.$idx_oids; - $idx = get_h_snmpwalk($snmp_obj); + $snmp_obj['base_oid'] = $base_oid.$idx_oids; + $idx = get_h_snmpwalk($snmp_obj); - $snmp_obj['base_oid'] = $base_oid.$names_oids; - $names = get_h_snmpwalk($snmp_obj); + $snmp_obj['base_oid'] = $base_oid.$names_oids; + $names = get_h_snmpwalk($snmp_obj); - $snmp_obj['base_oid'] = $base_oid.$status_oids; - $statuses = get_h_snmpwalk($snmp_obj); + $snmp_obj['base_oid'] = $base_oid.$status_oids; + $statuses = get_h_snmpwalk($snmp_obj); - foreach ($idx as $k => $v) { - $index = str_replace($base_oid.$idx_oids, '', $k); - $name = $names[$base_oid.$names_oids.$index]; + foreach ($idx as $k => $v) { + $index = str_replace($base_oid.$idx_oids, '', $k); + $name = $names[$base_oid.$names_oids.$index]; - $status = $statuses[$base_oid.$status_oids.$index]; + $status = $statuses[$base_oid.$status_oids.$index]; - $table->data[$i][0] = $name; - $table->data[$i++][1] = $status; - } + $table->data[$i][0] = $name; + $table->data[$i++][1] = $status; + } - html_print_table($table); - break; + html_print_table($table); + } else if ($operation === COMMAND_DIGWHOIS) { + echo '<h3>'.__('Domain and IP information for ').$ip.'</h3>'; - default: - // Ignore. - break; + // Dig execution. + $dig = $this->whereIsTheCommand('dig'); + if (empty($dig) === true) { + ui_print_error_message(__('Dig executable does not exist.')); + } else { + $this->performExecution($dig); + } + + // Whois execution. + $whois = $this->whereIsTheCommand('whois'); + if (empty($whois) === true) { + ui_print_error_message(__('Whois executable does not exist.')); + } else { + $this->performExecution($whois); + } + + return; + } else { + switch ($operation) { + case COMMAND_TRACEROUTE: + $command = $this->whereIsTheCommand('traceroute'); + if (empty($command) === true) { + ui_print_error_message(__('Traceroute executable does not exist.')); + return; + } else { + $stringCommand = __('Traceroute to %s', $ip); + $executeCommand = sprintf('%s %s', $command, $ip); + } + break; + + case COMMAND_PING: + $command = $this->whereIsTheCommand('ping'); + if (empty($command) === true) { + ui_print_error_message(__('Ping executable does not exist.')); + return; + } else { + $stringCommand = __('Ping to %s', $ip); + $executeCommand = sprintf('%s -c 5 %s', $command, $ip); + } + break; + + case COMMAND_NMAP: + $command = $this->whereIsTheCommand('nmap'); + if (empty($command) === true) { + ui_print_error_message(__('Nmap executable does not exist.')); + return; + } else { + $stringCommand = __('Basic TCP Scan on %s', $ip); + $executeCommand = sprintf('%s -F %s', $command, $ip); + } + break; + + default: + // Nothing to do. + $stringCommand = ''; + $executeCommand = ''; + break; + } + + $this->performExecution($executeCommand, $stringCommand); } } diff --git a/pandora_console/include/constants.php b/pandora_console/include/constants.php index 54f4c286f2..d8dfa770f2 100644 --- a/pandora_console/include/constants.php +++ b/pandora_console/include/constants.php @@ -747,3 +747,10 @@ define('MODULE_TYPE_REMOTE_CMD_PROC', 35); define('MODULE_TYPE_REMOTE_CMD_STRING', 36); define('MODULE_TYPE_REMOTE_CMD_INC', 37); define('MODULE_TYPE_KEEP_ALIVE', 100); + +// Commands for network tools. +define('COMMAND_TRACEROUTE', 1); +define('COMMAND_PING', 2); +define('COMMAND_SNMP', 3); +define('COMMAND_NMAP', 4); +define('COMMAND_DIGWHOIS', 5); From daa6e47768da779b257246719c0fe6183b631cc0 Mon Sep 17 00:00:00 2001 From: Jose Gonzalez <jose.gonzalez@artica.es> Date: Thu, 17 Dec 2020 19:33:10 +0100 Subject: [PATCH 07/61] Changes ended --- pandora_console/include/class/NetTools.class.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/pandora_console/include/class/NetTools.class.php b/pandora_console/include/class/NetTools.class.php index 779ddca25e..e519019158 100644 --- a/pandora_console/include/class/NetTools.class.php +++ b/pandora_console/include/class/NetTools.class.php @@ -121,6 +121,8 @@ class NetTools extends HTML */ private function setupNetToolsForm() { + global $config; + if ($this->updatePaths === true) { $network_tools_config = []; $network_tools_config['traceroute_path'] = $this->pathTraceroute; @@ -140,7 +142,7 @@ class NetTools extends HTML __('Set the paths.') ); } else { - if (isset($config['network_tools_config'])) { + if (isset($config['network_tools_config']) === true) { $network_tools_config_output = io_safe_output($config['network_tools_config']); $network_tools_config = json_decode($network_tools_config_output, true); // Setting paths. @@ -345,7 +347,7 @@ class NetTools extends HTML { global $config; - if (isset($config['network_tools_config'])) { + if (isset($config['network_tools_config']) === true) { $network_tools_config = json_decode(io_safe_output($config['network_tools_config']), true); $traceroute_path = $network_tools_config['traceroute_path']; $ping_path = $network_tools_config['ping_path']; @@ -395,14 +397,14 @@ class NetTools extends HTML $result = explode(':', $output); $result = trim($result[1]); - if (empty($result)) { + if (empty($result) === true) { return null; } $result = explode(' ', $result); $fullpath = trim($result[0]); - if (! file_exists($fullpath)) { + if (file_exists($fullpath) === false) { return null; } From 5f0d686034a7be45d5250910bbce7e8c243cfded Mon Sep 17 00:00:00 2001 From: Jose Gonzalez <jose.gonzalez@artica.es> Date: Fri, 18 Dec 2020 12:31:44 +0100 Subject: [PATCH 08/61] Changed Network Tools for External Tools --- pandora_console/extensions/net_tools.php | 506 ------------------ ...net_tools.php => setup_external_tools.php} | 8 +- ...ools.class.php => ExternalTools.class.php} | 99 +++- pandora_console/include/constants.php | 2 +- pandora_console/include/styles/pandora.css | 7 + .../{net_tools.php => external_tools.php} | 10 +- .../operation/agentes/ver_agente.php | 20 +- 7 files changed, 113 insertions(+), 539 deletions(-) delete mode 100644 pandora_console/extensions/net_tools.php rename pandora_console/godmode/setup/{setup_net_tools.php => setup_external_tools.php} (89%) rename pandora_console/include/class/{NetTools.class.php => ExternalTools.class.php} (87%) rename pandora_console/operation/agentes/{net_tools.php => external_tools.php} (86%) diff --git a/pandora_console/extensions/net_tools.php b/pandora_console/extensions/net_tools.php deleted file mode 100644 index b23c5b1fe0..0000000000 --- a/pandora_console/extensions/net_tools.php +++ /dev/null @@ -1,506 +0,0 @@ -<?php -/** - * Net tools utils. - * - * @category Extensions - * @package Pandora FMS - * @subpackage NetTools - * @version 1.0.0 - * @license See below - * - * ______ ___ _______ _______ ________ - * | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __| - * | __/| _ | | _ || _ | _| _ | | ___| |__ | - * |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______| - * - * ============================================================================ - * Copyright (c) 2005-2019 Artica Soluciones Tecnologicas - * Please see http://pandorafms.org for full contribution list - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation for version 2. - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * ============================================================================ - */ - -// Begin. -global $config; - -// Requires. -require_once $config['homedir'].'/include/functions.php'; - -// This extension is usefull only if the agent has associated IP. -$id_agente = get_parameter('id_agente'); -$address = agents_get_address($id_agente); - -if (!empty($address) || empty($id_agente)) { - extensions_add_opemode_tab_agent( - 'network_tools', - 'Network Tools', - 'extensions/net_tools/nettool.png', - 'main_net_tools', - 'v1r1', - 'AW' - ); -} - - -/** - * Searchs for command. - * - * @param string $command Command. - * - * @return string Path. - */ -function whereis_the_command($command) -{ - global $config; - - if (isset($config['network_tools_config'])) { - $network_tools_config = json_decode($config['network_tools_config'], true); - $traceroute_path = $network_tools_config['traceroute_path']; - $ping_path = $network_tools_config['ping_path']; - $nmap_path = $network_tools_config['nmap_path']; - $dig_path = $network_tools_config['dig_path']; - $snmpget_path = $network_tools_config['snmpget_path']; - - switch ($command) { - case 'traceroute': - if (!empty($traceroute_path)) { - return $traceroute_path; - } - break; - - case 'ping': - if (!empty($ping_path)) { - return $ping_path; - } - break; - - case 'nmap': - if (!empty($nmap_path)) { - return $nmap_path; - } - break; - - case 'dig': - if (!empty($dig_path)) { - return $dig_path; - } - break; - - case 'snmpget': - if (!empty($snmpget_path)) { - return $snmpget_path; - } - break; - - default: - return null; - } - } - - ob_start(); - system('whereis '.$command); - $output = ob_get_clean(); - $result = explode(':', $output); - $result = trim($result[1]); - - if (empty($result)) { - return null; - } - - $result = explode(' ', $result); - $fullpath = trim($result[0]); - - if (! file_exists($fullpath)) { - return null; - } - - return $fullpath; -} - - -/** - * Execute net tools action. - * - * @param integer $operation Operation. - * @param string $ip Ip. - * @param string $community Community. - * @param string $snmp_version SNMP version. - * - * @return void - */ -function net_tools_execute($operation, $ip, $community, $snmp_version) -{ - if (!validate_address($ip)) { - ui_print_error_message(__('The ip or dns name entered cannot be resolved')); - } else { - switch ($operation) { - case 1: - $traceroute = whereis_the_command('traceroute'); - if (empty($traceroute)) { - ui_print_error_message(__('Traceroute executable does not exist.')); - } else { - echo '<h3>'.__('Traceroute to ').$ip.'</h3>'; - echo '<pre>'; - echo system($traceroute.' '.$ip); - echo '</pre>'; - } - break; - - case 2: - $ping = whereis_the_command('ping'); - if (empty($ping)) { - ui_print_error_message(__('Ping executable does not exist.')); - } else { - echo '<h3>'.__('Ping to %s', $ip).'</h3>'; - echo '<pre>'; - echo system($ping.' -c 5 '.$ip); - echo '</pre>'; - } - break; - - case 4: - $nmap = whereis_the_command('nmap'); - if (empty($nmap)) { - ui_print_error_message(__('Nmap executable does not exist.')); - } else { - echo '<h3>'.__('Basic TCP Scan on ').$ip.'</h3>'; - echo '<pre>'; - echo system($nmap.' -F '.$ip); - echo '</pre>'; - } - break; - - case 5: - echo '<h3>'.__('Domain and IP information for ').$ip.'</h3>'; - - $dig = whereis_the_command('dig'); - if (empty($dig)) { - ui_print_error_message(__('Dig executable does not exist.')); - } else { - echo '<pre>'; - echo system('dig '.$ip); - echo '</pre>'; - } - - $whois = whereis_the_command('whois'); - if (empty($whois)) { - ui_print_error_message(__('Whois executable does not exist.')); - } else { - echo '<pre>'; - echo system('whois '.$ip); - echo '</pre>'; - } - break; - - case 3: - $snmp_obj = [ - 'ip_target' => $ip, - 'snmp_version' => $snmp_version, - 'snmp_community' => $community, - 'format' => '-Oqn', - ]; - - $snmp_obj['base_oid'] = '.1.3.6.1.2.1.1.3.0'; - $result = get_h_snmpwalk($snmp_obj); - echo '<h3>'.__('SNMP information for ').$ip.'</h3>'; - echo '<h4>'.__('Uptime').'</h4>'; - echo '<pre>'; - if (empty($result)) { - ui_print_error_message(__('Target unreachable.')); - break; - } else { - echo array_pop($result); - } - - echo '</pre>'; - echo '<h4>'.__('Device info').'</h4>'; - echo '<pre>'; - $snmp_obj['base_oid'] = '.1.3.6.1.2.1.1.1.0'; - $result = get_h_snmpwalk($snmp_obj); - if (empty($result)) { - ui_print_error_message(__('Target unreachable.')); - break; - } else { - echo array_pop($result); - } - - echo '</pre>'; - - echo '<h4>Interface Information</h4>'; - - $table = new StdClass(); - $table->class = 'databox'; - $table->head = []; - $table->head[] = __('Interface'); - $table->head[] = __('Status'); - - $i = 0; - - $base_oid = '.1.3.6.1.2.1.2.2.1'; - $idx_oids = '.1'; - $names_oids = '.2'; - $status_oids = '.8'; - - $snmp_obj['base_oid'] = $base_oid.$idx_oids; - $idx = get_h_snmpwalk($snmp_obj); - - $snmp_obj['base_oid'] = $base_oid.$names_oids; - $names = get_h_snmpwalk($snmp_obj); - - $snmp_obj['base_oid'] = $base_oid.$status_oids; - $statuses = get_h_snmpwalk($snmp_obj); - - foreach ($idx as $k => $v) { - $index = str_replace($base_oid.$idx_oids, '', $k); - $name = $names[$base_oid.$names_oids.$index]; - - $status = $statuses[$base_oid.$status_oids.$index]; - - $table->data[$i][0] = $name; - $table->data[$i++][1] = $status; - } - - html_print_table($table); - break; - - default: - // Ignore. - break; - } - } - -} - - -/** - * Main function. - * - * @return void - */ -function main_net_tools() -{ - $operation = get_parameter('operation', 0); - $community = get_parameter('community', 'public'); - $ip = get_parameter('select_ips'); - $snmp_version = get_parameter('select_version'); - - // Show form. - $id_agente = get_parameter('id_agente', 0); - $principal_ip = db_get_sql( - sprintf( - 'SELECT direccion FROM tagente WHERE id_agente = %d', - $id_agente - ) - ); - - $list_address = db_get_all_rows_sql( - sprintf( - 'SELECT id_a FROM taddress_agent WHERE id_agent = %d', - $id_agente - ) - ); - foreach ($list_address as $address) { - $ids[] = join(',', $address); - } - - $ips = db_get_all_rows_sql( - sprintf( - 'SELECT ip FROM taddress WHERE id_a IN (%s)', - join(',', $ids) - ) - ); - - if ($ips == '') { - echo "<div class='error' style='margin-top:5px'>".__('The agent hasn\'t got IP').'</div>'; - return; - } - - // Javascript. - ?> -<script type='text/javascript'> - $(document).ready(function(){ - mostrarColumns($('#operation :selected').val()); - }); - - function mostrarColumns(value) { - if (value == 3) { - $('.snmpcolumn').show(); - } - else { - $('.snmpcolumn').hide(); - } - } -</script> - <?php - echo '<div>'; - echo "<form name='actionbox' method='post'>"; - echo "<table class='databox filters' width=100% id=netToolTable>"; - echo '<tr><td>'; - echo __('Operation'); - echo '</td><td>'; - - html_print_select( - [ - 1 => __('Traceroute'), - 2 => __('Ping host & Latency'), - 3 => __('SNMP Interface status'), - 4 => __('Basic TCP Port Scan'), - 5 => __('DiG/Whois Lookup'), - ], - 'operation', - $operation, - 'mostrarColumns(this.value)', - __('Please select') - ); - - echo '</td>'; - echo '<td>'; - echo __('IP address'); - echo '</td><td>'; - - $ips_for_select = array_reduce( - $ips, - function ($carry, $item) { - $carry[$item['ip']] = $item['ip']; - return $carry; - } - ); - - html_print_select( - $ips_for_select, - 'select_ips', - $principal_ip - ); - echo '</td>'; - echo "<td class='snmpcolumn'>"; - echo __('SNMP Version'); - html_print_select( - [ - '1' => 'v1', - '2c' => 'v2c', - ], - 'select_version', - $snmp_version - ); - echo '</td><td class="snmpcolumn">'; - echo __('SNMP Community').' '; - html_print_input_text('community', $community); - echo '</td><td>'; - echo "<input style='margin:0px;' name=submit type=submit class='sub next' value='".__('Execute')."'>"; - echo '</td>'; - echo '</tr></table>'; - echo '</form>'; - - if ($operation) { - // Execute form. - net_tools_execute($operation, $ip, $community, $snmp_version); - } - - echo '</div>'; -} - - -/** - * Add option. - * - * @return void - */ -function godmode_net_tools() -{ - global $config; - - check_login(); - - if (! check_acl($config['id_user'], 0, 'PM')) { - db_pandora_audit( - 'ACL Violation', - 'Trying to access Profile Management' - ); - include 'general/noaccess.php'; - return; - } - - ui_print_page_header( - __('Config Network Tools'), - '', - false, - 'network_tools_tab' - ); - - $update_traceroute = (bool) get_parameter('update_traceroute', 0); - - $traceroute_path = (string) get_parameter('traceroute_path', ''); - $ping_path = (string) get_parameter('ping_path', ''); - $nmap_path = (string) get_parameter('nmap_path', ''); - $dig_path = (string) get_parameter('dig_path', ''); - $snmpget_path = (string) get_parameter('snmpget_path', ''); - - if ($update_traceroute) { - $network_tools_config = []; - $network_tools_config['traceroute_path'] = $traceroute_path; - $network_tools_config['ping_path'] = $ping_path; - $network_tools_config['nmap_path'] = $nmap_path; - $network_tools_config['dig_path'] = $dig_path; - $network_tools_config['snmpget_path'] = $snmpget_path; - - $result = config_update_value('network_tools_config', json_encode($network_tools_config)); - - ui_print_result_message( - $result, - __('Set the paths.'), - __('Set the paths.') - ); - } else { - if (isset($config['network_tools_config'])) { - $network_tools_config_output = io_safe_output($config['network_tools_config']); - $network_tools_config = json_decode($network_tools_config_output, true); - $traceroute_path = $network_tools_config['traceroute_path']; - $ping_path = $network_tools_config['ping_path']; - $nmap_path = $network_tools_config['nmap_path']; - $dig_path = $network_tools_config['dig_path']; - $snmpget_path = $network_tools_config['snmpget_path']; - } - } - - $table = null; - $table->width = '100%'; - - $table->data = []; - - $table->data[0][0] = __('Traceroute path'); - $table->data[0][1] = html_print_input_text('traceroute_path', $traceroute_path, '', 40, 255, true); - - $table->data[1][0] = __('Ping path'); - $table->data[1][1] = html_print_input_text('ping_path', $ping_path, '', 40, 255, true); - - $table->data[2][0] = __('Nmap path'); - $table->data[2][1] = html_print_input_text('nmap_path', $nmap_path, '', 40, 255, true); - - $table->data[3][0] = __('Dig path'); - $table->data[3][1] = html_print_input_text('dig_path', $dig_path, '', 40, 255, true); - - $table->data[4][0] = __('Snmpget path'); - $table->data[4][1] = html_print_input_text('snmpget_path', $snmpget_path, '', 40, 255, true); - - echo '<form id="form_setup" method="post" >'; - echo '<fieldset>'; - echo '<legend>'.__('Options').'</legend>'; - html_print_input_hidden('update_traceroute', 1); - html_print_table($table); - echo '</fieldset>'; - - echo '<div class="action-buttons" style="width: '.$table->width.'">'; - html_print_submit_button(__('Update'), 'update_button', false, 'class="sub upd"'); - echo '</div>'; - echo '</form>'; -} - - -extensions_add_godmode_menu_option(__('Config Network Tools'), 'PM'); -extensions_add_godmode_function('godmode_net_tools'); diff --git a/pandora_console/godmode/setup/setup_net_tools.php b/pandora_console/godmode/setup/setup_external_tools.php similarity index 89% rename from pandora_console/godmode/setup/setup_net_tools.php rename to pandora_console/godmode/setup/setup_external_tools.php index 4dafb6e39c..30bdd6b188 100644 --- a/pandora_console/godmode/setup/setup_net_tools.php +++ b/pandora_console/godmode/setup/setup_external_tools.php @@ -1,6 +1,6 @@ <?php /** - * Network Tools Setup Tab. + * External Tools Setup Tab. * * @category Operations * @package Pandora FMS @@ -32,14 +32,14 @@ global $config; require_once $config['homedir'].'/include/functions.php'; // Require needed class. -require_once $config['homedir'].'/include/class/NetTools.class.php'; +require_once $config['homedir'].'/include/class/ExternalTools.class.php'; // Control call flow for debug window. try { // User access and validation is being processed on class constructor. - $obj = new NetTools('setup'); + $obj = new ExternalTools('setup'); } catch (Exception $e) { - echo '[NetTools]'.$e->getMessage(); + echo '[ExternalTools]'.$e->getMessage(); // Stop this execution, but continue 'globally'. return; diff --git a/pandora_console/include/class/NetTools.class.php b/pandora_console/include/class/ExternalTools.class.php similarity index 87% rename from pandora_console/include/class/NetTools.class.php rename to pandora_console/include/class/ExternalTools.class.php index e519019158..97b644a11f 100644 --- a/pandora_console/include/class/NetTools.class.php +++ b/pandora_console/include/class/ExternalTools.class.php @@ -1,6 +1,6 @@ <?php /** - * Net Tools view Class. + * External Tools view Class. * * @category Class * @package Pandora FMS @@ -33,9 +33,9 @@ global $config; require_once $config['homedir'].'/include/class/HTML.class.php'; /** - * NetTools class + * External Tools class */ -class NetTools extends HTML +class ExternalTools extends HTML { @@ -81,6 +81,7 @@ class NetTools extends HTML // Capture needed parameters for setup form. $this->updatePaths = (bool) get_parameter('update_paths', 0); + // Capture paths. $this->pathTraceroute = (string) get_parameter('traceroute_path'); $this->pathPing = (string) get_parameter('ping_path'); @@ -103,10 +104,10 @@ class NetTools extends HTML { if ($this->origin === 'agent') { // Print tool form. - $this->agentNetToolsForm(); + $this->agentExternalToolsForm(); } else if ($this->origin === 'setup') { // Print setup form. - $this->setupNetToolsForm(); + $this->setupExternalToolsForm(); } // Anyway, load JS. @@ -115,11 +116,11 @@ class NetTools extends HTML /** - * Print the form for setup the network tools. + * Print the form for setup the external tools. * * @return void */ - private function setupNetToolsForm() + private function setupExternalToolsForm() { global $config; @@ -151,6 +152,7 @@ class NetTools extends HTML $this->pathNmap = $network_tools_config['nmap_path']; $this->pathDig = $network_tools_config['dig_path']; $this->pathSnmpget = $network_tools_config['snmpget_path']; + $this->pathCustomComm = ($network_tools_config['custom_command'] ?? ['a' => 'a']); } } @@ -175,6 +177,70 @@ class NetTools extends HTML $table->data[4][0] = __('Snmpget path'); $table->data[4][1] = html_print_input_text('snmpget_path', $this->pathSnmpget, '', 40, 255, true); + $table->data[5][0] = html_print_div( + [ + 'class' => 'title_custom_commands bolder float-left', + 'content' => __('Custom commands') + ], + true + ); + + $table->data[5][0] .= html_print_div( + [ + 'id' => 'add_button_custom_command', + 'content' => html_print_image( + 'images/add.png', + true, + ['title' => __('Add new custom command') ] + ) + ], + true + ); + + $table->data[6][0] = __('Command'); + $table->data[6][1] = __('Parameters'); + + $i = 0; + $iRow = 6; + foreach ($this->pathCustomComm as $command) { + $i++; + $iRow++; + + // Fill the fields. + $customCommand = ($command['custom_command'] ?? ''); + $customParams = ($command['custom_params'] ?? ''); + // Attach the fields. + $table->rowid[$iRow] = 'custom_row_'.$i; + $table->data[$iRow][0] = html_print_input_text( + 'command_custom_'.$i, + $customCommand, + '', + 40, + 255, + true + ); + $table->data[$iRow][1] = html_print_input_text( + 'params_custom_'.$i, + $customParams, + '', + 40, + 255, + true + ); + $table->data[$iRow][2] = html_print_div( + [ + 'id' => 'delete_custom_'.$i, + 'class' => '', + 'content' => html_print_image( + 'images/delete.png', + true, + ['title' => __('Delete this custom command') ] + ) + ], + true + ); + } + $form = '<form id="form_setup" method="post" >'; $form .= '<fieldset>'; $form .= '<legend>'.__('Options').'</legend>'; @@ -198,11 +264,11 @@ class NetTools extends HTML /** - * Print the form for use the network tools. + * Print the form for use the external tools. * * @return void */ - private function agentNetToolsForm() + private function agentExternalToolsForm() { $principal_ip = db_get_sql( sprintf( @@ -252,7 +318,7 @@ class NetTools extends HTML // Form table. $table = new StdClass(); $table->class = 'databox filters w100p'; - $table->id = 'netToolTable'; + $table->id = 'externalToolTable'; $table->data = []; @@ -331,7 +397,7 @@ class NetTools extends HTML if ($this->operation !== 0) { // Execute form. - echo $this->netToolsExecution($this->operation, $this->ip, $this->community, $this->snmp_version); + echo $this->externalToolsExecution($this->operation, $this->ip, $this->community, $this->snmp_version); } } @@ -451,7 +517,7 @@ class NetTools extends HTML /** - * Execute net tools action. + * Execute external tools action. * * @param integer $operation Operation. * @param string $ip Ip. @@ -460,7 +526,7 @@ class NetTools extends HTML * * @return string String formed result of execution. */ - public function netToolsExecution(int $operation, string $ip, string $community, string $snmp_version) + public function externalToolsExecution(int $operation, string $ip, string $community, string $snmp_version) { $output = ''; @@ -623,6 +689,13 @@ class NetTools extends HTML ?> <script type='text/javascript'> $(document).ready(function(){ + let custom_command = $('#add_button_custom_command'); + + custom_command.on('click', function(){ + console.log('queeee pasa'); + }); + + mostrarColumns($('#operation :selected').val()); }); diff --git a/pandora_console/include/constants.php b/pandora_console/include/constants.php index d8dfa770f2..1364a39104 100644 --- a/pandora_console/include/constants.php +++ b/pandora_console/include/constants.php @@ -748,7 +748,7 @@ define('MODULE_TYPE_REMOTE_CMD_STRING', 36); define('MODULE_TYPE_REMOTE_CMD_INC', 37); define('MODULE_TYPE_KEEP_ALIVE', 100); -// Commands for network tools. +// Commands basics for external tools. define('COMMAND_TRACEROUTE', 1); define('COMMAND_PING', 2); define('COMMAND_SNMP', 3); diff --git a/pandora_console/include/styles/pandora.css b/pandora_console/include/styles/pandora.css index 5e321b1a2e..d92861c312 100644 --- a/pandora_console/include/styles/pandora.css +++ b/pandora_console/include/styles/pandora.css @@ -6087,3 +6087,10 @@ div.graph div.legend table { writing-mode: lr-tb; white-space: nowrap; } + +/* NetTools */ +#add_button_custom_command { + float: left; + cursor: pointer; + margin: -3px 0 0 1em; +} diff --git a/pandora_console/operation/agentes/net_tools.php b/pandora_console/operation/agentes/external_tools.php similarity index 86% rename from pandora_console/operation/agentes/net_tools.php rename to pandora_console/operation/agentes/external_tools.php index a5eba9d171..1d57c06f81 100644 --- a/pandora_console/operation/agentes/net_tools.php +++ b/pandora_console/operation/agentes/external_tools.php @@ -1,8 +1,8 @@ <?php /** - * Network Tools view for agents. + * External Tools view for agents. * - * @category Network tools for agents. + * @category External tools for agents. * @package Pandora FMS * @subpackage Classic agent management view. * @version 1.0.0 @@ -32,14 +32,14 @@ global $config; require_once 'include/functions_agents.php'; // Require needed class. -require_once $config['homedir'].'/include/class/NetTools.class.php'; +require_once $config['homedir'].'/include/class/ExternalTools.class.php'; // Control call flow for debug window. try { // User access and validation is being processed on class constructor. - $obj = new NetTools('agent'); + $obj = new ExternalTools('agent'); } catch (Exception $e) { - echo '[NetTools]'.$e->getMessage(); + echo '[ExternalTools]'.$e->getMessage(); // Stop this execution, but continue 'globally'. return; diff --git a/pandora_console/operation/agentes/ver_agente.php b/pandora_console/operation/agentes/ver_agente.php index 72b4ee4389..38a2cf635b 100644 --- a/pandora_console/operation/agentes/ver_agente.php +++ b/pandora_console/operation/agentes/ver_agente.php @@ -1351,12 +1351,12 @@ if ($is_sap) { $saptab = ''; } -// Network Tools tab. -$nettools['text'] = '<a href="index.php?sec=estado&sec2=operation/agentes/ver_agente&tab=nettools&id_agente='.$id_agente.'">'.html_print_image('images/nettool.png', true, ['title' => __('Network Tools')]).'</a>'; -if ($tab == 'nettools') { - $nettools['active'] = true; +// External Tools tab. +$external_tools['text'] = '<a href="index.php?sec=estado&sec2=operation/agentes/ver_agente&tab=external_tools&id_agente='.$id_agente.'">'.html_print_image('images/nettool.png', true, ['title' => __('External Tools')]).'</a>'; +if ($tab == 'external_tools') { + $external_tools['active'] = true; } else { - $nettools['active'] = false; + $external_tools['active'] = false; } $onheader = [ @@ -1373,7 +1373,7 @@ $onheader = [ 'wux_console' => $wux_console_tab, 'url_route_analyzer' => $url_route_analyzer_tab, 'sap_view' => $saptab, - 'nettools' => $nettools, + 'external_tools' => $external_tools, ]; // Added after it exists @@ -1543,8 +1543,8 @@ switch ($tab) { $tab_name = 'SAP View'; break; - case 'nettools': - $tab_name = 'Net Tools'; + case 'external_tools': + $tab_name = 'External Tools'; break; default: @@ -1667,8 +1667,8 @@ switch ($tab) { include 'general/sap_view.php'; break; - case 'nettools': - include 'net_tools.php'; + case 'external_tools': + include 'external_tools.php'; break; case 'extension': From f8dd8da8c807304c8ebf979e33299673b203d13c Mon Sep 17 00:00:00 2001 From: Jose Gonzalez <jose.gonzalez@artica.es> Date: Fri, 18 Dec 2020 12:34:39 +0100 Subject: [PATCH 09/61] Forgotten file --- pandora_console/godmode/setup/setup.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/pandora_console/godmode/setup/setup.php b/pandora_console/godmode/setup/setup.php index 7fae0afa3b..21ffc3d60b 100644 --- a/pandora_console/godmode/setup/setup.php +++ b/pandora_console/godmode/setup/setup.php @@ -145,9 +145,9 @@ $buttons['websocket_engine'] = [ 'text' => '<a href="'.ui_get_full_url('index.php?sec=gsetup&sec2=godmode/setup/setup§ion=websocket_engine').'">'.html_print_image('images/websocket_small.png', true, ['title' => __('Websocket engine')]).'</a>', ]; -$buttons['nettools'] = [ +$buttons['external_tools'] = [ 'active' => false, - 'text' => '<a href="'.ui_get_full_url('index.php?sec=gsetup&sec2=godmode/setup/setup§ion=nettools').'">'.html_print_image('images/nettool.png', true, ['title' => __('Network Tools')]).'</a>', + 'text' => '<a href="'.ui_get_full_url('index.php?sec=gsetup&sec2=godmode/setup/setup§ion=external_tools').'">'.html_print_image('images/nettool.png', true, ['title' => __('External Tools')]).'</a>', ]; if ($config['activate_gis']) { @@ -225,10 +225,10 @@ switch ($section) { $help_header = 'quickshell_settings'; break; - case 'nettools': - $buttons['nettools']['active'] = true; - $subpage = ' » '.__('Network Tools'); - $help_header = 'Network_Tools'; + case 'external_tools': + $buttons['external_tools']['active'] = true; + $subpage = ' » '.__('External Tools'); + $help_header = 'External_Tools'; break; case 'enterprise': @@ -303,8 +303,8 @@ switch ($section) { include_once $config['homedir'].'/godmode/setup/setup_websocket_engine.php'; break; - case 'nettools': - include_once $config['homedir'].'/godmode/setup/setup_net_tools.php'; + case 'external_tools': + include_once $config['homedir'].'/godmode/setup/setup_external_tools.php'; break; default: From ba527391b48297c27a92bf2915d7fd8a07935e89 Mon Sep 17 00:00:00 2001 From: Jose Gonzalez <jose.gonzalez@artica.es> Date: Fri, 18 Dec 2020 13:18:03 +0100 Subject: [PATCH 10/61] WIP: Backup upload --- .../include/class/ExternalTools.class.php | 57 ++++++++++++++++--- 1 file changed, 49 insertions(+), 8 deletions(-) diff --git a/pandora_console/include/class/ExternalTools.class.php b/pandora_console/include/class/ExternalTools.class.php index 97b644a11f..e34317d945 100644 --- a/pandora_console/include/class/ExternalTools.class.php +++ b/pandora_console/include/class/ExternalTools.class.php @@ -180,7 +180,7 @@ class ExternalTools extends HTML $table->data[5][0] = html_print_div( [ 'class' => 'title_custom_commands bolder float-left', - 'content' => __('Custom commands') + 'content' => __('Custom commands'), ], true ); @@ -191,8 +191,8 @@ class ExternalTools extends HTML 'content' => html_print_image( 'images/add.png', true, - ['title' => __('Add new custom command') ] - ) + [ 'title' => __('Add new custom command') ] + ), ], true ); @@ -234,8 +234,8 @@ class ExternalTools extends HTML 'content' => html_print_image( 'images/delete.png', true, - ['title' => __('Delete this custom command') ] - ) + ['title' => __('Delete this custom command')] + ), ], true ); @@ -690,15 +690,56 @@ class ExternalTools extends HTML <script type='text/javascript'> $(document).ready(function(){ let custom_command = $('#add_button_custom_command'); - - custom_command.on('click', function(){ - console.log('queeee pasa'); + + custom_command.on('click', function(event){ + console.log(event); }); mostrarColumns($('#operation :selected').val()); }); + // Manage network component oid field generation. + function manageCommandLines(action, type) { + var fieldLines = $("tr[id*=network_component-" + type + "]").length; + var protocol = $("#module_protocol").val(); + if (action === "add") { + let lineNumber = fieldLines + 1; + let textForAdd = + type === "oid-list-pluginRow-snmpRow" + ? "_oid_" + lineNumber + "_" + : lineNumber; + + $("#network_component-manage-" + type).before( + $("#network_component-" + type + "-row-1") + .clone() + .attr("id", "network_component-" + type + "-row-" + lineNumber) + ); + + $("#network_component-" + type + "-row-" + lineNumber + " input") + .attr("name", "extra_field_" + protocol + "_" + lineNumber) + .attr("id", "extra_field_" + protocol + "_" + lineNumber); + + $("#network_component-" + type + "-row-" + lineNumber + " td div").html( + textForAdd + ); + + $("#del_field_button") + .attr("style", "opacity: 1;") + .addClass("clickable"); + } else if (action === "del") { + if (fieldLines >= 2) { + $("#network_component-" + type + "-row-" + fieldLines).remove(); + } + + if (fieldLines == 2) { + $("#del_field_button") + .attr("style", "opacity: 0.5;") + .removeClass("clickable"); + } + } + } + function mostrarColumns(value) { if (value == 3) { $('.snmpcolumn').show(); From 7aedc39f694969910bd4f647f89c06da7f2ea3ec Mon Sep 17 00:00:00 2001 From: fbsanchez <fborja.sanchez@artica.es> Date: Thu, 7 Jan 2021 13:48:57 +0100 Subject: [PATCH 11/61] Task list status --- .../wizards/DiscoveryTaskList.class.php | 110 +++++++++++------- 1 file changed, 67 insertions(+), 43 deletions(-) diff --git a/pandora_console/godmode/wizards/DiscoveryTaskList.class.php b/pandora_console/godmode/wizards/DiscoveryTaskList.class.php index a0a5fe549f..3c4f0fcb22 100644 --- a/pandora_console/godmode/wizards/DiscoveryTaskList.class.php +++ b/pandora_console/godmode/wizards/DiscoveryTaskList.class.php @@ -539,46 +539,9 @@ class DiscoveryTaskList extends HTML $data[4] = '-'; } - $can_be_reviewed = false; - if (empty($task['summary']) === false - && $task['summary'] == 'cancelled' - ) { - $data[5] = __('Cancelled').ui_print_help_tip( - __('Server has been restarted while executing this task, please retry.'), - true - ); - } else if ($task['review_mode'] == DISCOVERY_STANDARD) { - if ($task['status'] <= 0 - && empty($task['summary']) === false - ) { - $data[5] = __('Done'); - } else if ($task['utimestamp'] == 0 - && empty($task['summary']) - ) { - $data[5] = __('Not started'); - } else { - $data[5] = __('Pending'); - } - } else { - if ($task['status'] <= 0 - && empty($task['summary']) === false - ) { - $can_be_reviewed = true; - $data[5] = '<span class="link review" onclick="show_review('.$task['id_rt'].',\''.$task['name'].'\')">'; - $data[5] .= __('Review'); - $data[5] .= '</span>'; - } else if ($task['utimestamp'] == 0 - && empty($task['summary']) - ) { - $data[5] = __('Not started'); - } else { - if ($task['review_mode'] == DISCOVERY_RESULTS) { - $data[5] = __('Processing'); - } else { - $data[5] = __('Searching'); - } - } - } + $_rs = $this->getStatusMessage($task); + $can_be_reviewed = $_rs['can_be_reviewed']; + $data[5] = $_rs['message']; switch ($task['type']) { case DISCOVERY_CLOUD_AZURE_COMPUTE: @@ -954,7 +917,7 @@ class DiscoveryTaskList extends HTML */ private function progressTaskGraph($task) { - $result .= '<div style="display: flex;">'; + $result = '<div style="display: flex;">'; $result .= '<div class="subtitle">'; $result .= '<span>'._('Overall Progress').'</span>'; @@ -1546,9 +1509,9 @@ class DiscoveryTaskList extends HTML ); if (empty($summary)) { - $out .= __('No changes. Re-Scheduled'); + $out = __('No changes. Re-Scheduled'); } else { - $out .= __('Scheduled for creation'); + $out = __('Scheduled for creation'); $out .= '<ul>'; $out .= join('', $summary); $out .= '</ul>'; @@ -1560,4 +1523,65 @@ class DiscoveryTaskList extends HTML } + /** + * Generates task status string for given task. + * + * @param array $task Discovery task (retrieved from DB). + * + * @return array Message to be displayed and review status. + */ + public function getStatusMessage(array $task) + { + $status = ''; + $can_be_reviewed = false; + + if (empty($task['summary']) === false + && $task['summary'] == 'cancelled' + ) { + $status = __('Cancelled').ui_print_help_tip( + __('Server has been restarted while executing this task, please retry.'), + true + ); + } else if ($task['review_mode'] == DISCOVERY_STANDARD) { + if ($task['status'] <= 0 + && empty($task['summary']) === false + ) { + $status = __('Done'); + } else if ($task['utimestamp'] == 0 + && empty($task['summary']) + ) { + $status = __('Not started'); + } else if ($task['utimestamp'] > 0) { + $status = __('Done'); + } else { + $status = __('Pending'); + } + } else { + if ($task['status'] <= 0 + && empty($task['summary']) === false + ) { + $can_be_reviewed = true; + $status = '<span class="link review" onclick="show_review('.$task['id_rt'].',\''.$task['name'].'\')">'; + $status .= __('Review'); + $status .= '</span>'; + } else if ($task['utimestamp'] == 0 + && empty($task['summary']) + ) { + $status = __('Not started'); + } else { + if ($task['review_mode'] == DISCOVERY_RESULTS) { + $status = __('Processing'); + } else { + $status = __('Searching'); + } + } + } + + return [ + 'message' => $status, + 'can_be_reviewed' => $can_be_reviewed, + ]; + } + + } From 199ee732cd602efc50cae9d5f7ac48c26d162dbf Mon Sep 17 00:00:00 2001 From: Jose Gonzalez <jose.gonzalez@artica.es> Date: Mon, 11 Jan 2021 10:18:52 +0100 Subject: [PATCH 12/61] Added External tools link --- pandora_console/godmode/menu.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pandora_console/godmode/menu.php b/pandora_console/godmode/menu.php index b71e44ea54..23be7ef739 100644 --- a/pandora_console/godmode/menu.php +++ b/pandora_console/godmode/menu.php @@ -351,8 +351,8 @@ if (check_acl($config['id_user'], 0, 'PM')) { $sub2['godmode/setup/setup&section=websocket_engine']['text'] = __('Websocket Engine'); $sub2['godmode/setup/setup&section=websocket_engine']['refr'] = 0; - $sub2['godmode/setup/setup&section=nettools']['text'] = __('Network Tools'); - $sub2['godmode/setup/setup&section=nettools']['refr'] = 0; + $sub2['godmode/setup/setup&section=external_tools']['text'] = __('External Tools'); + $sub2['godmode/setup/setup&section=external_tools']['refr'] = 0; if ($config['activate_gis']) { $sub2['godmode/setup/setup&section=gis']['text'] = __('Map conections GIS'); From 422174b66fd1e94bfbe271cb843cad4083c77fdd Mon Sep 17 00:00:00 2001 From: Jose Gonzalez <jose.gonzalez@artica.es> Date: Mon, 11 Jan 2021 18:00:24 +0100 Subject: [PATCH 13/61] WIP: Backup upload --- .../include/class/ExternalTools.class.php | 204 +++++++++++------- 1 file changed, 132 insertions(+), 72 deletions(-) diff --git a/pandora_console/include/class/ExternalTools.class.php b/pandora_console/include/class/ExternalTools.class.php index e34317d945..27a2e7e1a1 100644 --- a/pandora_console/include/class/ExternalTools.class.php +++ b/pandora_console/include/class/ExternalTools.class.php @@ -159,6 +159,7 @@ class ExternalTools extends HTML // Make the table for show the form. $table = new stdClass(); $table->width = '100%'; + $table->id = 'commandsTable'; $table->data = []; @@ -191,7 +192,11 @@ class ExternalTools extends HTML 'content' => html_print_image( 'images/add.png', true, - [ 'title' => __('Add new custom command') ] + [ + 'title' => __('Add new custom command'), + 'onclick' => 'manageCommandLines(event)', + 'id' => 'img_add_button_custom_command', + ] ), ], true @@ -200,45 +205,29 @@ class ExternalTools extends HTML $table->data[6][0] = __('Command'); $table->data[6][1] = __('Parameters'); - $i = 0; - $iRow = 6; - foreach ($this->pathCustomComm as $command) { - $i++; - $iRow++; + $i = 1; + $iRow = 7; - // Fill the fields. - $customCommand = ($command['custom_command'] ?? ''); - $customParams = ($command['custom_params'] ?? ''); - // Attach the fields. + if (empty($this->pathCustomComm) === true) { $table->rowid[$iRow] = 'custom_row_'.$i; - $table->data[$iRow][0] = html_print_input_text( - 'command_custom_'.$i, - $customCommand, - '', - 40, - 255, - true - ); - $table->data[$iRow][1] = html_print_input_text( - 'params_custom_'.$i, - $customParams, - '', - 40, - 255, - true - ); - $table->data[$iRow][2] = html_print_div( - [ - 'id' => 'delete_custom_'.$i, - 'class' => '', - 'content' => html_print_image( - 'images/delete.png', - true, - ['title' => __('Delete this custom command')] - ), - ], - true - ); + + $table->data[$iRow][0] = $this->customCommandPair('command', $i); + $table->data[$iRow][1] = $this->customCommandPair('params', $i); + $table->data[$iRow][2] = $this->customCommandPair('delete', $i); + } else { + foreach ($this->pathCustomComm as $command) { + $i++; + $iRow++; + + // Fill the fields. + $customCommand = ($command['custom_command'] ?? ''); + $customParams = ($command['custom_params'] ?? ''); + // Attach the fields. + $table->rowid[$iRow] = 'custom_row_'.$i; + $table->data[$iRow][0] = $this->customCommandPair('command', $i, $customCommand); + $table->data[$iRow][1] = $this->customCommandPair('params', $i, $customParams); + $table->data[$iRow][2] = $this->customCommandPair('delete', $i); + } } $form = '<form id="form_setup" method="post" >'; @@ -263,6 +252,60 @@ class ExternalTools extends HTML } + /** + * Prints the custom command fields. + * + * @param string $type Type of field. + * @param integer $index Control index. + * @param string $value Value of this field. + * + * @return string + */ + private function customCommandPair($type, $index=0, $value='') + { + $output = ''; + + switch ($type) { + case 'command': + case 'params': + $output = html_print_input_text( + $type.'_custom_'.$index, + $value, + '', + 40, + 255, + true + ); + break; + + case 'delete': + $output = html_print_div( + [ + 'id' => 'delete_button_custom_'.$index, + 'class' => '', + 'content' => html_print_image( + 'images/delete.png', + true, + [ + 'title' => __('Delete this custom command'), + 'onclick' => 'manageCommandLines(event)', + 'id' => 'img_delete_button_custom_'.$index, + ] + ), + ], + true + ); + break; + + default: + // Do none. + break; + } + + return $output; + } + + /** * Print the form for use the external tools. * @@ -690,52 +733,69 @@ class ExternalTools extends HTML <script type='text/javascript'> $(document).ready(function(){ let custom_command = $('#add_button_custom_command'); - - custom_command.on('click', function(event){ - console.log(event); - }); - mostrarColumns($('#operation :selected').val()); }); // Manage network component oid field generation. - function manageCommandLines(action, type) { - var fieldLines = $("tr[id*=network_component-" + type + "]").length; - var protocol = $("#module_protocol").val(); - if (action === "add") { - let lineNumber = fieldLines + 1; - let textForAdd = - type === "oid-list-pluginRow-snmpRow" - ? "_oid_" + lineNumber + "_" - : lineNumber; + function manageCommandLines(event) { + let buttonId = event.target.id; + let parentId = event.target.parentElement.id; + let action = parentId.split('_'); + action = action[0]; - $("#network_component-manage-" + type).before( - $("#network_component-" + type + "-row-1") - .clone() - .attr("id", "network_component-" + type + "-row-" + lineNumber) + if (action === 'add') { + let fieldLines = $("tr[id*=custom_row_]").length; + let fieldLinesAdded = fieldLines + 1; + + // Ensure the first erase button is clickable + $("#img_delete_button_custom_1") + .attr("style", "opacity: 1;") + .addClass("clickable"); + + $("#custom_row_" + fieldLines).after( + $("#custom_row_" + fieldLines) + .clone() + .attr("id", 'custom_row_'+fieldLinesAdded) ); + let rowCommand = Array.from($("#custom_row_"+fieldLinesAdded).children()); - $("#network_component-" + type + "-row-" + lineNumber + " input") - .attr("name", "extra_field_" + protocol + "_" + lineNumber) - .attr("id", "extra_field_" + protocol + "_" + lineNumber); + rowCommand.forEach(function(value, index){ + let thisId = $(value).attr("id"); + let separatedId = thisId.split("-"); + let fieldLinesAddedForNewId = parseInt(separatedId[1]) + 1; + let thisNewId = separatedId[0] + "-" + fieldLinesAddedForNewId + "-" + separatedId[2]; + // Assignation of new Id for this cell + $(value).attr("id", thisNewId); - $("#network_component-" + type + "-row-" + lineNumber + " td div").html( - textForAdd - ); + // Children text fields. + if (parseInt(separatedId[2]) === 0) { + $("#text-command_custom_"+fieldLines, "#"+thisNewId) + .attr("name", "command_custom_"+fieldLinesAdded) + .attr("id", "text-command_custom_"+fieldLinesAdded); + } else if (parseInt(separatedId[2]) === 1) { + $("#text-params_custom_"+fieldLines, "#"+thisNewId) + .attr("id", "text-params_custom_"+fieldLinesAdded) + .attr("name", "params_custom_"+fieldLinesAdded); + } else if (parseInt(separatedId[2]) === 2) { + $("#img_delete_button_custom_"+fieldLines, "#"+thisNewId) + .attr("id", "img_delete_button_custom_"+fieldLinesAdded); + } + }); - $("#del_field_button") - .attr("style", "opacity: 1;") - .addClass("clickable"); - } else if (action === "del") { - if (fieldLines >= 2) { - $("#network_component-" + type + "-row-" + fieldLines).remove(); + } else if (action === 'delete') { + let buttonIdDivided = buttonId.split("_"); + let lineNumber = buttonIdDivided[buttonIdDivided.length-1]; + let lineCount = parseInt($("tr[id*=custom_row_]").length); + + if (parseInt(lineNumber) >= 1 && lineCount > 1) { + $("#custom_row_" + lineNumber).remove(); } - if (fieldLines == 2) { - $("#del_field_button") - .attr("style", "opacity: 0.5;") - .removeClass("clickable"); + if (lineCount === 1) { + $("[id*=img_delete_button_custom_]") + .attr("style", "opacity: 0.5;") + .removeClass("clickable"); } } } From d1831e71fb9828929948a10c3e84b081ba5c4a56 Mon Sep 17 00:00:00 2001 From: Jose Gonzalez <jose.gonzalez@artica.es> Date: Tue, 12 Jan 2021 13:24:08 +0100 Subject: [PATCH 14/61] Finished development --- .../include/class/ExternalTools.class.php | 145 ++++++++++++------ 1 file changed, 98 insertions(+), 47 deletions(-) diff --git a/pandora_console/include/class/ExternalTools.class.php b/pandora_console/include/class/ExternalTools.class.php index 27a2e7e1a1..675b6341d1 100644 --- a/pandora_console/include/class/ExternalTools.class.php +++ b/pandora_console/include/class/ExternalTools.class.php @@ -65,7 +65,7 @@ class ExternalTools extends HTML // Capture needed parameter for agent form. $this->id_agente = (int) get_parameter('id_agente', 0); - $this->operation = (int) get_parameter('operation', 0); + $this->operation = get_parameter('operation', 0); $this->community = (string) get_parameter('community', 'public'); $this->ip = (string) get_parameter('select_ips'); $this->snmp_version = (string) get_parameter('select_version'); @@ -88,6 +88,20 @@ class ExternalTools extends HTML $this->pathNmap = (string) get_parameter('nmap_path'); $this->pathDig = (string) get_parameter('dig_path'); $this->pathSnmpget = (string) get_parameter('snmpget_path'); + + // Capture custom commands. + $this->pathCustomComm = []; + foreach ($_REQUEST as $customKey => $customValue) { + if ((bool) preg_match('/command_custom_/', $customKey) === true) { + $temporaryCustomCommandId = explode('_', $customKey); + $customCommandId = $temporaryCustomCommandId[2]; + // Define array for host the command/parameters pair data. + $this->pathCustomComm[$customValue] = []; + // Ensure the information. + $this->pathCustomComm[$customValue]['command_custom'] = (string) get_parameter('command_custom_'.$customCommandId); + $this->pathCustomComm[$customValue]['params_custom'] = (string) get_parameter('params_custom_'.$customCommandId); + } + } } return $this; @@ -125,16 +139,20 @@ class ExternalTools extends HTML global $config; if ($this->updatePaths === true) { - $network_tools_config = []; - $network_tools_config['traceroute_path'] = $this->pathTraceroute; - $network_tools_config['ping_path'] = $this->pathPing; - $network_tools_config['nmap_path'] = $this->pathNmap; - $network_tools_config['dig_path'] = $this->pathDig; - $network_tools_config['snmpget_path'] = $this->pathSnmpget; + $external_tools_config = []; + $external_tools_config['traceroute_path'] = $this->pathTraceroute; + $external_tools_config['ping_path'] = $this->pathPing; + $external_tools_config['nmap_path'] = $this->pathNmap; + $external_tools_config['dig_path'] = $this->pathDig; + $external_tools_config['snmpget_path'] = $this->pathSnmpget; + + if (empty($this->pathCustomComm) === false) { + $external_tools_config['custom_commands'] = $this->pathCustomComm; + } $result = config_update_value( - 'network_tools_config', - json_encode($network_tools_config) + 'external_tools_config', + json_encode($external_tools_config) ); ui_print_result_message( @@ -143,16 +161,16 @@ class ExternalTools extends HTML __('Set the paths.') ); } else { - if (isset($config['network_tools_config']) === true) { - $network_tools_config_output = io_safe_output($config['network_tools_config']); - $network_tools_config = json_decode($network_tools_config_output, true); + if (isset($config['external_tools_config']) === true) { + $external_tools_config_output = io_safe_output($config['external_tools_config']); + $external_tools_config = json_decode($external_tools_config_output, true); // Setting paths. - $this->pathTraceroute = $network_tools_config['traceroute_path']; - $this->pathPing = $network_tools_config['ping_path']; - $this->pathNmap = $network_tools_config['nmap_path']; - $this->pathDig = $network_tools_config['dig_path']; - $this->pathSnmpget = $network_tools_config['snmpget_path']; - $this->pathCustomComm = ($network_tools_config['custom_command'] ?? ['a' => 'a']); + $this->pathTraceroute = $external_tools_config['traceroute_path']; + $this->pathPing = $external_tools_config['ping_path']; + $this->pathNmap = $external_tools_config['nmap_path']; + $this->pathDig = $external_tools_config['dig_path']; + $this->pathSnmpget = $external_tools_config['snmpget_path']; + $this->pathCustomComm = ($external_tools_config['custom_commands'] ?? ['a' => 'a']); } } @@ -203,7 +221,7 @@ class ExternalTools extends HTML ); $table->data[6][0] = __('Command'); - $table->data[6][1] = __('Parameters'); + $table->data[6][1] = __('Parameters').ui_print_help_tip(__('Adding `_address_` macro will use agent\'s IP when perform the execution'), true); $i = 1; $iRow = 7; @@ -216,17 +234,17 @@ class ExternalTools extends HTML $table->data[$iRow][2] = $this->customCommandPair('delete', $i); } else { foreach ($this->pathCustomComm as $command) { - $i++; - $iRow++; - // Fill the fields. - $customCommand = ($command['custom_command'] ?? ''); - $customParams = ($command['custom_params'] ?? ''); + $customCommand = ($command['command_custom'] ?? ''); + $customParams = ($command['params_custom'] ?? ''); // Attach the fields. $table->rowid[$iRow] = 'custom_row_'.$i; $table->data[$iRow][0] = $this->customCommandPair('command', $i, $customCommand); $table->data[$iRow][1] = $this->customCommandPair('params', $i, $customParams); $table->data[$iRow][2] = $this->customCommandPair('delete', $i); + // Add another command. + $i++; + $iRow++; } } @@ -313,6 +331,8 @@ class ExternalTools extends HTML */ private function agentExternalToolsForm() { + global $config; + $principal_ip = db_get_sql( sprintf( 'SELECT direccion FROM tagente WHERE id_agente = %d', @@ -358,6 +378,23 @@ class ExternalTools extends HTML } ); + // Get the list of available commands. + $commandList = [ + COMMAND_TRACEROUTE => __('Traceroute'), + COMMAND_PING => __('Ping host & Latency'), + COMMAND_SNMP => __('SNMP Interface status'), + COMMAND_NMAP => __('Basic TCP Port Scan'), + COMMAND_DIGWHOIS => __('DiG/Whois Lookup'), + ]; + + // Adding custom commands. + $tempCustomCommandsList = json_decode(io_safe_output($config['external_tools_config']), true); + $customCommandsList = $tempCustomCommandsList['custom_commands']; + + foreach ($customCommandsList as $customCommandKey => $customCommandValue) { + $commandList[$customCommandKey] = $customCommandKey; + } + // Form table. $table = new StdClass(); $table->class = 'databox filters w100p'; @@ -368,13 +405,7 @@ class ExternalTools extends HTML $table->data[0][0] = __('Operation'); $table->data[0][1] = html_print_select( - [ - COMMAND_TRACEROUTE => __('Traceroute'), - COMMAND_PING => __('Ping host & Latency'), - COMMAND_SNMP => __('SNMP Interface status'), - COMMAND_NMAP => __('Basic TCP Port Scan'), - COMMAND_DIGWHOIS => __('DiG/Whois Lookup'), - ], + $commandList, 'operation', $this->operation, 'mostrarColumns(this.value)', @@ -456,13 +487,13 @@ class ExternalTools extends HTML { global $config; - if (isset($config['network_tools_config']) === true) { - $network_tools_config = json_decode(io_safe_output($config['network_tools_config']), true); - $traceroute_path = $network_tools_config['traceroute_path']; - $ping_path = $network_tools_config['ping_path']; - $nmap_path = $network_tools_config['nmap_path']; - $dig_path = $network_tools_config['dig_path']; - $snmpget_path = $network_tools_config['snmpget_path']; + if (isset($config['external_tools_config']) === true) { + $external_tools_config = json_decode(io_safe_output($config['external_tools_config']), true); + $traceroute_path = $external_tools_config['traceroute_path']; + $ping_path = $external_tools_config['ping_path']; + $nmap_path = $external_tools_config['nmap_path']; + $dig_path = $external_tools_config['dig_path']; + $snmpget_path = $external_tools_config['snmpget_path']; switch ($command) { case 'traceroute': @@ -562,14 +593,14 @@ class ExternalTools extends HTML /** * Execute external tools action. * - * @param integer $operation Operation. - * @param string $ip Ip. - * @param string $community Community. - * @param string $snmp_version SNMP version. + * @param mixed $operation Operation. + * @param string $ip Ip. + * @param string $community Community. + * @param string $snmp_version SNMP version. * * @return string String formed result of execution. */ - public function externalToolsExecution(int $operation, string $ip, string $community, string $snmp_version) + public function externalToolsExecution($operation, string $ip, string $community, string $snmp_version) { $output = ''; @@ -705,9 +736,29 @@ class ExternalTools extends HTML break; default: - // Nothing to do. - $stringCommand = ''; - $executeCommand = ''; + global $config; + + $tempCustomCommandsList = json_decode(io_safe_output($config['external_tools_config']), true); + $customCommandsList = $tempCustomCommandsList['custom_commands']; + // If the selected operation exists or not. + if (isset($customCommandsList[$operation]) === true) { + // Setting custom commands. + $customCommand = $customCommandsList[$operation]['command_custom']; + $customParams = $customCommandsList[$operation]['params_custom']; + // If '_address_' macro is setted, attach to execution. + if ((bool) preg_match('/_address_/', $customParams) === true) { + $customParams = preg_replace('/_address_/', $ip, $customParams); + $stringCommand = __('Performing %s execution on %s', $customCommand, $ip); + } else { + $stringCommand = __('Performing %s execution', $customCommand); + } + + $executeCommand = sprintf('%s %s', $customCommand, $customParams); + } else { + // Nothing to do. + $stringCommand = ''; + $executeCommand = ''; + } break; } @@ -801,7 +852,7 @@ class ExternalTools extends HTML } function mostrarColumns(value) { - if (value == 3) { + if (parseInt(value) === 3) { $('.snmpcolumn').show(); } else { From 7eaca3a18251482f65863c89f1a5a9cbf0c28ec5 Mon Sep 17 00:00:00 2001 From: fbsanchez <fborja.sanchez@artica.es> Date: Tue, 12 Jan 2021 13:25:09 +0100 Subject: [PATCH 15/61] List IP address pandora_agent (AIX/*Nix) --- pandora_agents/unix/pandora_agent | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandora_agents/unix/pandora_agent b/pandora_agents/unix/pandora_agent index 9c9aee1094..702dc556d1 100755 --- a/pandora_agents/unix/pandora_agent +++ b/pandora_agents/unix/pandora_agent @@ -4143,7 +4143,7 @@ while (1) { @address_list = `ip addr show 2>$DevNull | sed -e '/127.0.0/d' -e '/\\([0-9][0-9]*\\.\\)\\{3\\}[0-9][0-9]*/!d' -e 's/^[ \\t]*\\([^ \\t]*\\)[ \\t]*\\([^ \\t]*\\)[ \\t].*/\\2/' -e 's/\\/.*//'`; } else { - @address_list = `ifconfig -a 2>$DevNull | sed -e '/127.0.0/d' -e '/\\([0-9][0-9]*\\.\\)\\{3\\}[0-9][0-9]*/!d' -e 's/^[ \\t]*\\([^ \\t]*\\)[ \\t]*\\([^ \\t]*\\)[ \\t].*/\\2/' -e 's/.*://'`; + @address_list = `ifconfig -a 2>$DevNull | grep -i inet | grep -v 'inet6' | grep -v '0.0.0.0' | grep -v '::/0' | awk '{print \$2}' | grep -v '127.0.0.1'`; } for (my $i = 0; $i <= $#address_list; $i++) { From 5283771e3224cb643c9e2c91c041bebb9dc34ff8 Mon Sep 17 00:00:00 2001 From: Jose Gonzalez <jose.gonzalez@artica.es> Date: Thu, 21 Jan 2021 13:33:14 +0100 Subject: [PATCH 16/61] Solved issue with verbosity parameters --- pandora_server/lib/PandoraFMS/Config.pm | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pandora_server/lib/PandoraFMS/Config.pm b/pandora_server/lib/PandoraFMS/Config.pm index 34f3f468f9..ea378b623e 100644 --- a/pandora_server/lib/PandoraFMS/Config.pm +++ b/pandora_server/lib/PandoraFMS/Config.pm @@ -826,7 +826,9 @@ sub pandora_load_config { $pa_config->{"snmp_proc_deadresponse"} = clean_blank($1); } elsif ($parametro =~ m/^verbosity\s+([0-9]*)/i) { - $pa_config->{"verbosity"} = clean_blank($1); + if ($pa_config->{"verbosity"} == 0) { + $pa_config->{"verbosity"} = clean_blank($1); + } } elsif ($parametro =~ m/^server_threshold\s+([0-9]*)/i) { $pa_config->{"server_threshold"} = clean_blank($1); From 64ae9641911ce55923b36ada623f1242c069440a Mon Sep 17 00:00:00 2001 From: Jose Gonzalez <jose.gonzalez@artica.es> Date: Fri, 19 Feb 2021 14:30:09 +0100 Subject: [PATCH 17/61] Fixed forced 2FA --- pandora_console/general/register.php | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/pandora_console/general/register.php b/pandora_console/general/register.php index 9f90e7ad39..9147a0e016 100644 --- a/pandora_console/general/register.php +++ b/pandora_console/general/register.php @@ -234,8 +234,8 @@ if (!$double_auth_enabled && $config['2FA_all_users'] != '' } }); - $("div#doble_auth_window").dialog({ <?php config_update_value('2Fa_auth', ''); ?> + $("div#doble_auth_window").dialog({ resizable: true, draggable: true, modal: true, @@ -247,12 +247,6 @@ if (!$double_auth_enabled && $config['2FA_all_users'] != '' width: 500, height: 400, close: function (event, ui) { - - <?php - if (!$double_auth_enabled) { - config_update_value('2Fa_auth', '1'); - } - ?> // Abort the ajax request if (typeof request != 'undefined'){ request.abort(); From 793ca4ace7f762958be7637af8fc8542bcbc85e1 Mon Sep 17 00:00:00 2001 From: "rafael.ameijeiras" <rafael.ameijeiras@artica.es> Date: Tue, 23 Feb 2021 15:05:08 +0100 Subject: [PATCH 18/61] change agent docker image to centos7 --- pandora_agents/Dockerfile | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/pandora_agents/Dockerfile b/pandora_agents/Dockerfile index 0ee2515a75..79257b955c 100644 --- a/pandora_agents/Dockerfile +++ b/pandora_agents/Dockerfile @@ -1,15 +1,15 @@ -FROM centos:centos8 -MAINTAINER Pandora FMS Team <info@pandorafms.com> +FROM centos:7 +LABEL maintainer="Pandora FMS Team <info@pandorafms.com>" # Add Pandora FMS agent installer ADD unix /opt/pandora/pandora_agent/unix RUN export LC_ALL=C -RUN dnf install -y dnf-plugins-core; dnf config-manager --set-enabled PowerTools +RUN yum -y update # Install dependencies -RUN dnf -y install \ +RUN yum -y install \ epel-release \ unzip \ perl \ @@ -17,7 +17,7 @@ RUN dnf -y install \ sed \ perl-YAML-Tiny \ "perl(Sys::Syslog)" \ - && dnf clean all + && yum clean all # Install Pandora FMS agent From 901d12fec02b31f6c5f28e825daa28aadf409f48 Mon Sep 17 00:00:00 2001 From: "alejandro.campos@artica.es" <alejandro.campos@artica.es> Date: Thu, 25 Feb 2021 13:18:04 +0100 Subject: [PATCH 19/61] Integration with Integria --- pandora_console/extras/mr/45.sql | 5 + .../pandoradb_migrate_6.0_to_7.0.mysql.sql | 2 + .../godmode/agentes/agent_incidents.php | 44 +- .../godmode/agentes/configurar_agente.php | 19 - .../godmode/alerts/alert_commands.php | 72 ++- .../godmode/alerts/alert_list.builder.php | 9 +- .../godmode/alerts/configure_alert_action.php | 248 +++++++- .../godmode/setup/setup_integria.php | 227 ++++++-- pandora_console/include/functions_alerts.php | 27 +- pandora_console/include/functions_config.php | 8 +- pandora_console/include/functions_graph.php | 204 ++----- .../include/functions_integriaims.php | 23 +- .../operation/agentes/ver_agente.php | 11 +- .../configure_integriaims_incident.php | 20 +- .../dashboard_detail_integriaims_incident.php | 2 +- .../operation/incidents/incident.php | 503 ----------------- .../operation/incidents/incident_detail.php | 532 ------------------ .../incidents/incident_statistics.php | 8 +- .../incidents/list_integriaims_incidents.php | 2 +- pandora_console/operation/menu.php | 5 +- pandora_server/lib/PandoraFMS/Core.pm | 172 ++++-- pandora_server/util/pandora_db.pl | 33 ++ pandora_server/util/pandora_manage.pl | 21 - .../util/recon_scripts/wmi-recon.pl | 8 - 24 files changed, 837 insertions(+), 1368 deletions(-) create mode 100644 pandora_console/extras/mr/45.sql delete mode 100755 pandora_console/operation/incidents/incident.php delete mode 100755 pandora_console/operation/incidents/incident_detail.php diff --git a/pandora_console/extras/mr/45.sql b/pandora_console/extras/mr/45.sql new file mode 100644 index 0000000000..c02109bd16 --- /dev/null +++ b/pandora_console/extras/mr/45.sql @@ -0,0 +1,5 @@ +START TRANSACTION; + +ALTER TABLE `talert_actions` ADD COLUMN `create_wu_integria` TINYINT(1) default NULL; + +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 bae705f725..4a279450f3 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 @@ -1378,6 +1378,8 @@ ALTER TABLE `talert_actions` MODIFY COLUMN `field11` text NOT NULL, MODIFY COLUMN `field14` text NOT NULL, MODIFY COLUMN `field15` text NOT NULL; +ALTER TABLE `talert_actions` ADD COLUMN `create_wu_integria` TINYINT(1) default NULL; + -- --------------------------------------------------------------------- -- Table `talert_commands` -- --------------------------------------------------------------------- diff --git a/pandora_console/godmode/agentes/agent_incidents.php b/pandora_console/godmode/agentes/agent_incidents.php index c144cdfdcd..c669af992e 100644 --- a/pandora_console/godmode/agentes/agent_incidents.php +++ b/pandora_console/godmode/agentes/agent_incidents.php @@ -18,6 +18,11 @@ require_once 'include/functions_incidents.php'; check_login(); +if (!$config['integria_enabled']) { + ui_print_error_message(__('In order to access ticket management system, integration with Integria IMS must be enabled and properly configured')); + return; +} + $group = $id_grupo; if (! check_acl($config['id_user'], $group, 'AW', $id_agente)) { @@ -38,24 +43,21 @@ $groups = users_get_groups($config['id_user'], 'IR'); $filter = ' AND id_agent = '.$id_agent; $url = 'index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=incident&id_agente='.$id_agent; -// Select incidencts where the user has access to ($groups from -// get_user_groups), array_keys for the id, implode to pass to SQL -switch ($config['dbtype']) { - case 'mysql': - $sql = 'SELECT * FROM tincidencia WHERE - id_grupo IN ('.implode(',', array_keys($groups)).')'.$filter.' - ORDER BY actualizacion DESC LIMIT '.$offset.','.$config['block_size']; - break; +$params = [ + '', + '-10', + '1', + '-1', + '0', + '', + '', + '', + agents_get_name($id_agent), +]; - case 'oracle': - $sql = 'SELECT * FROM tincidencia WHERE - id_grupo IN ('.implode(',', array_keys($groups)).')'.$filter.' - AND rownum <= '.$offset.','.$config['block_size'].' - ORDER BY actualizacion DESC'; - break; -} +$result = integria_api_call($config['integria_hostname'], $config['integria_user'], $config['integria_pass'], $config['integria_api_pass'], 'get_incidents', $params, false, 'json', ','); -$result = db_get_all_rows_sql($sql); +$result = json_decode($result, true); $count_sql = 'SELECT count(*) FROM tincidencia WHERE id_grupo IN ('.implode(',', array_keys($groups)).')'.$filter.' @@ -91,8 +93,6 @@ $table->head[2] = __('Incident'); $table->head[3] = __('Priority'); $table->head[4] = __('Group'); $table->head[5] = __('Updated'); -$table->head[6] = __('Source'); -$table->head[7] = __('Owner'); $table->size[0] = 43; $table->size[7] = 50; @@ -115,7 +115,7 @@ foreach ($result as $row) { $data = []; - $data[0] = '<a href="index.php?sec=incidencias&sec2=operation/incidents/incident_detail&id='.$row['id_incidencia'].'">'.$row['id_incidencia'].'</a>'; + $data[0] = '<a href="index.php?sec=incident&sec2=operation/incidents/dashboard_detail_integriaims_incident&incident_id='.$row['id_incidencia'].'">'.$row['id_incidencia'].'</a>'; $attach = incidents_get_attach($row['id_incidencia']); if (!empty($attach)) { @@ -123,12 +123,10 @@ foreach ($result as $row) { } $data[1] = incidents_print_status_img($row['estado'], true); - $data[2] = '<a href="index.php?sec=incidencias&sec2=operation/incidents/incident_detail&id='.$row['id_incidencia'].'">'.substr(io_safe_output($row['titulo']), 0, 45).'</a>'; + $data[2] = '<a href="index.php?sec=incident&sec2=operation/incidents/dashboard_detail_integriaims_incident&incident_id='.$row['id_incidencia'].'">'.substr(io_safe_output($row['titulo']), 0, 45).'</a>'; $data[3] = incidents_print_priority_img($row['prioridad'], true); - $data[4] = ui_print_group_icon($row['id_grupo'], true); + $data[4] = $row['id_grupo']; $data[5] = ui_print_timestamp($row['actualizacion'], true); - $data[6] = $row['origen']; - $data[7] = ui_print_username($row['id_usuario'], true); array_push($table->data, $data); } diff --git a/pandora_console/godmode/agentes/configurar_agente.php b/pandora_console/godmode/agentes/configurar_agente.php index 72fc0ef125..1f765c7d86 100644 --- a/pandora_console/godmode/agentes/configurar_agente.php +++ b/pandora_console/godmode/agentes/configurar_agente.php @@ -486,20 +486,6 @@ if ($id_agente) { $agent_wizard['active'] = false; } - - $total_incidents = agents_get_count_incidents($id_agente); - - // Incident tab. - if ($total_incidents > 0) { - $incidenttab['text'] = '<a href="index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=incident&id_agente='.$id_agente.'">'.html_print_image('images/book_edit.png', true, ['title' => __('Incidents')]).'</a>'; - - if ($tab == 'incident') { - $incidenttab['active'] = true; - } else { - $incidenttab['active'] = false; - } - } - if (check_acl_one_of_groups($config['id_user'], $all_groups, 'AW')) { if ($has_remote_conf) { $agent_name = agents_get_name($id_agente); @@ -550,11 +536,6 @@ if ($id_agente) { ]; } - - // Only if the agent has incidents associated show incidents tab. - if ($total_incidents) { - $onheader['incident'] = $incidenttab; - } } else { $onheader = [ 'view' => $viewtab, diff --git a/pandora_console/godmode/alerts/alert_commands.php b/pandora_console/godmode/alerts/alert_commands.php index 53272f6273..2175c8f7b2 100644 --- a/pandora_console/godmode/alerts/alert_commands.php +++ b/pandora_console/godmode/alerts/alert_commands.php @@ -56,7 +56,7 @@ if (is_ajax()) { $command = alerts_get_alert_command($id); - // If is setted a description, we change the carriage return by <br> tags + // If a description is set, change the carriage return by <br> tags. if (isset($command['description'])) { $command['description'] = str_replace( [ @@ -265,6 +265,76 @@ if (is_ajax()) { $editor_type_chkbx .= '</small></b></div>'; $rfield = $editor_type_chkbx; // Select type. + } else if (preg_match('/^_integria_type_custom_field_$/i', $field_value)) { + $ffield = ''; + $rfield = ''; + + $ffield .= '<div name="field'.$i.'_value_container">'.html_print_switch( + [ + 'name' => 'field'.$i.'_value[]', + 'value' => '', + ] + ).'</div>'; + $rfield .= '<div name="field'.$i.'_recovery_value_container">'.html_print_switch( + [ + 'name' => 'field'.$i.'_recovery_value[]', + 'value' => '', + ] + ).'</div>'; + + $ffield .= html_print_select( + '', + 'field'.$i.'_value[]', + '', + '', + __('None'), + '', + true, + false, + false, + 'fields', + $is_central_policies_on_node + ); + + $rfield .= html_print_select( + '', + 'field'.$i.'_recovery_value[]', + '', + '', + __('None'), + '', + true, + false, + false, + 'fields', + $is_central_policies_on_node + ); + + $ffield .= html_print_input_text('field'.$i.'_value[]', '', '', 10, 10, true, false, false, '', 'datepicker'); + $rfield .= html_print_input_text('field'.$i.'_recovery_value[]', '', '', 10, 10, true, false, false, '', 'datepicker'); + + $ffield .= html_print_textarea( + 'field'.$i.'_value[]', + 1, + 1, + '', + 'style="min-height:40px; '.$style.'" class="fields"', + true, + '', + $is_central_policies_on_node + ); + + + $rfield .= html_print_textarea( + 'field'.$i.'_recovery_value[]', + 1, + 1, + '', + 'style="min-height:40px; '.$style.'" class="fields_recovery', + true, + '', + $is_central_policies_on_node + ); } else { $fields_value_select = []; $fv = explode(';', $field_value); diff --git a/pandora_console/godmode/alerts/alert_list.builder.php b/pandora_console/godmode/alerts/alert_list.builder.php index 4fa89805ce..e1c07778c3 100644 --- a/pandora_console/godmode/alerts/alert_list.builder.php +++ b/pandora_console/godmode/alerts/alert_list.builder.php @@ -97,7 +97,14 @@ $table->data[1][0] = __('Actions'); $groups_user = users_get_groups($config['id_user']); if (!empty($groups_user)) { $groups = implode(',', array_keys($groups_user)); - $sql = "SELECT id, name FROM talert_actions WHERE id_group IN ($groups)"; + + if ($config['integria_enabled'] == 0) { + $integria_command = 'Integria IMS Ticket'; + $sql = sprintf('SELECT taa.id, taa.name FROM talert_actions taa INNER JOIN talert_commands tac ON taa.id_alert_command = tac.id WHERE tac.name <> "%s" AND taa.id_group IN (%s)', $integria_command, $groups); + } else { + $sql = "SELECT id, name FROM talert_actions WHERE id_group IN ($groups)"; + } + $actions = db_get_all_rows_sql($sql); } diff --git a/pandora_console/godmode/alerts/configure_alert_action.php b/pandora_console/godmode/alerts/configure_alert_action.php index 67a2837955..f3dfc35250 100644 --- a/pandora_console/godmode/alerts/configure_alert_action.php +++ b/pandora_console/godmode/alerts/configure_alert_action.php @@ -16,6 +16,7 @@ global $config; require_once $config['homedir'].'/include/functions_alerts.php'; require_once $config['homedir'].'/include/functions_users.php'; +require_once $config['homedir'].'/include/functions_integriaims.php'; enterprise_include_once('meta/include/functions_alerts_meta.php'); check_login(); @@ -36,6 +37,19 @@ $id = (int) get_parameter('id'); $al_action = alerts_get_alert_action($id); $pure = get_parameter('pure', 0); +if (is_ajax()) { + $get_integria_ticket_custom_types = (bool) get_parameter('get_integria_ticket_custom_types'); + + if ($get_integria_ticket_custom_types) { + $ticket_type_id = get_parameter('ticket_type_id'); + + $api_call = integria_api_call($config['integria_hostname'], $config['integria_user'], $config['integria_pass'], $config['integria_api_pass'], 'get_incident_fields', $ticket_type_id, false, 'json'); + + echo $api_call; + return; + } +} + if (defined('METACONSOLE')) { $sec = 'advanced'; } else { @@ -101,6 +115,7 @@ if ($id) { $group = $action['id_group']; $action_threshold = $action['action_threshold']; + $create_wu_integria = $action['create_wu_integria']; } // Hidden div with help hint to fill with javascript. @@ -185,10 +200,18 @@ $table->data[1][1] = '<div class="w250px inline">'.html_print_select_groups( ).'</div>'; $table->colspan[1][1] = 2; +$create_ticket_command_id = db_get_value('id', 'talert_commands', 'name', io_safe_input('Integria IMS Ticket')); + +$sql_exclude_command_id = ''; + +if ($config['integria_enabled'] == 0 && $create_ticket_command_id !== false) { + $sql_exclude_command_id = ' AND id <> '.$create_ticket_command_id; +} + $table->data[2][0] = __('Command'); $commands_sql = db_get_all_rows_filter( 'talert_commands', - ['id_group' => array_keys(users_get_groups(false, 'LW'))], + 'id_group IN ('.implode(',', array_keys(users_get_groups(false, 'LW'))).')'.$sql_exclude_command_id, [ 'id', 'name', @@ -266,6 +289,12 @@ $table->data[5][2] = html_print_textarea( true ); +$table->data[6][0] = __('Create workunit on recovery').ui_print_help_tip( + __('If closed status is set on recovery, a workunit will be added to the ticket in Integria IMS rather that closing the ticket.'), + true +); +$table->data[6][1] = html_print_checkbox_switch_extended('create_wu_integria', 1, $create_wu_integria, false, '', '', true); + for ($i = 1; $i <= $config['max_macro_fields']; $i++) { $table->data['field'.$i][0] = html_print_image( 'images/spinner.gif', @@ -356,6 +385,182 @@ $(document).ready (function () { render_command_description(command_description); } + function ajax_get_integria_custom_fields(ticket_type_id, values, recovery_values) { + var values = values || []; + var recovery_values = recovery_values || []; + + if (ticket_type_id === null || ticket_type_id === '' || (Array.isArray(values) && values.length === 0 && Array.isArray(recovery_values) && recovery_values.length === 0)) { + $('[name=field8_value\\[\\]').val(''); + $('[name=field9_value\\[\\]').val(''); + $('[name=field10_value\\[\\]').val(''); + $('[name=field8_recovery_value\\[\\]').val(''); + $('[name=field9_recovery_value\\[\\]').val(''); + $('[name=field10_recovery_value\\[\\]').val(''); + } + + // On ticket type change, hide all table rows and inputs corresponding to custom fields, regardless of what its type is. + $('[name=field8_value\\[\\]').hide(); + $('[name=field9_value\\[\\]').hide(); + $('[name=field10_value\\[\\]').hide(); + $('[name=field8_recovery_value\\[\\]').hide(); + $('[name=field9_recovery_value\\[\\]').hide(); + $('[name=field10_recovery_value\\[\\]').hide(); + $('#table_macros-field8').hide(); + $('#table_macros-field9').hide(); + $('#table_macros-field10').hide(); + $('[name=field8_value_container').hide(); + $('[name=field9_value_container').hide(); + $('[name=field10_value_container').hide(); + $('[name=field8_recovery_value_container').hide(); + $('[name=field9_recovery_value_container').hide(); + $('[name=field10_recovery_value_container').hide(); + + jQuery.post( + "ajax.php", + { + page: "godmode/alerts/configure_alert_action", + get_integria_ticket_custom_types: 1, + ticket_type_id: ticket_type_id + }, + function(data) { + var max_macro_fields = <?php echo $config['max_macro_fields']; ?>; + + data.forEach(function(custom_field, key) { + var custom_field_key = key+8; // Custom fields start from field 8. + + if (custom_field_key > max_macro_fields) { + return; + } + + // Display field row for current input. + var custom_field_row = $('#table_macros-field'+custom_field_key); + custom_field_row.show(); + + // Replace label text of field row for current input. + var label_html = $('#table_macros-field'+custom_field_key+' td').first().html(); + var label_name = label_html.split('<br>')[0]; + var new_html_content = custom_field_row.html().replace(label_name, custom_field.label); + custom_field_row.html(new_html_content); + + switch (custom_field.type) { + case 'checkbox': + var checkbox_selector = $('input:not(.datepicker)[name=field'+custom_field_key+'_value\\[\\]]'); + var checkbox_recovery_selector = $('input:not(.datepicker)[name=field'+custom_field_key+'_recovery_value\\[\\]]'); + + checkbox_selector.on('change', function() { + if (checkbox_selector.prop('checked')) { + checkbox_selector.attr('value', "1"); + } else { + checkbox_selector.attr('value', "0"); + } + }); + + checkbox_recovery_selector.on('change', function() { + if (checkbox_recovery_selector.prop('checked')) { + checkbox_recovery_selector.attr('value', "1"); + } else { + checkbox_recovery_selector.attr('value', "0"); + } + }); + + if (typeof values[key] !== "undefined") { + if (values[key] == 1) { + checkbox_selector.prop('checked', true); + checkbox_selector.attr('value', "1"); + } else { + checkbox_selector.prop('checked', false); + checkbox_selector.attr('value', "0"); + } + } + + if (typeof recovery_values[key] !== "undefined") { + if (recovery_values[key] == 1) { + checkbox_recovery_selector.prop('checked', true); + checkbox_recovery_selector.attr('value', "1"); + } else { + checkbox_recovery_selector.prop('checked', false); + checkbox_recovery_selector.attr('value', "0"); + } + } + + $('[name=field'+custom_field_key+'_value_container]').show(); + $('[name=field'+custom_field_key+'_recovery_value_container]').show(); + $('input:not(.datepicker)[name=field'+custom_field_key+'_value\\[\\]]').show(); + $('input:not(.datepicker)[name=field'+custom_field_key+'_recovery_value\\[\\]]').show(); + break; + case 'combo': + var combo_input = $('select[name=field'+custom_field_key+'_value\\[\\]]'); + var combo_input_recovery = $('select[name=field'+custom_field_key+'_recovery_value\\[\\]]'); + + combo_input.find('option').remove(); + combo_input_recovery.find('option').remove(); + + var combo_values_array = custom_field.combo_value.split(','); + + combo_values_array.forEach(function(value) { + combo_input.append($('<option>', { + value: value, + text: value + })); + + combo_input_recovery.append($('<option>', { + value: value, + text: value + })); + }); + + if (typeof values[key] !== "undefined") { + combo_input.val(values[key]); + } + + if (typeof recovery_values[key] !== "undefined") { + combo_input_recovery.val(recovery_values[key]); + } + + combo_input.show(); + combo_input_recovery.show(); + break; + case 'date': + $('input.datepicker[type="text"][name=field'+custom_field_key+'_value\\[\\]]').removeClass("hasDatepicker"); + $('input.datepicker[type="text"][name=field'+custom_field_key+'_recovery_value\\[\\]]').removeClass("hasDatepicker"); + $('input.datepicker[type="text"][name=field'+custom_field_key+'_value\\[\\]]').datepicker("destroy"); + $('input.datepicker[type="text"][name=field'+custom_field_key+'_recovery_value\\[\\]]').datepicker("destroy"); + + $('input.datepicker[type="text"][name=field'+custom_field_key+'_value\\[\\]]').show(); + $('input.datepicker[type="text"][name=field'+custom_field_key+'_recovery_value\\[\\]]').show(); + $('input.datepicker[type="text"][name=field'+custom_field_key+'_value\\[\\]]').datepicker({dateFormat: "<?php echo DATE_FORMAT_JS; ?>"}); + $('input.datepicker[type="text"][name=field'+custom_field_key+'_recovery_value\\[\\]]').datepicker({dateFormat: "<?php echo DATE_FORMAT_JS; ?>"}); + $.datepicker.setDefaults($.datepicker.regional[ "<?php echo get_user_language(); ?>"]); + + if (typeof values[key] !== "undefined") { + $('input.datepicker[type="text"][name=field'+custom_field_key+'_value\\[\\]]').val(values[key]); + } + + if (typeof recovery_values[key] !== "undefined") { + $('input.datepicker[type="text"][name=field'+custom_field_key+'_recovery_value\\[\\]]').val(recovery_values[key]); + } + break; + case 'text': + case 'textarea': + case 'numeric': + if (typeof values[key] !== "undefined") { + $('textarea[name=field'+custom_field_key+'_value\\[\\]]').val(values[key]); + } + + if (typeof recovery_values[key] !== "undefined") { + $('textarea[name=field'+custom_field_key+'_recovery_value\\[\\]]').val(recovery_values[key]); + } + + $('textarea[name=field'+custom_field_key+'_value\\[\\]]').show(); + $('textarea[name=field'+custom_field_key+'_recovery_value\\[\\]]').show(); + break; + } + }); + }, + "json" + ); + } + $("#id_command").change (function () { values = Array (); values.push({ @@ -391,6 +596,9 @@ $(document).ready (function () { $("#group").val(0); } + var integria_custom_fields_values = []; + var integria_custom_fields_rvalues = []; + for (i = 1; i <= max_fields; i++) { var old_value = ''; var old_recovery_value = ''; @@ -459,6 +667,12 @@ $(document).ready (function () { .val()); } } + + if ($("#id_command option:selected").text() === "Integria IMS Ticket" && i > 7) { + integria_custom_fields_values.push(old_value); + integria_custom_fields_rvalues.push(old_recovery_value); + } + // Add help hint only in first field if (i == 1) { var td_content = $table_macros_field.find('td').eq(0); @@ -471,7 +685,37 @@ $(document).ready (function () { $table_macros_field.show(); } - + + // Ad-hoc solution for Integria IMS command: get Integia IMS Ticket custom fields only when this command is selected and we selected a ticket type to retrieve fields from. + // Check command by name since it is unvariable in any case, unlike its ID. + if ($("#id_command option:selected").text() === "Integria IMS Ticket") { + + // At start hide all rows and inputs corresponding to custom fields, regardless of what its type is. + $('[name=field8_value\\[\\]').hide(); + $('[name=field9_value\\[\\]').hide(); + $('[name=field10_value\\[\\]').hide(); + $('[name=field8_recovery_value\\[\\]').hide(); + $('[name=field9_recovery_value\\[\\]').hide(); + $('[name=field10_recovery_value\\[\\]').hide(); + $('#table_macros-field8').hide(); + $('#table_macros-field9').hide(); + $('#table_macros-field10').hide(); + $('[name=field8_value_container').hide(); + $('[name=field9_value_container').hide(); + $('[name=field10_value_container').hide(); + $('[name=field8_recovery_value_container').hide(); + $('[name=field9_recovery_value_container').hide(); + $('[name=field10_recovery_value_container').hide(); + + if ($('#field5_value').val() !== '') { + ajax_get_integria_custom_fields($('#field5_value').val(), integria_custom_fields_values, integria_custom_fields_rvalues); + } + + $('#field5_value').on('change', function() { + ajax_get_integria_custom_fields($(this).val()); + }); + } + var added_config = { "selector": "textarea.tiny-mce-editor", "plugins": "preview, print, table, searchreplace, nonbreaking, xhtmlxtras, noneditable", diff --git a/pandora_console/godmode/setup/setup_integria.php b/pandora_console/godmode/setup/setup_integria.php index 10d1afe418..4d649d3e3a 100644 --- a/pandora_console/godmode/setup/setup_integria.php +++ b/pandora_console/godmode/setup/setup_integria.php @@ -31,6 +31,12 @@ if (! check_acl($config['id_user'], 0, 'PM') && ! is_user_admin($config['id_user require_once $config['homedir'].'/include/functions_integriaims.php'; if (is_ajax()) { + $operation = (string) get_parameter('operation', ''); + + if ($operation === 'check_api_access') { + } else if ($operation === 'sync_inventory') { + } + $integria_user = get_parameter('integria_user', ''); $integria_pass = get_parameter('integria_pass', ''); $integria_api_hostname = get_parameter('api_hostname', ''); @@ -80,6 +86,16 @@ if (get_parameter('update_config', 0) == 1) { ); } + $ticket_types = integria_api_call($config['integria_hostname'], $config['integria_user'], $config['integria_pass'], $config['integria_api_pass'], 'get_types', '', false, 'json'); + + $types_string = ''; + + if ($ticket_types !== '') { + foreach (json_decode($ticket_types, true) as $key => $value) { + $types_string .= $value['id'].','.$value['name'].';'; + } + } + if ($command_exists === false) { // Create 'Integria IMS Ticket' command only when user enables IntegriaIMS integration and it does not exist in database. $id_command_inserted = db_process_sql_insert( @@ -89,7 +105,8 @@ if (get_parameter('update_config', 0) == 1) { 'command' => io_safe_input('Internal type'), 'internal' => 1, 'description' => io_safe_input('Create a ticket in Integria IMS'), - 'fields_descriptions' => '["'.io_safe_input('Ticket title').'","'.io_safe_input('Ticket group ID').'","'.io_safe_input('Ticket priority').'","'.io_safe_input('Ticket owner').'","'.io_safe_input('Ticket type').'","'.io_safe_input('Ticket status').'","'.io_safe_input('Ticket description').'"]', + 'fields_descriptions' => '["'.io_safe_input('Ticket title').'","'.io_safe_input('Ticket group ID').'","'.io_safe_input('Ticket priority').'","'.io_safe_input('Ticket owner').'","'.io_safe_input('Ticket type').'","'.io_safe_input('Ticket status').'","'.io_safe_input('Ticket description').'","_integria_type_custom_field_","_integria_type_custom_field_","_integria_type_custom_field_"]', + 'fields_values' => '["", "", "","","'.$types_string.'","","","_integria_type_custom_field_","_integria_type_custom_field_","_integria_type_custom_field_"]', ] ); @@ -115,41 +132,80 @@ if (get_parameter('update_config', 0) == 1) { alerts_create_alert_action(io_safe_input('Create Integria IMS ticket'), $id_command_inserted, $action_values); } else { - // Update 'Create Integria IMS Ticket' action when setup data is updated, user enables IntegriaIMS integration and command does exist in database. - db_process_sql_update( - 'talert_actions', - [ - 'field1' => io_safe_input($config['incident_title']), - 'field1_recovery' => io_safe_input($config['incident_title']), - 'field2' => io_safe_input($config['default_group']), - 'field2_recovery' => io_safe_input($config['default_group']), - 'field3' => io_safe_input($config['default_criticity']), - 'field3_recovery' => io_safe_input($config['default_criticity']), - 'field4' => io_safe_input($config['default_owner']), - 'field4_recovery' => io_safe_input($config['default_owner']), - 'field5' => io_safe_input($config['incident_type']), - 'field5_recovery' => io_safe_input($config['incident_type']), - 'field6' => io_safe_input($config['incident_status']), - 'field6_recovery' => io_safe_input($config['incident_status']), - 'field7' => io_safe_input($config['incident_content']), - 'field7_recovery' => io_safe_input($config['incident_content']), - ], - ['name' => io_safe_input('Create Integria IMS ticket')] + // Update 'Integria IMS Ticket' command with ticket types retrieved from Integria IMS. + $sql_update_command_values = sprintf( + ' + UPDATE talert_commands + SET fields_values = \'["","","","","%s","","","_integria_type_custom_field_","_integria_type_custom_field_","_integria_type_custom_field_"]\' + WHERE name="%s"', + $types_string, + io_safe_input('Integria IMS Ticket') ); + + db_process_sql($sql_update_command_values); + + // Update those actions that make use of 'Integria IMS Ticket' command when setup default fields are updated. Empty fields in actions will be filled in with default values. + $update_action_values = [ + $config['incident_title'], + $config['default_group'], + $config['default_criticity'], + $config['default_owner'], + $config['incident_type'], + $config['incident_status'], + $config['incident_content'], + ]; + + foreach ($update_action_values as $key => $value) { + $field_key = ($key + 1); + + $sql_update_action_field = sprintf( + ' + UPDATE talert_actions taa + INNER JOIN talert_commands tac + ON taa.id_alert_command=tac.id + SET field%s= "%s" + WHERE tac.name="Integria IMS Ticket" + AND ( + taa.field%s IS NULL OR taa.field%s="" + )', + $field_key, + $value, + $field_key, + $field_key, + $field_key + ); + + db_process_sql($sql_update_action_field); + } + + foreach ($update_action_values as $key => $value) { + $field_key = ($key + 1); + + $sql_update_action_recovery_field = sprintf( + ' + UPDATE talert_actions taa + INNER JOIN talert_commands tac + ON taa.id_alert_command=tac.id + SET field%s_recovery = "%s" + WHERE tac.name="Integria IMS Ticket" + AND ( + taa.field%s_recovery IS NULL OR taa.field%s_recovery="" + )', + $field_key, + $value, + $field_key, + $field_key, + $field_key + ); + + db_process_sql($sql_update_action_recovery_field); + } } } else { - if ($event_response_exists != false) { + if ($event_response_exists !== false) { // Delete 'Create incident in IntegriaIMS from event' event response if it does exist and IntegriaIMS integration is disabled. db_process_sql_delete('tevent_response', ['name' => io_safe_input('Create ticket in IntegriaIMS from event')]); } - - if ($command_exists != false) { - // Delete 'Integria IMS Ticket' command if it does exist and IntegriaIMS integration is disabled. - db_process_sql_delete('talert_commands', ['name' => io_safe_input('Integria IMS Ticket')]); - - // Delete 'Create Integria IMS Ticket' action if command exists and IntegriaIMS integration is disabled. - db_process_sql_delete('talert_actions', ['name' => io_safe_input('Create Integria IMS ticket')]); - } } } @@ -243,6 +299,20 @@ $row['name'] = __('Request timeout'); $row['control'] = html_print_input_text('integria_req_timeout', $config['integria_req_timeout'], '', 3, 10, true); $table_remote->data['integria_req_timeout'] = $row; +$row = []; +$row['name'] = __('Inventory'); +$row['control'] = html_print_input_text('integria_req_timeout', $config['integria_req_timeout'], '', 3, 10, true); +$table_remote->data['integria_req_timeout'] = $row; + + +$row = []; +$row['name'] = __('Inventory'); +$row['control'] = html_print_button(__('Sync inventory'), 'sync-inventory', false, '', 'class="sub next"', true); +$row['control'] .= '<span id="test-integria-spinner-sync" style="display:none;"> '.html_print_image('images/spinner.gif', true).'</span>'; +$row['control'] .= '<span id="test-integria-success-sync" style="display:none;"> '.html_print_image('images/status_sets/default/severity_normal.png', true).'</span>'; +$row['control'] .= '<span id="test-integria-failure-sync" style="display:none;"> '.html_print_image('images/status_sets/default/severity_critical.png', true).'</span>'; +$table_remote->data['integria_sync_inventory'] = $row; + // Alert settings. $table_alert_settings = new StdClass(); $table_alert_settings->data = []; @@ -661,8 +731,8 @@ echo '</form>'; var api_pass = $('input[name=integria_api_pass]').val(); var data = { - page: "godmode/setup/setup_integria", - check_api_access: 1, + page: 'godmode/setup/setup_integria', + operation: 'check_api_access', integria_user: integria_user, integria_pass: integria_pass, api_hostname: api_hostname, @@ -694,7 +764,100 @@ echo '</form>'; hideLoadingImage(); }); } + + var handleInventorySync = function (event) { + + var badRequestMessage = '<?php echo __('Empty user or password'); ?>'; + var notFoundMessage = '<?php echo __('User not found'); ?>'; + var invalidPassMessage = '<?php echo __('Invalid password'); ?>'; + + var hideLoadingImage = function () { + $('span#test-integria-spinner-sync').hide(); + } + var showLoadingImage = function () { + $('span#test-integria-spinner-sync').show(); + } + var hideSuccessImage = function () { + $('span#test-integria-success-sync').hide(); + } + var showSuccessImage = function () { + $('span#test-integria-success-sync').show(); + } + var hideFailureImage = function () { + $('span#test-integria-failure-sync').hide(); + } + var showFailureImage = function () { + $('span#test-integria-failure-sync').show(); + } + + + hideSuccessImage(); + hideFailureImage(); + showLoadingImage(); + + var integria_user = $('input[name=integria_user]').val(); + var integria_pass = $('input[name=integria_pass]').val(); + var api_hostname = $('input[name=integria_hostname]').val(); + var api_pass = $('input[name=integria_api_pass]').val(); + + if (!api_hostname.match(/^[a-zA-Z]+:\/\//)) + { + api_hostname = 'http://' + api_hostname; + } + + var url = api_hostname + '/integria/include/api.php'; + + <?php + // Retrieve all agents and codify string in the format that will be sent over in Ajax call. + $agent_fields = [ + 'nombre', + 'alias', + 'id_os', + 'direccion', + 'id_agente', + 'id_grupo', + ]; + + $agents = agents_get_agents(false, $agent_fields); + + $agents_query_string_array = []; + + foreach ($agents as $agent_data) { + $agents_query_string_array[] = implode('|;|', $agent_data); + } + ?> + + var agents_query_string_array = <?php echo json_encode($agents_query_string_array); ?>; + + var data = { + op: 'sync_pandora_agents_inventory', + user: integria_user, + user_pass: integria_pass, + pass: api_pass, + params: agents_query_string_array, + token: '|;|' + } + + // AJAX call to check API connection. + $.ajax({ + type: "GET", + url: url, + dataType: "json", + data: data + }) + .done(function(data, textStatus, xhr) { + showSuccessImage(); + }) + .fail(function(xhr, textStatus, errorThrown) { + showFailureImage(); + }) + .always(function(xhr, textStatus) { + hideLoadingImage(); + }); + } + $('input#button-test-integria').click(handleTest); + $('input#button-sync-inventory').click(handleInventorySync); diff --git a/pandora_console/include/functions_alerts.php b/pandora_console/include/functions_alerts.php index 99ef4576da..3d1e054325 100644 --- a/pandora_console/include/functions_alerts.php +++ b/pandora_console/include/functions_alerts.php @@ -2747,6 +2747,7 @@ function alerts_ui_update_or_create_actions($update=true) $id_alert_command = (int) get_parameter('id_command'); $group = get_parameter('group'); $action_threshold = (int) get_parameter('action_threshold'); + $create_wu_integria = (int) get_parameter('create_wu_integria'); // Validate some values if (!$id_alert_command) { @@ -2769,14 +2770,36 @@ function alerts_ui_update_or_create_actions($update=true) $info_fields = ''; $values = []; for ($i = 1; $i <= $config['max_macro_fields']; $i++) { - $values['field'.$i] = (string) get_parameter('field'.$i.'_value'); + $field_value = get_parameter('field'.$i.'_value'); + + if (is_array($field_value)) { + $field_value = reset(array_filter($field_value)); + + if ($field_value === false) { + $field_value = ''; + } + } + + $values['field'.$i] = (string) $field_value; $info_fields .= ' Field'.$i.': '.$values['field'.$i]; - $values['field'.$i.'_recovery'] = (string) get_parameter('field'.$i.'_recovery_value'); + + $field_recovery_value = get_parameter('field'.$i.'_recovery_value'); + + if (is_array($field_recovery_value)) { + $field_recovery_value = reset(array_filter($field_recovery_value)); + + if ($field_recovery_value === false) { + $field_recovery_value = ''; + } + } + + $values['field'.$i.'_recovery'] = (string) $field_recovery_value; $info_fields .= ' Field'.$i.'Recovery: '.$values['field'.$i.'_recovery']; } $values['id_group'] = $group; $values['action_threshold'] = $action_threshold; + $values['create_wu_integria'] = $create_wu_integria; if ($update) { $values['name'] = $name; $values['id_alert_command'] = $id_alert_command; diff --git a/pandora_console/include/functions_config.php b/pandora_console/include/functions_config.php index d95c9110a6..332e7f1360 100644 --- a/pandora_console/include/functions_config.php +++ b/pandora_console/include/functions_config.php @@ -1548,7 +1548,13 @@ function config_update_config() $error_update[] = __('Integria password'); } - if (!config_update_value('integria_hostname', (string) get_parameter('integria_hostname', $config['integria_hostname']))) { + $integria_hostname = (string) get_parameter('integria_hostname', $config['integria_hostname']); + + if (parse_url($integria_hostname, PHP_URL_SCHEME) === null) { + $integria_hostname = 'http://'.$integria_hostname; + } + + if (!config_update_value('integria_hostname', $integria_hostname)) { $error_update[] = __('integria API hostname'); } diff --git a/pandora_console/include/functions_graph.php b/pandora_console/include/functions_graph.php index 87af7d818d..64c2d9369a 100644 --- a/pandora_console/include/functions_graph.php +++ b/pandora_console/include/functions_graph.php @@ -32,6 +32,7 @@ require_once $config['homedir'].'/include/functions_reporting.php'; require_once $config['homedir'].'/include/functions_agents.php'; require_once $config['homedir'].'/include/functions_modules.php'; require_once $config['homedir'].'/include/functions_users.php'; +require_once $config['homedir'].'/include/functions_integriaims.php'; /** @@ -2971,43 +2972,25 @@ function graph_sla_slicebar( function grafico_incidente_prioridad() { global $config; - global $graphic_type; - $data_tmp = [ - 0, - 0, - 0, - 0, - 0, - 0, - ]; - $sql = 'SELECT COUNT(id_incidencia) n_incidents, prioridad - FROM tincidencia - GROUP BY prioridad - ORDER BY 2 DESC'; - $incidents = db_get_all_rows_sql($sql); + $integria_ticket_count_by_priority_json = integria_api_call($config['integria_hostname'], $config['integria_user'], $config['integria_pass'], $config['integria_api_pass'], 'get_tickets_count', ['prioridad', 30], false, '', '|;|'); - if ($incidents == false) { - $incidents = []; + $integria_priorities_map_json = integria_api_call($config['integria_hostname'], $config['integria_user'], $config['integria_pass'], $config['integria_api_pass'], 'get_incident_priorities', '', false, 'json'); + + $integria_ticket_count_by_priority = json_decode($integria_ticket_count_by_priority_json, true); + $integria_priorities_map = json_decode($integria_priorities_map_json, true); + + $integria_priorities_map_ids = array_column($integria_priorities_map, 'id'); + $integria_priorities_map_names = array_column($integria_priorities_map, 'name'); + $integria_priorities_map_indexed_by_id = array_combine($integria_priorities_map_ids, $integria_priorities_map_names); + + $data = []; + + foreach ($integria_ticket_count_by_priority as $item) { + $priority_name = $integria_priorities_map_indexed_by_id[$item['prioridad']]; + $data[__($priority_name)] = $item['n_incidents']; } - foreach ($incidents as $incident) { - if ($incident['prioridad'] < 5) { - $data_tmp[$incident['prioridad']] = $incident['n_incidents']; - } else { - $data_tmp[5] += $incident['n_incidents']; - } - } - - $data = [ - __('Informative') => $data_tmp[0], - __('Low') => $data_tmp[1], - __('Medium') => $data_tmp[2], - __('Serious') => $data_tmp[3], - __('Very serious') => $data_tmp[4], - __('Maintenance') => $data_tmp[5], - ]; - if ($config['fixed_graph'] == false) { $water_mark = [ 'file' => $config['homedir'].'/images/logo_vertical_water.png', @@ -3034,52 +3017,23 @@ function grafico_incidente_prioridad() function graph_incidents_status() { global $config; - global $graphic_type; - $data = [ - 0, - 0, - 0, - 0, - ]; + + $integria_ticket_count_by_status_json = integria_api_call($config['integria_hostname'], $config['integria_user'], $config['integria_pass'], $config['integria_api_pass'], 'get_tickets_count', ['estado', 30], false, '', '|;|'); + + $integria_status_map_json = integria_api_call($config['integria_hostname'], $config['integria_user'], $config['integria_pass'], $config['integria_api_pass'], 'get_incidents_status', '', false, 'json'); + + $integria_ticket_count_by_status = json_decode($integria_ticket_count_by_status_json, true); + $integria_status_map = json_decode($integria_status_map_json, true); + + $integria_status_map_ids = array_column($integria_status_map, 'id'); + $integria_status_map_names = array_column($integria_status_map, 'name'); + $integria_status_map_indexed_by_id = array_combine($integria_status_map_ids, $integria_status_map_names); $data = []; - $data[__('Open incident')] = 0; - $data[__('Closed incident')] = 0; - $data[__('Outdated')] = 0; - $data[__('Invalid')] = 0; - $incidents = db_get_all_rows_filter( - 'tincidencia', - [ - 'estado' => [ - 0, - 2, - 3, - 13, - ], - ], - ['estado'] - ); - if ($incidents === false) { - $incidents = []; - } - - foreach ($incidents as $incident) { - if ($incident['estado'] == 0) { - $data[__('Open incident')]++; - } - - if ($incident['estado'] == 2) { - $data[__('Closed incident')]++; - } - - if ($incident['estado'] == 3) { - $data[__('Outdated')]++; - } - - if ($incident['estado'] == 13) { - $data[__('Invalid')]++; - } + foreach ($integria_ticket_count_by_status as $item) { + $status_name = $integria_status_map_indexed_by_id[$item['estado']]; + $data[__($status_name)] = $item['n_incidents']; } if ($config['fixed_graph'] == false) { @@ -3108,53 +3062,19 @@ function graph_incidents_status() function graphic_incident_group() { global $config; - global $graphic_type; + + $integria_ticket_count_by_group_json = integria_api_call($config['integria_hostname'], $config['integria_user'], $config['integria_pass'], $config['integria_api_pass'], 'get_tickets_count', ['id_grupo', 30], false, '', '|;|'); + + $integria_group_map_json = integria_api_call($config['integria_hostname'], $config['integria_user'], $config['integria_pass'], $config['integria_api_pass'], 'get_groups', '', false, 'json'); + + $integria_ticket_count_by_group = json_decode($integria_ticket_count_by_group_json, true); + $integria_group_map = json_decode($integria_group_map_json, true); $data = []; - $max_items = 5; - switch ($config['dbtype']) { - case 'mysql': - $sql = sprintf( - 'SELECT COUNT(id_incidencia) n_incidents, nombre - FROM tincidencia,tgrupo - WHERE tgrupo.id_grupo = tincidencia.id_grupo - GROUP BY tgrupo.id_grupo, nombre ORDER BY 1 DESC LIMIT %d', - $max_items - ); - break; - case 'oracle': - $sql = sprintf( - 'SELECT COUNT(id_incidencia) n_incidents, nombre - FROM tincidencia,tgrupo - WHERE tgrupo.id_grupo = tincidencia.id_grupo - AND rownum <= %d - GROUP BY tgrupo.id_grupo, nombre ORDER BY 1 DESC', - $max_items - ); - break; - } - - $incidents = db_get_all_rows_sql($sql); - - $sql = sprintf( - 'SELECT COUNT(id_incidencia) n_incidents - FROM tincidencia - WHERE tincidencia.id_grupo = 0' - ); - - $incidents_all = db_get_value_sql($sql); - - if ($incidents == false) { - $incidents = []; - } - - foreach ($incidents as $incident) { - $data[$incident['nombre']] = $incident['n_incidents']; - } - - if ($incidents_all > 0) { - $data[__('All')] = $incidents_all; + foreach ($integria_ticket_count_by_group as $item) { + $group_name = $integria_group_map[$item['id_grupo']]; + $data[__($group_name)] = $item['n_incidents']; } if ($config['fixed_graph'] == false) { @@ -3188,47 +3108,15 @@ function graphic_incident_group() function graphic_incident_user() { global $config; - global $graphic_type; + + $integria_ticket_count_by_user_json = integria_api_call($config['integria_hostname'], $config['integria_user'], $config['integria_pass'], $config['integria_api_pass'], 'get_tickets_count', ['id_usuario', 30], false, '', '|;|'); + + $integria_ticket_count_by_user = json_decode($integria_ticket_count_by_user_json, true); $data = []; - $max_items = 5; - switch ($config['dbtype']) { - case 'mysql': - $sql = sprintf( - 'SELECT COUNT(id_incidencia) n_incidents, id_usuario - FROM tincidencia - GROUP BY id_usuario - ORDER BY 1 DESC LIMIT %d', - $max_items - ); - break; - case 'oracle': - $sql = sprintf( - 'SELECT COUNT(id_incidencia) n_incidents, id_usuario - FROM tincidencia - WHERE rownum <= %d - GROUP BY id_usuario - ORDER BY 1 DESC', - $max_items - ); - break; - } - - $incidents = db_get_all_rows_sql($sql); - - if ($incidents == false) { - $incidents = []; - } - - foreach ($incidents as $incident) { - if ($incident['id_usuario'] == false) { - $name = __('System'); - } else { - $name = $incident['id_usuario']; - } - - $data[$name] = $incident['n_incidents']; + foreach ($integria_ticket_count_by_user as $item) { + $data[__($item['id_usuario'])] = $item['n_incidents']; } if ($config['fixed_graph'] == false) { diff --git a/pandora_console/include/functions_integriaims.php b/pandora_console/include/functions_integriaims.php index 166abec5cd..f95ce1b67a 100644 --- a/pandora_console/include/functions_integriaims.php +++ b/pandora_console/include/functions_integriaims.php @@ -161,22 +161,32 @@ function integriaims_get_details($details, $detail_index=false) * @param string User password. * @param string API password. * @param string API Operation. - * @param array Array with parameters required by the API function. + * @param mixed String or array with parameters required by the API function. * * @return boolean True if API request succeeded, false if API request failed. */ -function integria_api_call($api_hostname, $user, $user_pass, $api_pass, $operation, $params_array=[], $show_credentials_error_msg=false) +function integria_api_call($api_hostname, $user, $user_pass, $api_pass, $operation, $params='', $show_credentials_error_msg=false, $return_type='', $token='') { - $params_string = implode(',', $params_array); + if (is_array($params)) { + $params = implode($token, $params); + } $url_data = [ 'user' => $user, 'user_pass' => $user_pass, 'pass' => $api_pass, 'op' => $operation, - 'params' => html_entity_decode($params_string), + 'params' => html_entity_decode($params), ]; + if ($return_type !== '') { + $url_data['return_type'] = $return_type; + } + + if ($token !== '') { + $url_data['token'] = $token; + } + // Build URL for API request. $url = $api_hostname.'/integria/include/api.php'; @@ -355,7 +365,10 @@ function get_tickets_integriaims($tickets_filters) '0', $incident_owner, $incident_creator, - ] + ], + false, + '', + ',' ); // Return array of api call 'get_incidents'. diff --git a/pandora_console/operation/agentes/ver_agente.php b/pandora_console/operation/agentes/ver_agente.php index fdbd6905f5..a2a1b1e737 100644 --- a/pandora_console/operation/agentes/ver_agente.php +++ b/pandora_console/operation/agentes/ver_agente.php @@ -1239,8 +1239,7 @@ if ($config['activate_gis']) { // Incident tab. -$total_incidents = agents_get_count_incidents($id_agente); -if ($total_incidents > 0) { +if ($config['integria_enabled']) { $incidenttab['text'] = '<a href="index.php?sec=gagente&sec2=operation/agentes/ver_agente&tab=incident&id_agente='.$id_agente.'">'.html_print_image('images/book_edit.png', true, ['title' => __('Incidents')]).'</a>'; if ($tab == 'incident') { @@ -1369,11 +1368,9 @@ $onheader = [ ]; -// Added after it exists -// If the agent has incidents associated. -if ($total_incidents) { - $onheader['incident'] = $incidenttab; -} + +$onheader['incident'] = $incidenttab; + if ($agent['url_address'] != '') { $onheader['url_address'] = $urladdresstab; diff --git a/pandora_console/operation/incidents/configure_integriaims_incident.php b/pandora_console/operation/incidents/configure_integriaims_incident.php index 4fed803927..e41a043286 100644 --- a/pandora_console/operation/incidents/configure_integriaims_incident.php +++ b/pandora_console/operation/incidents/configure_integriaims_incident.php @@ -37,12 +37,12 @@ if ($update) { // Check if Integria integration enabled. if ($config['integria_enabled'] == 0) { - ui_print_error_message(__('Integria integration must be enabled in Pandora setup')); + ui_print_error_message(__('In order to access ticket management system, integration with Integria IMS must be enabled and properly configured')); return; } // Check connection to Integria IMS API. -$has_connection = integria_api_call($config['integria_hostname'], $config['integria_user'], $config['integria_pass'], $config['integria_api_pass'], 'get_login', []); +$has_connection = integria_api_call($config['integria_hostname'], $config['integria_user'], $config['integria_pass'], $config['integria_api_pass'], 'get_login'); if ($has_connection === false) { ui_print_error_message(__('Integria IMS API is not reachable')); @@ -59,19 +59,19 @@ $integria_users_values = []; $integria_types_values = []; $integria_status_values = []; -$integria_groups_csv = integria_api_call($config['integria_hostname'], $config['integria_user'], $config['integria_pass'], $config['integria_api_pass'], 'get_groups', []); +$integria_groups_csv = integria_api_call($config['integria_hostname'], $config['integria_user'], $config['integria_pass'], $config['integria_api_pass'], 'get_groups'); get_array_from_csv_data_pair($integria_groups_csv, $integria_group_values); -$integria_status_csv = integria_api_call($config['integria_hostname'], $config['integria_user'], $config['integria_pass'], $config['integria_api_pass'], 'get_incidents_status', []); +$integria_status_csv = integria_api_call($config['integria_hostname'], $config['integria_user'], $config['integria_pass'], $config['integria_api_pass'], 'get_incidents_status'); get_array_from_csv_data_pair($integria_status_csv, $integria_status_values); -$integria_criticity_levels_csv = integria_api_call($config['integria_hostname'], $config['integria_user'], $config['integria_pass'], $config['integria_api_pass'], 'get_incident_priorities', []); +$integria_criticity_levels_csv = integria_api_call($config['integria_hostname'], $config['integria_user'], $config['integria_pass'], $config['integria_api_pass'], 'get_incident_priorities'); get_array_from_csv_data_pair($integria_criticity_levels_csv, $integria_criticity_values); -$integria_users_csv = integria_api_call($config['integria_hostname'], $config['integria_user'], $config['integria_pass'], $config['integria_api_pass'], 'get_users', []); +$integria_users_csv = integria_api_call($config['integria_hostname'], $config['integria_user'], $config['integria_pass'], $config['integria_api_pass'], 'get_users'); $csv_array = explode("\n", $integria_users_csv); @@ -81,7 +81,7 @@ foreach ($csv_array as $csv_line) { } } -$integria_types_csv = integria_api_call($config['integria_hostname'], $config['integria_user'], $config['integria_pass'], $config['integria_api_pass'], 'get_types', []); +$integria_types_csv = integria_api_call($config['integria_hostname'], $config['integria_user'], $config['integria_pass'], $config['integria_api_pass'], 'get_types'); get_array_from_csv_data_pair($integria_types_csv, $integria_types_values); @@ -105,7 +105,7 @@ $incident_content = str_replace(',', ':::', $incident_content); // Perform action. if ($create_incident === true) { // Call Integria IMS API method to create an incident. - $result_api_call = integria_api_call($config['integria_hostname'], $incident_creator, $config['integria_pass'], $config['integria_api_pass'], 'create_incident', [$incident_title, $incident_group_id, $incident_criticity_id, $incident_content, '', $incident_type, '', $incident_owner, '0', $incident_status]); + $result_api_call = integria_api_call($config['integria_hostname'], $incident_creator, $config['integria_pass'], $config['integria_api_pass'], 'create_incident', [$incident_title, $incident_group_id, $incident_criticity_id, $incident_content, '', $incident_type, '', $incident_owner, '0', $incident_status], false, '', ','); // Necessary to explicitly set true if not false because function returns api call result in case of success instead of true value. $incident_created_ok = ($result_api_call != false) ? true : false; @@ -117,7 +117,7 @@ if ($create_incident === true) { ); } else if ($update_incident === true) { // Call Integria IMS API method to update an incident. - $result_api_call = integria_api_call($config['integria_hostname'], $config['integria_user'], $config['integria_pass'], $config['integria_api_pass'], 'update_incident', [$incident_id_edit, $incident_title, $incident_content, '', $incident_group_id, $incident_criticity_id, 0, $incident_status, $incident_owner, 0, $incident_type]); + $result_api_call = integria_api_call($config['integria_hostname'], $config['integria_user'], $config['integria_pass'], $config['integria_api_pass'], 'update_incident', [$incident_id_edit, $incident_title, $incident_content, '', $incident_group_id, $incident_criticity_id, 0, $incident_status, $incident_owner, 0, $incident_type], false, '', ','); // Necessary to explicitly set true if not false because function returns api call result in case of success instead of true value. $incident_updated_ok = ($result_api_call != false) ? true : false; @@ -132,7 +132,7 @@ if ($create_incident === true) { // If incident id is specified, retrieve incident values from api to populate combos with such values. if ($update) { // Call Integria IMS API method to get details of an incident given its id. - $result_api_call = integria_api_call($config['integria_hostname'], $config['integria_user'], $config['integria_pass'], $config['integria_api_pass'], 'get_incident_details', [$incident_id_edit]); + $result_api_call = integria_api_call($config['integria_hostname'], $config['integria_user'], $config['integria_pass'], $config['integria_api_pass'], 'get_incident_details', [$incident_id_edit], false, '', ','); // API call does not return indexes, therefore future modifications of API function in Integria IMS may lead to inconsistencies when accessing resulting array in this file. $incident_details_separator = explode(',', $result_api_call); diff --git a/pandora_console/operation/incidents/dashboard_detail_integriaims_incident.php b/pandora_console/operation/incidents/dashboard_detail_integriaims_incident.php index 423ec8075d..f5111c0343 100644 --- a/pandora_console/operation/incidents/dashboard_detail_integriaims_incident.php +++ b/pandora_console/operation/incidents/dashboard_detail_integriaims_incident.php @@ -27,7 +27,7 @@ if (!check_acl($config['id_user'], 0, 'IR')) { // Check if Integria integration enabled. if ($config['integria_enabled'] == 0) { - ui_print_error_message(__('Integria integration must be enabled in Pandora setup')); + ui_print_error_message(__('In order to access ticket management system, integration with Integria IMS must be enabled and properly configured')); return; } diff --git a/pandora_console/operation/incidents/incident.php b/pandora_console/operation/incidents/incident.php deleted file mode 100755 index 8b8029e3c0..0000000000 --- a/pandora_console/operation/incidents/incident.php +++ /dev/null @@ -1,503 +0,0 @@ -<script type="text/javascript"> - - $( document ).ready(function() { - - $('[id^=checkbox-id_inc]').change(function(){ - if($(this).parent().parent().hasClass('checkselected')){ - $(this).parent().parent().removeClass('checkselected'); - } - else{ - $(this).parent().parent().addClass('checkselected'); - } - }); - - $('[id^=checkbox-all_action]').change(function(){ - if ($("#checkbox-all_action").prop("checked")) { - $('[id^=checkbox-id_inc]').parent().parent().addClass('checkselected'); - $('[name^=id_inc]').prop("checked", true); - } - else{ - $('[id^=checkbox-id_inc]').parent().parent().removeClass('checkselected'); - $('[name^=id_inc]').prop("checked", false); - } - }); - - }); - -</script> - -<?php - -// Pandora FMS - http://pandorafms.com -// ================================================== -// Copyright (c) 2005-2021 Artica Soluciones Tecnologicas -// Please see http://pandorafms.org for full contribution list -// This program is free software; you can redistribute it and/or -// modify it under the terms of the GNU General Public License -// as published by the Free Software Foundation for version 2. -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -global $config; -require_once 'include/functions_incidents.php'; - -check_login(); - -$incident_r = check_acl($config['id_user'], 0, 'IR'); -$incident_w = check_acl($config['id_user'], 0, 'IW'); -$incident_m = check_acl($config['id_user'], 0, 'IM'); -$access = ($incident_r == true) ? 'IR' : (($incident_w == true) ? 'IW' : (($incident_m == true) ? 'IM' : 'IR')); - -if (!$incident_r && !$incident_w && !$incident_m) { - db_pandora_audit('ACL Violation', 'Trying to access incident viewer'); - include 'general/noaccess.php'; - exit; -} - -// Header -ui_print_page_header( - __('Incident management'), - 'images/book_edit.png', - false, - '', - false, - '' -); - -// Take input parameters -// Offset adjustment -if (isset($_GET['offset'])) { - $offset = get_parameter('offset'); -} else { - $offset = 0; -} - -// Check action. Try to get author and group -$action = get_parameter('action'); - -if ($action == 'mass') { - $id_inc = get_parameter('id_inc', []); - $delete_btn = get_parameter('delete_btn', -1); - $own_btn = get_parameter('own_btn', -1); - - foreach ($id_inc as $incident) { - if (check_acl($config['id_user'], incidents_get_group($incident), 'IM') || incidents_get_author($incident) == $config['id_user'] || incidents_get_owner($incident) == $config['id_user']) { - continue; - } - - db_pandora_audit('ACL Forbidden', 'Mass-update or deletion of incident'); - include 'general/noaccess.php'; - exit; - } - - if ($delete_btn != -1) { - $result = incidents_delete_incident($id_inc); - ui_print_result_message( - $result, - __('Successfully deleted'), - __('Could not be deleted') - ); - } - - if ($own_btn != -1) { - $result = incidents_process_chown($id_inc, $config['id_user']); - ui_print_result_message( - $result, - __('Successfully reclaimed ownership'), - __('Could not reclame ownership') - ); - } -} else if ($action == 'update') { - $id_inc = get_parameter('id_inc', 0); - $author = incidents_get_author($id_inc); - $owner = incidents_get_owner($id_inc); - $grupo = incidents_get_group($id_inc); - - if ($author != $config['id_user'] && $owner != $config['id_user'] && !check_acl($config['id_user'], $grupo, 'IM')) { - // Only admins (manage incident) or owners/creators can modify incidents - db_pandora_audit('ACL Forbidden', 'Update incident #'.$id_inc, $author); - include 'general/noaccess.php'; - exit; - } - - $titulo = get_parameter('titulo'); - $titulo = io_safe_input(strip_tags(io_safe_output($titulo))); - $descripcion = get_parameter('descripcion'); - $origen = get_parameter('origen_form'); - $prioridad = get_parameter('prioridad_form', 0); - $estado = get_parameter('estado_form', 0); - $grupo = get_parameter('grupo_form', 1); - $usuario = get_parameter('usuario_form', $config['id_user']); - $id_agent = get_parameter('id_agent'); - - $sql = sprintf( - "UPDATE tincidencia - SET titulo = '%s', origen = '%s', estado = %d, id_grupo = %d, id_usuario = '%s', prioridad = %d, descripcion = '%s', id_lastupdate = '%s', id_agent = %d - WHERE id_incidencia = %d", - $titulo, - $origen, - $estado, - $grupo, - $usuario, - $prioridad, - $descripcion, - $config['id_user'], - $id_agent, - $id_inc - ); - $result = db_process_sql($sql); - - if ($result !== false) { - db_pandora_audit('Incident updated', 'User '.$config['id_user'].' updated incident #'.$id_inc); - } - - ui_print_result_message( - $result, - __('Successfully updated'), - __('Could not be updated') - ); -} else if ($action == 'insert') { - // Create incident - $grupo = get_parameter('grupo_form', 1); - - if (!check_acl($config['id_user'], $grupo, 'IW')) { - db_pandora_audit('ACL Forbidden', 'User '.$config['id_user'].' tried to update incident'); - include 'general/noaccess.php'; - exit; - } - - // Read input variables - $titulo = get_parameter('titulo'); - $titulo = io_safe_input(strip_tags(io_safe_output($titulo))); - $descripcion = get_parameter('descripcion'); - $origen = get_parameter('origen_form'); - $prioridad = get_parameter('prioridad_form'); - $id_creator = $config['id_user']; - $estado = get_parameter('estado_form'); - $usuario = get_parameter('usuario_form', ''); - $id_agent = get_parameter('id_agent'); - - $sql = sprintf( - "INSERT INTO tincidencia - (inicio, actualizacion, titulo, descripcion, id_usuario, origen, estado, prioridad, id_grupo, id_creator, id_agent, id_agente_modulo) - VALUES - (NOW(), NOW(), '%s', '%s', '%s', '%s', %d, %d, '%s', '%s', %d, 0)", - $titulo, - $descripcion, - $usuario, - $origen, - $estado, - $prioridad, - $grupo, - $config['id_user'], - $id_agent - ); - $id_inc = db_process_sql($sql, 'insert_id'); - - if ($id_inc === false) { - ui_print_error_message(__('Error creating incident')); - } else { - ui_print_success_message(__('Incident created')); - db_pandora_audit('Incident created', 'User '.$config['id_user'].' created incident #'.$id_inc); - } -} - -// Search -$filter = ''; - -$texto = (string) get_parameter('texto', ''); -if ($texto != '') { - $filter .= sprintf(" AND (titulo LIKE '%%%s%%' OR descripcion LIKE '%%%s%%')", $texto, $texto); -} - -$usuario = (string) get_parameter('usuario', ''); -if ($usuario != '') { - $filter .= sprintf(" AND id_usuario = '%s'", $usuario); -} - -$estado = (int) get_parameter('estado', -1); -if ($estado >= 0) { - // -1 = All - $filter .= sprintf(' AND estado = %d', $estado); -} - -$grupo = (int) get_parameter('grupo', 0); -if ($grupo > 0) { - $filter .= sprintf(' AND id_grupo = %d', $grupo); - if (check_acl($config['id_user'], $grupo, 'IM') == 0) { - db_pandora_audit('ACL Forbidden', 'User tried to read incidents from group without access'); - include 'general/noaccess.php'; - exit; - } -} - -$prioridad = (int) get_parameter('prioridad', -1); -if ($prioridad != -1) { - // -1 = All - $filter .= sprintf(' AND prioridad = %d', $prioridad); -} - -$agent_search = (int) get_parameter('agent_search'); -if ($agent_search != 0) { - $filter .= sprintf(' AND id_agent = %d', $agent_search); -} - -$offset = (int) get_parameter('offset', 0); -$groups = users_get_groups($config['id_user'], 'IR'); - -// Select incidencts where the user has access to ($groups from -// get_user_groups), array_keys for the id, implode to pass to SQL -switch ($config['dbtype']) { - case 'mysql': - $sql = 'SELECT * FROM tincidencia WHERE - id_grupo IN ('.implode(',', array_keys($groups)).')'.$filter.' - ORDER BY actualizacion DESC LIMIT '.$offset.','.$config['block_size']; - $count_sql = 'SELECT count(*) FROM tincidencia WHERE - id_grupo IN ('.implode(',', array_keys($groups)).')'.$filter.' - ORDER BY actualizacion DESC'; - $total_sql = 'SELECT count(*) FROM tincidencia WHERE - id_grupo IN ('.implode(',', array_keys($groups)).') - ORDER BY actualizacion DESC'; - break; - - case 'postgresql': - case 'oracle': - $set = []; - $set['limit'] = $config['block_size']; - $set['offset'] = $offset; - $sql = 'SELECT * FROM tincidencia WHERE - id_grupo IN ('.implode(',', array_keys($groups)).')'.$filter.' - ORDER BY actualizacion DESC'; - $sql = oracle_recode_query($sql, $set); - $count_sql = 'SELECT count(*) FROM tincidencia WHERE - id_grupo IN ('.implode(',', array_keys($groups)).')'.$filter; - $total_sql = 'SELECT count(*) FROM tincidencia WHERE - id_grupo IN ('.implode(',', array_keys($groups)).')'; - break; -} - -$result = db_get_all_rows_sql($sql); -$count = db_get_value_sql($count_sql); -$count_total = db_get_value_sql($total_sql); - -if (empty($result)) { - $result = []; - $count = 0; -} - -if ($count_total >= 1) { - echo '<form name="visualizacion" method="post" action="index.php?sec=workspace&sec2=operation/incidents/incident">'; - - echo '<table class="databox filters" cellpadding="4" cellspacing="4" width="100%"><tr> - <td valign="middle"><h3>'.__('Filter').'</h3>'; - - $fields = incidents_get_status(); - echo '<b>'.__('Incidents:').'</b>'.' '; - html_print_select($fields, 'estado', $estado, 'javascript:this.form.submit();', __('All incidents'), -1, false, false, false, 'w155'); - - // Legend - echo '</td><td valign="middle"><noscript>'; - html_print_submit_button(__('Show'), 'submit-estado', false, ['class' => 'sub']); - - echo '</noscript></td><td rowspan="7" class="f9" style="padding-left: 30px; vertical-align: top;"><h3>'.__('Status').'</h3>'; - foreach (incidents_get_status() as $id => $str) { - incidents_print_status_img($id); - echo ' - '.$str.'<br />'; - } - - echo '</td><td rowspan="7" class="f9" style="padding-left: 30px; vertical-align: top;"><h3>'.__('Priority').'</h3>'; - foreach (incidents_get_priorities() as $id => $str) { - incidents_print_priority_img($id); - echo ' - '.$str.'<br />'; - } - - echo '</td></tr><tr><td>'; - - $fields = incidents_get_priorities(); - - echo '<b>'.__('Priorities:').'</b>'.' '; - html_print_select($fields, 'prioridad', $prioridad, 'javascript:this.form.submit();', __('All priorities'), -1, false, false, false, 'w155'); - - echo '</td></tr><tr><td>'; - - echo '<b>'.__('Users:').'</b>'.' '; - html_print_select(users_get_info(), 'usuario', $usuario, 'javascript:this.form.submit();', __('All users'), '', false, false, false, 'w155'); - - echo '</td></tr><tr><td>'; - - $agents_incidents = agents_get_agents(false, ['id_agente', 'nombre']); - - if ($agents_incidents === false) { - $agents_incidents = []; - } - - $result_agent_incidents = []; - foreach ($agents_incidents as $agent_incident) { - $result_agent_incidents[$agent_incident['id_agente']] = $agent_incident['nombre']; - } - - echo '<b>'.__('Agents:').'</b>'.' '; - html_print_select( - $result_agent_incidents, - 'agent_search', - $agent_search, - 'javascript:this.form.submit();', - __('All agents'), - '', - false, - false, - false, - 'w155' - ); - - echo '</td></tr><tr><td colspan=3>'; - - echo '<b>'.__('Groups:').'</b>'.' '; - echo '<div class="w250px inline">'; - html_print_select_groups($config['id_user'], 'IR', true, 'grupo', $grupo, 'javascript:this.form.submit();', '', '', false, false, false, 'w155'); - echo '</div>'; - - // echo " "; - echo '</td></tr><tr><td colspan=3>'; - - echo '<b>'.__('Free text:').'</b>'.ui_print_help_tip( - __('Search by incident name or description, list matches.'), - true - ).' '; - html_print_input_text('texto', $texto, '', 45); - echo ' '; - html_print_input_image('submit', 'images/zoom.png', __('Search'), 'padding:0;', false, ['alt' => __('Search')]); - - echo '</td></tr></table>'; - echo '</form>'; -} - -if ($count_total < 1) { - include_once $config['homedir'].'/general/first_task/incidents.php'; -} else { - // TOTAL incidents - $url = 'index.php?sec=workspace&sec2=operation/incidents/incident'; - - $estado = -1; - - // add form filter values for group, priority, state, and search fields: user and text - if ($grupo != -1) { - $url .= '&grupo='.$grupo; - } - - if ($prioridad != -1) { - $url .= '&prioridad='.$prioridad; - } - - if ($estado != -1) { - $url .= '&estado='.$estado; - } - - if ($usuario != '') { - $url .= '&usuario='.$usuario; - } - - if ($texto != '') { - $url .= '&texto='.$texto; - } - - // Show pagination - ui_pagination($count, $url, $offset, 0, false); - // ($count + $offset) it's real count of incidents because it's use LIMIT $offset in query. - echo '<br />'; - - // Show headers - $table->width = '100%'; - $table->class = 'info_table'; - $table->cellpadding = 0; - $table->cellspacing = 0; - $table->head = []; - $table->data = []; - $table->size = []; - $table->align = []; - - $table->head[0] = html_print_checkbox('all_action', 0, false, true, false); - $table->head[1] = __('ID'); - $table->head[2] = __('Status'); - $table->head[3] = __('Incident'); - $table->head[4] = __('Priority'); - $table->head[5] = __('Group'); - $table->head[6] = __('Updated'); - $table->head[7] = __('Source'); - $table->head[8] = __('Owner'); - - $table->size[0] = '20px'; - - $table->align[0] = 'left'; - $table->align[2] = 'left'; - $table->align[4] = 'left'; - $table->align[5] = 'left'; - - $rowPair = true; - $iterator = 0; - foreach ($result as $row) { - if ($rowPair) { - $table->rowclass[$iterator] = 'rowPair'; - } else { - $table->rowclass[$iterator] = 'rowOdd'; - } - - $rowPair = !$rowPair; - $iterator++; - - $data = []; - - if (check_acl($config['id_user'], $row['id_grupo'], 'IM') || $config['id_user'] == $row['id_usuario'] || $config['id_user'] == $row['id_creator']) { - $data[0] = html_print_checkbox('id_inc[]', $row['id_incidencia'], false, true); - } else { - $data[0] = ''; - } - - $data[1] = '<a href="index.php?sec=workspace&sec2=operation/incidents/incident_detail&id='.$row['id_incidencia'].'">'.$row['id_incidencia'].'</a>'; - $attach = incidents_get_attach($row['id_incidencia']); - - if (!empty($attach)) { - $data[1] .= ' '.html_print_image('images/attachment.png', true, ['style' => 'align:middle;']); - } - - $data[2] = incidents_print_status_img($row['estado'], true); - $data[3] = '<a href="index.php?sec=workspace&sec2=operation/incidents/incident_detail&id='.$row['id_incidencia'].'">'.ui_print_truncate_text(io_safe_output($row['titulo']), 'item_title').'</a>'; - $data[4] = incidents_print_priority_img($row['prioridad'], true); - $data[5] = ui_print_group_icon($row['id_grupo'], true); - $data[6] = ui_print_timestamp($row['actualizacion'], true); - $data[7] = $row['origen']; - if (empty($row['id_usuario'])) { - $data[8] = 'SYSTEM'; - } else { - $data[8] = ui_print_username($row['id_usuario'], true); - } - - array_push($table->data, $data); - } - - echo '<form method="post" action="'.$url.'&action=mass" style="margin-bottom: 0px;">'; - html_print_table($table); - echo '<div style="text-align:right; float:right;">'; - if (check_acl($config['id_user'], 0, 'IW')) { - html_print_submit_button(__('Delete incidents'), 'delete_btn', false, 'class="sub delete" style="margin-right: 5px;"'); - } - - if (check_acl($config['id_user'], 0, 'IM')) { - html_print_submit_button(__('Become owner'), 'own_btn', false, 'class="sub upd"'); - } - - echo '</div>'; - echo '</form>'; - unset($table); - if (check_acl($config['id_user'], 0, 'IW')) { - echo '<div style="text-align:right; float:right; padding-right: 5px;">'; - echo '<form method="post" action="index.php?sec=workspace&sec2=operation/incidents/incident_detail&insert_form=1">'; - html_print_submit_button(__('Create incident'), 'crt', false, 'class="sub next"'); - echo '</form>'; - echo '</div>'; - } -} - - -echo '<div style="clear:both"> </div>'; diff --git a/pandora_console/operation/incidents/incident_detail.php b/pandora_console/operation/incidents/incident_detail.php deleted file mode 100755 index 70288d29bf..0000000000 --- a/pandora_console/operation/incidents/incident_detail.php +++ /dev/null @@ -1,532 +0,0 @@ -<?php - -// Pandora FMS - http://pandorafms.com -// ================================================== -// Copyright (c) 2005-2021 Artica Soluciones Tecnologicas -// Please see http://pandorafms.org for full contribution list -// This program is free software; you can redistribute it and/or -// modify it under the terms of the GNU General Public License -// as published by the Free Software Foundation for version 2. -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// Load global vars -global $config; -require_once 'include/functions_incidents.php'; -require_once 'include/functions_events.php'; -// To get events group information -check_login(); - -if (! check_acl($config['id_user'], 0, 'IR') && ! check_acl($config['id_user'], 0, 'IW') && ! check_acl($config['id_user'], 0, 'IM')) { - // Doesn't have access to this page - db_pandora_audit('ACL Violation', 'Trying to access incident details'); - include 'general/noaccess.php'; - exit; -} - -$inicio = get_system_time(); -// Just inits the variable -$actualizacion = get_system_time(); - -// EDITION MODE -if (isset($_GET['id'])) { - $id_inc = (int) get_parameter('id', 0); - - // Obtain group of this incident - $row = db_get_row('tincidencia', 'id_incidencia', $id_inc); - - // Get values - $titulo = $row['titulo']; - $texto = $row['descripcion']; - $inicio = time_w_fixed_tz($row['inicio']); - $actualizacion = time_w_fixed_tz($row['actualizacion']); - $estado = $row['estado']; - $prioridad = $row['prioridad']; - $origen = $row['origen']; - $usuario = $row['id_usuario']; - // owner - $id_grupo = $row['id_grupo']; - $id_creator = $row['id_creator']; - // creator - $id_lastupdate = $row['id_lastupdate']; - // last updater - $id_agent = $row['id_agent']; - // Agent - // Note add - everybody that can read incidents, can add notes - if (isset($_GET['insertar_nota'])) { - $nota = get_parameter('nota'); - - $sql = sprintf( - "INSERT INTO tnota (id_usuario, id_incident, nota) - VALUES ('%s', %d, '%s')", - $config['id_user'], - $id_inc, - $nota - ); - $id_nota = db_process_sql($sql, 'insert_id'); - - if ($id_nota !== false) { - incidents_process_touch($id_inc); - } - - ui_print_result_message( - $id_nota, - __('Successfully added'), - __('Could not be added') - ); - } - - // Delete note - if (isset($_POST['delete_nota'])) { - $id_nota = get_parameter('delete_nota', 0); - $note_user = incidents_get_notes_author($id_nota); - if (((check_acl($config['id_user'], $id_grupo, 'IM') == 1) or ($note_user == $config['id_user'])) or ($id_owner == $config['id_user'])) { - // Only admins (manage incident) or owners can modify - // incidents notes. note authors are - // able to delete their own notes - $result = incidents_delete_note($id_nota); - - if (!empty($result)) { - incidents_process_touch($id_inc); - } - - ui_print_result_message( - $id_nota, - __('Successfully deleted'), - __('Could not be deleted') - ); - } - } - - // Delete file - if (((check_acl($config['id_user'], $id_grupo, 'IM') == 1) - or ($id_owner == $config['id_user'])) and isset($_POST['delete_file']) - ) { - $file_id = (int) get_parameter('delete_file', 0); - $filename = db_get_value('filename', 'tattachment', 'id_attachment', $file_id); - $sql = sprintf( - ' - DELETE - FROM tattachment - WHERE id_attachment = %d', - $file_id - ); - $result = db_process_sql($sql); - - if (!empty($result)) { - if (file_exists($config['homedir'].'/attachment/pand'.$row['id_attachment'].'_'.$row['filename'].'.zip')) { - unlink( - $config['attachment_store'].'/pand'.$file_id.'_'.io_safe_output($filename).'.zip' - ); - } else { - unlink( - $config['attachment_store'].'/pand'.$file_id.'_'.io_safe_output($filename) - ); - } - - - incidents_process_touch($id_inc); - } - - ui_print_result_message( - $result, - __('Successfully deleted'), - __('Could not be deleted') - ); - } - - // Upload file - if ((check_acl($config['id_user'], $id_grupo, 'IW') == 1) && isset($_GET['upload_file']) && ($_FILES['userfile']['name'] != '')) { - $description = get_parameter('file_description', __('No description available')); - - // Insert into database - $filename = strip_tags(io_safe_input($_FILES['userfile']['name']), '<br>'); - $filesize = io_safe_input($_FILES['userfile']['size']); - - // The following is if you have clamavlib installed - // (php5-clamavlib) and enabled in php.ini - // http://www.howtoforge.com/scan_viruses_with_php_clamavlib - if (extension_loaded('clamav')) { - cl_setlimits(5, 1000, 200, 0, 10485760); - $malware = cl_scanfile($_FILES['file']['tmp_name']); - if ($malware) { - $error = 'Malware detected: '.$malware.'<br>ClamAV version: '.clam_get_version(); - die($error); - // On malware, we die because it's not good to handle it - } - } - - $sql = sprintf( - "INSERT INTO tattachment (id_incidencia, id_usuario, filename, description, size) - VALUES (%d, '%s', '%s', '%s', %d)", - $id_inc, - $config['id_user'], - $filename, - $description, - $filesize - ); - - $id_attachment = db_process_sql($sql, 'insert_id'); - - // Copy file to directory and change name - if ($id_attachment !== false) { - $nombre_archivo = $config['attachment_store'].'/pand'.$id_attachment.'_'.$_FILES['userfile']['name']; - - - $zip = new ZipArchive; - - if ($zip->open($nombre_archivo.'.zip', ZIPARCHIVE::CREATE) === true) { - $zip->addFile($_FILES['userfile']['tmp_name'], io_safe_output($filename)); - $zip->close(); - } - - - // $result = copy ($_FILES['userfile']['tmp_name'], $nombre_archivo); - } else { - ui_print_error_message(__('File could not be saved due to database error')); - $result = false; - } - - if ($result !== false) { - unlink($_FILES['userfile']['tmp_name']); - incidents_process_touch($id_inc); - } else { - db_process_sql('DELETE FROM tattachment WHERE id_attachment = '.$id_attachment); - } - - ui_print_result_message( - $result, - __('File uploaded'), - __('File could not be uploaded') - ); - } -} //end if -// Create incident from event... read event data -else if (isset($_GET['insert_form'])) { - $titulo = ''; - $descripcion = ''; - $origen = ''; - $prioridad = 0; - $id_grupo = 0; - $estado = 0; - $texto = ''; - $usuario = $config['id_user']; - $id_creator = $config['id_user']; - $id_grupo = 0; - $id_agent = 0; - - if (isset($_GET['from_event'])) { - $event = get_parameter('from_event'); - $texto = io_safe_output(events_get_description($event)); - $titulo = ui_print_truncate_text(events_get_description($event), 'description', false, true, false); - $id_grupo = events_get_group($event); - $origen = 'Pandora FMS Event'; - $id_agent = db_get_value('id_agente', 'tevento', 'id_evento', $event); - unset($event); - } - - $prioridad = 0; -} else { - db_pandora_audit('HACK', 'Trying to get to incident details in an unusual way'); - include 'general/noaccess.php'; - exit; -} - - - -// ******************************************************************************************************** -// ******************************************************************************************************** -// Show the form -// ******************************************************************************************************** -// This is for the pretty slide down attachment form -echo "<script type=\"text/javascript\"> - $(document).ready(function() { - $('#file_control').hide(); - $('#add_note').hide(); - $('a.attachment').click(function() { - $('a.attachment').fadeOut('fast'); - $('#file_control').slideDown('slow'); - return false; - }); - $('a.note_control').click(function() { - $('a.note_control').fadeOut('fast'); - $('#add_note').slideDown('slow'); - return false; - }); - }); - </script>"; - -if (isset($id_inc)) { - // If $id_inc is set (when $_GET["id"] is set, not $_GET["insert_form"] - ui_print_page_header(__('Incident details').' #'.$id_inc, 'images/book_edit.png', false, '', false, ''); - echo '<form name="accion_form" method="POST" action="index.php?sec=workspace&sec2=operation/incidents/incident&action=update">'; - echo '<input type="hidden" name="id_inc" value="'.$id_inc.'">'; -} else { - ui_print_page_header(__('Create incident'), 'images/book_edit.png', false, '', false, ''); - echo '<form name="accion_form" method="POST" action="index.php?sec=workspace&sec2=operation/incidents/incident&action=insert">'; -} - -echo '<table cellpadding="4" cellspacing="4" class="databox filters" width="100%">'; -echo '<tr> - <td class="datos"><b>'.__('Incident').'</b></td> - <td colspan="3" class="datos">'; - -if ((check_acl($config['id_user'], $id_grupo, 'IM') == 1) - or ($usuario == $config['id_user']) -) { - html_print_input_text('titulo', $titulo, '', 70); -} else { - html_print_input_text_extended('titulo', $titulo, '', '', 70, '', false, '', 'readonly'); -} - -echo '</td> - </tr>'; - -echo '<tr> - <td class="datos2"><b>'.__('Opened at').'</b></td> - <td class="datos2"><i>'.date($config['date_format'], $inicio).'</i></td> - <td class="datos2"><b>'.__('Updated at').'</b></td> - <td class="datos2"><i>'.date($config['date_format'], $actualizacion).'</i></td> - </tr>'; - -echo '<tr> - <td class="datos"><b>'.__('Owner').'</b></td> - <td class="datos">'; - -if ((check_acl($config['id_user'], $id_grupo, 'IM') == 1) or ($usuario == $config['id_user'])) { - html_print_select(users_get_info(), 'usuario_form', $usuario, '', 'SYSTEM', '', false, false, true, 'w135'); -} else { - html_print_select(users_get_info(), 'usuario_form', $usuario, '', 'SYSTEM', '', false, false, true, 'w135', true); -} - -echo '</td> - <td class="datos"><b>'.__('Status').'</b></td> - <td class="datos">'; - -if ((check_acl($config['id_user'], $id_grupo, 'IM') == 1) or ($usuario == $config['id_user'])) { - html_print_select(incidents_get_status(), 'estado_form', $estado, '', '', '', false, false, false, 'w135'); -} else { - html_print_select(incidents_get_status(), 'estado_form', $estado, '', '', '', false, false, false, 'w135', true); -} - -echo '</td> - </tr>'; - -echo '<tr> - <td class="datos2"><b>'.__('Source').'</b></td> - <td class="datos2">'; - -$fields = []; -$return = db_get_all_rows_sql('SELECT origen FROM torigen ORDER BY origen'); -if ($return === false) { - $return[0] = $estado; - // Something must be displayed -} - -foreach ($return as $row) { - $fields[$row['origen']] = $row['origen']; -} - -// Only owner could change source or user with Incident management privileges -if ((check_acl($config['id_user'], $id_grupo, 'IM') == 1) or ($usuario == $config['id_user'])) { - html_print_select($fields, 'origen_form', $origen, '', '', '', false, false, false, 'w135'); -} else { - html_print_select($fields, 'origen_form', $origen, '', '', '', false, false, false, 'w135', true); -} - -echo '</td><td class="datos2"><b>'.__('Group').'</b></td><td class="datos2">'; - -// Group combo -echo '<div class="w250px">'; -if ((check_acl($config['id_user'], $id_grupo, 'IM') == 1) or ($usuario == $config['id_user'])) { - html_print_select_groups($config['id_user'], 'IR', true, 'grupo_form', $id_grupo, '', '', '', false, false, false, 'w135'); -} else { - html_print_select_groups($config['id_user'], 'IR', true, 'grupo_form', $id_grupo, '', '', '', false, false, true, 'w135', true); -} - -echo '</div>'; -echo '</td></tr><tr><td class="datos"><b>'.__('Priority').'</b></td><td class="datos">'; - -if ((check_acl($config['id_user'], $id_grupo, 'IM') == 1) or ($usuario == $config['id_user'])) { - html_print_select(incidents_get_priorities(), 'prioridad_form', $prioridad, '', '', '', false, false, false, 'w135'); -} else { - html_print_select(incidents_get_priorities(), 'prioridad_form', $prioridad, '', '', '', false, false, false, 'w135', true); -} - -echo '</td><td class="datos"><b>'.__('Creator').'</b></td><td class="datos">'; -if (empty($id_creator)) { - echo 'SYSTEM'; -} else { - echo $id_creator.' (<i>'.get_user_fullname($id_creator).'</i>)'; -} - -$agents_incidents = agents_get_agents(false, ['id_agente', 'nombre']); - -if ($agents_incidents === false) { - $agents_incidents = []; -} - -foreach ($agents_incidents as $agent_incident) { - $result_agent_incidents[$agent_incident['id_agente']] = $agent_incident['nombre']; -} - -echo '</td>'; -echo '</tr>'; - -echo '<tr>'; -echo '<td class="datos"><b>'.__('Agent').'</b></td>'; -echo '<td class="datos">'; -$params = []; -$params['show_helptip'] = true; -$params['input_name'] = 'agent'; -$params['value'] = db_get_value('alias', 'tagente', 'id_agente', $id_agent); -$params['print_hidden_input_idagent'] = true; -$params['hidden_input_idagent_value'] = $id_agent; -$params['hidden_input_idagent_name'] = 'id_agent'; -ui_print_agent_autocomplete_input($params); -echo '</td>'; -echo '</tr>'; -echo '<tr><td class="datos2" colspan="4">'; - -if ((check_acl($config['id_user'], $id_grupo, 'IM') == 1) or ($usuario == $config['id_user'])) { - html_print_textarea('descripcion', 15, 80, $texto, 'style="height:200px;"'); -} else { - html_print_textarea('descripcion', 15, 80, $texto, 'style="height:200px;" disabled'); -} - -echo '</td></tr></table><div style="width: 100%; text-align:right;">'; - -// Only if user is the used who opened incident or (s)he is admin -if (isset($id_inc) and ((check_acl($config['id_user'], $id_grupo, 'IM') == 1) or ($usuario == $config['id_user']))) { - html_print_submit_button(__('Update incident'), 'accion', false, 'class="sub upd"'); -} else if (check_acl($config['id_user'], $id_grupo, 'IW')) { - html_print_submit_button(__('Create'), 'accion', false, 'class="sub wand"'); -} else { - html_print_submit_button(__('Submit'), 'accion', true, 'class="sub upd"'); -} - -echo '</div></form>'; - -// If we're actually working on an incident -if (isset($id_inc)) { - // ****************************************************************** - // Notes - // ****************************************************************** - echo '<div>'; - - echo '<a class="note_control" href="#">'; - echo html_print_image('images/add.png', true); - echo __('Add note'); - echo '</a>'; - echo '</div><div>'; - echo '<form id="add_note" name="nota" method="POST" action="index.php?sec=workspace&sec2=operation/incidents/incident_detail&insertar_nota=1&id='.$id_inc.'"><h4>'.__('Add note').'</h4>'; - - echo '<table cellpadding="4" cellspacing="4" class="databox" width="100%"> - <tr><td class="datos2"><textarea name="nota" rows="5" cols="70" style="height: 100px;"></textarea></td> - <td valign="bottom"><input name="addnote" type="submit" class="sub wand" value="'.__('Add').'"></td></tr> - </table></form></div><div>'; - - $result = incidents_get_notes($id_inc); - - $table->cellpadding = 4; - $table->cellspacing = 4; - $table->class = 'databox'; - $table->width = '98%'; - $table->data = []; - $table->head = []; - - foreach ($result as $row) { - $data = []; - $data[0] = html_print_image('images/page_white_text.png', true, ['border' => '0']); - $data[1] = __('Author').': '.ui_print_username($row['id_usuario'], true).' ('.ui_print_timestamp($row['timestamp'], true).')'; - array_push($table->data, $data); - - $data = []; - $data[0] = ''; - if ((check_acl($config['id_user'], $id_grupo, 'IM') == 1) or ($row['id_usuario'] == $config['id_user'])) { - $data[0] .= html_print_input_image('delete_nota', 'images/cross.png', $row['id_nota'], 'border:0px;" onClick="if (!confirm(\' '.__('Are you sure?').'\')) return false;', true); - } - - $data[1] = $row['nota']; - array_push($table->data, $data); - } - - if (!empty($table->data)) { - echo '<h4>'.__('Notes attached to incident').'</h4>'; - echo '<form method="POST" action="index.php?sec=workspace&sec2=operation/incidents/incident_detail&id='.$id_inc.'">'; - html_print_table($table); - echo '</form>'; - } - - unset($table); - - - // ****************************************************************** - // Files attached to this incident - // ****************************************************************** - $result = incidents_get_attach($id_inc); - - $table->cellpadding = 4; - $table->cellspacing = 4; - $table->class = 'databox'; - $table->width = '98%'; - $table->head = []; - $table->data = []; - - $table->head[0] = __('Filename'); - $table->head[1] = __('Description'); - $table->head[2] = __('Size'); - $table->head[3] = __('Delete'); - - $table->align[2] = 'center'; - $table->align[3] = 'center'; - - foreach ($result as $row) { - if (file_exists($config['homedir'].'/attachment/pand'.$row['id_attachment'].'_'.io_safe_output($row['filename']).'.zip')) { - $url = 'attachment/pand'.$row['id_attachment'].'_'.io_safe_output($row['filename']).'.zip'; - } else { - $url = 'attachment/pand'.$row['id_attachment'].'_'.io_safe_output($row['filename']); - } - - $data[0] = html_print_image('images/disk.png', true, ['border' => '0', 'align' => 'top']).' <a target="_new" href="'.$url.'"><b>'.$row['filename'].'</b></a>'; - $data[1] = $row['description']; - $data[2] = format_for_graph($row['size']).'B'; - if ((check_acl($config['id_user'], $id_grupo, 'IM') == 1) or ($usuario == $config['id_user'])) { - $data[3] = html_print_input_image('delete_file', 'images/cross.png', $row['id_attachment'], 'border:0px;" onClick="if (!confirm(\' '.__('Are you sure?').'\')) return false;', true); - } else { - $data[3] = ''; - } - - array_push($table->data, $data); - } - - if (!empty($table->data)) { - echo '<h4>'.__('Attached files').'</h4>'; - echo '<form method="POST" action="index.php?sec=workspace&sec2=operation/incidents/incident_detail&id='.$id_inc.'">'; - html_print_table($table); - echo '</form>'; - } - - unset($table); - - // ****************************************************************** - // Upload control - // ****************************************************************** - // Upload control - if ((check_acl($config['id_user'], $id_grupo, 'IW') == 1)) { - echo '<div>'; - echo '<a class="attachment" href="#">'; - echo html_print_image('images/add.png', true); - echo __('Add attachment'); - echo '</a>'; - echo '</div>'; - - echo '<div><form method="post" id="file_control" action="index.php?sec=workspace&sec2=operation/incidents/incident_detail&id='.$id_inc.'&upload_file=1" enctype="multipart/form-data"><h4>'.__('Add attachment').'</h4>'; - echo '<table cellpadding="4" cellspacing="3" class="databox" width="98%"> - <tr><td class="datos">'.__('Filename').'</td><td class="datos"><input type="file" name="userfile" value="userfile" class="sub" size="40" /></td></tr> - <tr><td class="datos2">'.__('Description').'</td><td class="datos2" colspan="3"><input type="text" name="file_description" size="47"></td></tr> - <tr><td colspan="2" style="text-align: right;"> <input type="submit" name="upload" value="'.__('Upload').'" class="sub wand"></td></tr> - </table></form></div>'; - } -} diff --git a/pandora_console/operation/incidents/incident_statistics.php b/pandora_console/operation/incidents/incident_statistics.php index 7cabe749d7..af1867264f 100755 --- a/pandora_console/operation/incidents/incident_statistics.php +++ b/pandora_console/operation/incidents/incident_statistics.php @@ -26,6 +26,11 @@ if (! check_acl($config['id_user'], 0, 'IR') && ! check_acl($config['id_user'], ui_print_page_header(__('Incidents').' » '.__('Statistics'), 'images/book_edit.png', false, '', false, ''); +if (!$config['integria_enabled']) { + ui_print_error_message(__('In order to access ticket management system, integration with Integria IMS must be enabled and properly configured')); + exit; +} + echo '<table width="90%"> <tr><td valign="top"><h3>'.__('Incidents by status').'</h3>'; echo graph_incidents_status(); @@ -39,7 +44,4 @@ echo graphic_incident_group(); echo '<td><h3>'.__('Incidents by user').'</h3>'; echo graphic_incident_user(); -echo '<tr><td><h3>'.__('Incidents by source').'</h3>'; -echo graphic_incident_source(); - echo '</table>'; diff --git a/pandora_console/operation/incidents/list_integriaims_incidents.php b/pandora_console/operation/incidents/list_integriaims_incidents.php index f18fb31566..7dd39c44ea 100644 --- a/pandora_console/operation/incidents/list_integriaims_incidents.php +++ b/pandora_console/operation/incidents/list_integriaims_incidents.php @@ -38,7 +38,7 @@ ui_print_page_header( // Check if Integria integration enabled. if ($config['integria_enabled'] == 0) { - ui_print_error_message(__('Integria integration must be enabled in Pandora setup')); + ui_print_error_message(__('In order to access ticket management system, integration with Integria IMS must be enabled and properly configured')); return; } diff --git a/pandora_console/operation/menu.php b/pandora_console/operation/menu.php index 87a3da3af1..d1256ae7e1 100644 --- a/pandora_console/operation/menu.php +++ b/pandora_console/operation/menu.php @@ -500,9 +500,8 @@ if (check_acl($config['id_user'], 0, 'IR') ]; $sub2 = []; - $sub2['operation/incidents/incident']['text'] = __('List of Incidents'); - $sub2[$sec2sub]['text'] = __('Statistics'); - $sub2['operation/incidents/list_integriaims_incidents']['text'] = __('Integria IMS Tickets'); + $sub2[$sec2sub]['text'] = __('Integria IMS statistics'); + $sub2['operation/incidents/list_integriaims_incidents']['text'] = __('Integria IMS ticket list'); $sub[$sec2]['sub2'] = $sub2; $sec2 = $temp_sec2; diff --git a/pandora_server/lib/PandoraFMS/Core.pm b/pandora_server/lib/PandoraFMS/Core.pm index cffa235f04..ba5820ee9d 100644 --- a/pandora_server/lib/PandoraFMS/Core.pm +++ b/pandora_server/lib/PandoraFMS/Core.pm @@ -44,8 +44,6 @@ Exported Functions: =item * C<pandora_create_group> -=item * C<pandora_create_incident> - =item * C<pandora_create_module> =item * C<pandora_disable_autodisable_agents> @@ -161,6 +159,9 @@ use LWP::Simple; use IO::Socket::INET6; use LWP::UserAgent; use HTTP::Request::Common; +use URI::URL; +use LWP::UserAgent; +use JSON; # For IPv6 support in Net::HTTP. BEGIN { @@ -179,7 +180,6 @@ our @EXPORT = qw( pandora_create_agent pandora_create_alert_command pandora_create_group - pandora_create_incident pandora_create_module pandora_create_module_from_hash pandora_create_module_from_network_component @@ -254,6 +254,8 @@ our @EXPORT = qw( pandora_self_monitoring pandora_sample_agent pandora_process_policy_queue + pandora_sync_agents_integria + pandora_get_integria_ticket_types subst_alert_macros subst_column_macros locate_agent @@ -1564,6 +1566,12 @@ sub pandora_execute_action ($$$$$$$$$;$) { # Integria IMS Ticket } elsif ($clean_name eq "Integria IMS Ticket") { + my $config_integria_enabled = pandora_get_tconfig_token ($dbh, 'integria_enabled', ''); + + if (!$config_integria_enabled) { + return; + } + my $config_api_path = pandora_get_tconfig_token ($dbh, 'integria_hostname', ''); my $config_api_pass = pandora_get_tconfig_token ($dbh, 'integria_api_pass', ''); my $config_integria_user = pandora_get_tconfig_token ($dbh, 'integria_user', ''); @@ -1575,6 +1583,9 @@ sub pandora_execute_action ($$$$$$$$$;$) { $field5 = subst_alert_macros ($field5, \%macros, $pa_config, $dbh, $agent, $module, $alert); $field6 = subst_alert_macros ($field6, \%macros, $pa_config, $dbh, $agent, $module, $alert); $field7 = subst_alert_macros ($field7, \%macros, $pa_config, $dbh, $agent, $module, $alert); + $field8 = subst_alert_macros ($field8, \%macros, $pa_config, $dbh, $agent, $module, $alert); + $field9 = subst_alert_macros ($field9, \%macros, $pa_config, $dbh, $agent, $module, $alert); + $field10 = subst_alert_macros ($field10, \%macros, $pa_config, $dbh, $agent, $module, $alert); # Field 1 (Integria IMS API path) my $api_path = $config_api_path . "/integria/include/api.php"; @@ -1627,7 +1638,18 @@ sub pandora_execute_action ($$$$$$$$$;$) { # Field 7 (Ticket description); my $ticket_description = safe_output($field7); - pandora_create_integria_ticket($pa_config, $api_path, $api_pass, $integria_user, $integria_user_pass, $ticket_name, $ticket_group_id, $ticket_priority, $ticket_owner, $ticket_type, $ticket_status, $ticket_description); + my $create_wu_on_close_recovery = 0; + + if ($alert_mode == RECOVERED_ALERT && $action->{'create_wu_integria'} == '1') { + $create_wu_on_close_recovery = 1; + } + + # Ticket type custom fields + my $ticket_custom_field1 = $field8; + my $ticket_custom_field2 = $field9; + my $ticket_custom_field3 = $field10; + + pandora_create_integria_ticket($pa_config, $api_path, $api_pass, $integria_user, $integria_user_pass, $agent->{'nombre'}, $agent->{'alias'}, $agent->{'id_os'}, $agent->{'direccion'}, $agent->{'id_agente'}, $agent->{'id_grupo'}, $ticket_name, $ticket_group_id, $ticket_priority, $ticket_owner, $ticket_type, $ticket_status, $ticket_description, $create_wu_on_close_recovery, $ticket_custom_field1, $ticket_custom_field2, $ticket_custom_field3); # Generate notification } elsif ($clean_name eq "Generate Notification") { @@ -3040,27 +3062,6 @@ sub pandora_module_keep_alive ($$$$$) { } } -########################################################################## -=head2 C<< pandora_create_incident (I<$pa_config>, I<$dbh>, I<$title>, I<$text>, I<$priority>, I<$status>, I<$origin>, I<$id_group>) >> - -Create an internal Pandora incident. - -=cut -########################################################################## -sub pandora_create_incident ($$$$$$$$;$) { - my ($pa_config, $dbh, $title, $text, - $priority, $status, $origin, $id_group, $owner) = @_; - - logger($pa_config, "Creating incident '$text' source '$origin'.", 8); - - # Initialize default parameters - $owner = '' unless defined ($owner); - - db_do($dbh, 'INSERT INTO tincidencia (inicio, titulo, descripcion, origen, estado, prioridad, id_grupo, id_usuario) - VALUES (NOW(), ?, ?, ?, ?, ?, ?, ?)', $title, $text, $origin, $status, $priority, $id_group, $owner); -} - - ########################################################################## =head2 C<< pandora_audit (I<$pa_config>, I<$description>, I<$name>, I<$action>, I<$dbh>) >> @@ -6213,30 +6214,51 @@ sub pandora_edit_custom_graph ($$$$$$$$$$$) { return $res; } -sub pandora_create_integria_ticket ($$$$$$$$$$$) { - my ($pa_config,$api_path,$api_pass,$integria_user,$user_pass,$ticket_name,$ticket_group_id,$ticket_priority,$ticket_owner,$ticket_type,$ticket_status,$ticket_description) = @_; +sub pandora_create_integria_ticket ($$$$$$$$$$$$$$$$$$$$$$) { + my ($pa_config,$api_path,$api_pass,$integria_user,$user_pass,$agent_name,$agent_alias,$agent_os,$agent_addr,$agent_id,$agent_group,$ticket_name,$ticket_group_id,$ticket_priority,$ticket_owner,$ticket_type,$ticket_status,$ticket_description, $create_wu_on_close_recovery, $ticket_custom_field1, $ticket_custom_field2, $ticket_custom_field3) = @_; + + use URI::URL; + use URI::Escape; + use HTML::Entities; my $data_ticket; my $call_api; - $data_ticket = $ticket_name . + my $uri = URI->new($api_path); + + if ($uri->scheme eq "") { + $api_path = "http://" . $api_path; + } + + my $ticket_create_wu = 0; + + if ($create_wu_on_close_recovery == 1 && $ticket_status eq '7') { + $ticket_create_wu = 1; + } + + $data_ticket = $agent_name . + "|;|" . uri_escape(decode_entities($agent_alias)) . + "|;|" . $agent_os . + "|;|" . $agent_addr . + "|;|" . $agent_id . + "|;|" . $agent_group . + "|;|" . $ticket_name . "|;|" . $ticket_group_id . "|;|" . $ticket_priority . "|;|" . $ticket_description . - "|;|" . "|;|" . $ticket_type . - "|;|" . "|;|" . $ticket_owner . - "|;|" . "|;|" . $ticket_status . - "|;|" . - "|;|"; - + "|;|" . $ticket_create_wu . + "|;|" . $ticket_custom_field1 . + "|;|" . $ticket_custom_field2 . + "|;|" . $ticket_custom_field3; + $call_api = $api_path . '?' . 'user=' . $integria_user . '&' . 'user_pass=' . $user_pass . '&' . 'pass=' . $api_pass . '&' . - 'op=create_incident&' . + 'op=create_pandora_ticket&' . 'params=' . $data_ticket .'&' . 'token=|;|'; @@ -6250,6 +6272,86 @@ sub pandora_create_integria_ticket ($$$$$$$$$$$) { } } +sub pandora_sync_agents_integria ($) { + my ($dbh) = @_; + + my $config_integria_enabled = pandora_get_tconfig_token ($dbh, 'integria_enabled', ''); + + if (!$config_integria_enabled) { + return; + } + + my $config_api_path = pandora_get_tconfig_token ($dbh, 'integria_hostname', ''); + my $config_api_pass = pandora_get_tconfig_token ($dbh, 'integria_api_pass', ''); + my $config_integria_user = pandora_get_tconfig_token ($dbh, 'integria_user', ''); + my $config_integria_user_pass = pandora_get_tconfig_token ($dbh, 'integria_pass', ''); + + my $api_path = $config_api_path . "/integria/include/api.php"; + + my @agents_string = ''; + my @agents = get_db_rows ($dbh, 'SELECT * FROM tagente'); + + my @agents_array = (); + my $agents_string = ''; + + foreach my $agent (@agents) { + push @agents_array, $agent->{'nombre'} . + "|;|" . + $agent->{'alias'} . + "|;|" . + $agent->{'id_os'} . + "|;|" . + $agent->{'direccion'} . + "|;|" . + $agent->{'id_grupo'}; + } + + my $ua = LWP::UserAgent->new(); + my $response = $ua->post( $api_path, { + 'user' => $config_integria_user, + 'user_pass' => $config_integria_user_pass, + 'pass' => $config_api_pass, + 'op' => 'sync_pandora_agents_inventory', + 'params[]' => [@agents_array], + 'token' => '|;|' + }); + + my $content = $response->decoded_content(); + + if (defined $content && is_numeric($content) && $content ne "-1") { + return $content; + } + else { + return 0; + } +} + +sub pandora_get_integria_ticket_types($) { + my ($dbh) = @_; + + my $config_api_path = pandora_get_tconfig_token ($dbh, 'integria_hostname', ''); + my $config_api_pass = pandora_get_tconfig_token ($dbh, 'integria_api_pass', ''); + my $config_integria_user = pandora_get_tconfig_token ($dbh, 'integria_user', ''); + my $config_integria_user_pass = pandora_get_tconfig_token ($dbh, 'integria_pass', ''); + + my $api_path = $config_api_path . "/integria/include/api.php"; + + my $call_api = $api_path . '?' . + 'user=' . $config_integria_user . '&' . + 'user_pass=' . $config_integria_user_pass . '&' . + 'pass=' . $config_api_pass . '&' . + 'op=get_types&' . + 'return_type=json'; + + my $content = get($call_api); + + my @decoded_json; + @decoded_json = @{decode_json($content)} if (defined $content && $content ne ""); + + return @decoded_json; + +} + ########################################################################## =head2 C<< pandora_input_password (I<$pa_config>, I<$password>) >> diff --git a/pandora_server/util/pandora_db.pl b/pandora_server/util/pandora_db.pl index af5663158c..4b58381ce9 100755 --- a/pandora_server/util/pandora_db.pl +++ b/pandora_server/util/pandora_db.pl @@ -1086,6 +1086,39 @@ if ($lock == 0 && $conf{'_force'} == 0) { # Main pandoradb_main(\%conf, $dbh, $history_dbh); +# history_dbh is unset in pandoradb_main if not in use. +if (defined($history_dbh)) { + log_message('', " [>] DB Tool running on historical database.\n"); + my $h_conf = pandoradb_load_history_conf($history_dbh); + + # Keep base settings. + $h_conf->{'_onlypurge'} = $conf{'_onlypurge'}; + + # Re-launch maintenance process for historical database. + pandoradb_main( + $h_conf, + $history_dbh, + undef + ); + +} + +# Keep integrity between PandoraFMS agents and IntegriaIMS inventory objects. +pandora_sync_agents_integria($dbh); + +# Get Integria IMS ticket types for alert commands. +my @types = pandora_get_integria_ticket_types($dbh); + +if (scalar(@types) != 0) { + my $query_string = ''; + foreach my $type (@types) { + $query_string .= $type->{'id'} . ',' . $type->{'name'} . ';'; + } + + db_do($dbh, "UPDATE talert_commands SET fields_descriptions='[\"Ticket title\",\"Ticket group ID\",\"Ticket priority\",\"Ticket owner\",\"Ticket type\",\"Ticket status\",\"Ticket description\",\"_integria_type_custom_field_\",\"_integria_type_custom_field_\",\"_integria_type_custom_field_\"]' WHERE name=\"Integria IMS Ticket\""); + db_do($dbh, "UPDATE talert_commands SET fields_values='[\"\", \"\", \"\",\"\",\"" . $query_string . "\",\"\",\"\",\"_integria_type_custom_field_\",\"_integria_type_custom_field_\", \"_integria_type_custom_field_\"]' WHERE name=\"Integria IMS Ticket\""); +} + # Release the lock if ($lock == 1) { db_release_lock ($dbh, 'pandora_db'); diff --git a/pandora_server/util/pandora_manage.pl b/pandora_server/util/pandora_manage.pl index 4a2ff349d0..6b13b697fc 100755 --- a/pandora_server/util/pandora_manage.pl +++ b/pandora_server/util/pandora_manage.pl @@ -202,8 +202,6 @@ sub help_screen{ help_screen_line('--validate_event_id', '<event_id>', 'Validate event given a event id'); help_screen_line('--get_event_info', '<event_id>[<csv_separator>]', 'Show info about a event given a event id'); help_screen_line('--add_event_comment', '<event_id> <user_name> <comment>', 'Add event\'s comment'); - print "\nINCIDENTS:\n\n" unless $param ne ''; - help_screen_line('--create_incident', "<title> <description> <origin> <status> <priority 0 for Informative, \n\t 1 for Low, 2 for Medium, 3 for Serious, 4 for Very serious or 5 for Maintenance>\n\t <group> [<owner>]", 'Create incidents'); print "\nPOLICIES:\n\n" unless $param ne ''; help_screen_line('--apply_policy', '<id_policy> [<id_agent> <name(boolean)> <id_server>]', 'Force apply a policy in an agent'); help_screen_line('--apply_all_policies', '', 'Force apply to all the policies'); @@ -4364,21 +4362,6 @@ sub cli_add_event_comment() { pandora_update_event_from_hash ($update, 'id_evento', $id_event, $dbh); } -############################################################################## -# Create incident. -# Related option: --create_incident -############################################################################## - -sub cli_create_incident() { - my ($title, $description, $origin, $status, $priority, $group_name, $owner) = @ARGV[2..8]; - - my $id_group = get_group_id($dbh,$group_name); - exist_check($id_group,'group',$group_name); - - pandora_create_incident ($conf, $dbh, $title, $description, $priority, $status, $origin, $id_group, $owner); - print_log "[INFO] Creating incident '$title'\n\n"; -} - ############################################################################## # Delete data. # Related option: --delete_data @@ -7392,10 +7375,6 @@ sub pandora_manage_main ($$$) { param_check($ltotal, 3); cli_add_event_comment(); } - elsif ($param eq '--create_incident') { - param_check($ltotal, 7, 1); - cli_create_incident(); - } elsif ($param eq '--delete_data') { param_check($ltotal, 4, 2); cli_delete_data($ltotal); diff --git a/pandora_server/util/recon_scripts/wmi-recon.pl b/pandora_server/util/recon_scripts/wmi-recon.pl index 53bb697b0d..513a5ac08a 100755 --- a/pandora_server/util/recon_scripts/wmi-recon.pl +++ b/pandora_server/util/recon_scripts/wmi-recon.pl @@ -136,13 +136,6 @@ sub recon_scan($$) { # Mark the recon task as done. update_recon_task ($DBH, $task->{'id_rt'}, -1); - - # Create an incident. - if (defined($ADDED_HOSTS[0]) && $task->{'create_incident'} == 1) { - my $text = "At " . strftime ("%Y-%m-%d %H:%M:%S", localtime()) . " (". scalar(@ADDED_HOSTS) . ") new hosts were detected by Pandora FMS WMI Recon Script running on [" . $CONF{'servername'} . "_Recon]. This incident has been automatically created following instructions for this recon task [" . $task->{'id_group'} . "].\n\n"; - $text .= "\n\nThis is the list of IP addresses found: \n\n" . join(',', @ADDED_HOSTS); - pandora_create_incident (\%CONF, $DBH, "[RECON] New hosts detected", $text, 0, 0, 'Pandora FMS Recon Server', $task->{'id_group'}); - } } ########################################################################## @@ -369,6 +362,5 @@ die("Error retrieving recon task ID $TASK_ID\n") unless defined($task); # Scan! $task->{'subnet'} = $NETWORKS; $task->{'id_group'} = $GROUP_ID; -$task->{'create_incident'} = $CREATE_INCIDENT; recon_scan($task, \&wmi_scan); From ab68bcf1d6f5ddbcf64fba08d99115c33b6ddb39 Mon Sep 17 00:00:00 2001 From: "rafael.ameijeiras" <rafael.ameijeiras@artica.es> Date: Thu, 4 Mar 2021 12:13:16 +0100 Subject: [PATCH 20/61] adding permissions to apache group --- pandora_server/pandora_server_installer | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandora_server/pandora_server_installer b/pandora_server/pandora_server_installer index 9c1c2f0c06..bd5dae4aae 100755 --- a/pandora_server/pandora_server_installer +++ b/pandora_server/pandora_server_installer @@ -313,7 +313,7 @@ install () { mkdir $DESTDIR$PANDORA_SPOOL/data_in/commands 2> /dev/null chmod 2770 $DESTDIR$PANDORA_SPOOL/data_in/commands mkdir -p $DESTDIR$PANDORA_LOG 2> /dev/null - chown -R pandora $DESTDIR$PANDORA_LOG 2> /dev/null + chown -R pandora:apache $DESTDIR$PANDORA_LOG 2> /dev/null chmod 2774 $DESTDIR$PANDORA_LOG 2> /dev/null echo "Giving proper permission to /var/spool/pandora" From b117bbfd7e10314e2a586624181206693d4cb67f Mon Sep 17 00:00:00 2001 From: "alejandro.campos@artica.es" <alejandro.campos@artica.es> Date: Thu, 4 Mar 2021 16:27:14 +0100 Subject: [PATCH 21/61] Refactored downtime editor --- .../agentes/planned_downtime.editor.php | 879 +++++++++--------- 1 file changed, 452 insertions(+), 427 deletions(-) diff --git a/pandora_console/godmode/agentes/planned_downtime.editor.php b/pandora_console/godmode/agentes/planned_downtime.editor.php index 662ff019bb..e9d2720508 100644 --- a/pandora_console/godmode/agentes/planned_downtime.editor.php +++ b/pandora_console/godmode/agentes/planned_downtime.editor.php @@ -70,6 +70,7 @@ ui_print_page_header( // Recursion group filter. $recursion = get_parameter('recursion', $_POST['recursion']); + // Initialize data. $id_group = (int) get_parameter('id_group'); $name = (string) get_parameter('name'); @@ -142,144 +143,9 @@ $user_groups_ad = array_keys( users_get_groups($config['id_user'], $access) ); -// Check AD permission on downtime. -$downtime_group = db_get_value( - 'id_group', - 'tplanned_downtime', - 'id', - $id_downtime -); - -if ($id_downtime > 0) { - if (!check_acl_restricted_all($config['id_user'], $downtime_group, 'AW') - && !check_acl_restricted_all($config['id_user'], $downtime_group, 'AD') - ) { - db_pandora_audit( - 'ACL Violation', - 'Trying to access downtime scheduler' - ); - include 'general/noaccess.php'; - return; - } -} - // INSERT A NEW DOWNTIME_AGENT ASSOCIATION. if ($insert_downtime_agent === 1) { - if ($downtime_group === false - || !in_array($downtime_group, $user_groups_ad) - ) { - db_pandora_audit( - 'ACL Violation', - 'Trying to access downtime scheduler' - ); - include 'general/noaccess.php'; - return; - } - - $agents = (array) get_parameter('id_agents'); - $module_names = (array) get_parameter('module'); - - $all_modules = ($modules_selection_mode === 'all' && (empty($module_names) || (int) $modules[0] === 0)); - $all_common_modules = ($modules_selection_mode === 'common' && (empty($module_names) || (int) $modules[0] === 0)); - - if ($all_common_modules === true) { - $module_names = explode(',', get_parameter('all_common_modules')); - } - - // 'Is running' check. - $is_running = (bool) db_get_value( - 'executed', - 'tplanned_downtime', - 'id', - $id_downtime - ); - if ($is_running) { - ui_print_error_message( - __('This elements cannot be modified while the downtime is being executed') - ); - } else { - // If is selected 'Any', get all the agents. - if (count($agents) === 1 && (int) $agents[0] === -2) { - $all_agents = get_parameter('all_agents'); - $agents = explode(',', $all_agents); - } - - foreach ($agents as $agent_id) { - // Check module belongs to the agent. - if ($modules_selection_mode == 'all' && $all_modules === false) { - $check = false; - foreach ($module_names as $module_name) { - $check_module = modules_get_agentmodule_id( - $module_name, - $agent_id - ); - if (!empty($check_module)) { - $check = true; - } - } - - if (!$check) { - continue; - } - } - - // Check AD permission on agent. - $agent_group = db_get_value( - 'id_grupo', - 'tagente', - 'id_agente', - $agent_id - ); - - if ($agent_group === false - || !in_array($agent_group, $user_groups_ad) - ) { - continue; - } - - $values = [ - 'id_downtime' => $id_downtime, - 'id_agent' => $agent_id, - 'all_modules' => $all_modules, - ]; - $result = db_process_sql_insert( - 'tplanned_downtime_agents', - $values - ); - - if ($result && !$all_modules) { - foreach ($module_names as $module_name) { - $module = modules_get_agentmodule_id( - $module_name, - $agent_id - ); - - if (empty($module)) { - continue; - } - - $values = [ - 'id_downtime' => $id_downtime, - 'id_agent' => $agent_id, - 'id_agent_module' => $module['id_agente_modulo'], - ]; - $result = db_process_sql_insert( - 'tplanned_downtime_modules', - $values - ); - - if ($result) { - $values = ['id_user' => $config['id_user']]; - $result = db_process_sql_update( - 'tplanned_downtime', - $values, - ['id' => $id_downtime] - ); - } - } - } - } - } + insert_downtime_agent($id_downtime, $user_groups_ad); } // DELETE A DOWNTIME_AGENT ASSOCIATION. @@ -485,10 +351,6 @@ if ($create_downtime || $update_downtime) { 'date_to' => $datetime_to, 'id_user' => $config['id_user'], ]; - } else if ($is_running) { - ui_print_error_message( - __('Cannot be modified while the downtime is being executed') - ); } else { $values = [ 'name' => $name, @@ -519,12 +381,18 @@ if ($create_downtime || $update_downtime) { } } - if (!empty($values)) { - $result = db_process_sql_update( - 'tplanned_downtime', - $values, - ['id' => $id_downtime] + if ($is_running) { + ui_print_error_message( + __('Cannot be modified while the downtime is being executed') ); + } else { + if (!empty($values)) { + $result = db_process_sql_update( + 'tplanned_downtime', + $values, + ['id' => $id_downtime] + ); + } } } @@ -537,6 +405,9 @@ if ($create_downtime || $update_downtime) { } else { if ($create_downtime && $name && !$check) { $id_downtime = $result; + + insert_downtime_agent($id_downtime, $user_groups_ad); + ui_print_success_message(__('Successfully created')); } else if ($update_downtime && $name) { ui_print_success_message(__('Successfully updated')); @@ -579,8 +450,8 @@ if ($id_downtime > 0) { case 'postgresql': $columns_str = implode(',', $columns); $sql = "SELECT $columns_str - FROM tplanned_downtime - WHERE id = $id_downtime"; + FROM tplanned_downtime + WHERE id = $id_downtime"; break; case 'oracle': @@ -602,8 +473,8 @@ if ($id_downtime > 0) { $columns_str = implode(',', $columns); $sql = "SELECT $columns_str - FROM tplanned_downtime - WHERE id = $id_downtime"; + FROM tplanned_downtime + WHERE id = $id_downtime"; break; } @@ -667,20 +538,11 @@ $table->data[0][1] = html_print_input_text( true, $disabled_in_execution ); - -$return_all_group = false; - -if (users_can_manage_group_all('AW') === true - || users_can_manage_group_all('AD') === true -) { - $return_all_group = true; -} - $table->data[1][0] = __('Group'); $table->data[1][1] = '<div class="w250px">'.html_print_select_groups( false, $access, - $return_all_group, + true, 'id_group', $id_group, '', @@ -745,23 +607,23 @@ $days = array_combine(range(1, 31), range(1, 31)); $table->data[5][0] = __('Configure the time').' '; ; $table->data[5][1] = " - <div id='once_time' style='display: none;'> - <table> - <tr> - <td>".__('From:').'</td> - <td>'.html_print_input_text('once_date_from', $once_date_from, '', 10, 10, true, $disabled_in_execution).html_print_input_text('once_time_from', $once_time_from, '', 9, 9, true, $disabled_in_execution).'</td> - </tr> - <tr> - <td>'.__('To:').'</td> - <td>'.html_print_input_text('once_date_to', $once_date_to, '', 10, 10, true).html_print_input_text('once_time_to', $once_time_to, '', 9, 9, true)."</td> - </tr> - </table> - </div> - <div id='periodically_time' style='display: none;'> - <table> - <tr><td>".ui_get_using_system_timezone_warning().'</td></tr> - <tr> - <td>'.__('Type Periodicity:').' '.html_print_select( + <div id='once_time' style='display: none;'> + <table> + <tr> + <td>".__('From:').'</td> + <td>'.html_print_input_text('once_date_from', $once_date_from, '', 10, 10, true, $disabled_in_execution).html_print_input_text('once_time_from', $once_time_from, '', 9, 9, true, $disabled_in_execution).'</td> + </tr> + <tr> + <td>'.__('To:').'</td> + <td>'.html_print_input_text('once_date_to', $once_date_to, '', 10, 10, true).html_print_input_text('once_time_to', $once_time_to, '', 9, 9, true)."</td> + </tr> + </table> + </div> + <div id='periodically_time' style='display: none;'> + <table> + <tr><td>".ui_get_using_system_timezone_warning().'</td></tr> + <tr> + <td>'.__('Type Periodicity:').' '.html_print_select( [ 'weekly' => __('Weekly'), 'monthly' => __('Monthly'), @@ -777,24 +639,24 @@ $table->data[5][1] = " '', $disabled_in_execution )."</td> - </tr> - <tr> - <td colspan='2'> - <table id='weekly_item' style='display: none;'> - <tr> - <td>".__('Mon').html_print_checkbox('monday', 1, $monday, true, $disabled_in_execution).'</td> - <td>'.__('Tue').html_print_checkbox('tuesday', 1, $tuesday, true, $disabled_in_execution).'</td> - <td>'.__('Wed').html_print_checkbox('wednesday', 1, $wednesday, true, $disabled_in_execution).'</td> - <td>'.__('Thu').html_print_checkbox('thursday', 1, $thursday, true, $disabled_in_execution).'</td> - <td>'.__('Fri').html_print_checkbox('friday', 1, $friday, true, $disabled_in_execution).'</td> - <td>'.__('Sat').html_print_checkbox('saturday', 1, $saturday, true, $disabled_in_execution).'</td> - <td>'.__('Sun').html_print_checkbox('sunday', 1, $sunday, true, $disabled_in_execution)."</td> - </tr> - </table> - <table id='monthly_item' style='display: none;'> - <tr> - <td>".__('From day:').'</td> - <td>'.html_print_select( + </tr> + <tr> + <td colspan='2'> + <table id='weekly_item' style='display: none;'> + <tr> + <td>".__('Mon').html_print_checkbox('monday', 1, $monday, true, $disabled_in_execution).'</td> + <td>'.__('Tue').html_print_checkbox('tuesday', 1, $tuesday, true, $disabled_in_execution).'</td> + <td>'.__('Wed').html_print_checkbox('wednesday', 1, $wednesday, true, $disabled_in_execution).'</td> + <td>'.__('Thu').html_print_checkbox('thursday', 1, $thursday, true, $disabled_in_execution).'</td> + <td>'.__('Fri').html_print_checkbox('friday', 1, $friday, true, $disabled_in_execution).'</td> + <td>'.__('Sat').html_print_checkbox('saturday', 1, $saturday, true, $disabled_in_execution).'</td> + <td>'.__('Sun').html_print_checkbox('sunday', 1, $sunday, true, $disabled_in_execution)."</td> + </tr> + </table> + <table id='monthly_item' style='display: none;'> + <tr> + <td>".__('From day:').'</td> + <td>'.html_print_select( $days, 'periodically_day_from', $periodically_day_from, @@ -807,8 +669,8 @@ $table->data[5][1] = " '', $disabled_in_execution ).'</td> - <td>'.__('To day:').'</td> - <td>'.html_print_select( + <td>'.__('To day:').'</td> + <td>'.html_print_select( $days, 'periodically_day_to', $periodically_day_to, @@ -821,13 +683,13 @@ $table->data[5][1] = " '', $disabled_in_execution ).'</td> - <td>'.ui_print_help_tip(__('The end day must be higher than the start day'), true).'</td> - </tr> - </table> - <table> - <tr> - <td>'.__('From hour:').'</td> - <td>'.html_print_input_text( + <td>'.ui_print_help_tip(__('The end day must be higher than the start day'), true).'</td> + </tr> + </table> + <table> + <tr> + <td>'.__('From hour:').'</td> + <td>'.html_print_input_text( 'periodically_time_from', $periodically_time_from, '', @@ -839,8 +701,8 @@ $table->data[5][1] = " __('The end time must be higher than the start time'), true ).'</td> - <td>'.__('To hour:').'</td> - <td>'.html_print_input_text( + <td>'.__('To hour:').'</td> + <td>'.html_print_input_text( 'periodically_time_to', $periodically_time_to, '', @@ -852,23 +714,135 @@ $table->data[5][1] = " __('The end time must be higher than the start time'), true ).'</td> - </tr> - </table> - </td> - </tr> - </table> - </div>'; - -echo '<form method="POST" action="index.php?sec=extensions&sec2=godmode/agentes/planned_downtime.editor">'; + </tr> + </table> + </td> + </tr> + </table> + </div>'; if ($id_downtime > 0) { - echo '<table width=100% border=0 cellpadding=4 >'; - echo "<tr><td width=75% valign='top'>"; + echo "<form method=post action='index.php?sec=extensions&sec2=godmode/agentes/planned_downtime.editor&insert_downtime_agent=1&id_downtime=$id_downtime'>"; +} else { + echo '<form method="POST" action="index.php?sec=extensions&sec2=godmode/agentes/planned_downtime.editor">'; } // Editor form. html_print_table($table); +echo "<td valign=top style='width:300px;padding-left:20px;'>"; + +$filter_group = (int) get_parameter('filter_group', 0); + +// User AD groups to str for the filter. +$id_groups_str = implode(',', $user_groups_ad); + +if (empty($id_groups_str)) { + // Restrictive filter on error. This will filter all the downtimes. + $id_groups_str = '-1'; +} + +$filter_cond = ''; +if ($filter_group > 0) { + if ($recursion) { + $rg = groups_get_children_ids($filter_group, true); + $filter_cond .= ' AND id_grupo IN ('; + + $i = 0; + $len = count($rg); + + foreach ($rg as $key) { + if ($i == ($len - 1)) { + $filter_cond .= $key.')'; + } else { + $i++; + $filter_cond .= $key.','; + } + } + } else { + $filter_cond = " AND id_grupo = $filter_group "; + } +} + +$agents = get_planned_downtime_agents_list($id_downtime, $filter_cond, $id_groups_str); + +$disabled_add_button = false; +if (empty($agents) || $disabled_in_execution) { + $disabled_add_button = true; +} + +// Show available agents to include into downtime +$table = new StdClass(); +$table->class = 'databox filters'; +$table->width = '100%'; +$table->data = []; + +$table->data[0][0] = __('Group filter'); +$table->data[0][1] = html_print_select_groups(false, $access, true, 'filter_group', $filter_group, '', '', '', true, false, true, '', false, 'min-width:180px;margin-right:15px;'); +$table->data[0][2] = __('Recursion').'  '.html_print_checkbox('recursion', 1, $recursion, true, false, ''); + +$table->data[1][0] = __('Available agents'); +$table->data[1][1] = html_print_select($agents, 'id_agents[]', -1, '', _('Any'), -2, true, true, true, '', false, 'width: 180px;'); + + +if ($type_downtime != 'quiet') { + echo '<div id="available_modules_selection_mode" style="padding-top:20px;display: none;">'; +} else { + echo '<div id="available_modules_selection_mode" style="padding-top:20px">'; +} + +$table->data[2][1] = html_print_select( + [ + 'common' => __('Show common modules'), + 'all' => __('Show all modules'), + ], + 'modules_selection_mode', + 'common', + false, + '', + '', + true, + false, + true, + '', + false, + 'min-width:180px;' +); + +echo '</div>'; + +$table->data[3][0] = __('Available modules:').ui_print_help_tip( + __('Only for type Quiet for downtimes.'), + true +); + +if ($type_downtime != 'quiet') { + echo '<div id="available_modules" style="display: none;">'; +} else { + echo '<div id="available_modules" style="">'; +} + +$table->data[3][1] = html_print_select( + [], + 'module[]', + '', + '', + '', + 0, + true, + true, + true, + '', + false, + 'width: 180px;' +); +echo '</div>'; + +// Print agent table. +html_print_table($table); + +echo '<br /><br /><br />'; + html_print_input_hidden('id_agent', $id_agent); echo '<div class="action-buttons" style="width: 100%">'; if ($id_downtime > 0) { @@ -891,215 +865,97 @@ if ($id_downtime > 0) { } echo '</div>'; +html_print_input_hidden('all_agents', implode(',', array_keys($agents))); +html_print_input_hidden('all_common_modules', ''); echo '</form>'; -if ($id_downtime > 0) { - echo "<td valign=top style='width:300px;padding-left:20px;'>"; +// Start Overview of existing planned downtime. +echo '<h4>'.__('Agents planned for this downtime').':</h4>'; - $filter_group = (int) get_parameter('filter_group', 0); +// User the $id_groups_str built before. +$sql = sprintf( + 'SELECT ta.nombre, tpda.id, + ta.id_os, ta.id_agente, ta.id_grupo, + ta.ultimo_contacto, tpda.all_modules + FROM tagente ta + INNER JOIN tplanned_downtime_agents tpda + ON ta.id_agente = tpda.id_agent + AND tpda.id_downtime = %d + WHERE ta.id_grupo IN (%s)', + $id_downtime, + $id_groups_str +); +$downtimes_agents = db_get_all_rows_sql($sql); - // User AD groups to str for the filter. - $id_groups_str = implode(',', $user_groups_ad); +if (empty($downtimes_agents)) { + echo '<div class="nf">'.__('There are no agents').'</div>'; +} else { + $table = new stdClass(); + $table->id = 'list'; + $table->class = 'databox data'; + $table->width = '100%'; + $table->data = []; + $table->head = []; + $table->head[0] = __('Name'); + $table->head[1] = __('Group'); + $table->head[2] = __('OS'); + $table->head[3] = __('Last contact'); + $table->head['count_modules'] = __('Modules'); - if (empty($id_groups_str)) { - // Restrictive filter on error. This will filter all the downtimes. - $id_groups_str = '-1'; + if (!$running) { + $table->head[5] = __('Actions'); + $table->align[5] = 'center'; + $table->size[5] = '5%'; } - $filter_cond = ''; - if ($filter_group > 0) { - if ($recursion) { - $rg = groups_get_children_ids($filter_group, true); - $filter_cond .= ' AND id_grupo IN ('; + foreach ($downtimes_agents as $downtime_agent) { + $data = []; - $i = 0; - $len = count($rg); + $alias = db_get_value( + 'alias', + 'tagente', + 'id_agente', + $downtime_agent['id_agente'] + ); + $data[0] = $alias; - foreach ($rg as $key) { - if ($i == ($len - 1)) { - $filter_cond .= $key.')'; - } else { - $i++; - $filter_cond .= $key.','; - } - } + $data[1] = db_get_sql( + 'SELECT nombre + FROM tgrupo + WHERE id_grupo = '.$downtime_agent['id_grupo'] + ); + + $data[2] = ui_print_os_icon($downtime_agent['id_os'], true, true); + + $data[3] = $downtime_agent['ultimo_contacto']; + + if ($type_downtime == 'disable_agents_alerts') { + $data['count_modules'] = __('All alerts'); + } else if ($type_downtime == 'disable_agents') { + $data['count_modules'] = __('Entire agent'); } else { - $filter_cond = " AND id_grupo = $filter_group "; + if ($downtime_agent['all_modules']) { + $data['count_modules'] = __('All modules'); + } else { + $data['count_modules'] = __('Some modules'); + } } - } - - $agents = get_planned_downtime_agents_list($id_downtime, $filter_cond, $id_groups_str); - - $disabled_add_button = false; - if (empty($agents) || $disabled_in_execution) { - $disabled_add_button = true; - } - - echo "<form method=post action='index.php?sec=extensions&sec2=godmode/agentes/planned_downtime.editor&id_downtime=$id_downtime'>"; - html_print_select_groups(false, $access, true, 'filter_group', $filter_group, '', '', '', false, false, true, '', false, 'min-width:180px;margin-right:15px;'); - - html_print_checkbox('recursion', 1, $recursion, false, false, ''); - echo __('Recursion').' '; - echo '<br /><br />'; - html_print_submit_button(__('Filter by group'), '', false, 'class="sub next"', false); - echo '</form>'; - // Show available agents to include into downtime - echo '<h4>'.__('Available agents').':</h4>'; - echo "<form method=post action='index.php?sec=extensions&sec2=godmode/agentes/planned_downtime.editor&insert_downtime_agent=1&id_downtime=$id_downtime'>"; - html_print_input_hidden('all_agents', implode(',', array_keys($agents))); - echo html_print_select($agents, 'id_agents[]', -1, '', _('Any'), -2, false, true, true, '', false, 'width: 180px;'); - - if ($type_downtime != 'quiet') { - echo '<div id="available_modules_selection_mode" style="padding-top:20px;display: none;">'; - } else { - echo '<div id="available_modules_selection_mode" style="padding-top:20px">'; - } - - html_print_input_hidden('all_common_modules', ''); - echo html_print_select( - [ - 'common' => __('Show common modules'), - 'all' => __('Show all modules'), - ], - 'modules_selection_mode', - 'common', - false, - '', - '', - true, - false, - true, - '', - false, - 'min-width:180px;' - ); - echo '</div>'; - - echo '<h4>'.__('Available modules:').ui_print_help_tip( - __('Only for type Quiet for downtimes.'), - true - ).'</h4>'; - - if ($type_downtime != 'quiet') { - echo '<div id="available_modules" style="display: none;">'; - } else { - echo '<div id="available_modules" style="">'; - } - - echo html_print_select( - [], - 'module[]', - '', - '', - '', - 0, - false, - true, - true, - '', - false, - 'width: 180px;' - ); - echo '</div>'; - echo '<br /><br /><br />'; - html_print_submit_button( - __('Add'), - 'add_item', - $disabled_add_button, - 'class="sub next"', - false - ); - echo '</form>'; - echo '</table>'; - - // Start Overview of existing planned downtime. - echo '<h4>'.__('Agents planned for this downtime').':</h4>'; - - // User the $id_groups_str built before. - $sql = sprintf( - 'SELECT ta.nombre, tpda.id, - ta.id_os, ta.id_agente, ta.id_grupo, - ta.ultimo_contacto, tpda.all_modules - FROM tagente ta - INNER JOIN tplanned_downtime_agents tpda - ON ta.id_agente = tpda.id_agent - AND tpda.id_downtime = %d - WHERE ta.id_grupo IN (%s)', - $id_downtime, - $id_groups_str - ); - $downtimes_agents = db_get_all_rows_sql($sql); - - if (empty($downtimes_agents)) { - echo '<div class="nf">'.__('There are no agents').'</div>'; - } else { - $table = new stdClass(); - $table->id = 'list'; - $table->class = 'databox data'; - $table->width = '100%'; - $table->data = []; - $table->head = []; - $table->head[0] = __('Name'); - $table->head[1] = __('Group'); - $table->head[2] = __('OS'); - $table->head[3] = __('Last contact'); - $table->head['count_modules'] = __('Modules'); if (!$running) { - $table->head[5] = __('Actions'); - $table->align[5] = 'center'; - $table->size[5] = '5%'; - } - - foreach ($downtimes_agents as $downtime_agent) { - $data = []; - - $alias = db_get_value( - 'alias', - 'tagente', - 'id_agente', - $downtime_agent['id_agente'] - ); - $data[0] = $alias; - - $data[1] = db_get_sql( - 'SELECT nombre - FROM tgrupo - WHERE id_grupo = '.$downtime_agent['id_grupo'] - ); - - $data[2] = ui_print_os_icon($downtime_agent['id_os'], true, true); - - $data[3] = $downtime_agent['ultimo_contacto']; - - if ($type_downtime == 'disable_agents_alerts') { - $data['count_modules'] = __('All alerts'); - } else if ($type_downtime == 'disable_agents') { - $data['count_modules'] = __('Entire agent'); - } else { - if ($downtime_agent['all_modules']) { - $data['count_modules'] = __('All modules'); - } else { - $data['count_modules'] = __('Some modules'); - } + $data[5] = ''; + if ($type_downtime != 'disable_agents_alerts' + && $type_downtime != 'disable_agents' + ) { + $data[5] = '<a href="javascript:show_editor_module('.$downtime_agent['id_agente'].');">'.html_print_image('images/config.png', true, ['border' => '0', 'alt' => __('Delete')]).'</a>'; } - if (!$running) { - $data[5] = ''; - if ($type_downtime != 'disable_agents_alerts' - && $type_downtime != 'disable_agents' - ) { - $data[5] = '<a href="javascript:show_editor_module('.$downtime_agent['id_agente'].');">'.html_print_image('images/config.png', true, ['border' => '0', 'alt' => __('Delete')]).'</a>'; - } - - $data[5] .= '<a href="index.php?sec=extensions&sec2=godmode/agentes/planned_downtime.editor&id_agent='.$downtime_agent['id_agente'].'&delete_downtime_agent=1&id_downtime_agent='.$downtime_agent['id'].'&id_downtime='.$id_downtime.'">'.html_print_image('images/cross.png', true, ['border' => '0', 'alt' => __('Delete')]).'</a>'; - } - - $table->data['agent_'.$downtime_agent['id_agente']] = $data; + $data[5] .= '<a href="index.php?sec=extensions&sec2=godmode/agentes/planned_downtime.editor&id_agent='.$downtime_agent['id_agente'].'&delete_downtime_agent=1&id_downtime_agent='.$downtime_agent['id'].'&id_downtime='.$id_downtime.'">'.html_print_image('images/cross.png', true, ['border' => '0', 'alt' => __('Delete')]).'</a>'; } - html_print_table($table); + $table->data['agent_'.$downtime_agent['id_agente']] = $data; } + + html_print_table($table); } $table = new stdClass(); @@ -1125,20 +981,20 @@ $table->data['module'][1] = '<h4>'.__('Modules').'</h4>'; // List of modules, empty, it is populated by javascript. $table->data['module'][1] = " - <table cellspacing='4' cellpadding='4' border='0' width='100%' - id='modules_in_agent' class='databox_color'> - <thead> - <tr> - <th scope='col' class='header c0'>".__('Module')."</th> - <th scope='col' class='header c1'>".__('Action')."</th> - </tr> - </thead> - <tbody> - <tr class='datos' id='template' style='display: none;'> - <td class='name_module' style=''></td> - <td class='cell_delete_button' style='text-align: right; width:10%;' id=''>".'<a class="link_delete" - onclick="if(!confirm(\''.__('Are you sure?').'\')) return false;" - href="">'.html_print_image( + <table cellspacing='4' cellpadding='4' border='0' width='100%' + id='modules_in_agent' class='databox_color'> + <thead> + <tr> + <th scope='col' class='header c0'>".__('Module')."</th> + <th scope='col' class='header c1'>".__('Action')."</th> + </tr> + </thead> + <tbody> + <tr class='datos' id='template' style='display: none;'> + <td class='name_module' style=''></td> + <td class='cell_delete_button' style='text-align: right; width:10%;' id=''>".'<a class="link_delete" + onclick="if(!confirm(\''.__('Are you sure?').'\')) return false;" + href="">'.html_print_image( 'images/cross.png', true, [ @@ -1146,9 +1002,9 @@ $table->data['module'][1] = " 'alt' => __('Delete'), ] ).'</a>'."</td> - </tr> - <tr class='datos2' id='add_modules_row'> - <td class='datos2' style='' id=''>".__('Add Module:').' '.html_print_select( + </tr> + <tr class='datos2' id='add_modules_row'> + <td class='datos2' style='' id=''>".__('Add Module:').' '.html_print_select( [], 'modules', '', @@ -1157,16 +1013,16 @@ $table->data['module'][1] = " 0, true )."</td> - <td class='datos2 button_cell' style='text-align: right; width:10%;' id=''>".'<div id="add_button_div">'.'<a class="add_button" href="">'.html_print_image( + <td class='datos2 button_cell' style='text-align: right; width:10%;' id=''>".'<div id="add_button_div">'.'<a class="add_button" href="">'.html_print_image( 'images/add.png', true, [ 'border' => '0', - 'alt' => __('Add'), + 'alt' => __('Add444'), ] ).'</a>'.'</div>'."<div id='spinner_add' style='display: none;'>".html_print_image('images/spinner.gif', true).'</div>'.'</td> - </tr> - </tbody></table>'; + </tr> + </tbody></table>'; echo "<div style='display: none;'>"; html_print_table($table); @@ -1193,10 +1049,141 @@ echo '</div>'; ui_include_time_picker(); ui_require_jquery_file('ui.datepicker-'.get_user_language(), 'include/javascript/i18n/'); +// Auxiliary function for downtime agent creation. +function insert_downtime_agent($id_downtime, $user_groups_ad) +{ + // Check AD permission on downtime. + $downtime_group = db_get_value( + 'id_group', + 'tplanned_downtime', + 'id', + $id_downtime + ); + + if ($downtime_group === false + || !in_array($downtime_group, $user_groups_ad) + ) { + db_pandora_audit( + 'ACL Violation', + 'Trying to access downtime scheduler' + ); + include 'general/noaccess.php'; + return; + } + + $agents = (array) get_parameter('id_agents'); + $module_names = (array) get_parameter('module'); + $modules_selection_mode = (string) get_parameter('modules_selection_mode'); + + $all_modules = ($modules_selection_mode === 'all' && (empty($module_names) || (string) $module_names[0] === '0')); + $all_common_modules = ($modules_selection_mode === 'common' && (empty($module_names) || (string) $module_names[0] === '0')); + + if ($all_common_modules === true) { + $module_names = explode(',', get_parameter('all_common_modules')); + } + + // 'Is running' check. + $is_running = (bool) db_get_value( + 'executed', + 'tplanned_downtime', + 'id', + $id_downtime + ); + if ($is_running) { + ui_print_error_message( + __('This elements cannot be modified while the downtime is being executed') + ); + } else { + // If is selected 'Any', get all the agents. + if (count($agents) === 1 && (int) $agents[0] === -2) { + $all_agents = get_parameter('all_agents'); + $agents = explode(',', $all_agents); + } + + foreach ($agents as $agent_id) { + // Check module belongs to the agent. + if ($modules_selection_mode == 'all' && $all_modules === false) { + $check = false; + foreach ($module_names as $module_name) { + $check_module = modules_get_agentmodule_id( + $module_name, + $agent_id + ); + if (!empty($check_module)) { + $check = true; + } + } + + if (!$check) { + continue; + } + } + + // Check AD permission on agent. + $agent_group = db_get_value( + 'id_grupo', + 'tagente', + 'id_agente', + $agent_id + ); + + if ($agent_group === false + || !in_array($agent_group, $user_groups_ad) + ) { + continue; + } + + $values = [ + 'id_downtime' => $id_downtime, + 'id_agent' => $agent_id, + 'all_modules' => $all_modules, + ]; + $result = db_process_sql_insert( + 'tplanned_downtime_agents', + $values + ); + + if ($result && !$all_modules) { + foreach ($module_names as $module_name) { + $module = modules_get_agentmodule_id( + $module_name, + $agent_id + ); + + if (empty($module)) { + continue; + } + + $values = [ + 'id_downtime' => $id_downtime, + 'id_agent' => $agent_id, + 'id_agent_module' => $module['id_agente_modulo'], + ]; + $result = db_process_sql_insert( + 'tplanned_downtime_modules', + $values + ); + + if ($result) { + $values = ['id_user' => $config['id_user']]; + $result = db_process_sql_update( + 'tplanned_downtime', + $values, + ['id' => $id_downtime] + ); + } + } + } + } + } +} + + ?> <script language="javascript" type="text/javascript"> var id_downtime = <?php echo $id_downtime; ?>; var action_in_progress = false; + var recursion = false; function change_type_downtime() { switch ($("#type_downtime").val()) { @@ -1509,5 +1496,43 @@ ui_require_jquery_file('ui.datepicker-'.get_user_language(), 'include/javascript } // Disable datepickers when it has readonly attribute $('input.hasDatepicker[readonly]').disable(); + + $("#checkbox-recursion").click(function() { + recursion = this.checked; + $("#filter_group").trigger("change"); + }); + + // Change agent selector based on group. + $("#filter_group").change(function() { + jQuery.post ("ajax.php", + {"page": "operation/agentes/ver_agente", + "get_agents_group_json": 1, + "id_group": this.value, + "privilege": "AW", + "keys_prefix": "_", + "recursion": recursion, + }, + function (data, status) { + $("#id_agents").empty(); + $("#module").html(''); + + option_any = $("<option></option>") + .attr ("value", -2) + .html ("Any"); + $("#id_agents").append (option_any); + + jQuery.each (data, function (id, value) { + // Remove keys_prefix from the index + id = id.substring(1); + + option = $("<option></option>") + .attr ("value", value["id_agente"]) + .html (value["alias"]); + $("#id_agents").append (option); + }); + }, + "json" + ); + }); }); </script> From f1dd0503336e8886ca910c81c090871cf19c1f4d Mon Sep 17 00:00:00 2001 From: Jose Gonzalez <jose.gonzalez@artica.es> Date: Tue, 9 Mar 2021 15:19:28 +0100 Subject: [PATCH 22/61] Solve deleted files --- .../extras/delete_files/delete_files.txt | 60 ++++++++++++++++++- 1 file changed, 59 insertions(+), 1 deletion(-) diff --git a/pandora_console/extras/delete_files/delete_files.txt b/pandora_console/extras/delete_files/delete_files.txt index 8964458b93..37acef8382 100644 --- a/pandora_console/extras/delete_files/delete_files.txt +++ b/pandora_console/extras/delete_files/delete_files.txt @@ -1,5 +1,6 @@ operation/servers/recon_view.php operation/users/webchat.php +operation/events/event_statistics.php include/javascript/webchat.js attachment/pandora_chat.log.json.txt attachment/pandora_chat.user_list.json.txt @@ -14,4 +15,61 @@ enterprise/godmode/reporting/cluster_view.php enterprise/include/ajax/clustermap.php enterprise/include/functions_clustermap.php enterprise/include/functions_clusters.php -enterprise/include/javascript/ClusterMapController.js \ No newline at end of file +enterprise/include/javascript/ClusterMapController.js +enterprise/extensions/ipam/ipam_supernet_network.php +enterprise/extensions/ipam/ipam_vlan_wizard.php +enterprise/extensions/ipam/sql +enterprise/extensions/ipam/sql/ipam_mr_1.sql +enterprise/extensions/ipam/sql/ipam_mr_2.sql +enterprise/extensions/ipam/sql/ipam.sql +enterprise/extensions/ipam/css +enterprise/extensions/ipam/css/ipam.css +enterprise/extensions/ipam/ipam_ajax.php +enterprise/extensions/ipam/ipam_vlan_network.php +enterprise/extensions/ipam/ipam_supernet_config.php +enterprise/extensions/ipam/ipam_list.php +enterprise/extensions/ipam/ipam_excel.php +enterprise/extensions/ipam/ipam_massive.php +enterprise/extensions/ipam/ipam_editor.php +enterprise/extensions/ipam/recon_script +enterprise/extensions/ipam/recon_script/readme +enterprise/extensions/ipam/ipam_network.php +enterprise/extensions/ipam/ipam_calculator.php +enterprise/extensions/ipam/ipam_vlan_config.php +enterprise/extensions/ipam/images +enterprise/extensions/ipam/images/red_host_agent.png +enterprise/extensions/ipam/images/lil_green_host_alert.png +enterprise/extensions/ipam/images/lil_red_host_alert.png +enterprise/extensions/ipam/images/lil_red_host_agent.png +enterprise/extensions/ipam/images/green_host_dotted.png +enterprise/extensions/ipam/images/red_host.png +enterprise/extensions/ipam/images/red_host_alert.png +enterprise/extensions/ipam/images/not_host.png +enterprise/extensions/ipam/images/lil_green_host_agent_alert.png +enterprise/extensions/ipam/images/ball_alive.png +enterprise/extensions/ipam/images/lil_green_host_agent.png +enterprise/extensions/ipam/images/ball_notalive.png +enterprise/extensions/ipam/images/green_host_agent_alert.png +enterprise/extensions/ipam/images/green_host_agent.png +enterprise/extensions/ipam/images/lil_red_host.png +enterprise/extensions/ipam/images/green_host_alert.png +enterprise/extensions/ipam/images/lil_not_host.png +enterprise/extensions/ipam/images/green_host.png +enterprise/extensions/ipam/images/lil_green_host.png +enterprise/extensions/ipam/images/lil_red_host_agent_alert.png +enterprise/extensions/ipam/images/lil_green_host_dotted.png +enterprise/extensions/ipam/images/red_host_agent_alert.png +enterprise/extensions/ipam/ipam_supernet_map.php +enterprise/extensions/ipam/include +enterprise/extensions/ipam/include/functions_ipam.php +enterprise/extensions/ipam/include/ajax +enterprise/extensions/ipam/include/ajax/ipam_ajax.php +enterprise/extensions/ipam/include/javascript +enterprise/extensions/ipam/include/javascript/ipam.js +enterprise/extensions/ipam/include/javascript/IpamMapController.js +enterprise/extensions/ipam/ipam_action.php +enterprise/extensions/ipam.php +enterprise/extensions/ipam +enterprise/extensions/disabled/visual_console_manager.php +enterprise/extensions/visual_console_manager.php +pandora_console/extensions/net_tools.php \ No newline at end of file From 5913313baeb9c5d9c89bdd7764b023fda2973208 Mon Sep 17 00:00:00 2001 From: "alejandro.campos@artica.es" <alejandro.campos@artica.es> Date: Wed, 10 Mar 2021 10:28:27 +0100 Subject: [PATCH 23/61] Increased number of possible custom fields for Integria action --- .../godmode/alerts/configure_alert_action.php | 56 +++++++------------ .../godmode/setup/setup_integria.php | 6 +- pandora_console/pandoradb.sql | 1 + pandora_server/lib/PandoraFMS/Core.pm | 38 +++++++++++-- pandora_server/util/pandora_db.pl | 4 +- 5 files changed, 60 insertions(+), 45 deletions(-) diff --git a/pandora_console/godmode/alerts/configure_alert_action.php b/pandora_console/godmode/alerts/configure_alert_action.php index f3dfc35250..3719e1100c 100644 --- a/pandora_console/godmode/alerts/configure_alert_action.php +++ b/pandora_console/godmode/alerts/configure_alert_action.php @@ -388,32 +388,23 @@ $(document).ready (function () { function ajax_get_integria_custom_fields(ticket_type_id, values, recovery_values) { var values = values || []; var recovery_values = recovery_values || []; + var max_macro_fields = <?php echo $config['max_macro_fields']; ?>; if (ticket_type_id === null || ticket_type_id === '' || (Array.isArray(values) && values.length === 0 && Array.isArray(recovery_values) && recovery_values.length === 0)) { - $('[name=field8_value\\[\\]').val(''); - $('[name=field9_value\\[\\]').val(''); - $('[name=field10_value\\[\\]').val(''); - $('[name=field8_recovery_value\\[\\]').val(''); - $('[name=field9_recovery_value\\[\\]').val(''); - $('[name=field10_recovery_value\\[\\]').val(''); + for (var i=8; i <= max_macro_fields; i++) { + $('[name=field'+i+'_value\\[\\]').val(''); + $('[name=field'+i+'_recovery_value\\[\\]').val(''); + } } // On ticket type change, hide all table rows and inputs corresponding to custom fields, regardless of what its type is. - $('[name=field8_value\\[\\]').hide(); - $('[name=field9_value\\[\\]').hide(); - $('[name=field10_value\\[\\]').hide(); - $('[name=field8_recovery_value\\[\\]').hide(); - $('[name=field9_recovery_value\\[\\]').hide(); - $('[name=field10_recovery_value\\[\\]').hide(); - $('#table_macros-field8').hide(); - $('#table_macros-field9').hide(); - $('#table_macros-field10').hide(); - $('[name=field8_value_container').hide(); - $('[name=field9_value_container').hide(); - $('[name=field10_value_container').hide(); - $('[name=field8_recovery_value_container').hide(); - $('[name=field9_recovery_value_container').hide(); - $('[name=field10_recovery_value_container').hide(); + for (var i=8; i <= max_macro_fields; i++) { + $('[name=field'+i+'_value\\[\\]').hide(); + $('[name=field'+i+'_recovery_value\\[\\]').hide(); + $('#table_macros-field'+i).hide(); + $('[name=field'+i+'_value_container').hide(); + $('[name=field'+i+'_recovery_value_container').hide(); + } jQuery.post( "ajax.php", @@ -689,23 +680,16 @@ $(document).ready (function () { // Ad-hoc solution for Integria IMS command: get Integia IMS Ticket custom fields only when this command is selected and we selected a ticket type to retrieve fields from. // Check command by name since it is unvariable in any case, unlike its ID. if ($("#id_command option:selected").text() === "Integria IMS Ticket") { + var max_macro_fields = <?php echo $config['max_macro_fields']; ?>; // At start hide all rows and inputs corresponding to custom fields, regardless of what its type is. - $('[name=field8_value\\[\\]').hide(); - $('[name=field9_value\\[\\]').hide(); - $('[name=field10_value\\[\\]').hide(); - $('[name=field8_recovery_value\\[\\]').hide(); - $('[name=field9_recovery_value\\[\\]').hide(); - $('[name=field10_recovery_value\\[\\]').hide(); - $('#table_macros-field8').hide(); - $('#table_macros-field9').hide(); - $('#table_macros-field10').hide(); - $('[name=field8_value_container').hide(); - $('[name=field9_value_container').hide(); - $('[name=field10_value_container').hide(); - $('[name=field8_recovery_value_container').hide(); - $('[name=field9_recovery_value_container').hide(); - $('[name=field10_recovery_value_container').hide(); + for (var i=8; i <= max_macro_fields; i++) { + $('[name=field'+i+'_value\\[\\]').hide(); + $('[name=field'+i+'_recovery_value\\[\\]').hide(); + $('#table_macros-field'+i).hide(); + $('[name=field'+i+'_value_container').hide(); + $('[name=field'+i+'_recovery_value_container').hide(); + } if ($('#field5_value').val() !== '') { ajax_get_integria_custom_fields($('#field5_value').val(), integria_custom_fields_values, integria_custom_fields_rvalues); diff --git a/pandora_console/godmode/setup/setup_integria.php b/pandora_console/godmode/setup/setup_integria.php index 4d649d3e3a..058ad0dc0a 100644 --- a/pandora_console/godmode/setup/setup_integria.php +++ b/pandora_console/godmode/setup/setup_integria.php @@ -105,8 +105,8 @@ if (get_parameter('update_config', 0) == 1) { 'command' => io_safe_input('Internal type'), 'internal' => 1, 'description' => io_safe_input('Create a ticket in Integria IMS'), - 'fields_descriptions' => '["'.io_safe_input('Ticket title').'","'.io_safe_input('Ticket group ID').'","'.io_safe_input('Ticket priority').'","'.io_safe_input('Ticket owner').'","'.io_safe_input('Ticket type').'","'.io_safe_input('Ticket status').'","'.io_safe_input('Ticket description').'","_integria_type_custom_field_","_integria_type_custom_field_","_integria_type_custom_field_"]', - 'fields_values' => '["", "", "","","'.$types_string.'","","","_integria_type_custom_field_","_integria_type_custom_field_","_integria_type_custom_field_"]', + 'fields_descriptions' => '["'.io_safe_input('Ticket title').'","'.io_safe_input('Ticket group ID').'","'.io_safe_input('Ticket priority').'","'.io_safe_input('Ticket owner').'","'.io_safe_input('Ticket type').'","'.io_safe_input('Ticket status').'","'.io_safe_input('Ticket description').'","_integria_type_custom_field_","_integria_type_custom_field_","_integria_type_custom_field_","_integria_type_custom_field_","_integria_type_custom_field_","_integria_type_custom_field_","_integria_type_custom_field_","_integria_type_custom_field_","_integria_type_custom_field_","_integria_type_custom_field_","_integria_type_custom_field_","_integria_type_custom_field_","_integria_type_custom_field_"]', + 'fields_values' => '["", "", "","","'.$types_string.'","","","_integria_type_custom_field_","_integria_type_custom_field_","_integria_type_custom_field_","_integria_type_custom_field_","_integria_type_custom_field_","_integria_type_custom_field_","_integria_type_custom_field_","_integria_type_custom_field_","_integria_type_custom_field_","_integria_type_custom_field_","_integria_type_custom_field_","_integria_type_custom_field_","_integria_type_custom_field_"]', ] ); @@ -136,7 +136,7 @@ if (get_parameter('update_config', 0) == 1) { $sql_update_command_values = sprintf( ' UPDATE talert_commands - SET fields_values = \'["","","","","%s","","","_integria_type_custom_field_","_integria_type_custom_field_","_integria_type_custom_field_"]\' + SET fields_values = \'["","","","","%s","","","_integria_type_custom_field_","_integria_type_custom_field_","_integria_type_custom_field_","_integria_type_custom_field_","_integria_type_custom_field_","_integria_type_custom_field_","_integria_type_custom_field_","_integria_type_custom_field_","_integria_type_custom_field_","_integria_type_custom_field_","_integria_type_custom_field_","_integria_type_custom_field_","_integria_type_custom_field_"]\' WHERE name="%s"', $types_string, io_safe_input('Integria IMS Ticket') diff --git a/pandora_console/pandoradb.sql b/pandora_console/pandoradb.sql index 771b2e99fc..f704147e3a 100644 --- a/pandora_console/pandoradb.sql +++ b/pandora_console/pandoradb.sql @@ -441,6 +441,7 @@ CREATE TABLE IF NOT EXISTS `talert_actions` ( `field19_recovery` text NOT NULL, `field20_recovery` text NOT NULL, `previous_name` text, + `create_wu_integria` tinyint(1) default NULL, PRIMARY KEY (`id`), FOREIGN KEY (`id_alert_command`) REFERENCES talert_commands(`id`) ON DELETE CASCADE ON UPDATE CASCADE diff --git a/pandora_server/lib/PandoraFMS/Core.pm b/pandora_server/lib/PandoraFMS/Core.pm index ba5820ee9d..0fb017103b 100644 --- a/pandora_server/lib/PandoraFMS/Core.pm +++ b/pandora_server/lib/PandoraFMS/Core.pm @@ -1586,6 +1586,16 @@ sub pandora_execute_action ($$$$$$$$$;$) { $field8 = subst_alert_macros ($field8, \%macros, $pa_config, $dbh, $agent, $module, $alert); $field9 = subst_alert_macros ($field9, \%macros, $pa_config, $dbh, $agent, $module, $alert); $field10 = subst_alert_macros ($field10, \%macros, $pa_config, $dbh, $agent, $module, $alert); + $field11 = subst_alert_macros ($field11, \%macros, $pa_config, $dbh, $agent, $module, $alert); + $field12 = subst_alert_macros ($field12, \%macros, $pa_config, $dbh, $agent, $module, $alert); + $field13 = subst_alert_macros ($field13, \%macros, $pa_config, $dbh, $agent, $module, $alert); + $field14 = subst_alert_macros ($field14, \%macros, $pa_config, $dbh, $agent, $module, $alert); + $field15 = subst_alert_macros ($field15, \%macros, $pa_config, $dbh, $agent, $module, $alert); + $field16 = subst_alert_macros ($field16, \%macros, $pa_config, $dbh, $agent, $module, $alert); + $field17 = subst_alert_macros ($field17, \%macros, $pa_config, $dbh, $agent, $module, $alert); + $field18 = subst_alert_macros ($field18, \%macros, $pa_config, $dbh, $agent, $module, $alert); + $field19 = subst_alert_macros ($field19, \%macros, $pa_config, $dbh, $agent, $module, $alert); + $field20 = subst_alert_macros ($field20, \%macros, $pa_config, $dbh, $agent, $module, $alert); # Field 1 (Integria IMS API path) my $api_path = $config_api_path . "/integria/include/api.php"; @@ -1648,8 +1658,18 @@ sub pandora_execute_action ($$$$$$$$$;$) { my $ticket_custom_field1 = $field8; my $ticket_custom_field2 = $field9; my $ticket_custom_field3 = $field10; + my $ticket_custom_field4 = $field11; + my $ticket_custom_field5 = $field12; + my $ticket_custom_field6 = $field13; + my $ticket_custom_field7 = $field14; + my $ticket_custom_field8 = $field15; + my $ticket_custom_field9 = $field16; + my $ticket_custom_field10 = $field17; + my $ticket_custom_field11 = $field18; + my $ticket_custom_field12 = $field19; + my $ticket_custom_field13 = $field20; - pandora_create_integria_ticket($pa_config, $api_path, $api_pass, $integria_user, $integria_user_pass, $agent->{'nombre'}, $agent->{'alias'}, $agent->{'id_os'}, $agent->{'direccion'}, $agent->{'id_agente'}, $agent->{'id_grupo'}, $ticket_name, $ticket_group_id, $ticket_priority, $ticket_owner, $ticket_type, $ticket_status, $ticket_description, $create_wu_on_close_recovery, $ticket_custom_field1, $ticket_custom_field2, $ticket_custom_field3); + pandora_create_integria_ticket($pa_config, $api_path, $api_pass, $integria_user, $integria_user_pass, $agent->{'nombre'}, $agent->{'alias'}, $agent->{'id_os'}, $agent->{'direccion'}, $agent->{'id_agente'}, $agent->{'id_grupo'}, $ticket_name, $ticket_group_id, $ticket_priority, $ticket_owner, $ticket_type, $ticket_status, $ticket_description, $create_wu_on_close_recovery, $ticket_custom_field1, $ticket_custom_field2, $ticket_custom_field3, $ticket_custom_field4, $ticket_custom_field5, $ticket_custom_field6, $ticket_custom_field7, $ticket_custom_field8, $ticket_custom_field9, $ticket_custom_field10, $ticket_custom_field11, $ticket_custom_field12, $ticket_custom_field13); # Generate notification } elsif ($clean_name eq "Generate Notification") { @@ -6214,8 +6234,8 @@ sub pandora_edit_custom_graph ($$$$$$$$$$$) { return $res; } -sub pandora_create_integria_ticket ($$$$$$$$$$$$$$$$$$$$$$) { - my ($pa_config,$api_path,$api_pass,$integria_user,$user_pass,$agent_name,$agent_alias,$agent_os,$agent_addr,$agent_id,$agent_group,$ticket_name,$ticket_group_id,$ticket_priority,$ticket_owner,$ticket_type,$ticket_status,$ticket_description, $create_wu_on_close_recovery, $ticket_custom_field1, $ticket_custom_field2, $ticket_custom_field3) = @_; +sub pandora_create_integria_ticket ($$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$) { + my ($pa_config,$api_path,$api_pass,$integria_user,$user_pass,$agent_name,$agent_alias,$agent_os,$agent_addr,$agent_id,$agent_group,$ticket_name,$ticket_group_id,$ticket_priority,$ticket_owner,$ticket_type,$ticket_status,$ticket_description, $create_wu_on_close_recovery, $ticket_custom_field1, $ticket_custom_field2, $ticket_custom_field3, $ticket_custom_field4, $ticket_custom_field5, $ticket_custom_field6, $ticket_custom_field7, $ticket_custom_field8, $ticket_custom_field9, $ticket_custom_field10, $ticket_custom_field11, $ticket_custom_field12, $ticket_custom_field13) = @_; use URI::URL; use URI::Escape; @@ -6252,7 +6272,17 @@ sub pandora_create_integria_ticket ($$$$$$$$$$$$$$$$$$$$$$) { "|;|" . $ticket_create_wu . "|;|" . $ticket_custom_field1 . "|;|" . $ticket_custom_field2 . - "|;|" . $ticket_custom_field3; + "|;|" . $ticket_custom_field3 . + "|;|" . $ticket_custom_field4 . + "|;|" . $ticket_custom_field5 . + "|;|" . $ticket_custom_field6 . + "|;|" . $ticket_custom_field7 . + "|;|" . $ticket_custom_field8 . + "|;|" . $ticket_custom_field9 . + "|;|" . $ticket_custom_field10 . + "|;|" . $ticket_custom_field11 . + "|;|" . $ticket_custom_field12 . + "|;|" . $ticket_custom_field13; $call_api = $api_path . '?' . 'user=' . $integria_user . '&' . diff --git a/pandora_server/util/pandora_db.pl b/pandora_server/util/pandora_db.pl index 4b58381ce9..6d248d9320 100755 --- a/pandora_server/util/pandora_db.pl +++ b/pandora_server/util/pandora_db.pl @@ -1115,8 +1115,8 @@ if (scalar(@types) != 0) { $query_string .= $type->{'id'} . ',' . $type->{'name'} . ';'; } - db_do($dbh, "UPDATE talert_commands SET fields_descriptions='[\"Ticket title\",\"Ticket group ID\",\"Ticket priority\",\"Ticket owner\",\"Ticket type\",\"Ticket status\",\"Ticket description\",\"_integria_type_custom_field_\",\"_integria_type_custom_field_\",\"_integria_type_custom_field_\"]' WHERE name=\"Integria IMS Ticket\""); - db_do($dbh, "UPDATE talert_commands SET fields_values='[\"\", \"\", \"\",\"\",\"" . $query_string . "\",\"\",\"\",\"_integria_type_custom_field_\",\"_integria_type_custom_field_\", \"_integria_type_custom_field_\"]' WHERE name=\"Integria IMS Ticket\""); + db_do($dbh, "UPDATE talert_commands SET fields_descriptions='[\"Ticket title\",\"Ticket group ID\",\"Ticket priority\",\"Ticket owner\",\"Ticket type\",\"Ticket status\",\"Ticket description\",\"_integria_type_custom_field_\",\"_integria_type_custom_field_\",\"_integria_type_custom_field_\",\"_integria_type_custom_field_\",\"_integria_type_custom_field_\",\"_integria_type_custom_field_\",\"_integria_type_custom_field_\",\"_integria_type_custom_field_\",\"_integria_type_custom_field_\",\"_integria_type_custom_field_\",\"_integria_type_custom_field_\",\"_integria_type_custom_field_\",\"_integria_type_custom_field_\"]' WHERE name=\"Integria IMS Ticket\""); + db_do($dbh, "UPDATE talert_commands SET fields_values='[\"\", \"\", \"\",\"\",\"" . $query_string . "\",\"\",\"\",\"_integria_type_custom_field_\",\"_integria_type_custom_field_\",\"_integria_type_custom_field_\",\"_integria_type_custom_field_\",\"_integria_type_custom_field_\",\"_integria_type_custom_field_\",\"_integria_type_custom_field_\",\"_integria_type_custom_field_\",\"_integria_type_custom_field_\",\"_integria_type_custom_field_\",\"_integria_type_custom_field_\",\"_integria_type_custom_field_\",\"_integria_type_custom_field_\"]' WHERE name=\"Integria IMS Ticket\""); } # Release the lock From 5c3b5d2be04ceb36054569ab97a0050c42cf1225 Mon Sep 17 00:00:00 2001 From: "alejandro.campos@artica.es" <alejandro.campos@artica.es> Date: Wed, 10 Mar 2021 13:02:17 +0100 Subject: [PATCH 24/61] minor fixes in scheduled downtime setup --- .../godmode/agentes/planned_downtime.editor.php | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/pandora_console/godmode/agentes/planned_downtime.editor.php b/pandora_console/godmode/agentes/planned_downtime.editor.php index e9d2720508..0c2d06993e 100644 --- a/pandora_console/godmode/agentes/planned_downtime.editor.php +++ b/pandora_console/godmode/agentes/planned_downtime.editor.php @@ -382,9 +382,7 @@ if ($create_downtime || $update_downtime) { } if ($is_running) { - ui_print_error_message( - __('Cannot be modified while the downtime is being executed') - ); + $result = false; } else { if (!empty($values)) { $result = db_process_sql_update( @@ -1444,6 +1442,8 @@ function insert_downtime_agent($id_downtime, $user_groups_ad) } $(document).ready (function () { + populate_agents_selector(); + $("#id_agents").change(agent_changed_by_multiple_agents); $("#modules_selection_mode").change(agent_changed_by_multiple_agents); @@ -1504,10 +1504,14 @@ function insert_downtime_agent($id_downtime, $user_groups_ad) // Change agent selector based on group. $("#filter_group").change(function() { + populate_agents_selector(); + }); + + function populate_agents_selector() { jQuery.post ("ajax.php", {"page": "operation/agentes/ver_agente", "get_agents_group_json": 1, - "id_group": this.value, + "id_group": $("#filter_group").val(), "privilege": "AW", "keys_prefix": "_", "recursion": recursion, @@ -1533,6 +1537,6 @@ function insert_downtime_agent($id_downtime, $user_groups_ad) }, "json" ); - }); + } }); </script> From 2d4577b23b9b7e3d909c55175490308fe06e0cc4 Mon Sep 17 00:00:00 2001 From: Jose Gonzalez <jose.gonzalez@artica.es> Date: Wed, 10 Mar 2021 13:58:56 +0100 Subject: [PATCH 25/61] Cleaned -v and -q options --- pandora_server/lib/PandoraFMS/Config.pm | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pandora_server/lib/PandoraFMS/Config.pm b/pandora_server/lib/PandoraFMS/Config.pm index ea378b623e..71f2c70ce1 100644 --- a/pandora_server/lib/PandoraFMS/Config.pm +++ b/pandora_server/lib/PandoraFMS/Config.pm @@ -44,8 +44,8 @@ our @EXPORT = qw( ); # version: Defines actual version of Pandora Server for this module only -my $pandora_version = "7.0NG.751"; -my $pandora_build = "210120"; +my $pandora_version = "7.0NG.752"; +my $pandora_build = "210310"; our $VERSION = $pandora_version." ".$pandora_build; # Setup hash @@ -827,7 +827,7 @@ sub pandora_load_config { } elsif ($parametro =~ m/^verbosity\s+([0-9]*)/i) { if ($pa_config->{"verbosity"} == 0) { - $pa_config->{"verbosity"} = clean_blank($1); + $pa_config->{"verbosity"} = clean_blank($1); } } elsif ($parametro =~ m/^server_threshold\s+([0-9]*)/i) { From d86bfa8e7a7b93f7d7622a69cde057f3a7f6a32d Mon Sep 17 00:00:00 2001 From: Jose Gonzalez <jose.gonzalez@artica.es> Date: Wed, 10 Mar 2021 14:00:29 +0100 Subject: [PATCH 26/61] Updated --- pandora_server/lib/PandoraFMS/Config.pm | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/pandora_server/lib/PandoraFMS/Config.pm b/pandora_server/lib/PandoraFMS/Config.pm index 71f2c70ce1..cd8407115a 100644 --- a/pandora_server/lib/PandoraFMS/Config.pm +++ b/pandora_server/lib/PandoraFMS/Config.pm @@ -60,11 +60,9 @@ my %pa_config; sub help_screen { print "\nSyntax: \n\n pandora_server [ options ] < fullpathname to configuration file > \n\n"; print "Following options are optional : \n"; - print " -v : Verbose mode activated. Writes more information in the logfile \n"; print " -d : Debug mode activated. Writes extensive information in the logfile \n"; print " -D : Daemon mode (runs in background)\n"; print " -P <file> : Store PID to file.\n"; - print " -q : Quiet startup \n"; print " -S <install|uninstall|run>: Manage the win32 service.\n"; print " -h : This screen. Shows a little help screen \n"; print " \n"; @@ -103,18 +101,12 @@ sub pandora_init { if (($parametro =~ m/-h\z/i ) || ($parametro =~ m/help\z/i )) { help_screen(); } - elsif ($parametro =~ m/-v\z/i) { - $pa_config->{"verbosity"}=5; - } elsif ($parametro =~ m/^-P\z/i) { $pa_config->{'PID'}= clean_blank($ARGV[$ax+1]); } elsif ($parametro =~ m/-d\z/) { $pa_config->{"verbosity"}=10; } - elsif ($parametro =~ m/-q\z/) { - $pa_config->{"quiet"}=1; - } elsif ($parametro =~ m/-D\z/) { $pa_config->{"daemon"}=1; } @@ -827,7 +819,7 @@ sub pandora_load_config { } elsif ($parametro =~ m/^verbosity\s+([0-9]*)/i) { if ($pa_config->{"verbosity"} == 0) { - $pa_config->{"verbosity"} = clean_blank($1); + $pa_config->{"verbosity"} = clean_blank($1); } } elsif ($parametro =~ m/^server_threshold\s+([0-9]*)/i) { From 92d654763fc27aca6cc6154fe59112e870a3897c Mon Sep 17 00:00:00 2001 From: Jose Gonzalez <jose.gonzalez@artica.es> Date: Wed, 10 Mar 2021 16:20:45 +0100 Subject: [PATCH 27/61] Fixed some issues --- .../godmode/setup/setup_general.php | 111 ---------- .../godmode/setup/setup_visuals.php | 10 - .../include/class/ExternalTools.class.php | 189 +++++++++++++++--- 3 files changed, 163 insertions(+), 147 deletions(-) diff --git a/pandora_console/godmode/setup/setup_general.php b/pandora_console/godmode/setup/setup_general.php index 9c9e5baad2..e897506b3b 100644 --- a/pandora_console/godmode/setup/setup_general.php +++ b/pandora_console/godmode/setup/setup_general.php @@ -27,32 +27,6 @@ */ // File begin. - - -/** - * Return sounds path. - * - * @return string Path. - */ -function get_sounds() -{ - global $config; - - $return = []; - - $files = scandir($config['homedir'].'/include/sounds'); - - foreach ($files as $file) { - if (strstr($file, 'wav') !== false) { - $return['include/sounds/'.$file] = $file; - } - } - - return $return; -} - - -// Begin. global $config; @@ -345,73 +319,6 @@ $table->data[$i++][1] .= ' '.html_print_select( true ); -$sounds = get_sounds(); -$table->data[$i][0] = __('Sound for Alert fired'); -$table->data[$i][1] = html_print_select( - $sounds, - 'sound_alert', - $config['sound_alert'], - 'replaySound(\'alert\');', - '', - '', - true -); -$table->data[$i][1] .= ' <a href="javascript: toggleButton(\'alert\');">'.html_print_image( - 'images/control_play_col.png', - true, - [ - 'id' => 'button_sound_alert', - 'style' => 'vertical-align: middle;', - 'width' => '16', - 'title' => __('Play sound'), - ] -).'</a>'; -$table->data[$i++][1] .= '<div id="layer_sound_alert"></div>'; - -$table->data[$i][0] = __('Sound for Monitor critical'); -$table->data[$i][1] = html_print_select( - $sounds, - 'sound_critical', - $config['sound_critical'], - 'replaySound(\'critical\');', - '', - '', - true -); -$table->data[$i][1] .= ' <a href="javascript: toggleButton(\'critical\');">'.html_print_image( - 'images/control_play_col.png', - true, - [ - 'id' => 'button_sound_critical', - 'style' => 'vertical-align: middle;', - 'width' => '16', - 'title' => __('Play sound'), - ] -).'</a>'; -$table->data[$i++][1] .= '<div id="layer_sound_critical"></div>'; - -$table->data[$i][0] = __('Sound for Monitor warning'); -$table->data[$i][1] = html_print_select( - $sounds, - 'sound_warning', - $config['sound_warning'], - 'replaySound(\'warning\');', - '', - '', - true -); -$table->data[$i][1] .= ' <a href="javascript: toggleButton(\'warning\');">'.html_print_image( - 'images/control_play_col.png', - true, - [ - 'id' => 'button_sound_warning', - 'style' => 'vertical-align: middle;', - 'width' => '16', - 'title' => __('Play sound'), - ] -).'</a>'; -$table->data[$i++][1] .= '<div id="layer_sound_warning"></div>'; - $table->data[$i][0] = __('Public URL'); $table->data[$i++][1] = html_print_input_text( 'public_url', @@ -767,24 +674,6 @@ echo '<legend>'.__('Mail configuration').'</legend>'; ?> <script type="text/javascript"> -function toggleButton(type) { - if ($("#button_sound_" + type).attr('src') == 'images/control_pause_col.png') { - $("#button_sound_" + type).attr('src', 'images/control_play_col.png'); - $('#layer_sound_' + type).html(""); - } - else { - $("#button_sound_" + type).attr('src', 'images/control_pause_col.png'); - $('#layer_sound_' + type).html("<audio src='" + $("#sound_" + type).val() + "' autoplay='true' hidden='true' loop='true'>"); - } -} - -function replaySound(type) { - if ($("#button_sound_" + type).attr('src') == 'images/control_pause_col.png') { - $('#layer_sound_' + type).html(""); - $('#layer_sound_' + type).html("<audio src='" + $("#sound_" + type).val() + "' autoplay='true' hidden='true' loop='true'>"); - } -} - function show_timezone () { zone = $("#zone").val(); $.ajax({ diff --git a/pandora_console/godmode/setup/setup_visuals.php b/pandora_console/godmode/setup/setup_visuals.php index fdd49d1e1c..9067755c1f 100755 --- a/pandora_console/godmode/setup/setup_visuals.php +++ b/pandora_console/godmode/setup/setup_visuals.php @@ -1301,16 +1301,6 @@ $row++; $table_other->size[3] = '12%'; $table_other->data = []; - $table_other->data[$row][0] = __('Custom graphviz directory'); - $table_other->data[$row][1] = html_print_input_text( - 'graphviz_bin_dir', - $config['graphviz_bin_dir'], - '', - 25, - 255, - true - ); - $row++; $table_other->data[$row][0] = __('Networkmap max width'); diff --git a/pandora_console/include/class/ExternalTools.class.php b/pandora_console/include/class/ExternalTools.class.php index 675b6341d1..23232aed10 100644 --- a/pandora_console/include/class/ExternalTools.class.php +++ b/pandora_console/include/class/ExternalTools.class.php @@ -138,6 +138,9 @@ class ExternalTools extends HTML { global $config; + $i = 0; + $sounds = $this->get_sounds(); + if ($this->updatePaths === true) { $external_tools_config = []; $external_tools_config['traceroute_path'] = $this->pathTraceroute; @@ -181,30 +184,123 @@ class ExternalTools extends HTML $table->data = []; - $table->data[0][0] = __('Traceroute path'); - $table->data[0][1] = html_print_input_text('traceroute_path', $this->pathTraceroute, '', 40, 255, true); + $table->data[$i][0] = __('Sound for Alert fired'); + $table->data[$i][1] = html_print_select( + $sounds, + 'sound_alert', + $config['sound_alert'], + 'replaySound(\'alert\');', + '', + '', + true + ); + $table->data[$i][1] .= html_print_anchor( + [ + 'href' => 'javascript:toggleButton(\'alert\')', + 'content' => html_print_image( + 'images/control_play_col.png', + true, + [ + 'id' => 'button_sound_warning', + 'style' => 'vertical-align: middle;', + 'width' => '16', + 'title' => __('Play sound'), + ] + ), + ], + true + ); + $table->data[$i++][1] .= '<div id="layer_sound_alert"></div>'; - $table->data[1][0] = __('Ping path'); - $table->data[1][1] = html_print_input_text('ping_path', $this->pathPing, '', 40, 255, true); + $table->data[$i][0] = __('Sound for Monitor critical'); + $table->data[$i][1] = html_print_select( + $sounds, + 'sound_critical', + $config['sound_critical'], + 'replaySound(\'critical\');', + '', + '', + true + ); + $table->data[$i][1] .= html_print_anchor( + [ + 'href' => 'javascript:toggleButton(\'critical\')', + 'content' => html_print_image( + 'images/control_play_col.png', + true, + [ + 'id' => 'button_sound_warning', + 'style' => 'vertical-align: middle;', + 'width' => '16', + 'title' => __('Play sound'), + ] + ), + ], + true + ); + $table->data[$i++][1] .= '<div id="layer_sound_critical"></div>'; - $table->data[2][0] = __('Nmap path'); - $table->data[2][1] = html_print_input_text('nmap_path', $this->pathNmap, '', 40, 255, true); + $table->data[$i][0] = __('Sound for Monitor warning'); + $table->data[$i][1] = html_print_select( + $sounds, + 'sound_warning', + $config['sound_warning'], + 'replaySound(\'warning\');', + '', + '', + true + ); + $table->data[$i][1] .= html_print_anchor( + [ + 'href' => 'javascript:toggleButton(\'warning\')', + 'content' => html_print_image( + 'images/control_play_col.png', + true, + [ + 'id' => 'button_sound_warning', + 'style' => 'vertical-align: middle;', + 'width' => '16', + 'title' => __('Play sound'), + ] + ), + ], + true + ); + $table->data[$i++][1] .= '<div id="layer_sound_warning"></div>'; - $table->data[3][0] = __('Dig path'); - $table->data[3][1] = html_print_input_text('dig_path', $this->pathDig, '', 40, 255, true); + $table->data[$i][0] = __('Custom graphviz directory'); + $table->data[$i++][1] = html_print_input_text( + 'graphviz_bin_dir', + $config['graphviz_bin_dir'], + '', + 25, + 255, + true + ); - $table->data[4][0] = __('Snmpget path'); - $table->data[4][1] = html_print_input_text('snmpget_path', $this->pathSnmpget, '', 40, 255, true); + $table->data[$i][0] = __('Traceroute path'); + $table->data[$i++][1] = html_print_input_text('traceroute_path', $this->pathTraceroute, '', 40, 255, true); - $table->data[5][0] = html_print_div( + $table->data[$i][0] = __('Ping path'); + $table->data[$i++][1] = html_print_input_text('ping_path', $this->pathPing, '', 40, 255, true); + + $table->data[$i][0] = __('Nmap path'); + $table->data[$i++][1] = html_print_input_text('nmap_path', $this->pathNmap, '', 40, 255, true); + + $table->data[$i][0] = __('Dig path'); + $table->data[$i++][1] = html_print_input_text('dig_path', $this->pathDig, '', 40, 255, true); + + $table->data[$i][0] = __('Snmpget path'); + $table->data[$i++][1] = html_print_input_text('snmpget_path', $this->pathSnmpget, '', 40, 255, true); + + $table->data[$i][0] = html_print_div( [ 'class' => 'title_custom_commands bolder float-left', 'content' => __('Custom commands'), ], true ); - - $table->data[5][0] .= html_print_div( + $table->data[$i++][0] .= html_print_div( [ 'id' => 'add_button_custom_command', 'content' => html_print_image( @@ -220,30 +316,30 @@ class ExternalTools extends HTML true ); - $table->data[6][0] = __('Command'); - $table->data[6][1] = __('Parameters').ui_print_help_tip(__('Adding `_address_` macro will use agent\'s IP when perform the execution'), true); + $table->data[$i][0] = __('Command'); + $table->data[$i++][1] = __('Parameters').ui_print_help_tip(__('Adding `_address_` macro will use agent\'s IP when perform the execution'), true); - $i = 1; - $iRow = 7; + $y = 1; + $iRow = $i; if (empty($this->pathCustomComm) === true) { - $table->rowid[$iRow] = 'custom_row_'.$i; + $table->rowid[$iRow] = 'custom_row_'.$y; - $table->data[$iRow][0] = $this->customCommandPair('command', $i); - $table->data[$iRow][1] = $this->customCommandPair('params', $i); - $table->data[$iRow][2] = $this->customCommandPair('delete', $i); + $table->data[$iRow][0] = $this->customCommandPair('command', $y); + $table->data[$iRow][1] = $this->customCommandPair('params', $y); + $table->data[$iRow][2] = $this->customCommandPair('delete', $y); } else { foreach ($this->pathCustomComm as $command) { // Fill the fields. $customCommand = ($command['command_custom'] ?? ''); $customParams = ($command['params_custom'] ?? ''); // Attach the fields. - $table->rowid[$iRow] = 'custom_row_'.$i; - $table->data[$iRow][0] = $this->customCommandPair('command', $i, $customCommand); - $table->data[$iRow][1] = $this->customCommandPair('params', $i, $customParams); - $table->data[$iRow][2] = $this->customCommandPair('delete', $i); + $table->rowid[$iRow] = 'custom_row_'.$y; + $table->data[$iRow][0] = $this->customCommandPair('command', $y, $customCommand); + $table->data[$iRow][1] = $this->customCommandPair('params', $y, $customParams); + $table->data[$iRow][2] = $this->customCommandPair('delete', $y); // Add another command. - $i++; + $y++; $iRow++; } } @@ -771,6 +867,29 @@ class ExternalTools extends HTML } + /** + * Return sounds path. + * + * @return string Path. + */ + private function get_sounds() + { + global $config; + + $return = []; + + $files = scandir($config['homedir'].'/include/sounds'); + + foreach ($files as $file) { + if (strstr($file, 'wav') !== false) { + $return['include/sounds/'.$file] = $file; + } + } + + return $return; + } + + /** * Load the JS and attach * @@ -859,6 +978,24 @@ class ExternalTools extends HTML $('.snmpcolumn').hide(); } } + + function toggleButton(type) { + if ($("#button_sound_" + type).attr('src') == 'images/control_pause_col.png') { + $("#button_sound_" + type).attr('src', 'images/control_play_col.png'); + $('#layer_sound_' + type).html(""); + } + else { + $("#button_sound_" + type).attr('src', 'images/control_pause_col.png'); + $('#layer_sound_' + type).html("<audio src='" + $("#sound_" + type).val() + "' autoplay='true' hidden='true' loop='true'>"); + } + } + + function replaySound(type) { + if ($("#button_sound_" + type).attr('src') == 'images/control_pause_col.png') { + $('#layer_sound_' + type).html(""); + $('#layer_sound_' + type).html("<audio src='" + $("#sound_" + type).val() + "' autoplay='true' hidden='true' loop='true'>"); + } + } </script> <?php // Get the JS script. From cf1c460a9d5d00c277319f5e7fc960e7469837bd Mon Sep 17 00:00:00 2001 From: Jose Gonzalez <jose.gonzalez@artica.es> Date: Thu, 11 Mar 2021 09:12:53 +0100 Subject: [PATCH 28/61] Fixed all issues --- .../include/class/ExternalTools.class.php | 30 ++++++++++++++----- 1 file changed, 23 insertions(+), 7 deletions(-) diff --git a/pandora_console/include/class/ExternalTools.class.php b/pandora_console/include/class/ExternalTools.class.php index 23232aed10..403cd72fa6 100644 --- a/pandora_console/include/class/ExternalTools.class.php +++ b/pandora_console/include/class/ExternalTools.class.php @@ -149,19 +149,35 @@ class ExternalTools extends HTML $external_tools_config['dig_path'] = $this->pathDig; $external_tools_config['snmpget_path'] = $this->pathSnmpget; + $otherParameters = []; + $otherParameters['sound_alert'] = (string) get_parameter('sound_alert'); + $otherParameters['sound_critical'] = (string) get_parameter('sound_critical'); + $otherParameters['sound_warning'] = (string) get_parameter('sound_warning'); + $otherParameters['graphviz_bin_dir'] = (string) get_parameter('graphviz_bin_dir'); + if (empty($this->pathCustomComm) === false) { $external_tools_config['custom_commands'] = $this->pathCustomComm; } - $result = config_update_value( - 'external_tools_config', - json_encode($external_tools_config) - ); + foreach ($otherParameters as $keyParam => $valueParam) { + $result = config_update_value($keyParam, $valueParam); + + if ($result === false) { + break; + } + } + + if ($result === true) { + $result = config_update_value( + 'external_tools_config', + json_encode($external_tools_config) + ); + } ui_print_result_message( - $result, - __('Set the paths.'), - __('Set the paths.') + ($result), + __('Changes successfully saved.'), + __('Changes not saved.') ); } else { if (isset($config['external_tools_config']) === true) { From ba997dd13fb372865b5483d500be5f8f0ba88c38 Mon Sep 17 00:00:00 2001 From: Jose Gonzalez <jose.gonzalez@artica.es> Date: Thu, 11 Mar 2021 14:49:39 +0100 Subject: [PATCH 29/61] Fixed --- pandora_console/general/register.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pandora_console/general/register.php b/pandora_console/general/register.php index 9147a0e016..c01f8bc445 100644 --- a/pandora_console/general/register.php +++ b/pandora_console/general/register.php @@ -257,7 +257,11 @@ if (!$double_auth_enabled && $config['2FA_all_users'] != '' //document.location.reload(); } }) - .show(); </script> + .show(); + // Don't allow close the dialog with X button + $('.ui-dialog-titlebar-close').css('display', 'none'); + + </script> <?php echo '</div>'; } From 2f7a826253c845c424ef86cc90064f29c9039a5f Mon Sep 17 00:00:00 2001 From: "alejandro.campos@artica.es" <alejandro.campos@artica.es> Date: Thu, 11 Mar 2021 17:54:20 +0100 Subject: [PATCH 30/61] minor fixes --- pandora_console/godmode/agentes/agent_incidents.php | 6 ++---- pandora_console/godmode/alerts/alert_commands.php | 2 +- pandora_server/util/pandora_db.pl | 2 ++ 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/pandora_console/godmode/agentes/agent_incidents.php b/pandora_console/godmode/agentes/agent_incidents.php index c669af992e..179ab1540e 100644 --- a/pandora_console/godmode/agentes/agent_incidents.php +++ b/pandora_console/godmode/agentes/agent_incidents.php @@ -59,11 +59,9 @@ $result = integria_api_call($config['integria_hostname'], $config['integria_user $result = json_decode($result, true); -$count_sql = 'SELECT count(*) FROM tincidencia WHERE - id_grupo IN ('.implode(',', array_keys($groups)).')'.$filter.' - ORDER BY actualizacion DESC'; +$count = count($result); -$count = db_get_value_sql($count_sql); +$result = array_slice($result, $offset, $config['block_size']); if (empty($result)) { $result = []; diff --git a/pandora_console/godmode/alerts/alert_commands.php b/pandora_console/godmode/alerts/alert_commands.php index d76ea79cea..6afee9098d 100644 --- a/pandora_console/godmode/alerts/alert_commands.php +++ b/pandora_console/godmode/alerts/alert_commands.php @@ -374,7 +374,7 @@ if (is_ajax()) { 'field'.$i.'_recovery_value', '', '', - '', + __('None'), 0, true, false, diff --git a/pandora_server/util/pandora_db.pl b/pandora_server/util/pandora_db.pl index 691fb5cfd5..f17da2467f 100755 --- a/pandora_server/util/pandora_db.pl +++ b/pandora_server/util/pandora_db.pl @@ -1143,6 +1143,8 @@ if (scalar(@types) != 0) { $query_string .= $type->{'id'} . ',' . $type->{'name'} . ';'; } + $query_string = substr $query_string, 0, -1; + db_do($dbh, "UPDATE talert_commands SET fields_descriptions='[\"Ticket title\",\"Ticket group ID\",\"Ticket priority\",\"Ticket owner\",\"Ticket type\",\"Ticket status\",\"Ticket description\",\"_integria_type_custom_field_\",\"_integria_type_custom_field_\",\"_integria_type_custom_field_\",\"_integria_type_custom_field_\",\"_integria_type_custom_field_\",\"_integria_type_custom_field_\",\"_integria_type_custom_field_\",\"_integria_type_custom_field_\",\"_integria_type_custom_field_\",\"_integria_type_custom_field_\",\"_integria_type_custom_field_\",\"_integria_type_custom_field_\",\"_integria_type_custom_field_\"]' WHERE name=\"Integria IMS Ticket\""); db_do($dbh, "UPDATE talert_commands SET fields_values='[\"\", \"\", \"\",\"\",\"" . $query_string . "\",\"\",\"\",\"_integria_type_custom_field_\",\"_integria_type_custom_field_\",\"_integria_type_custom_field_\",\"_integria_type_custom_field_\",\"_integria_type_custom_field_\",\"_integria_type_custom_field_\",\"_integria_type_custom_field_\",\"_integria_type_custom_field_\",\"_integria_type_custom_field_\",\"_integria_type_custom_field_\",\"_integria_type_custom_field_\",\"_integria_type_custom_field_\",\"_integria_type_custom_field_\"]' WHERE name=\"Integria IMS Ticket\""); } From d4bf4b9cad3068ee4c7b724aef2018a703c5d6ba Mon Sep 17 00:00:00 2001 From: artica <artica.devel@gmail.com> Date: Fri, 12 Mar 2021 01:00:20 +0100 Subject: [PATCH 31/61] 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.rhel7.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/lib/PandoraFMS/PluginTools.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 +- 25 files changed, 25 insertions(+), 25 deletions(-) diff --git a/pandora_agents/unix/DEBIAN/control b/pandora_agents/unix/DEBIAN/control index 53f6c71331..67f0acfd4a 100644 --- a/pandora_agents/unix/DEBIAN/control +++ b/pandora_agents/unix/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-agent-unix -Version: 7.0NG.752-210311 +Version: 7.0NG.752-210312 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 c7ac46ab2a..191f74f161 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.752-210311" +pandora_version="7.0NG.752-210312" 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 efbc6bcaea..d6f7b72549 100755 --- a/pandora_agents/unix/pandora_agent +++ b/pandora_agents/unix/pandora_agent @@ -1016,7 +1016,7 @@ my $Sem = undef; my $ThreadSem = undef; use constant AGENT_VERSION => '7.0NG.752'; -use constant AGENT_BUILD => '210311'; +use constant AGENT_BUILD => '210312'; # 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 cd6f5c5345..464e16bf1f 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.752 -%define release 210311 +%define release 210312 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 6bc45c43ab..00f1bd8423 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.752 -%define release 210311 +%define release 210312 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 c29decfbca..2cb0dac8cf 100755 --- a/pandora_agents/unix/pandora_agent_installer +++ b/pandora_agents/unix/pandora_agent_installer @@ -10,7 +10,7 @@ # ********************************************************************** PI_VERSION="7.0NG.752" -PI_BUILD="210311" +PI_BUILD="210312" OS_NAME=`uname -s` FORCE=0 diff --git a/pandora_agents/win32/installer/pandora.mpi b/pandora_agents/win32/installer/pandora.mpi index 3676db6f23..41de0bc08d 100644 --- a/pandora_agents/win32/installer/pandora.mpi +++ b/pandora_agents/win32/installer/pandora.mpi @@ -186,7 +186,7 @@ UpgradeApplicationID {} Version -{210311} +{210312} ViewReadme {Yes} diff --git a/pandora_agents/win32/pandora.cc b/pandora_agents/win32/pandora.cc index 6085898f74..ff430dd2ba 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.752(Build 210311)") +#define PANDORA_VERSION ("7.0NG.752(Build 210312)") string pandora_path; string pandora_dir; diff --git a/pandora_agents/win32/versioninfo.rc b/pandora_agents/win32/versioninfo.rc index 9d7c3a7d12..36fb1d4cb0 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.752(Build 210311))" + VALUE "ProductVersion", "(7.0NG.752(Build 210312))" VALUE "FileVersion", "1.0.0.0" END END diff --git a/pandora_console/DEBIAN/control b/pandora_console/DEBIAN/control index 1dfc8565d5..687f4fcd3c 100644 --- a/pandora_console/DEBIAN/control +++ b/pandora_console/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-console -Version: 7.0NG.752-210311 +Version: 7.0NG.752-210312 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 e3fc7561d9..07cad24e71 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.752-210311" +pandora_version="7.0NG.752-210312" package_pear=0 package_pandora=1 diff --git a/pandora_console/include/config_process.php b/pandora_console/include/config_process.php index 45e58db6d9..12bcfda85d 100644 --- a/pandora_console/include/config_process.php +++ b/pandora_console/include/config_process.php @@ -20,7 +20,7 @@ /** * Pandora build version and version */ -$build_version = 'PC210311'; +$build_version = 'PC210312'; $pandora_version = 'v7.0NG.752'; // Do not overwrite default timezone set if defined. diff --git a/pandora_console/install.php b/pandora_console/install.php index 30f37720b7..e8c2355c74 100644 --- a/pandora_console/install.php +++ b/pandora_console/install.php @@ -129,7 +129,7 @@ <div style='height: 10px'> <?php $version = '7.0NG.752'; - $build = '210311'; + $build = '210312'; $banner = "v$version Build $build"; error_reporting(0); diff --git a/pandora_console/pandora_console.redhat.spec b/pandora_console/pandora_console.redhat.spec index 425b1b5bf5..2732d9cdfc 100644 --- a/pandora_console/pandora_console.redhat.spec +++ b/pandora_console/pandora_console.redhat.spec @@ -3,7 +3,7 @@ # %define name pandorafms_console %define version 7.0NG.752 -%define release 210311 +%define release 210312 # User and Group under which Apache is running %define httpd_name httpd diff --git a/pandora_console/pandora_console.rhel7.spec b/pandora_console/pandora_console.rhel7.spec index 3b942ae95c..d2c8b447fe 100644 --- a/pandora_console/pandora_console.rhel7.spec +++ b/pandora_console/pandora_console.rhel7.spec @@ -3,7 +3,7 @@ # %define name pandorafms_console %define version 7.0NG.752 -%define release 210311 +%define release 210312 # User and Group under which Apache is running %define httpd_name httpd diff --git a/pandora_console/pandora_console.spec b/pandora_console/pandora_console.spec index a767f3821f..e0c533f109 100644 --- a/pandora_console/pandora_console.spec +++ b/pandora_console/pandora_console.spec @@ -3,7 +3,7 @@ # %define name pandorafms_console %define version 7.0NG.752 -%define release 210311 +%define release 210312 %define httpd_name httpd # User and Group under which Apache is running %define httpd_name apache2 diff --git a/pandora_server/DEBIAN/control b/pandora_server/DEBIAN/control index ec1a4d6834..292a5d8cc8 100644 --- a/pandora_server/DEBIAN/control +++ b/pandora_server/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-server -Version: 7.0NG.752-210311 +Version: 7.0NG.752-210312 Architecture: all Priority: optional Section: admin diff --git a/pandora_server/DEBIAN/make_deb_package.sh b/pandora_server/DEBIAN/make_deb_package.sh index 354acc4570..ded35cf05b 100644 --- a/pandora_server/DEBIAN/make_deb_package.sh +++ b/pandora_server/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.752-210311" +pandora_version="7.0NG.752-210312" package_cpan=0 package_pandora=1 diff --git a/pandora_server/lib/PandoraFMS/Config.pm b/pandora_server/lib/PandoraFMS/Config.pm index 3fdaa7baef..e117ade911 100644 --- a/pandora_server/lib/PandoraFMS/Config.pm +++ b/pandora_server/lib/PandoraFMS/Config.pm @@ -45,7 +45,7 @@ our @EXPORT = qw( # version: Defines actual version of Pandora Server for this module only my $pandora_version = "7.0NG.752"; -my $pandora_build = "210311"; +my $pandora_build = "210312"; our $VERSION = $pandora_version." ".$pandora_build; # Setup hash diff --git a/pandora_server/lib/PandoraFMS/PluginTools.pm b/pandora_server/lib/PandoraFMS/PluginTools.pm index 1b889a33b0..a8eeb1c28f 100644 --- a/pandora_server/lib/PandoraFMS/PluginTools.pm +++ b/pandora_server/lib/PandoraFMS/PluginTools.pm @@ -34,7 +34,7 @@ our @ISA = qw(Exporter); # version: Defines actual version of Pandora Server for this module only my $pandora_version = "7.0NG.752"; -my $pandora_build = "210311"; +my $pandora_build = "210312"; our $VERSION = $pandora_version." ".$pandora_build; our %EXPORT_TAGS = ( 'all' => [ qw() ] ); diff --git a/pandora_server/pandora_server.redhat.spec b/pandora_server/pandora_server.redhat.spec index b67521022d..7b26b1aad9 100644 --- a/pandora_server/pandora_server.redhat.spec +++ b/pandora_server/pandora_server.redhat.spec @@ -3,7 +3,7 @@ # %define name pandorafms_server %define version 7.0NG.752 -%define release 210311 +%define release 210312 Summary: Pandora FMS Server Name: %{name} diff --git a/pandora_server/pandora_server.spec b/pandora_server/pandora_server.spec index c5db0e8c0a..809fc04b2f 100644 --- a/pandora_server/pandora_server.spec +++ b/pandora_server/pandora_server.spec @@ -3,7 +3,7 @@ # %define name pandorafms_server %define version 7.0NG.752 -%define release 210311 +%define release 210312 Summary: Pandora FMS Server Name: %{name} diff --git a/pandora_server/pandora_server_installer b/pandora_server/pandora_server_installer index bc2a62de7e..dc7f6f0dd6 100755 --- a/pandora_server/pandora_server_installer +++ b/pandora_server/pandora_server_installer @@ -9,7 +9,7 @@ # ********************************************************************** PI_VERSION="7.0NG.752" -PI_BUILD="210311" +PI_BUILD="210312" MODE=$1 if [ $# -gt 1 ]; then diff --git a/pandora_server/util/pandora_db.pl b/pandora_server/util/pandora_db.pl index 4f03017475..2509e0543a 100755 --- a/pandora_server/util/pandora_db.pl +++ b/pandora_server/util/pandora_db.pl @@ -35,7 +35,7 @@ use PandoraFMS::Config; use PandoraFMS::DB; # version: define current version -my $version = "7.0NG.752 PS210311"; +my $version = "7.0NG.752 PS210312"; # Pandora server configuration my %conf; diff --git a/pandora_server/util/pandora_manage.pl b/pandora_server/util/pandora_manage.pl index 6fd7ae604d..c4aa714f3d 100755 --- a/pandora_server/util/pandora_manage.pl +++ b/pandora_server/util/pandora_manage.pl @@ -36,7 +36,7 @@ use Encode::Locale; Encode::Locale::decode_argv; # version: define current version -my $version = "7.0NG.752 PS210311"; +my $version = "7.0NG.752 PS210312"; # save program name for logging my $progname = basename($0); From 7f46d078c072cb3b7b046e9771d58817597060cc Mon Sep 17 00:00:00 2001 From: marcos <marcos.alconada@artica.es> Date: Fri, 12 Mar 2021 09:32:07 +0100 Subject: [PATCH 32/61] fixed error with snmpbrower modal --- pandora_console/include/functions_snmp_browser.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pandora_console/include/functions_snmp_browser.php b/pandora_console/include/functions_snmp_browser.php index ec31f20cc2..cbe6683931 100644 --- a/pandora_console/include/functions_snmp_browser.php +++ b/pandora_console/include/functions_snmp_browser.php @@ -636,7 +636,7 @@ function snmp_browser_print_oid( __('Create network component'), 'create_network_component', false, - 'class="sub add"', + 'class="sub add float-left"', true ); @@ -1068,7 +1068,7 @@ function snmp_browser_print_container( $output .= '<div id="spinner" class="spinner_none_padding">'.html_print_image('images/spinner.gif', true).'</div>'; $output .= '<div id="snmp_browser">'; $output .= '</div>'; - $output .= '<div class="databox invisible mrgn_5px" id="snmp_data"></div>'; + $output .= '<div class="databox mrgn_5px" id="snmp_data"></div>'; $output .= '</div>'; $output .= '</div>'; $output .= '</div>'; From 6a427cfa8ad65234037f95b0543c380e598b6992 Mon Sep 17 00:00:00 2001 From: Jose Gonzalez <jose.gonzalez@artica.es> Date: Fri, 12 Mar 2021 11:09:34 +0100 Subject: [PATCH 33/61] Fixed --- .../godmode/setup/setup_general.php | 70 ------------------- 1 file changed, 70 deletions(-) diff --git a/pandora_console/godmode/setup/setup_general.php b/pandora_console/godmode/setup/setup_general.php index f43ce4a605..6401cd2949 100644 --- a/pandora_console/godmode/setup/setup_general.php +++ b/pandora_console/godmode/setup/setup_general.php @@ -322,76 +322,6 @@ $table->data[$i++][1] .= ' '.html_print_select( true ); -$sounds = get_sounds(); -$table->data[$i][0] = __('Sound for Alert fired'); -$table->data[$i][1] = html_print_select( - $sounds, - 'sound_alert', - $config['sound_alert'], - 'replaySound(\'alert\');', - '', - '', - true -); -$table->data[$i][1] .= ' <a href="javascript: toggleButton(\'alert\');">'.html_print_image( - 'images/control_play_col.png', - true, - [ - 'id' => 'button_sound_alert', - 'style' => 'vertical-align: middle;', - 'width' => '16', - 'title' => __('Play sound'), - 'class' => 'invert_filter', - ] -).'</a>'; -$table->data[$i++][1] .= '<div id="layer_sound_alert"></div>'; - -$table->data[$i][0] = __('Sound for Monitor critical'); -$table->data[$i][1] = html_print_select( - $sounds, - 'sound_critical', - $config['sound_critical'], - 'replaySound(\'critical\');', - '', - '', - true -); -$table->data[$i][1] .= ' <a href="javascript: toggleButton(\'critical\');">'.html_print_image( - 'images/control_play_col.png', - true, - [ - 'id' => 'button_sound_critical', - 'style' => 'vertical-align: middle;', - 'width' => '16', - 'title' => __('Play sound'), - 'class' => 'invert_filter', - ] -).'</a>'; -$table->data[$i++][1] .= '<div id="layer_sound_critical"></div>'; - -$table->data[$i][0] = __('Sound for Monitor warning'); -$table->data[$i][1] = html_print_select( - $sounds, - 'sound_warning', - $config['sound_warning'], - 'replaySound(\'warning\');', - '', - '', - true -); -$table->data[$i][1] .= ' <a href="javascript: toggleButton(\'warning\');">'.html_print_image( - 'images/control_play_col.png', - true, - [ - 'id' => 'button_sound_warning', - 'style' => 'vertical-align: middle;', - 'width' => '16', - 'title' => __('Play sound'), - 'class' => 'invert_filter', - ] -).'</a>'; -$table->data[$i++][1] .= '<div id="layer_sound_warning"></div>'; - $table->data[$i][0] = __('Public URL'); $table->data[$i++][1] = html_print_input_text( 'public_url', From de716ddc4a554b9065dbc77769b84d1a1c95548b Mon Sep 17 00:00:00 2001 From: marcos <marcos.alconada@artica.es> Date: Fri, 12 Mar 2021 11:55:54 +0100 Subject: [PATCH 34/61] fixed visual error group view --- pandora_console/include/styles/pandora.css | 2 +- pandora_console/operation/agentes/group_view.php | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pandora_console/include/styles/pandora.css b/pandora_console/include/styles/pandora.css index 935520bc78..63d64c6342 100644 --- a/pandora_console/include/styles/pandora.css +++ b/pandora_console/include/styles/pandora.css @@ -1775,7 +1775,7 @@ table.databox { padding: 9px 7px; font-weight: normal; color: #fff; - text-align: justify; + text-align: center; } .databox > th * { diff --git a/pandora_console/operation/agentes/group_view.php b/pandora_console/operation/agentes/group_view.php index befd7439fb..54ba514851 100644 --- a/pandora_console/operation/agentes/group_view.php +++ b/pandora_console/operation/agentes/group_view.php @@ -319,7 +319,7 @@ if (!empty($result_groups)) { $link = "<a class='group_view_data $color_class bolder font_18px center' href='index.php?sec=monitoring&sec2=operation/tree&tag_id=".$data['_id_'].'&status='.AGENT_STATUS_UNKNOWN."'>"; } else { - $link = "<a class='group_view_data $color_class bolder font_18x center' + $link = "<a class='group_view_data $color_class bolder font_18px center' href='index.php?sec=view&sec2=operation/agentes/estado_agente&group_id=".$data['_id_'].'&status='.AGENT_STATUS_UNKNOWN."'>"; } @@ -336,7 +336,7 @@ if (!empty($result_groups)) { // Agents not init echo "<td class='group_view_data group_view_data_unk $color_class bolder font_18px center'>"; if (isset($data['_is_tag_'])) { - $link = "<a class='group_view_data $color_class bolder ont_18px center' + $link = "<a class='group_view_data $color_class bolder font_18px center' href='index.php?sec=monitoring&sec2=operation/tree&tag_id=".$data['_id_'].'&status='.AGENT_STATUS_NOT_INIT."'>"; } else { $link = "<a class='group_view_data $color_class bolder font_18px center' @@ -359,7 +359,7 @@ if (!empty($result_groups)) { $link = "<a class='group_view_data $color_class bolder font_18px center' href='index.php?sec=monitoring&sec2=operation/tree&tag_id=".$data['_id_'].'&status='.AGENT_STATUS_NORMAL."'>"; } else { - $link = "<a class='group_view_data $color_class bolder ont_18px center' + $link = "<a class='group_view_data $color_class bolder font_18px center' href='index.php?sec=view&sec2=operation/agentes/estado_agente&group_id=".$data['_id_'].'&status='.AGENT_STATUS_NORMAL."'>"; } From ac3587208b116e8af97df9406f4e65a973c1420d Mon Sep 17 00:00:00 2001 From: marcos <marcos.alconada@artica.es> Date: Fri, 12 Mar 2021 12:10:56 +0100 Subject: [PATCH 35/61] fixed visual error --- pandora_console/operation/agentes/group_view.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandora_console/operation/agentes/group_view.php b/pandora_console/operation/agentes/group_view.php index 54ba514851..61dfda1a22 100644 --- a/pandora_console/operation/agentes/group_view.php +++ b/pandora_console/operation/agentes/group_view.php @@ -190,7 +190,7 @@ if (!empty($result_groups)) { echo '<tr>'; echo "<th class='w26px'>".__('Force').'</th>'; - echo "<th width='30%' class='mw60px'>".__('Group').'/'.__('Tags').'</th>'; + echo "<th width='30%' class='mw60px' style='text-align: justify'>".__('Group').'/'.__('Tags').'</th>'; echo "<th width='10%' class='mw60px center'>".__('Total').'</th>'; echo "<th width='10%' class='mw60px center'>".__('Unknown').'</th>'; echo "<th width='10%' class='mw60px center'>".__('Not init').'</th>'; From b4927d60719d04c2f9d1ca64268c3194824b0816 Mon Sep 17 00:00:00 2001 From: "alejandro.campos@artica.es" <alejandro.campos@artica.es> Date: Fri, 12 Mar 2021 12:46:27 +0100 Subject: [PATCH 36/61] minor fix --- pandora_console/godmode/setup/setup_integria.php | 6 ------ 1 file changed, 6 deletions(-) diff --git a/pandora_console/godmode/setup/setup_integria.php b/pandora_console/godmode/setup/setup_integria.php index ebb31f20e0..7cec5eccd1 100644 --- a/pandora_console/godmode/setup/setup_integria.php +++ b/pandora_console/godmode/setup/setup_integria.php @@ -299,12 +299,6 @@ $row['name'] = __('Request timeout'); $row['control'] = html_print_input_text('integria_req_timeout', $config['integria_req_timeout'], '', 3, 10, true); $table_remote->data['integria_req_timeout'] = $row; -$row = []; -$row['name'] = __('Inventory'); -$row['control'] = html_print_input_text('integria_req_timeout', $config['integria_req_timeout'], '', 3, 10, true); -$table_remote->data['integria_req_timeout'] = $row; - - $row = []; $row['name'] = __('Inventory'); $row['control'] = html_print_button(__('Sync inventory'), 'sync-inventory', false, '', 'class="sub next"', true); From 5fca622b3b3787c76086749cd7794bc1e8f3bd62 Mon Sep 17 00:00:00 2001 From: artica <artica.devel@gmail.com> Date: Sat, 13 Mar 2021 01:00:19 +0100 Subject: [PATCH 37/61] 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.rhel7.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/lib/PandoraFMS/PluginTools.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 +- 25 files changed, 25 insertions(+), 25 deletions(-) diff --git a/pandora_agents/unix/DEBIAN/control b/pandora_agents/unix/DEBIAN/control index 67f0acfd4a..558e04deb8 100644 --- a/pandora_agents/unix/DEBIAN/control +++ b/pandora_agents/unix/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-agent-unix -Version: 7.0NG.752-210312 +Version: 7.0NG.752-210313 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 191f74f161..aa2a4af7ff 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.752-210312" +pandora_version="7.0NG.752-210313" 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 d6f7b72549..cce853ddc3 100755 --- a/pandora_agents/unix/pandora_agent +++ b/pandora_agents/unix/pandora_agent @@ -1016,7 +1016,7 @@ my $Sem = undef; my $ThreadSem = undef; use constant AGENT_VERSION => '7.0NG.752'; -use constant AGENT_BUILD => '210312'; +use constant AGENT_BUILD => '210313'; # 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 464e16bf1f..2fd5671bfb 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.752 -%define release 210312 +%define release 210313 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 00f1bd8423..ea57a15090 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.752 -%define release 210312 +%define release 210313 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 2cb0dac8cf..5b111e706f 100755 --- a/pandora_agents/unix/pandora_agent_installer +++ b/pandora_agents/unix/pandora_agent_installer @@ -10,7 +10,7 @@ # ********************************************************************** PI_VERSION="7.0NG.752" -PI_BUILD="210312" +PI_BUILD="210313" OS_NAME=`uname -s` FORCE=0 diff --git a/pandora_agents/win32/installer/pandora.mpi b/pandora_agents/win32/installer/pandora.mpi index 41de0bc08d..ea5c18cb66 100644 --- a/pandora_agents/win32/installer/pandora.mpi +++ b/pandora_agents/win32/installer/pandora.mpi @@ -186,7 +186,7 @@ UpgradeApplicationID {} Version -{210312} +{210313} ViewReadme {Yes} diff --git a/pandora_agents/win32/pandora.cc b/pandora_agents/win32/pandora.cc index ff430dd2ba..10174cdfe5 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.752(Build 210312)") +#define PANDORA_VERSION ("7.0NG.752(Build 210313)") string pandora_path; string pandora_dir; diff --git a/pandora_agents/win32/versioninfo.rc b/pandora_agents/win32/versioninfo.rc index 36fb1d4cb0..6ff2407ff5 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.752(Build 210312))" + VALUE "ProductVersion", "(7.0NG.752(Build 210313))" VALUE "FileVersion", "1.0.0.0" END END diff --git a/pandora_console/DEBIAN/control b/pandora_console/DEBIAN/control index 687f4fcd3c..90c806c5ab 100644 --- a/pandora_console/DEBIAN/control +++ b/pandora_console/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-console -Version: 7.0NG.752-210312 +Version: 7.0NG.752-210313 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 07cad24e71..e5f2ad9afe 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.752-210312" +pandora_version="7.0NG.752-210313" package_pear=0 package_pandora=1 diff --git a/pandora_console/include/config_process.php b/pandora_console/include/config_process.php index 12bcfda85d..65397df121 100644 --- a/pandora_console/include/config_process.php +++ b/pandora_console/include/config_process.php @@ -20,7 +20,7 @@ /** * Pandora build version and version */ -$build_version = 'PC210312'; +$build_version = 'PC210313'; $pandora_version = 'v7.0NG.752'; // Do not overwrite default timezone set if defined. diff --git a/pandora_console/install.php b/pandora_console/install.php index e8c2355c74..7854ac475a 100644 --- a/pandora_console/install.php +++ b/pandora_console/install.php @@ -129,7 +129,7 @@ <div style='height: 10px'> <?php $version = '7.0NG.752'; - $build = '210312'; + $build = '210313'; $banner = "v$version Build $build"; error_reporting(0); diff --git a/pandora_console/pandora_console.redhat.spec b/pandora_console/pandora_console.redhat.spec index 2732d9cdfc..bc293645c8 100644 --- a/pandora_console/pandora_console.redhat.spec +++ b/pandora_console/pandora_console.redhat.spec @@ -3,7 +3,7 @@ # %define name pandorafms_console %define version 7.0NG.752 -%define release 210312 +%define release 210313 # User and Group under which Apache is running %define httpd_name httpd diff --git a/pandora_console/pandora_console.rhel7.spec b/pandora_console/pandora_console.rhel7.spec index d2c8b447fe..172acfa1b9 100644 --- a/pandora_console/pandora_console.rhel7.spec +++ b/pandora_console/pandora_console.rhel7.spec @@ -3,7 +3,7 @@ # %define name pandorafms_console %define version 7.0NG.752 -%define release 210312 +%define release 210313 # User and Group under which Apache is running %define httpd_name httpd diff --git a/pandora_console/pandora_console.spec b/pandora_console/pandora_console.spec index e0c533f109..e00d8802fc 100644 --- a/pandora_console/pandora_console.spec +++ b/pandora_console/pandora_console.spec @@ -3,7 +3,7 @@ # %define name pandorafms_console %define version 7.0NG.752 -%define release 210312 +%define release 210313 %define httpd_name httpd # User and Group under which Apache is running %define httpd_name apache2 diff --git a/pandora_server/DEBIAN/control b/pandora_server/DEBIAN/control index 292a5d8cc8..ecb8d41f19 100644 --- a/pandora_server/DEBIAN/control +++ b/pandora_server/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-server -Version: 7.0NG.752-210312 +Version: 7.0NG.752-210313 Architecture: all Priority: optional Section: admin diff --git a/pandora_server/DEBIAN/make_deb_package.sh b/pandora_server/DEBIAN/make_deb_package.sh index ded35cf05b..2a07a542fb 100644 --- a/pandora_server/DEBIAN/make_deb_package.sh +++ b/pandora_server/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.752-210312" +pandora_version="7.0NG.752-210313" package_cpan=0 package_pandora=1 diff --git a/pandora_server/lib/PandoraFMS/Config.pm b/pandora_server/lib/PandoraFMS/Config.pm index f4b5f68903..7b14d385be 100644 --- a/pandora_server/lib/PandoraFMS/Config.pm +++ b/pandora_server/lib/PandoraFMS/Config.pm @@ -45,7 +45,7 @@ our @EXPORT = qw( # version: Defines actual version of Pandora Server for this module only my $pandora_version = "7.0NG.752"; -my $pandora_build = "210312"; +my $pandora_build = "210313"; our $VERSION = $pandora_version." ".$pandora_build; # Setup hash diff --git a/pandora_server/lib/PandoraFMS/PluginTools.pm b/pandora_server/lib/PandoraFMS/PluginTools.pm index a8eeb1c28f..fae2922edb 100644 --- a/pandora_server/lib/PandoraFMS/PluginTools.pm +++ b/pandora_server/lib/PandoraFMS/PluginTools.pm @@ -34,7 +34,7 @@ our @ISA = qw(Exporter); # version: Defines actual version of Pandora Server for this module only my $pandora_version = "7.0NG.752"; -my $pandora_build = "210312"; +my $pandora_build = "210313"; our $VERSION = $pandora_version." ".$pandora_build; our %EXPORT_TAGS = ( 'all' => [ qw() ] ); diff --git a/pandora_server/pandora_server.redhat.spec b/pandora_server/pandora_server.redhat.spec index 7b26b1aad9..456b14551a 100644 --- a/pandora_server/pandora_server.redhat.spec +++ b/pandora_server/pandora_server.redhat.spec @@ -3,7 +3,7 @@ # %define name pandorafms_server %define version 7.0NG.752 -%define release 210312 +%define release 210313 Summary: Pandora FMS Server Name: %{name} diff --git a/pandora_server/pandora_server.spec b/pandora_server/pandora_server.spec index 809fc04b2f..120d07431b 100644 --- a/pandora_server/pandora_server.spec +++ b/pandora_server/pandora_server.spec @@ -3,7 +3,7 @@ # %define name pandorafms_server %define version 7.0NG.752 -%define release 210312 +%define release 210313 Summary: Pandora FMS Server Name: %{name} diff --git a/pandora_server/pandora_server_installer b/pandora_server/pandora_server_installer index dc7f6f0dd6..86f44536d7 100755 --- a/pandora_server/pandora_server_installer +++ b/pandora_server/pandora_server_installer @@ -9,7 +9,7 @@ # ********************************************************************** PI_VERSION="7.0NG.752" -PI_BUILD="210312" +PI_BUILD="210313" MODE=$1 if [ $# -gt 1 ]; then diff --git a/pandora_server/util/pandora_db.pl b/pandora_server/util/pandora_db.pl index 3373880bab..2ac8b4c65a 100755 --- a/pandora_server/util/pandora_db.pl +++ b/pandora_server/util/pandora_db.pl @@ -35,7 +35,7 @@ use PandoraFMS::Config; use PandoraFMS::DB; # version: define current version -my $version = "7.0NG.752 PS210312"; +my $version = "7.0NG.752 PS210313"; # Pandora server configuration my %conf; diff --git a/pandora_server/util/pandora_manage.pl b/pandora_server/util/pandora_manage.pl index d7ec708427..059d4ecbce 100755 --- a/pandora_server/util/pandora_manage.pl +++ b/pandora_server/util/pandora_manage.pl @@ -36,7 +36,7 @@ use Encode::Locale; Encode::Locale::decode_argv; # version: define current version -my $version = "7.0NG.752 PS210312"; +my $version = "7.0NG.752 PS210313"; # save program name for logging my $progname = basename($0); From 0f848d48e8ad86dfa71f7528e9ba2bb34a50d46e Mon Sep 17 00:00:00 2001 From: artica <artica.devel@gmail.com> Date: Sun, 14 Mar 2021 01:00:14 +0100 Subject: [PATCH 38/61] 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.rhel7.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/lib/PandoraFMS/PluginTools.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 +- 25 files changed, 25 insertions(+), 25 deletions(-) diff --git a/pandora_agents/unix/DEBIAN/control b/pandora_agents/unix/DEBIAN/control index 558e04deb8..629cc66a92 100644 --- a/pandora_agents/unix/DEBIAN/control +++ b/pandora_agents/unix/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-agent-unix -Version: 7.0NG.752-210313 +Version: 7.0NG.752-210314 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 aa2a4af7ff..be44691491 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.752-210313" +pandora_version="7.0NG.752-210314" 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 cce853ddc3..096ddfdbe6 100755 --- a/pandora_agents/unix/pandora_agent +++ b/pandora_agents/unix/pandora_agent @@ -1016,7 +1016,7 @@ my $Sem = undef; my $ThreadSem = undef; use constant AGENT_VERSION => '7.0NG.752'; -use constant AGENT_BUILD => '210313'; +use constant AGENT_BUILD => '210314'; # 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 2fd5671bfb..f3a68e2333 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.752 -%define release 210313 +%define release 210314 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 ea57a15090..33d80a43af 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.752 -%define release 210313 +%define release 210314 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 5b111e706f..abe2ea0fb2 100755 --- a/pandora_agents/unix/pandora_agent_installer +++ b/pandora_agents/unix/pandora_agent_installer @@ -10,7 +10,7 @@ # ********************************************************************** PI_VERSION="7.0NG.752" -PI_BUILD="210313" +PI_BUILD="210314" OS_NAME=`uname -s` FORCE=0 diff --git a/pandora_agents/win32/installer/pandora.mpi b/pandora_agents/win32/installer/pandora.mpi index ea5c18cb66..381c757447 100644 --- a/pandora_agents/win32/installer/pandora.mpi +++ b/pandora_agents/win32/installer/pandora.mpi @@ -186,7 +186,7 @@ UpgradeApplicationID {} Version -{210313} +{210314} ViewReadme {Yes} diff --git a/pandora_agents/win32/pandora.cc b/pandora_agents/win32/pandora.cc index 10174cdfe5..72986ac24f 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.752(Build 210313)") +#define PANDORA_VERSION ("7.0NG.752(Build 210314)") string pandora_path; string pandora_dir; diff --git a/pandora_agents/win32/versioninfo.rc b/pandora_agents/win32/versioninfo.rc index 6ff2407ff5..7a59169eb6 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.752(Build 210313))" + VALUE "ProductVersion", "(7.0NG.752(Build 210314))" VALUE "FileVersion", "1.0.0.0" END END diff --git a/pandora_console/DEBIAN/control b/pandora_console/DEBIAN/control index 90c806c5ab..b0c6d81c3a 100644 --- a/pandora_console/DEBIAN/control +++ b/pandora_console/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-console -Version: 7.0NG.752-210313 +Version: 7.0NG.752-210314 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 e5f2ad9afe..feee9fedb7 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.752-210313" +pandora_version="7.0NG.752-210314" package_pear=0 package_pandora=1 diff --git a/pandora_console/include/config_process.php b/pandora_console/include/config_process.php index 65397df121..03c0f7fb4c 100644 --- a/pandora_console/include/config_process.php +++ b/pandora_console/include/config_process.php @@ -20,7 +20,7 @@ /** * Pandora build version and version */ -$build_version = 'PC210313'; +$build_version = 'PC210314'; $pandora_version = 'v7.0NG.752'; // Do not overwrite default timezone set if defined. diff --git a/pandora_console/install.php b/pandora_console/install.php index 7854ac475a..ea4d78fd2a 100644 --- a/pandora_console/install.php +++ b/pandora_console/install.php @@ -129,7 +129,7 @@ <div style='height: 10px'> <?php $version = '7.0NG.752'; - $build = '210313'; + $build = '210314'; $banner = "v$version Build $build"; error_reporting(0); diff --git a/pandora_console/pandora_console.redhat.spec b/pandora_console/pandora_console.redhat.spec index bc293645c8..abec124781 100644 --- a/pandora_console/pandora_console.redhat.spec +++ b/pandora_console/pandora_console.redhat.spec @@ -3,7 +3,7 @@ # %define name pandorafms_console %define version 7.0NG.752 -%define release 210313 +%define release 210314 # User and Group under which Apache is running %define httpd_name httpd diff --git a/pandora_console/pandora_console.rhel7.spec b/pandora_console/pandora_console.rhel7.spec index 172acfa1b9..15f08726f7 100644 --- a/pandora_console/pandora_console.rhel7.spec +++ b/pandora_console/pandora_console.rhel7.spec @@ -3,7 +3,7 @@ # %define name pandorafms_console %define version 7.0NG.752 -%define release 210313 +%define release 210314 # User and Group under which Apache is running %define httpd_name httpd diff --git a/pandora_console/pandora_console.spec b/pandora_console/pandora_console.spec index e00d8802fc..3ad04374e4 100644 --- a/pandora_console/pandora_console.spec +++ b/pandora_console/pandora_console.spec @@ -3,7 +3,7 @@ # %define name pandorafms_console %define version 7.0NG.752 -%define release 210313 +%define release 210314 %define httpd_name httpd # User and Group under which Apache is running %define httpd_name apache2 diff --git a/pandora_server/DEBIAN/control b/pandora_server/DEBIAN/control index ecb8d41f19..326a4798a3 100644 --- a/pandora_server/DEBIAN/control +++ b/pandora_server/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-server -Version: 7.0NG.752-210313 +Version: 7.0NG.752-210314 Architecture: all Priority: optional Section: admin diff --git a/pandora_server/DEBIAN/make_deb_package.sh b/pandora_server/DEBIAN/make_deb_package.sh index 2a07a542fb..7bef4c4285 100644 --- a/pandora_server/DEBIAN/make_deb_package.sh +++ b/pandora_server/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.752-210313" +pandora_version="7.0NG.752-210314" package_cpan=0 package_pandora=1 diff --git a/pandora_server/lib/PandoraFMS/Config.pm b/pandora_server/lib/PandoraFMS/Config.pm index 7b14d385be..7d94b5ecf3 100644 --- a/pandora_server/lib/PandoraFMS/Config.pm +++ b/pandora_server/lib/PandoraFMS/Config.pm @@ -45,7 +45,7 @@ our @EXPORT = qw( # version: Defines actual version of Pandora Server for this module only my $pandora_version = "7.0NG.752"; -my $pandora_build = "210313"; +my $pandora_build = "210314"; our $VERSION = $pandora_version." ".$pandora_build; # Setup hash diff --git a/pandora_server/lib/PandoraFMS/PluginTools.pm b/pandora_server/lib/PandoraFMS/PluginTools.pm index fae2922edb..00dfc503c7 100644 --- a/pandora_server/lib/PandoraFMS/PluginTools.pm +++ b/pandora_server/lib/PandoraFMS/PluginTools.pm @@ -34,7 +34,7 @@ our @ISA = qw(Exporter); # version: Defines actual version of Pandora Server for this module only my $pandora_version = "7.0NG.752"; -my $pandora_build = "210313"; +my $pandora_build = "210314"; our $VERSION = $pandora_version." ".$pandora_build; our %EXPORT_TAGS = ( 'all' => [ qw() ] ); diff --git a/pandora_server/pandora_server.redhat.spec b/pandora_server/pandora_server.redhat.spec index 456b14551a..045ca872a7 100644 --- a/pandora_server/pandora_server.redhat.spec +++ b/pandora_server/pandora_server.redhat.spec @@ -3,7 +3,7 @@ # %define name pandorafms_server %define version 7.0NG.752 -%define release 210313 +%define release 210314 Summary: Pandora FMS Server Name: %{name} diff --git a/pandora_server/pandora_server.spec b/pandora_server/pandora_server.spec index 120d07431b..915aa94393 100644 --- a/pandora_server/pandora_server.spec +++ b/pandora_server/pandora_server.spec @@ -3,7 +3,7 @@ # %define name pandorafms_server %define version 7.0NG.752 -%define release 210313 +%define release 210314 Summary: Pandora FMS Server Name: %{name} diff --git a/pandora_server/pandora_server_installer b/pandora_server/pandora_server_installer index 86f44536d7..867e43cdab 100755 --- a/pandora_server/pandora_server_installer +++ b/pandora_server/pandora_server_installer @@ -9,7 +9,7 @@ # ********************************************************************** PI_VERSION="7.0NG.752" -PI_BUILD="210313" +PI_BUILD="210314" MODE=$1 if [ $# -gt 1 ]; then diff --git a/pandora_server/util/pandora_db.pl b/pandora_server/util/pandora_db.pl index 2ac8b4c65a..ff49ae919f 100755 --- a/pandora_server/util/pandora_db.pl +++ b/pandora_server/util/pandora_db.pl @@ -35,7 +35,7 @@ use PandoraFMS::Config; use PandoraFMS::DB; # version: define current version -my $version = "7.0NG.752 PS210313"; +my $version = "7.0NG.752 PS210314"; # Pandora server configuration my %conf; diff --git a/pandora_server/util/pandora_manage.pl b/pandora_server/util/pandora_manage.pl index 059d4ecbce..068aa83e0d 100755 --- a/pandora_server/util/pandora_manage.pl +++ b/pandora_server/util/pandora_manage.pl @@ -36,7 +36,7 @@ use Encode::Locale; Encode::Locale::decode_argv; # version: define current version -my $version = "7.0NG.752 PS210313"; +my $version = "7.0NG.752 PS210314"; # save program name for logging my $progname = basename($0); From fc29160c91a95febad8aac81a38236375225b4d8 Mon Sep 17 00:00:00 2001 From: artica <artica.devel@gmail.com> Date: Mon, 15 Mar 2021 01:00:15 +0100 Subject: [PATCH 39/61] 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.rhel7.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/lib/PandoraFMS/PluginTools.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 +- 25 files changed, 25 insertions(+), 25 deletions(-) diff --git a/pandora_agents/unix/DEBIAN/control b/pandora_agents/unix/DEBIAN/control index 629cc66a92..05cd328a94 100644 --- a/pandora_agents/unix/DEBIAN/control +++ b/pandora_agents/unix/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-agent-unix -Version: 7.0NG.752-210314 +Version: 7.0NG.752-210315 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 be44691491..b8a06b11ee 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.752-210314" +pandora_version="7.0NG.752-210315" 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 096ddfdbe6..83596329cb 100755 --- a/pandora_agents/unix/pandora_agent +++ b/pandora_agents/unix/pandora_agent @@ -1016,7 +1016,7 @@ my $Sem = undef; my $ThreadSem = undef; use constant AGENT_VERSION => '7.0NG.752'; -use constant AGENT_BUILD => '210314'; +use constant AGENT_BUILD => '210315'; # 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 f3a68e2333..e40e91a984 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.752 -%define release 210314 +%define release 210315 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 33d80a43af..95bb0dca93 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.752 -%define release 210314 +%define release 210315 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 abe2ea0fb2..12a3f35c7a 100755 --- a/pandora_agents/unix/pandora_agent_installer +++ b/pandora_agents/unix/pandora_agent_installer @@ -10,7 +10,7 @@ # ********************************************************************** PI_VERSION="7.0NG.752" -PI_BUILD="210314" +PI_BUILD="210315" OS_NAME=`uname -s` FORCE=0 diff --git a/pandora_agents/win32/installer/pandora.mpi b/pandora_agents/win32/installer/pandora.mpi index 381c757447..f9d6248fba 100644 --- a/pandora_agents/win32/installer/pandora.mpi +++ b/pandora_agents/win32/installer/pandora.mpi @@ -186,7 +186,7 @@ UpgradeApplicationID {} Version -{210314} +{210315} ViewReadme {Yes} diff --git a/pandora_agents/win32/pandora.cc b/pandora_agents/win32/pandora.cc index 72986ac24f..9d83302b9b 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.752(Build 210314)") +#define PANDORA_VERSION ("7.0NG.752(Build 210315)") string pandora_path; string pandora_dir; diff --git a/pandora_agents/win32/versioninfo.rc b/pandora_agents/win32/versioninfo.rc index 7a59169eb6..7db5378152 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.752(Build 210314))" + VALUE "ProductVersion", "(7.0NG.752(Build 210315))" VALUE "FileVersion", "1.0.0.0" END END diff --git a/pandora_console/DEBIAN/control b/pandora_console/DEBIAN/control index b0c6d81c3a..a4c4347d37 100644 --- a/pandora_console/DEBIAN/control +++ b/pandora_console/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-console -Version: 7.0NG.752-210314 +Version: 7.0NG.752-210315 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 feee9fedb7..bedf3f522b 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.752-210314" +pandora_version="7.0NG.752-210315" package_pear=0 package_pandora=1 diff --git a/pandora_console/include/config_process.php b/pandora_console/include/config_process.php index 03c0f7fb4c..1f0f644a72 100644 --- a/pandora_console/include/config_process.php +++ b/pandora_console/include/config_process.php @@ -20,7 +20,7 @@ /** * Pandora build version and version */ -$build_version = 'PC210314'; +$build_version = 'PC210315'; $pandora_version = 'v7.0NG.752'; // Do not overwrite default timezone set if defined. diff --git a/pandora_console/install.php b/pandora_console/install.php index ea4d78fd2a..24a84748b9 100644 --- a/pandora_console/install.php +++ b/pandora_console/install.php @@ -129,7 +129,7 @@ <div style='height: 10px'> <?php $version = '7.0NG.752'; - $build = '210314'; + $build = '210315'; $banner = "v$version Build $build"; error_reporting(0); diff --git a/pandora_console/pandora_console.redhat.spec b/pandora_console/pandora_console.redhat.spec index abec124781..5986252849 100644 --- a/pandora_console/pandora_console.redhat.spec +++ b/pandora_console/pandora_console.redhat.spec @@ -3,7 +3,7 @@ # %define name pandorafms_console %define version 7.0NG.752 -%define release 210314 +%define release 210315 # User and Group under which Apache is running %define httpd_name httpd diff --git a/pandora_console/pandora_console.rhel7.spec b/pandora_console/pandora_console.rhel7.spec index 15f08726f7..19ff217a20 100644 --- a/pandora_console/pandora_console.rhel7.spec +++ b/pandora_console/pandora_console.rhel7.spec @@ -3,7 +3,7 @@ # %define name pandorafms_console %define version 7.0NG.752 -%define release 210314 +%define release 210315 # User and Group under which Apache is running %define httpd_name httpd diff --git a/pandora_console/pandora_console.spec b/pandora_console/pandora_console.spec index 3ad04374e4..b2082b095f 100644 --- a/pandora_console/pandora_console.spec +++ b/pandora_console/pandora_console.spec @@ -3,7 +3,7 @@ # %define name pandorafms_console %define version 7.0NG.752 -%define release 210314 +%define release 210315 %define httpd_name httpd # User and Group under which Apache is running %define httpd_name apache2 diff --git a/pandora_server/DEBIAN/control b/pandora_server/DEBIAN/control index 326a4798a3..0c71840520 100644 --- a/pandora_server/DEBIAN/control +++ b/pandora_server/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-server -Version: 7.0NG.752-210314 +Version: 7.0NG.752-210315 Architecture: all Priority: optional Section: admin diff --git a/pandora_server/DEBIAN/make_deb_package.sh b/pandora_server/DEBIAN/make_deb_package.sh index 7bef4c4285..ba322aae7f 100644 --- a/pandora_server/DEBIAN/make_deb_package.sh +++ b/pandora_server/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.752-210314" +pandora_version="7.0NG.752-210315" package_cpan=0 package_pandora=1 diff --git a/pandora_server/lib/PandoraFMS/Config.pm b/pandora_server/lib/PandoraFMS/Config.pm index 7d94b5ecf3..a4b578e306 100644 --- a/pandora_server/lib/PandoraFMS/Config.pm +++ b/pandora_server/lib/PandoraFMS/Config.pm @@ -45,7 +45,7 @@ our @EXPORT = qw( # version: Defines actual version of Pandora Server for this module only my $pandora_version = "7.0NG.752"; -my $pandora_build = "210314"; +my $pandora_build = "210315"; our $VERSION = $pandora_version." ".$pandora_build; # Setup hash diff --git a/pandora_server/lib/PandoraFMS/PluginTools.pm b/pandora_server/lib/PandoraFMS/PluginTools.pm index 00dfc503c7..87e6bac486 100644 --- a/pandora_server/lib/PandoraFMS/PluginTools.pm +++ b/pandora_server/lib/PandoraFMS/PluginTools.pm @@ -34,7 +34,7 @@ our @ISA = qw(Exporter); # version: Defines actual version of Pandora Server for this module only my $pandora_version = "7.0NG.752"; -my $pandora_build = "210314"; +my $pandora_build = "210315"; our $VERSION = $pandora_version." ".$pandora_build; our %EXPORT_TAGS = ( 'all' => [ qw() ] ); diff --git a/pandora_server/pandora_server.redhat.spec b/pandora_server/pandora_server.redhat.spec index 045ca872a7..20914dff60 100644 --- a/pandora_server/pandora_server.redhat.spec +++ b/pandora_server/pandora_server.redhat.spec @@ -3,7 +3,7 @@ # %define name pandorafms_server %define version 7.0NG.752 -%define release 210314 +%define release 210315 Summary: Pandora FMS Server Name: %{name} diff --git a/pandora_server/pandora_server.spec b/pandora_server/pandora_server.spec index 915aa94393..861eaf696a 100644 --- a/pandora_server/pandora_server.spec +++ b/pandora_server/pandora_server.spec @@ -3,7 +3,7 @@ # %define name pandorafms_server %define version 7.0NG.752 -%define release 210314 +%define release 210315 Summary: Pandora FMS Server Name: %{name} diff --git a/pandora_server/pandora_server_installer b/pandora_server/pandora_server_installer index 867e43cdab..658c4ece30 100755 --- a/pandora_server/pandora_server_installer +++ b/pandora_server/pandora_server_installer @@ -9,7 +9,7 @@ # ********************************************************************** PI_VERSION="7.0NG.752" -PI_BUILD="210314" +PI_BUILD="210315" MODE=$1 if [ $# -gt 1 ]; then diff --git a/pandora_server/util/pandora_db.pl b/pandora_server/util/pandora_db.pl index ff49ae919f..63c5e347bf 100755 --- a/pandora_server/util/pandora_db.pl +++ b/pandora_server/util/pandora_db.pl @@ -35,7 +35,7 @@ use PandoraFMS::Config; use PandoraFMS::DB; # version: define current version -my $version = "7.0NG.752 PS210314"; +my $version = "7.0NG.752 PS210315"; # Pandora server configuration my %conf; diff --git a/pandora_server/util/pandora_manage.pl b/pandora_server/util/pandora_manage.pl index 068aa83e0d..a0d7bbef23 100755 --- a/pandora_server/util/pandora_manage.pl +++ b/pandora_server/util/pandora_manage.pl @@ -36,7 +36,7 @@ use Encode::Locale; Encode::Locale::decode_argv; # version: define current version -my $version = "7.0NG.752 PS210314"; +my $version = "7.0NG.752 PS210315"; # save program name for logging my $progname = basename($0); From 09e94bd0e9acf7cbad8cfd548089a60a50907d4f Mon Sep 17 00:00:00 2001 From: marcos <marcos.alconada@artica.es> Date: Mon, 15 Mar 2021 11:43:36 +0100 Subject: [PATCH 40/61] resolved merge conflict --- .../reporting/reporting_builder.item_editor.php | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/pandora_console/godmode/reporting/reporting_builder.item_editor.php b/pandora_console/godmode/reporting/reporting_builder.item_editor.php index 298e36aa25..0a6c53d766 100755 --- a/pandora_console/godmode/reporting/reporting_builder.item_editor.php +++ b/pandora_console/godmode/reporting/reporting_builder.item_editor.php @@ -2763,17 +2763,13 @@ $class = 'databox filters'; </td> </tr> -<<<<<<< HEAD - <tr id="row_filter_search" class="datos"> - <td class="bolder"><?php echo __('Free search'); ?></td> -======= - <tr id="row_summary" style="" class="datos"> - <td style="font-weight:bold;"> + <tr id="row_summary"class="datos"> + <td class="bolder"> <?php echo __('Summary'); ?> </td> - <td style=""> + <td> <?php html_print_checkbox_switch( 'summary', @@ -2788,9 +2784,8 @@ $class = 'databox filters'; </td> </tr> - <tr id="row_filter_search" style="" class="datos"> - <td style="font-weight:bold;"><?php echo __('Include filter'); ?></td> ->>>>>>> origin/develop + <tr id="row_filter_search" class="datos"> + <td class="bolder"><?php echo __('Include filter'); ?></td> <td> <?php html_print_input_text('filter_search', $filter_search); From e4e3007def1e1de35df8cc7a20ddf2bb92ac5ba3 Mon Sep 17 00:00:00 2001 From: Daniel Maya <daniel.maya@artica.es> Date: Mon, 15 Mar 2021 13:32:25 +0100 Subject: [PATCH 41/61] Fixed img --- .../godmode/agentes/configurar_agente.php | 28 ++++++++++++++++++- .../include/functions_snmp_browser.php | 2 +- 2 files changed, 28 insertions(+), 2 deletions(-) diff --git a/pandora_console/godmode/agentes/configurar_agente.php b/pandora_console/godmode/agentes/configurar_agente.php index 58add351ab..f7ff804b50 100644 --- a/pandora_console/godmode/agentes/configurar_agente.php +++ b/pandora_console/godmode/agentes/configurar_agente.php @@ -367,7 +367,7 @@ $img_style = [ if ($id_agente) { // View tab. $viewtab['text'] = '<a href="index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente='.$id_agente.'">'.html_print_image( - 'images/operation.png', + 'images/eye.png', true, [ 'title' => __('View'), @@ -563,6 +563,27 @@ if ($id_agente) { $agent_wizard['active'] = false; } + + $total_incidents = agents_get_count_incidents($id_agente); + + // Incident tab. + if ($total_incidents > 0) { + $incidenttab['text'] = '<a href="index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=incident&id_agente='.$id_agente.'">'.html_print_image( + 'images/book_edit.png', + true, + [ + 'title' => __('Incidents'), + 'class' => 'invert_filter', + ] + ).'</a>'; + + if ($tab == 'incident') { + $incidenttab['active'] = true; + } else { + $incidenttab['active'] = false; + } + } + if (check_acl_one_of_groups($config['id_user'], $all_groups, 'AW')) { if ($has_remote_conf) { $agent_name = agents_get_name($id_agente); @@ -616,6 +637,11 @@ if ($id_agente) { ]; } + + // Only if the agent has incidents associated show incidents tab. + if ($total_incidents) { + $onheader['incident'] = $incidenttab; + } } else { $onheader = [ 'view' => $viewtab, diff --git a/pandora_console/include/functions_snmp_browser.php b/pandora_console/include/functions_snmp_browser.php index cbe6683931..04f3823304 100644 --- a/pandora_console/include/functions_snmp_browser.php +++ b/pandora_console/include/functions_snmp_browser.php @@ -144,7 +144,7 @@ function snmp_browser_get_html_tree( // Branch or leave with branches! if (isset($sub_level['__OID__'])) { $output .= "<a onfocus='javascript: this.blur();' href='javascript: snmpGet(\"".addslashes($sub_level['__OID__'])."\");'>"; - $output .= '<img src="'.$url.'/../../images/eye.png" class="vertical_middle">'; + $output .= '<img src="'.$url.'/../../images/operation.png" class="vertical_middle">'; $output .= '</a>'; } From 95787e2fe83e941a3400b1abf2f1529b3aed7923 Mon Sep 17 00:00:00 2001 From: marcos <marcos.alconada@artica.es> Date: Mon, 15 Mar 2021 14:38:20 +0100 Subject: [PATCH 42/61] fixed visual style error --- pandora_console/godmode/reporting/graph_builder.main.php | 4 ++-- pandora_console/godmode/reporting/graphs.php | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/pandora_console/godmode/reporting/graph_builder.main.php b/pandora_console/godmode/reporting/graph_builder.main.php index 131fae5cfb..3f9107db4e 100644 --- a/pandora_console/godmode/reporting/graph_builder.main.php +++ b/pandora_console/godmode/reporting/graph_builder.main.php @@ -285,11 +285,11 @@ $output .= '</table>'; if ($edit_graph) { $output .= "<div class='w100p'>"; - $output .= "<input class='right' type=submit name='store' class='sub upd' value='".__('Update')."'>"; + $output .= "<input type=submit name='store' class='sub upd right' value='".__('Update')."'>"; $output .= '</div>'; } else { $output .= "<div class='w100p'>"; - $output .= "<input class='right' type=submit name='store' class='sub next' value='".__('Create')."'>"; + $output .= "<input type=submit name='store' class='sub next right' value='".__('Create')."'>"; $output .= '</div>'; } diff --git a/pandora_console/godmode/reporting/graphs.php b/pandora_console/godmode/reporting/graphs.php index 856f251947..3fdf7b3969 100644 --- a/pandora_console/godmode/reporting/graphs.php +++ b/pandora_console/godmode/reporting/graphs.php @@ -349,7 +349,6 @@ $table_aux = new stdClass(); ui_pagination(count($graphs), false, 0, 0, false, 'offset', true, 'pagination-bottom'); echo "<div class='right'>"; html_print_submit_button(__('Delete'), 'delete_btn', false, 'class="sub delete"'); - echo '</div>'; echo '</form>'; } @@ -361,6 +360,8 @@ $table_aux = new stdClass(); echo '</form>'; } + echo '</div>'; + echo '</div>'; } else { include_once $config['homedir'].'/general/first_task/custom_graphs.php'; From 137a2c31ad7ee69ba716f36c6d88a689afb8aec1 Mon Sep 17 00:00:00 2001 From: marcos <marcos.alconada@artica.es> Date: Mon, 15 Mar 2021 15:30:56 +0100 Subject: [PATCH 43/61] fixed visual fails --- pandora_console/godmode/agentes/modificar_agente.php | 2 +- pandora_console/operation/agentes/estado_agente.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pandora_console/godmode/agentes/modificar_agente.php b/pandora_console/godmode/agentes/modificar_agente.php index 909930a4e0..0ce255f403 100644 --- a/pandora_console/godmode/agentes/modificar_agente.php +++ b/pandora_console/godmode/agentes/modificar_agente.php @@ -754,7 +754,7 @@ if ($agents !== false) { echo '</em>'; } - echo '</span><div class="left actions clear_left">'; + echo '</span><div class="left actions clear_left" style="visibility: hidden">'; if ($check_aw) { if ($agent['id_os'] == CLUSTER_OS_ID) { if (enterprise_installed()) { diff --git a/pandora_console/operation/agentes/estado_agente.php b/pandora_console/operation/agentes/estado_agente.php index 846f23d5d6..6db5feaf7d 100644 --- a/pandora_console/operation/agentes/estado_agente.php +++ b/pandora_console/operation/agentes/estado_agente.php @@ -709,7 +709,7 @@ $table->class = 'info_table'; $table->head = []; $table->head[0] = __('Agent').ui_get_sorting_arrows($url_up_agente, $url_down_agente, $selectNameUp, $selectNameDown); -$table->size[0] = '10%'; +$table->size[0] = '12%'; $table->head[1] = __('Description').ui_get_sorting_arrows($url_up_description, $url_down_description, $selectDescriptionUp, $selectDescriptionDown); $table->size[1] = '16%'; From 2b8b27a86355e654c521eaea431a187226c84cb0 Mon Sep 17 00:00:00 2001 From: Daniel Barbero Martin <daniel.barbero@artica.es> Date: Mon, 15 Mar 2021 15:42:22 +0100 Subject: [PATCH 44/61] fixed visual error dashboards --- pandora_console/include/javascript/pandora_dashboards.js | 4 ++-- pandora_console/views/dashboard/layout.php | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/pandora_console/include/javascript/pandora_dashboards.js b/pandora_console/include/javascript/pandora_dashboards.js index 6b05e0e680..d992a9d5fa 100644 --- a/pandora_console/include/javascript/pandora_dashboards.js +++ b/pandora_console/include/javascript/pandora_dashboards.js @@ -452,7 +452,7 @@ function initialiceLayout(data) { $(".add-widget").show(); $(".new-widget-message").hide(); $("#container-layout").addClass("container-layout"); - $("#add-widget").show(); + $("#add-widget").removeClass("invisible"); } else { grid.movable(".grid-stack-item", false); grid.resizable(".grid-stack-item", false); @@ -461,7 +461,7 @@ function initialiceLayout(data) { $(".add-widget").hide(); $(".new-widget-message").show(); $("#container-layout").removeClass("container-layout"); - $("#add-widget").hide(); + $("#add-widget").addClass("invisible"); } }); diff --git a/pandora_console/views/dashboard/layout.php b/pandora_console/views/dashboard/layout.php index de0273c684..09a6d76c2a 100644 --- a/pandora_console/views/dashboard/layout.php +++ b/pandora_console/views/dashboard/layout.php @@ -43,10 +43,10 @@ $output = ''; // Div for modal update dashboard. -$output .= '<div id="modal-update-dashboard" class=""></div>'; -$output .= '<div id="modal-add-widget" class=""></div>'; -$output .= '<div id="modal-config-widget" class=""></div>'; -$output .= '<div id="modal-slides-dialog" class=""></div>'; +$output .= '<div id="modal-update-dashboard" style="display:none;"></div>'; +$output .= '<div id="modal-add-widget" style="display:none;"></div>'; +$output .= '<div id="modal-config-widget" style="display:none;"></div>'; +$output .= '<div id="modal-slides-dialog" style="display:none;"></div>'; // Layout. $output .= '<div class="container-fluid">'; From bd4cad3c83761440118b044498b7808aa6ebe5d7 Mon Sep 17 00:00:00 2001 From: marcos <marcos.alconada@artica.es> Date: Mon, 15 Mar 2021 16:28:30 +0100 Subject: [PATCH 45/61] fixed position --- .../godmode/reporting/reporting_builder.list_items.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pandora_console/godmode/reporting/reporting_builder.list_items.php b/pandora_console/godmode/reporting/reporting_builder.list_items.php index 64e5819b1e..1a086a3bed 100755 --- a/pandora_console/godmode/reporting/reporting_builder.list_items.php +++ b/pandora_console/godmode/reporting/reporting_builder.list_items.php @@ -664,7 +664,7 @@ if (defined('METACONSOLE')) { if (check_acl($config['id_user'], 0, 'RM')) { html_print_input_hidden('ids_items_to_delete', ''); - html_print_submit_button(__('Delete'), 'delete_btn', false, 'class="sub delete"'); + html_print_submit_button(__('Delete'), 'delete_btn', false, 'class="sub delete right"'); } echo '</div>'; @@ -687,7 +687,7 @@ if (defined('METACONSOLE')) { echo "<div class='pdd_b_20px right; w100p'>"; html_print_input_hidden('ids_items_to_delete', ''); - html_print_submit_button(__('Delete'), 'delete_btn', false, 'class="sub delete"'); + html_print_submit_button(__('Delete'), 'delete_btn', false, 'class="sub delete right mrgn_btn_15px"'); echo '</div>'; echo '</form>'; } From 03cb6ef91397f7cd903704316d2711fdbcd5baa5 Mon Sep 17 00:00:00 2001 From: marcos <marcos.alconada@artica.es> Date: Mon, 15 Mar 2021 17:05:34 +0100 Subject: [PATCH 46/61] fixed visual error --- .../incidents/dashboard_detail_integriaims_incident.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pandora_console/operation/incidents/dashboard_detail_integriaims_incident.php b/pandora_console/operation/incidents/dashboard_detail_integriaims_incident.php index 3da5d264d9..9b195342cc 100644 --- a/pandora_console/operation/incidents/dashboard_detail_integriaims_incident.php +++ b/pandora_console/operation/incidents/dashboard_detail_integriaims_incident.php @@ -265,7 +265,7 @@ $table_files_section->data[1][0] .= html_print_textarea( $table_files_section->data[2][0] .= '<div class="w100p right">'.html_print_submit_button(__('Upload'), 'accion', false, 'class="sub wand"', true).'</div>'; -$upload_file_form = '<div>'; +$upload_file_form = '<div class="w100p">'; if (check_acl($config['id_user'], 0, 'IW')) { $upload_file_form .= '<form method="post" id="file_control" enctype="multipart/form-data">'.'<h4>'.__('Add attachment').'</h4>'.html_print_table($table_files_section, true).html_print_input_hidden('upload_file', 1, true); @@ -359,7 +359,7 @@ if (!empty($comments)) { $comment_table = __('No comments found'); } -$upload_comment_form = '<div>'; +$upload_comment_form = '<div class="w100p">'; if (check_acl($config['id_user'], 0, 'IW')) { $upload_comment_form .= '<form method="post" id="comment_form" enctype="multipart/form-data"><h4>'.__('Add comment').'</h4>'.html_print_table($table_comments_section, true).html_print_input_hidden('upload_comment', 1, true).'</form>'; From df269f52c1a4ca2042ffbb819914f92731f9a51c Mon Sep 17 00:00:00 2001 From: artica <artica.devel@gmail.com> Date: Tue, 16 Mar 2021 01:00:18 +0100 Subject: [PATCH 47/61] 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.rhel7.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/lib/PandoraFMS/PluginTools.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 +- 25 files changed, 25 insertions(+), 25 deletions(-) diff --git a/pandora_agents/unix/DEBIAN/control b/pandora_agents/unix/DEBIAN/control index 05cd328a94..a69d63c09b 100644 --- a/pandora_agents/unix/DEBIAN/control +++ b/pandora_agents/unix/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-agent-unix -Version: 7.0NG.752-210315 +Version: 7.0NG.752-210316 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 b8a06b11ee..4f36a43027 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.752-210315" +pandora_version="7.0NG.752-210316" 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 83596329cb..8ea0c103c9 100755 --- a/pandora_agents/unix/pandora_agent +++ b/pandora_agents/unix/pandora_agent @@ -1016,7 +1016,7 @@ my $Sem = undef; my $ThreadSem = undef; use constant AGENT_VERSION => '7.0NG.752'; -use constant AGENT_BUILD => '210315'; +use constant AGENT_BUILD => '210316'; # 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 e40e91a984..8226c25798 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.752 -%define release 210315 +%define release 210316 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 95bb0dca93..e3a383cc50 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.752 -%define release 210315 +%define release 210316 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 12a3f35c7a..be6b8c86c9 100755 --- a/pandora_agents/unix/pandora_agent_installer +++ b/pandora_agents/unix/pandora_agent_installer @@ -10,7 +10,7 @@ # ********************************************************************** PI_VERSION="7.0NG.752" -PI_BUILD="210315" +PI_BUILD="210316" OS_NAME=`uname -s` FORCE=0 diff --git a/pandora_agents/win32/installer/pandora.mpi b/pandora_agents/win32/installer/pandora.mpi index f9d6248fba..1a55def851 100644 --- a/pandora_agents/win32/installer/pandora.mpi +++ b/pandora_agents/win32/installer/pandora.mpi @@ -186,7 +186,7 @@ UpgradeApplicationID {} Version -{210315} +{210316} ViewReadme {Yes} diff --git a/pandora_agents/win32/pandora.cc b/pandora_agents/win32/pandora.cc index 9d83302b9b..7d8a95f0aa 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.752(Build 210315)") +#define PANDORA_VERSION ("7.0NG.752(Build 210316)") string pandora_path; string pandora_dir; diff --git a/pandora_agents/win32/versioninfo.rc b/pandora_agents/win32/versioninfo.rc index 7db5378152..83686db20b 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.752(Build 210315))" + VALUE "ProductVersion", "(7.0NG.752(Build 210316))" VALUE "FileVersion", "1.0.0.0" END END diff --git a/pandora_console/DEBIAN/control b/pandora_console/DEBIAN/control index a4c4347d37..b3db5244f1 100644 --- a/pandora_console/DEBIAN/control +++ b/pandora_console/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-console -Version: 7.0NG.752-210315 +Version: 7.0NG.752-210316 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 bedf3f522b..aaad4e0f21 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.752-210315" +pandora_version="7.0NG.752-210316" package_pear=0 package_pandora=1 diff --git a/pandora_console/include/config_process.php b/pandora_console/include/config_process.php index 1f0f644a72..fb03a543b4 100644 --- a/pandora_console/include/config_process.php +++ b/pandora_console/include/config_process.php @@ -20,7 +20,7 @@ /** * Pandora build version and version */ -$build_version = 'PC210315'; +$build_version = 'PC210316'; $pandora_version = 'v7.0NG.752'; // Do not overwrite default timezone set if defined. diff --git a/pandora_console/install.php b/pandora_console/install.php index 24a84748b9..42173b9866 100644 --- a/pandora_console/install.php +++ b/pandora_console/install.php @@ -129,7 +129,7 @@ <div style='height: 10px'> <?php $version = '7.0NG.752'; - $build = '210315'; + $build = '210316'; $banner = "v$version Build $build"; error_reporting(0); diff --git a/pandora_console/pandora_console.redhat.spec b/pandora_console/pandora_console.redhat.spec index 5986252849..11f2ef6e16 100644 --- a/pandora_console/pandora_console.redhat.spec +++ b/pandora_console/pandora_console.redhat.spec @@ -3,7 +3,7 @@ # %define name pandorafms_console %define version 7.0NG.752 -%define release 210315 +%define release 210316 # User and Group under which Apache is running %define httpd_name httpd diff --git a/pandora_console/pandora_console.rhel7.spec b/pandora_console/pandora_console.rhel7.spec index 19ff217a20..a709a4e657 100644 --- a/pandora_console/pandora_console.rhel7.spec +++ b/pandora_console/pandora_console.rhel7.spec @@ -3,7 +3,7 @@ # %define name pandorafms_console %define version 7.0NG.752 -%define release 210315 +%define release 210316 # User and Group under which Apache is running %define httpd_name httpd diff --git a/pandora_console/pandora_console.spec b/pandora_console/pandora_console.spec index b2082b095f..2c26de3d14 100644 --- a/pandora_console/pandora_console.spec +++ b/pandora_console/pandora_console.spec @@ -3,7 +3,7 @@ # %define name pandorafms_console %define version 7.0NG.752 -%define release 210315 +%define release 210316 %define httpd_name httpd # User and Group under which Apache is running %define httpd_name apache2 diff --git a/pandora_server/DEBIAN/control b/pandora_server/DEBIAN/control index 0c71840520..bdf9210fa1 100644 --- a/pandora_server/DEBIAN/control +++ b/pandora_server/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-server -Version: 7.0NG.752-210315 +Version: 7.0NG.752-210316 Architecture: all Priority: optional Section: admin diff --git a/pandora_server/DEBIAN/make_deb_package.sh b/pandora_server/DEBIAN/make_deb_package.sh index ba322aae7f..ee40a0e996 100644 --- a/pandora_server/DEBIAN/make_deb_package.sh +++ b/pandora_server/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.752-210315" +pandora_version="7.0NG.752-210316" package_cpan=0 package_pandora=1 diff --git a/pandora_server/lib/PandoraFMS/Config.pm b/pandora_server/lib/PandoraFMS/Config.pm index a4b578e306..a17278087b 100644 --- a/pandora_server/lib/PandoraFMS/Config.pm +++ b/pandora_server/lib/PandoraFMS/Config.pm @@ -45,7 +45,7 @@ our @EXPORT = qw( # version: Defines actual version of Pandora Server for this module only my $pandora_version = "7.0NG.752"; -my $pandora_build = "210315"; +my $pandora_build = "210316"; our $VERSION = $pandora_version." ".$pandora_build; # Setup hash diff --git a/pandora_server/lib/PandoraFMS/PluginTools.pm b/pandora_server/lib/PandoraFMS/PluginTools.pm index 87e6bac486..a79a67ea36 100644 --- a/pandora_server/lib/PandoraFMS/PluginTools.pm +++ b/pandora_server/lib/PandoraFMS/PluginTools.pm @@ -34,7 +34,7 @@ our @ISA = qw(Exporter); # version: Defines actual version of Pandora Server for this module only my $pandora_version = "7.0NG.752"; -my $pandora_build = "210315"; +my $pandora_build = "210316"; our $VERSION = $pandora_version." ".$pandora_build; our %EXPORT_TAGS = ( 'all' => [ qw() ] ); diff --git a/pandora_server/pandora_server.redhat.spec b/pandora_server/pandora_server.redhat.spec index 20914dff60..f466bebc14 100644 --- a/pandora_server/pandora_server.redhat.spec +++ b/pandora_server/pandora_server.redhat.spec @@ -3,7 +3,7 @@ # %define name pandorafms_server %define version 7.0NG.752 -%define release 210315 +%define release 210316 Summary: Pandora FMS Server Name: %{name} diff --git a/pandora_server/pandora_server.spec b/pandora_server/pandora_server.spec index 861eaf696a..039e622089 100644 --- a/pandora_server/pandora_server.spec +++ b/pandora_server/pandora_server.spec @@ -3,7 +3,7 @@ # %define name pandorafms_server %define version 7.0NG.752 -%define release 210315 +%define release 210316 Summary: Pandora FMS Server Name: %{name} diff --git a/pandora_server/pandora_server_installer b/pandora_server/pandora_server_installer index 658c4ece30..f5c1e47240 100755 --- a/pandora_server/pandora_server_installer +++ b/pandora_server/pandora_server_installer @@ -9,7 +9,7 @@ # ********************************************************************** PI_VERSION="7.0NG.752" -PI_BUILD="210315" +PI_BUILD="210316" MODE=$1 if [ $# -gt 1 ]; then diff --git a/pandora_server/util/pandora_db.pl b/pandora_server/util/pandora_db.pl index 63c5e347bf..4d7d7fe718 100755 --- a/pandora_server/util/pandora_db.pl +++ b/pandora_server/util/pandora_db.pl @@ -35,7 +35,7 @@ use PandoraFMS::Config; use PandoraFMS::DB; # version: define current version -my $version = "7.0NG.752 PS210315"; +my $version = "7.0NG.752 PS210316"; # Pandora server configuration my %conf; diff --git a/pandora_server/util/pandora_manage.pl b/pandora_server/util/pandora_manage.pl index a0d7bbef23..5ac914a1f4 100755 --- a/pandora_server/util/pandora_manage.pl +++ b/pandora_server/util/pandora_manage.pl @@ -36,7 +36,7 @@ use Encode::Locale; Encode::Locale::decode_argv; # version: define current version -my $version = "7.0NG.752 PS210315"; +my $version = "7.0NG.752 PS210316"; # save program name for logging my $progname = basename($0); From 8dc6ec4e076aa3348f01898d4c255d8807ecf699 Mon Sep 17 00:00:00 2001 From: "alejandro.campos@artica.es" <alejandro.campos@artica.es> Date: Tue, 16 Mar 2021 09:21:16 +0100 Subject: [PATCH 48/61] added setup token --- pandora_console/include/functions_config.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pandora_console/include/functions_config.php b/pandora_console/include/functions_config.php index 3edda7e357..98fa4d22e1 100644 --- a/pandora_console/include/functions_config.php +++ b/pandora_console/include/functions_config.php @@ -1888,6 +1888,10 @@ function config_process_config() config_update_value('collection_max_size', 1000000); } + if (!isset($config['policy_add_max_agents'])) { + config_update_value('policy_add_max_agents', 200); + } + if (!isset($config['event_replication'])) { config_update_value('event_replication', 0); } From 75d57c41ac4321ff01d684d7f20d8eb2ae1155c5 Mon Sep 17 00:00:00 2001 From: "alejandro.campos@artica.es" <alejandro.campos@artica.es> Date: Tue, 16 Mar 2021 09:22:43 +0100 Subject: [PATCH 49/61] remove constant --- pandora_console/include/constants.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/pandora_console/include/constants.php b/pandora_console/include/constants.php index a186e656cf..66b784d712 100644 --- a/pandora_console/include/constants.php +++ b/pandora_console/include/constants.php @@ -476,8 +476,6 @@ define('MODULE_LINKED', 1); define('MODULE_PENDING_UNLINK', 10); define('MODULE_PENDING_LINK', 11); -define('POLICY_ADD_MAX_AGENTS', 200); - // EVENTS. define('EVENTS_GOING_UNKNOWN', 'going_unknown'); define('EVENTS_UNKNOWN', 'unknown'); From f765493ce723180244d7dd00f58140c6d35d575f Mon Sep 17 00:00:00 2001 From: marcos <marcos.alconada@artica.es> Date: Tue, 16 Mar 2021 11:24:05 +0100 Subject: [PATCH 50/61] revert selector theme --- pandora_console/godmode/setup/setup.php | 2 +- pandora_console/godmode/setup/setup_visuals.php | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/pandora_console/godmode/setup/setup.php b/pandora_console/godmode/setup/setup.php index 573fdaa333..3f1867591e 100644 --- a/pandora_console/godmode/setup/setup.php +++ b/pandora_console/godmode/setup/setup.php @@ -218,7 +218,7 @@ $buttons['websocket_engine'] = [ $buttons['external_tools'] = [ 'active' => false, - 'text' => '<a href="'.ui_get_full_url('index.php?sec=gsetup&sec2=godmode/setup/setup§ion=external_tools').'">'.html_print_image('images/nettool.png', true, ['title' => __('External Tools')]).'</a>', + 'text' => '<a href="'.ui_get_full_url('index.php?sec=gsetup&sec2=godmode/setup/setup§ion=external_tools').'">'.html_print_image('images/nettool.png', true, ['title' => __('External Tools'), 'class' => 'invert_filter']).'</a>', ]; if ($config['activate_gis']) { diff --git a/pandora_console/godmode/setup/setup_visuals.php b/pandora_console/godmode/setup/setup_visuals.php index dc5e04d018..70a46eea2e 100755 --- a/pandora_console/godmode/setup/setup_visuals.php +++ b/pandora_console/godmode/setup/setup_visuals.php @@ -131,6 +131,20 @@ $table_styles->style[0] = 'font-weight: bold;'; $table_styles->size[0] = '50%'; $table_styles->data = []; + +$table_styles->data[$row][0] = __('Style template'); +$table_styles->data[$row][1] = html_print_select( + themes_get_css(), + 'style', + $config['style'].'.css', + '', + '', + '', + true +); +$row++; + + $table_styles->data[$row][0] = __('Status icon set'); $iconsets['default'] = __('Colors'); $iconsets['faces'] = __('Faces'); From e4a6c8c876ecf44b9ef498a0ba57d6f54611d522 Mon Sep 17 00:00:00 2001 From: Daniel Barbero Martin <daniel.barbero@artica.es> Date: Tue, 16 Mar 2021 11:44:44 +0100 Subject: [PATCH 51/61] fixed errors visual snmp browser --- pandora_console/include/functions_snmp_browser.php | 2 +- pandora_console/operation/snmpconsole/snmp_browser.php | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pandora_console/include/functions_snmp_browser.php b/pandora_console/include/functions_snmp_browser.php index 04f3823304..5c55dd4e69 100644 --- a/pandora_console/include/functions_snmp_browser.php +++ b/pandora_console/include/functions_snmp_browser.php @@ -1024,7 +1024,7 @@ function snmp_browser_print_container( if ($snmp_version == 3) { $output .= '<div id="snmp3_browser_options">'; } else { - $output .= '<div id="snmp3_browser_options" class="invisible">'; + $output .= '<div id="snmp3_browser_options" style="display: none;">'; } $output .= ui_toggle( diff --git a/pandora_console/operation/snmpconsole/snmp_browser.php b/pandora_console/operation/snmpconsole/snmp_browser.php index a4839cce25..9b5a194410 100644 --- a/pandora_console/operation/snmpconsole/snmp_browser.php +++ b/pandora_console/operation/snmpconsole/snmp_browser.php @@ -82,10 +82,10 @@ ui_print_page_header( // SNMP tree container. snmp_browser_print_container(false, '100%', '60%', '', true); -// Div for modal -echo '<div id="modal" class="invisible"></div>'; +// Div for modal. +echo '<div id="modal" style="display:none"></div>'; // Div for loading modal. -echo '<div id="loading_modal" class="invisible"></div>'; +echo '<div id="loading_modal" style="display:none"></div>'; ?> From fd1c885e2f298de8a6057a2b9a8a393bed89fd3c Mon Sep 17 00:00:00 2001 From: Daniel Barbero Martin <daniel.barbero@artica.es> Date: Tue, 16 Mar 2021 12:06:59 +0100 Subject: [PATCH 52/61] fixed errors visual --- pandora_console/godmode/modules/manage_network_components.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandora_console/godmode/modules/manage_network_components.php b/pandora_console/godmode/modules/manage_network_components.php index 2594d4c023..5a68fb86c2 100644 --- a/pandora_console/godmode/modules/manage_network_components.php +++ b/pandora_console/godmode/modules/manage_network_components.php @@ -918,7 +918,7 @@ if (isset($data)) { ); } -echo '<form method="post" action="'.$url.'">'; +echo '<form method="post" action="'.$url.'" class="float-right">'; echo '<div class="right">'; html_print_input_hidden('new_component', 1); html_print_select( From f05592faeb37f455505d9f6ff48802e7e12c7b81 Mon Sep 17 00:00:00 2001 From: marcos <marcos.alconada@artica.es> Date: Tue, 16 Mar 2021 13:12:03 +0100 Subject: [PATCH 53/61] fixed error --- pandora_console/godmode/agentes/modificar_agente.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandora_console/godmode/agentes/modificar_agente.php b/pandora_console/godmode/agentes/modificar_agente.php index 0ce255f403..6d9516bad7 100644 --- a/pandora_console/godmode/agentes/modificar_agente.php +++ b/pandora_console/godmode/agentes/modificar_agente.php @@ -754,7 +754,7 @@ if ($agents !== false) { echo '</em>'; } - echo '</span><div class="left actions clear_left" style="visibility: hidden">'; + echo '</span><div class="left actions clear_left" style=" visibility: hidden">'; if ($check_aw) { if ($agent['id_os'] == CLUSTER_OS_ID) { if (enterprise_installed()) { From e689813e2c3ba75494f902bafc27f5ae3c3e8095 Mon Sep 17 00:00:00 2001 From: marcos <marcos.alconada@artica.es> Date: Tue, 16 Mar 2021 13:37:13 +0100 Subject: [PATCH 54/61] fixed icons --- pandora_console/godmode/alerts/alert_special_days.php | 2 +- pandora_console/include/class/ConfigPEN.class.php | 2 +- pandora_console/include/functions_html.php | 2 +- pandora_console/include/functions_ui.php | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pandora_console/godmode/alerts/alert_special_days.php b/pandora_console/godmode/alerts/alert_special_days.php index 7a29f7758b..31f787f910 100644 --- a/pandora_console/godmode/alerts/alert_special_days.php +++ b/pandora_console/godmode/alerts/alert_special_days.php @@ -551,7 +551,7 @@ for ($month = 1; $month <= 12; $month++) { $cal_table->data[$cal_line][$week] .= '<a href="index.php?sec=galertas&sec2=godmode/alerts/configure_alert_special_days&create_special_day=1&date='.$date.'" title='; $cal_table->data[$cal_line][$week] .= __('Create'); $cal_table->data[$cal_line][$week] .= '>'.html_print_image( - 'images/add.png', + 'images/add_mc.png', true, ['class' => 'invert_filter'] ).'</a>'; diff --git a/pandora_console/include/class/ConfigPEN.class.php b/pandora_console/include/class/ConfigPEN.class.php index 5f5e692077..0482c10863 100644 --- a/pandora_console/include/class/ConfigPEN.class.php +++ b/pandora_console/include/class/ConfigPEN.class.php @@ -246,7 +246,7 @@ class ConfigPEN extends HTML $tmp->options .= $tmp->pen; $tmp->options .= '\')" >'; $tmp->options .= html_print_image( - 'images/eye.png', + 'images/operation.png', true, [ 'title' => __('Show'), diff --git a/pandora_console/include/functions_html.php b/pandora_console/include/functions_html.php index adb1fd9b9d..bb19f7c962 100644 --- a/pandora_console/include/functions_html.php +++ b/pandora_console/include/functions_html.php @@ -4037,7 +4037,7 @@ function html_print_autocomplete_modules( ob_start(); - $module_icon = 'images/module.png'; + $module_icon = 'images/search_module.png'; if ($config['style'] === 'pandora_black') { $module_icon = 'images/brick.menu.png'; } diff --git a/pandora_console/include/functions_ui.php b/pandora_console/include/functions_ui.php index 8026bd12c2..267b5123c4 100755 --- a/pandora_console/include/functions_ui.php +++ b/pandora_console/include/functions_ui.php @@ -4689,7 +4689,7 @@ function ui_print_agent_autocomplete_input($parameters) } // Default value. - $icon_agent = 'images/agent.png'; + $icon_agent = 'images/search_agent.png'; if ($config['style'] === 'pandora_black') { $icon_agent = 'images/agent_mc.menu.png'; From df8695b01539e1c3daedd3c4873ec2606a96d830 Mon Sep 17 00:00:00 2001 From: marcos <marcos.alconada@artica.es> Date: Tue, 16 Mar 2021 16:25:09 +0100 Subject: [PATCH 55/61] fix green old theme --- pandora_console/include/functions_themes.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pandora_console/include/functions_themes.php b/pandora_console/include/functions_themes.php index 456a2337cc..3fdead3998 100644 --- a/pandora_console/include/functions_themes.php +++ b/pandora_console/include/functions_themes.php @@ -43,7 +43,11 @@ function themes_get_css($path=false) $retval = []; foreach ($files as $file) { - // Skip '..' and '.' entries and files not ended in '.css' + if ($file === 'pandora_green_old.css') { + continue; + } + + // Skip '..' and '.' entries and files not ended in '.css'. if ($path && ($file == '.' || $file == '..' || strtolower(substr($file, (strlen($file) - 4))) !== '.css')) { continue; } From 6bb6f1121be0431362480db65998f01fd128d199 Mon Sep 17 00:00:00 2001 From: Luis <luis.calvo@artica.es> Date: Tue, 16 Mar 2021 16:41:54 +0000 Subject: [PATCH 56/61] Fixed snmpv3 options on modules massive op --- .../godmode/massive/massive_edit_modules.php | 23 +++++++++++++------ 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/pandora_console/godmode/massive/massive_edit_modules.php b/pandora_console/godmode/massive/massive_edit_modules.php index 26d2eae73a..24c772ef33 100755 --- a/pandora_console/godmode/massive/massive_edit_modules.php +++ b/pandora_console/godmode/massive/massive_edit_modules.php @@ -803,11 +803,11 @@ $table->data['edit1'][1] = '<table width="100%">'; true ); $table->data['edit36'][2] = __('Auth password').ui_print_help_tip(__('The pass length must be eight character minimum.'), true); - $table->data['edit36'][3] = html_print_input_text('plugin_pass_snmp', '', '', 15, 60, true); + $table->data['edit36'][3] = html_print_input_password('plugin_pass_snmp', '', '', 15, 60, true); $table->data['edit37'][0] = __('Privacy method'); - $table->data['edit37'][1] = html_print_select(['DES' => __('DES'), 'AES' => __('AES')], 'custom_string_1', '', '', __('No change'), '', true); + $table->data['edit37'][1] = html_print_select(['DES' => __('DES'), 'AES' => __('AES')], 'snmp3_privacy_method', '', '', __('No change'), '', true); $table->data['edit37'][2] = __('Privacy pass').ui_print_help_tip(__('The pass length must be eight character minimum.'), true); - $table->data['edit37'][3] = html_print_input_text('custom_string_2', '', '', 15, 60, true); + $table->data['edit37'][3] = html_print_input_password('snmp3_privacy_pass', '', '', 15, 60, true); $table->data['edit38'][0] = __('Auth method'); $table->data['edit38'][1] = html_print_select(['MD5' => __('MD5'), 'SHA' => __('SHA')], 'plugin_parameter', '', '', __('No change'), '', true); $table->data['edit38'][2] = __('Security level'); @@ -1670,7 +1670,7 @@ $(document).ready (function () { } }); - $('#tcp_send').change(function() { + $('#snmp_version').change(function() { if($(this).val() == 3) { $("tr#delete_table-edit36, tr#delete_table-edit37, tr#delete_table-edit38").show(); } @@ -2096,7 +2096,7 @@ function process_manage_edit($module_name, $agents_select=null, $module_status=' } // Specific snmp reused fields - if (get_parameter('tcp_send', '') == 3) { + if (get_parameter('snmp_version', '') == 3) { $plugin_user_snmp = get_parameter('plugin_user_snmp', ''); if ($plugin_user_snmp != '') { $values['plugin_user'] = $plugin_user_snmp; @@ -2107,7 +2107,12 @@ function process_manage_edit($module_name, $agents_select=null, $module_status=' $values['plugin_pass'] = io_input_password($plugin_pass_snmp); } - $snmp3_privacy_pass = get_parameter('custom_string_2', ''); + $snmp3_privacy_method = get_parameter('snmp3_privacy_method', ''); + if ($snmp3_privacy_method != '') { + $values['custom_string_1'] = io_input_password($snmp3_privacy_method); + } + + $snmp3_privacy_pass = get_parameter('snmp3_privacy_pass', ''); if ($snmp3_privacy_pass != '') { $values['custom_string_2'] = io_input_password($snmp3_privacy_pass); } @@ -2209,7 +2214,11 @@ function process_manage_edit($module_name, $agents_select=null, $module_status=' } // Set tcp_send value according to module type since the purpose of this field in database varies in case of SNMP modules. - if ($module['id_tipo_modulo'] >= 15 && $module['id_tipo_modulo'] <= 18) { + if ($module['id_tipo_modulo'] == MODULE_TYPE_REMOTE_SNMP + || $module['id_tipo_modulo'] == MODULE_TYPE_REMOTE_SNMP_INC + || $module['id_tipo_modulo'] == MODULE_TYPE_REMOTE_SNMP_STRING + || $module['id_tipo_modulo'] <= MODULE_TYPE_REMOTE_SNMP_PROC + ) { if ($snmp_version != '') { $values['tcp_send'] = $snmp_version; } else { From 610d41290e934f4a461f4da7d647e199d9b6721e Mon Sep 17 00:00:00 2001 From: artica <artica.devel@gmail.com> Date: Wed, 17 Mar 2021 01:00:20 +0100 Subject: [PATCH 57/61] 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.rhel7.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/lib/PandoraFMS/PluginTools.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 +- 25 files changed, 25 insertions(+), 25 deletions(-) diff --git a/pandora_agents/unix/DEBIAN/control b/pandora_agents/unix/DEBIAN/control index a69d63c09b..1d4c3f9906 100644 --- a/pandora_agents/unix/DEBIAN/control +++ b/pandora_agents/unix/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-agent-unix -Version: 7.0NG.752-210316 +Version: 7.0NG.752-210317 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 4f36a43027..278da9f8af 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.752-210316" +pandora_version="7.0NG.752-210317" 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 4ff8dd9383..562510270b 100755 --- a/pandora_agents/unix/pandora_agent +++ b/pandora_agents/unix/pandora_agent @@ -1016,7 +1016,7 @@ my $Sem = undef; my $ThreadSem = undef; use constant AGENT_VERSION => '7.0NG.752'; -use constant AGENT_BUILD => '210316'; +use constant AGENT_BUILD => '210317'; # 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 8226c25798..91b3b575e3 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.752 -%define release 210316 +%define release 210317 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 e3a383cc50..19a1cb4704 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.752 -%define release 210316 +%define release 210317 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 be6b8c86c9..e3f281818e 100755 --- a/pandora_agents/unix/pandora_agent_installer +++ b/pandora_agents/unix/pandora_agent_installer @@ -10,7 +10,7 @@ # ********************************************************************** PI_VERSION="7.0NG.752" -PI_BUILD="210316" +PI_BUILD="210317" OS_NAME=`uname -s` FORCE=0 diff --git a/pandora_agents/win32/installer/pandora.mpi b/pandora_agents/win32/installer/pandora.mpi index 1a55def851..a585cac4ed 100644 --- a/pandora_agents/win32/installer/pandora.mpi +++ b/pandora_agents/win32/installer/pandora.mpi @@ -186,7 +186,7 @@ UpgradeApplicationID {} Version -{210316} +{210317} ViewReadme {Yes} diff --git a/pandora_agents/win32/pandora.cc b/pandora_agents/win32/pandora.cc index 7d8a95f0aa..6022283d75 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.752(Build 210316)") +#define PANDORA_VERSION ("7.0NG.752(Build 210317)") string pandora_path; string pandora_dir; diff --git a/pandora_agents/win32/versioninfo.rc b/pandora_agents/win32/versioninfo.rc index 83686db20b..dba97bc8de 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.752(Build 210316))" + VALUE "ProductVersion", "(7.0NG.752(Build 210317))" VALUE "FileVersion", "1.0.0.0" END END diff --git a/pandora_console/DEBIAN/control b/pandora_console/DEBIAN/control index b3db5244f1..614105ac53 100644 --- a/pandora_console/DEBIAN/control +++ b/pandora_console/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-console -Version: 7.0NG.752-210316 +Version: 7.0NG.752-210317 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 aaad4e0f21..976e3ce1e9 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.752-210316" +pandora_version="7.0NG.752-210317" package_pear=0 package_pandora=1 diff --git a/pandora_console/include/config_process.php b/pandora_console/include/config_process.php index fb03a543b4..45ddf03a33 100644 --- a/pandora_console/include/config_process.php +++ b/pandora_console/include/config_process.php @@ -20,7 +20,7 @@ /** * Pandora build version and version */ -$build_version = 'PC210316'; +$build_version = 'PC210317'; $pandora_version = 'v7.0NG.752'; // Do not overwrite default timezone set if defined. diff --git a/pandora_console/install.php b/pandora_console/install.php index 42173b9866..e585920a52 100644 --- a/pandora_console/install.php +++ b/pandora_console/install.php @@ -129,7 +129,7 @@ <div style='height: 10px'> <?php $version = '7.0NG.752'; - $build = '210316'; + $build = '210317'; $banner = "v$version Build $build"; error_reporting(0); diff --git a/pandora_console/pandora_console.redhat.spec b/pandora_console/pandora_console.redhat.spec index 11f2ef6e16..95d06842d7 100644 --- a/pandora_console/pandora_console.redhat.spec +++ b/pandora_console/pandora_console.redhat.spec @@ -3,7 +3,7 @@ # %define name pandorafms_console %define version 7.0NG.752 -%define release 210316 +%define release 210317 # User and Group under which Apache is running %define httpd_name httpd diff --git a/pandora_console/pandora_console.rhel7.spec b/pandora_console/pandora_console.rhel7.spec index a709a4e657..d7f8769e1e 100644 --- a/pandora_console/pandora_console.rhel7.spec +++ b/pandora_console/pandora_console.rhel7.spec @@ -3,7 +3,7 @@ # %define name pandorafms_console %define version 7.0NG.752 -%define release 210316 +%define release 210317 # User and Group under which Apache is running %define httpd_name httpd diff --git a/pandora_console/pandora_console.spec b/pandora_console/pandora_console.spec index 2c26de3d14..6467cfb2ed 100644 --- a/pandora_console/pandora_console.spec +++ b/pandora_console/pandora_console.spec @@ -3,7 +3,7 @@ # %define name pandorafms_console %define version 7.0NG.752 -%define release 210316 +%define release 210317 %define httpd_name httpd # User and Group under which Apache is running %define httpd_name apache2 diff --git a/pandora_server/DEBIAN/control b/pandora_server/DEBIAN/control index bdf9210fa1..287640cd5e 100644 --- a/pandora_server/DEBIAN/control +++ b/pandora_server/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-server -Version: 7.0NG.752-210316 +Version: 7.0NG.752-210317 Architecture: all Priority: optional Section: admin diff --git a/pandora_server/DEBIAN/make_deb_package.sh b/pandora_server/DEBIAN/make_deb_package.sh index ee40a0e996..dd08dd0dde 100644 --- a/pandora_server/DEBIAN/make_deb_package.sh +++ b/pandora_server/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.752-210316" +pandora_version="7.0NG.752-210317" package_cpan=0 package_pandora=1 diff --git a/pandora_server/lib/PandoraFMS/Config.pm b/pandora_server/lib/PandoraFMS/Config.pm index a17278087b..5fdb3d8520 100644 --- a/pandora_server/lib/PandoraFMS/Config.pm +++ b/pandora_server/lib/PandoraFMS/Config.pm @@ -45,7 +45,7 @@ our @EXPORT = qw( # version: Defines actual version of Pandora Server for this module only my $pandora_version = "7.0NG.752"; -my $pandora_build = "210316"; +my $pandora_build = "210317"; our $VERSION = $pandora_version." ".$pandora_build; # Setup hash diff --git a/pandora_server/lib/PandoraFMS/PluginTools.pm b/pandora_server/lib/PandoraFMS/PluginTools.pm index a79a67ea36..c21d1219cc 100644 --- a/pandora_server/lib/PandoraFMS/PluginTools.pm +++ b/pandora_server/lib/PandoraFMS/PluginTools.pm @@ -34,7 +34,7 @@ our @ISA = qw(Exporter); # version: Defines actual version of Pandora Server for this module only my $pandora_version = "7.0NG.752"; -my $pandora_build = "210316"; +my $pandora_build = "210317"; our $VERSION = $pandora_version." ".$pandora_build; our %EXPORT_TAGS = ( 'all' => [ qw() ] ); diff --git a/pandora_server/pandora_server.redhat.spec b/pandora_server/pandora_server.redhat.spec index f466bebc14..a465738ec4 100644 --- a/pandora_server/pandora_server.redhat.spec +++ b/pandora_server/pandora_server.redhat.spec @@ -3,7 +3,7 @@ # %define name pandorafms_server %define version 7.0NG.752 -%define release 210316 +%define release 210317 Summary: Pandora FMS Server Name: %{name} diff --git a/pandora_server/pandora_server.spec b/pandora_server/pandora_server.spec index 039e622089..da0c5f069d 100644 --- a/pandora_server/pandora_server.spec +++ b/pandora_server/pandora_server.spec @@ -3,7 +3,7 @@ # %define name pandorafms_server %define version 7.0NG.752 -%define release 210316 +%define release 210317 Summary: Pandora FMS Server Name: %{name} diff --git a/pandora_server/pandora_server_installer b/pandora_server/pandora_server_installer index 9a66c854c6..8fba37181c 100755 --- a/pandora_server/pandora_server_installer +++ b/pandora_server/pandora_server_installer @@ -9,7 +9,7 @@ # ********************************************************************** PI_VERSION="7.0NG.752" -PI_BUILD="210316" +PI_BUILD="210317" MODE=$1 if [ $# -gt 1 ]; then diff --git a/pandora_server/util/pandora_db.pl b/pandora_server/util/pandora_db.pl index cea64716be..f66fc3f5db 100755 --- a/pandora_server/util/pandora_db.pl +++ b/pandora_server/util/pandora_db.pl @@ -35,7 +35,7 @@ use PandoraFMS::Config; use PandoraFMS::DB; # version: define current version -my $version = "7.0NG.752 PS210316"; +my $version = "7.0NG.752 PS210317"; # Pandora server configuration my %conf; diff --git a/pandora_server/util/pandora_manage.pl b/pandora_server/util/pandora_manage.pl index 5ac914a1f4..45881d1b20 100755 --- a/pandora_server/util/pandora_manage.pl +++ b/pandora_server/util/pandora_manage.pl @@ -36,7 +36,7 @@ use Encode::Locale; Encode::Locale::decode_argv; # version: define current version -my $version = "7.0NG.752 PS210316"; +my $version = "7.0NG.752 PS210317"; # save program name for logging my $progname = basename($0); From 1ea562fe17922ee56d5a812cc93f1fda55c5efa5 Mon Sep 17 00:00:00 2001 From: marcos <marcos.alconada@artica.es> Date: Wed, 17 Mar 2021 13:22:11 +0100 Subject: [PATCH 58/61] fixed visual error --- pandora_console/include/class/Tree.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pandora_console/include/class/Tree.class.php b/pandora_console/include/class/Tree.class.php index 9ef583d574..70fb1d4e60 100644 --- a/pandora_console/include/class/Tree.class.php +++ b/pandora_console/include/class/Tree.class.php @@ -704,9 +704,9 @@ class Tree if ((bool) $module['alerts']) { // Module has alerts triggered. if ($module_alert_triggered === true) { - $module['alertsImageHTML'] = html_print_image('images/bell_orange.png', true, ['title' => __('Module alerts')]); + $module['alertsImageHTML'] = html_print_image('images/bell_orange.png', true, ['title' => __('Module alerts'), 'style' => 'filter: initial']); } else { - $module['alertsImageHTML'] = html_print_image('images/bell_green.png', true, ['title' => __('Module alerts')]); + $module['alertsImageHTML'] = html_print_image('images/bell_green.png', true, ['title' => __('Module alerts'), 'style' => 'filter: initial']); } } } From e8e9b61d32f05ff409f37d09716a98172a9eb148 Mon Sep 17 00:00:00 2001 From: marcos <marcos.alconada@artica.es> Date: Wed, 17 Mar 2021 16:44:57 +0100 Subject: [PATCH 59/61] fixed visual error --- pandora_console/operation/users/user_edit.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandora_console/operation/users/user_edit.php b/pandora_console/operation/users/user_edit.php index 269ef69203..7f17cedb19 100644 --- a/pandora_console/operation/users/user_edit.php +++ b/pandora_console/operation/users/user_edit.php @@ -565,7 +565,7 @@ $table_ichanges = '<div class="autorefresh_select"> <p class="autorefresh_select_text">'.__('Full list of pages').': </p> <div>'.$select_out.'</div> </div> - <div class="autorefresh_select_arrows"> + <div class="autorefresh_select_arrows" style="display:grid"> <a href="javascript:">'.html_print_image( 'images/darrowright_green.png', true, From e667bdd2e8d236e725c3d710c33126444abba8e7 Mon Sep 17 00:00:00 2001 From: Luis <luis.calvo@artica.es> Date: Wed, 17 Mar 2021 16:29:07 +0000 Subject: [PATCH 60/61] Fixed interfaces wizard modules genartion wit hypen --- pandora_console/include/class/AgentWizard.class.php | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/pandora_console/include/class/AgentWizard.class.php b/pandora_console/include/class/AgentWizard.class.php index 6094582691..24dfdf4738 100644 --- a/pandora_console/include/class/AgentWizard.class.php +++ b/pandora_console/include/class/AgentWizard.class.php @@ -1344,12 +1344,10 @@ class AgentWizard extends HTML $generalInterface = false; // Lets catch all values. foreach ($data as $key => $value) { - if (empty(preg_match('/module-active/', $key)) === false + if (empty(preg_match('/module-active-(.*)/m', $key, $tmpModules)) === false && (int) $value === 1 ) { - $tmpModules = explode('-', $key); - - $keyData = $tmpModules[2].'-'.$tmpModules[3]; + $keyData = $tmpModules[1]; $modulesActivated[] = $keyData; } else if (empty(preg_match('/interfaz_select_/', $key)) === false) { @@ -1423,8 +1421,8 @@ class AgentWizard extends HTML $result[$value]['value'] = $data['module-value-'.$key]; } - preg_match('/^(.*)-.*?_(\d+-\d+)$/', $k, $matches); - $k = $matches[1].'-0_'.$matches[2]; + preg_match('/^(.*).*?_(\d+)-+(\d+)$/', $k, $matches); + $k = $matches[1].'_'.$matches[2].'-'.$matches[3]; } else { if (empty(preg_match('/module-value/', $k)) === false) { $result[$value]['value'] = $data[$k]; From 572f8c9908a1041c4c194a3a92823cb1f1e952ac Mon Sep 17 00:00:00 2001 From: artica <artica.devel@gmail.com> Date: Thu, 18 Mar 2021 01:00:22 +0100 Subject: [PATCH 61/61] 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.rhel7.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/lib/PandoraFMS/PluginTools.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 +- 25 files changed, 25 insertions(+), 25 deletions(-) diff --git a/pandora_agents/unix/DEBIAN/control b/pandora_agents/unix/DEBIAN/control index 1d4c3f9906..284f2d7c7a 100644 --- a/pandora_agents/unix/DEBIAN/control +++ b/pandora_agents/unix/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-agent-unix -Version: 7.0NG.752-210317 +Version: 7.0NG.752-210318 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 278da9f8af..ef723e092b 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.752-210317" +pandora_version="7.0NG.752-210318" 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 562510270b..15d09b10a8 100755 --- a/pandora_agents/unix/pandora_agent +++ b/pandora_agents/unix/pandora_agent @@ -1016,7 +1016,7 @@ my $Sem = undef; my $ThreadSem = undef; use constant AGENT_VERSION => '7.0NG.752'; -use constant AGENT_BUILD => '210317'; +use constant AGENT_BUILD => '210318'; # 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 91b3b575e3..d809aed77d 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.752 -%define release 210317 +%define release 210318 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 19a1cb4704..c535b0b973 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.752 -%define release 210317 +%define release 210318 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 e3f281818e..fe011c76e6 100755 --- a/pandora_agents/unix/pandora_agent_installer +++ b/pandora_agents/unix/pandora_agent_installer @@ -10,7 +10,7 @@ # ********************************************************************** PI_VERSION="7.0NG.752" -PI_BUILD="210317" +PI_BUILD="210318" OS_NAME=`uname -s` FORCE=0 diff --git a/pandora_agents/win32/installer/pandora.mpi b/pandora_agents/win32/installer/pandora.mpi index a585cac4ed..0f62b05a6d 100644 --- a/pandora_agents/win32/installer/pandora.mpi +++ b/pandora_agents/win32/installer/pandora.mpi @@ -186,7 +186,7 @@ UpgradeApplicationID {} Version -{210317} +{210318} ViewReadme {Yes} diff --git a/pandora_agents/win32/pandora.cc b/pandora_agents/win32/pandora.cc index 6022283d75..de6d4ba9ed 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.752(Build 210317)") +#define PANDORA_VERSION ("7.0NG.752(Build 210318)") string pandora_path; string pandora_dir; diff --git a/pandora_agents/win32/versioninfo.rc b/pandora_agents/win32/versioninfo.rc index dba97bc8de..01e30be83e 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.752(Build 210317))" + VALUE "ProductVersion", "(7.0NG.752(Build 210318))" VALUE "FileVersion", "1.0.0.0" END END diff --git a/pandora_console/DEBIAN/control b/pandora_console/DEBIAN/control index 614105ac53..cfa7abf43a 100644 --- a/pandora_console/DEBIAN/control +++ b/pandora_console/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-console -Version: 7.0NG.752-210317 +Version: 7.0NG.752-210318 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 976e3ce1e9..3fb7248a48 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.752-210317" +pandora_version="7.0NG.752-210318" package_pear=0 package_pandora=1 diff --git a/pandora_console/include/config_process.php b/pandora_console/include/config_process.php index 45ddf03a33..d53ce18b66 100644 --- a/pandora_console/include/config_process.php +++ b/pandora_console/include/config_process.php @@ -20,7 +20,7 @@ /** * Pandora build version and version */ -$build_version = 'PC210317'; +$build_version = 'PC210318'; $pandora_version = 'v7.0NG.752'; // Do not overwrite default timezone set if defined. diff --git a/pandora_console/install.php b/pandora_console/install.php index e585920a52..8211415152 100644 --- a/pandora_console/install.php +++ b/pandora_console/install.php @@ -129,7 +129,7 @@ <div style='height: 10px'> <?php $version = '7.0NG.752'; - $build = '210317'; + $build = '210318'; $banner = "v$version Build $build"; error_reporting(0); diff --git a/pandora_console/pandora_console.redhat.spec b/pandora_console/pandora_console.redhat.spec index 95d06842d7..2c72229d9b 100644 --- a/pandora_console/pandora_console.redhat.spec +++ b/pandora_console/pandora_console.redhat.spec @@ -3,7 +3,7 @@ # %define name pandorafms_console %define version 7.0NG.752 -%define release 210317 +%define release 210318 # User and Group under which Apache is running %define httpd_name httpd diff --git a/pandora_console/pandora_console.rhel7.spec b/pandora_console/pandora_console.rhel7.spec index d7f8769e1e..1e6aea79bc 100644 --- a/pandora_console/pandora_console.rhel7.spec +++ b/pandora_console/pandora_console.rhel7.spec @@ -3,7 +3,7 @@ # %define name pandorafms_console %define version 7.0NG.752 -%define release 210317 +%define release 210318 # User and Group under which Apache is running %define httpd_name httpd diff --git a/pandora_console/pandora_console.spec b/pandora_console/pandora_console.spec index 6467cfb2ed..76d1a74c67 100644 --- a/pandora_console/pandora_console.spec +++ b/pandora_console/pandora_console.spec @@ -3,7 +3,7 @@ # %define name pandorafms_console %define version 7.0NG.752 -%define release 210317 +%define release 210318 %define httpd_name httpd # User and Group under which Apache is running %define httpd_name apache2 diff --git a/pandora_server/DEBIAN/control b/pandora_server/DEBIAN/control index 287640cd5e..555a1a534d 100644 --- a/pandora_server/DEBIAN/control +++ b/pandora_server/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-server -Version: 7.0NG.752-210317 +Version: 7.0NG.752-210318 Architecture: all Priority: optional Section: admin diff --git a/pandora_server/DEBIAN/make_deb_package.sh b/pandora_server/DEBIAN/make_deb_package.sh index dd08dd0dde..3627800caa 100644 --- a/pandora_server/DEBIAN/make_deb_package.sh +++ b/pandora_server/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.752-210317" +pandora_version="7.0NG.752-210318" package_cpan=0 package_pandora=1 diff --git a/pandora_server/lib/PandoraFMS/Config.pm b/pandora_server/lib/PandoraFMS/Config.pm index 5fdb3d8520..d1bf8a6fb0 100644 --- a/pandora_server/lib/PandoraFMS/Config.pm +++ b/pandora_server/lib/PandoraFMS/Config.pm @@ -45,7 +45,7 @@ our @EXPORT = qw( # version: Defines actual version of Pandora Server for this module only my $pandora_version = "7.0NG.752"; -my $pandora_build = "210317"; +my $pandora_build = "210318"; our $VERSION = $pandora_version." ".$pandora_build; # Setup hash diff --git a/pandora_server/lib/PandoraFMS/PluginTools.pm b/pandora_server/lib/PandoraFMS/PluginTools.pm index c21d1219cc..2f73404363 100644 --- a/pandora_server/lib/PandoraFMS/PluginTools.pm +++ b/pandora_server/lib/PandoraFMS/PluginTools.pm @@ -34,7 +34,7 @@ our @ISA = qw(Exporter); # version: Defines actual version of Pandora Server for this module only my $pandora_version = "7.0NG.752"; -my $pandora_build = "210317"; +my $pandora_build = "210318"; our $VERSION = $pandora_version." ".$pandora_build; our %EXPORT_TAGS = ( 'all' => [ qw() ] ); diff --git a/pandora_server/pandora_server.redhat.spec b/pandora_server/pandora_server.redhat.spec index a465738ec4..52d328d661 100644 --- a/pandora_server/pandora_server.redhat.spec +++ b/pandora_server/pandora_server.redhat.spec @@ -3,7 +3,7 @@ # %define name pandorafms_server %define version 7.0NG.752 -%define release 210317 +%define release 210318 Summary: Pandora FMS Server Name: %{name} diff --git a/pandora_server/pandora_server.spec b/pandora_server/pandora_server.spec index da0c5f069d..030930ed18 100644 --- a/pandora_server/pandora_server.spec +++ b/pandora_server/pandora_server.spec @@ -3,7 +3,7 @@ # %define name pandorafms_server %define version 7.0NG.752 -%define release 210317 +%define release 210318 Summary: Pandora FMS Server Name: %{name} diff --git a/pandora_server/pandora_server_installer b/pandora_server/pandora_server_installer index 8fba37181c..211bc4c441 100755 --- a/pandora_server/pandora_server_installer +++ b/pandora_server/pandora_server_installer @@ -9,7 +9,7 @@ # ********************************************************************** PI_VERSION="7.0NG.752" -PI_BUILD="210317" +PI_BUILD="210318" MODE=$1 if [ $# -gt 1 ]; then diff --git a/pandora_server/util/pandora_db.pl b/pandora_server/util/pandora_db.pl index f66fc3f5db..476e56d29f 100755 --- a/pandora_server/util/pandora_db.pl +++ b/pandora_server/util/pandora_db.pl @@ -35,7 +35,7 @@ use PandoraFMS::Config; use PandoraFMS::DB; # version: define current version -my $version = "7.0NG.752 PS210317"; +my $version = "7.0NG.752 PS210318"; # Pandora server configuration my %conf; diff --git a/pandora_server/util/pandora_manage.pl b/pandora_server/util/pandora_manage.pl index 45881d1b20..991fe7f244 100755 --- a/pandora_server/util/pandora_manage.pl +++ b/pandora_server/util/pandora_manage.pl @@ -36,7 +36,7 @@ use Encode::Locale; Encode::Locale::decode_argv; # version: define current version -my $version = "7.0NG.752 PS210317"; +my $version = "7.0NG.752 PS210318"; # save program name for logging my $progname = basename($0);