Merge remote-tracking branch 'origin/develop' into ent-7074-Command-Center

This commit is contained in:
Daniel Barbero Martin 2021-05-28 14:37:20 +02:00
commit 12e67380ee
7 changed files with 124 additions and 59 deletions

View File

@ -196,6 +196,7 @@ function mainModuleGroups()
ON ta.id_agente = tam.id_agente
WHERE ta.disabled = 0
AND tam.disabled = 0
AND tam.id_modulo <> 0
AND tam.delete_pending = 0
AND ta.id_grupo IN (%s)
GROUP BY tam.id_agente_modulo

View File

@ -1,29 +1,43 @@
<?php
/**
* Resource registration.
*
* @category Extensions
* @package Pandora FMS
* @subpackage Community
* @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.
* ============================================================================
*/
// 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; 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.
// Remember the hard-coded values
/*
-- id_modulo now uses tmodule
-- ---------------------------
-- 1 - Data server modules (agent related modules)
-- 2 - Network server modules
-- 4 - Plugin server
-- 5 - Predictive server
-- 6 - WMI server
-- 7 - WEB Server (enteprise)
In the xml is the tag "module_source"
*/
/**
* Remember the hard-coded values.
* -- id_modulo now uses tmodule.
* -- ---------------------------.
* -- 1 - Data server modules (agent related modules)
* -- 2 - Network server modules
* -- 4 - Plugin server
* -- 5 - Predictive server
* -- 6 - WMI server
* -- 7 - WEB Server (enteprise)
* In the xml is the tag "module_source"
*/
require_once $config['homedir'].'/include/functions_agents.php';
enterprise_include_once('include/functions_local_components.php');
@ -1097,7 +1111,13 @@ function resource_registration_extension_main()
$xml = simplexml_load_file($_FILES['resource_upload']['tmp_name'], null, LIBXML_NOCDATA);
process_upload_xml($xml);
if ($xml === false) {
ui_print_error_message(
__('Error uploading resource. Check if the selected file is a valid resource template in .ptr format')
);
} else {
process_upload_xml($xml);
}
}

View File

@ -1,17 +1,32 @@
<?php
/**
* Common editor fields.
*
* @category Module manager
* @package Pandora FMS
* @subpackage Community
* @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.
* ============================================================================
*/
// 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.
// Begin
require_once $config['homedir'].'/include/functions_modules.php';
require_once $config['homedir'].'/include/functions_categories.php';
require_once $config['homedir'].'/include/graphs/functions_d3.php';
@ -19,7 +34,9 @@ require_once $config['homedir'].'/include/graphs/functions_d3.php';
include_javascript_d3();
global $config;function prepend_table_simple($row, $id=false)
global $config;
function prepend_table_simple($row, $id=false)
{
global $table_simple;
@ -115,7 +132,12 @@ function add_component_selection($id_network_component_type)
'',
'---'.__('Manual setup').'---',
0,
true
true,
false,
true,
'',
false,
'width: 460px; '
);
$data[1] .= '</span>';
$data[1] .= ' <span id="component_loading" class="invisible">';

View File

@ -312,7 +312,7 @@ class AgentWizard extends HTML
$this->idPolicy = get_parameter('id', '');
$this->targetIp = get_parameter('targetIp', '');
if (!empty($this->idAgent)) {
if (empty($this->idAgent) === false) {
$array_aux = db_get_all_rows_sql(
sprintf(
'SELECT ip FROM taddress ta
@ -1691,28 +1691,43 @@ class AgentWizard extends HTML
)
);
if ($fieldsPlugin !== false) {
$fieldsPlugin = json_decode($fieldsPlugin, true);
$i = 1;
foreach ($infoMacros as $key => $value) {
if (empty(preg_match('/_snmp_field/', $key)) === false) {
$new_macros = [];
foreach ($fieldsPlugin as $k => $v) {
if ($v['macro'] === preg_replace('/_snmp_field/', '', $key)) {
$fieldsPlugin[$k]['value'] = $this->replacementMacrosPlugin(
$value,
$infoMacros['macros']
);
$i++;
continue;
if ($this->wizardSection === 'snmp_interfaces_explorer'
&& empty($candidate['macros']) === false
) {
// Use definition provided.
$values['id_plugin'] = $candidate['id_plugin'];
$values['macros'] = base64_decode($candidate['macros']);
} else {
$fieldsPlugin = db_get_value_sql(
sprintf(
'SELECT macros FROM tplugin WHERE id=%d',
(int) $infoMacros['server_plugin']
)
);
if ($fieldsPlugin !== false) {
$fieldsPlugin = json_decode($fieldsPlugin, true);
$i = 1;
foreach ($infoMacros as $key => $value) {
if (empty(preg_match('/_snmp_field/', $key)) === false) {
$new_macros = [];
foreach ($fieldsPlugin as $k => $v) {
if ($v['macro'] === preg_replace('/_snmp_field/', '', $key)) {
$fieldsPlugin[$k]['value'] = $this->replacementMacrosPlugin(
$value,
$infoMacros['macros']
);
$i++;
continue;
}
}
}
}
}
}
$values['id_plugin'] = $infoMacros['server_plugin'];
$values['macros'] = json_encode($fieldsPlugin);
$values['id_plugin'] = $infoMacros['server_plugin'];
$values['macros'] = json_encode($fieldsPlugin);
}
}
}
} else if ($this->protocol === 'wmi') {

View File

@ -27,6 +27,8 @@
*/
// Begin.
global $config;
// Check to avoid error when load this library in error screen situations.
if (isset($config['homedir'])) {
include_once $config['homedir'].'/include/functions_agents.php';
@ -35,8 +37,6 @@ if (isset($config['homedir'])) {
include_once $config['homedir'].'/include/functions_groups.php';
include_once $config['homedir'].'/include/functions_users.php';
include_once $config['homedir'].'/include/functions_html.php';
// For standard breadcrumbs.
ui_require_css_file('discovery');
}
@ -4355,6 +4355,8 @@ function ui_print_standard_header(
array $options=[],
array $breadcrumbs=[]
) {
// For standard breadcrumbs.
ui_require_css_file('discovery');
// Create the breadcrumb.
$headerInformation = new HTML();
$headerInformation->setBreadcrum([]);

View File

@ -8516,3 +8516,7 @@ div.stat-win-spinner img {
float: right;
margin-bottom: 20px;
}
.align-left-important {
text-align: left !important;
}

View File

@ -1290,6 +1290,7 @@ if ($config['pure'] == 0) {
// Container div.
echo '</div>';
echo '<div id="both"></div>';
echo '</div>';
echo '<div id="foot">';
include 'general/footer.php';