mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-31 01:35:36 +02:00
Merge remote-tracking branch 'origin/develop' into ent-7519-cambio-de-fuentes-en-la-consola-a-nivel-global
This commit is contained in:
commit
2de45a7eb8
@ -1,5 +1,5 @@
|
|||||||
package: pandorafms-agent-unix
|
package: pandorafms-agent-unix
|
||||||
Version: 7.0NG.754-210531
|
Version: 7.0NG.754-210603
|
||||||
Architecture: all
|
Architecture: all
|
||||||
Priority: optional
|
Priority: optional
|
||||||
Section: admin
|
Section: admin
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
|
|
||||||
pandora_version="7.0NG.754-210531"
|
pandora_version="7.0NG.754-210603"
|
||||||
|
|
||||||
echo "Test if you has the tools for to make the packages."
|
echo "Test if you has the tools for to make the packages."
|
||||||
whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null
|
whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null
|
||||||
|
@ -1015,7 +1015,7 @@ my $Sem = undef;
|
|||||||
my $ThreadSem = undef;
|
my $ThreadSem = undef;
|
||||||
|
|
||||||
use constant AGENT_VERSION => '7.0NG.754';
|
use constant AGENT_VERSION => '7.0NG.754';
|
||||||
use constant AGENT_BUILD => '210531';
|
use constant AGENT_BUILD => '210603';
|
||||||
|
|
||||||
# Agent log default file size maximum and instances
|
# Agent log default file size maximum and instances
|
||||||
use constant DEFAULT_MAX_LOG_SIZE => 600000;
|
use constant DEFAULT_MAX_LOG_SIZE => 600000;
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
#
|
#
|
||||||
%define name pandorafms_agent_unix
|
%define name pandorafms_agent_unix
|
||||||
%define version 7.0NG.754
|
%define version 7.0NG.754
|
||||||
%define release 210531
|
%define release 210603
|
||||||
|
|
||||||
Summary: Pandora FMS Linux agent, PERL version
|
Summary: Pandora FMS Linux agent, PERL version
|
||||||
Name: %{name}
|
Name: %{name}
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
#
|
#
|
||||||
%define name pandorafms_agent_unix
|
%define name pandorafms_agent_unix
|
||||||
%define version 7.0NG.754
|
%define version 7.0NG.754
|
||||||
%define release 210531
|
%define release 210603
|
||||||
|
|
||||||
Summary: Pandora FMS Linux agent, PERL version
|
Summary: Pandora FMS Linux agent, PERL version
|
||||||
Name: %{name}
|
Name: %{name}
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
# **********************************************************************
|
# **********************************************************************
|
||||||
|
|
||||||
PI_VERSION="7.0NG.754"
|
PI_VERSION="7.0NG.754"
|
||||||
PI_BUILD="210531"
|
PI_BUILD="210603"
|
||||||
OS_NAME=`uname -s`
|
OS_NAME=`uname -s`
|
||||||
|
|
||||||
FORCE=0
|
FORCE=0
|
||||||
|
@ -186,7 +186,7 @@ UpgradeApplicationID
|
|||||||
{}
|
{}
|
||||||
|
|
||||||
Version
|
Version
|
||||||
{210531}
|
{210603}
|
||||||
|
|
||||||
ViewReadme
|
ViewReadme
|
||||||
{Yes}
|
{Yes}
|
||||||
|
@ -30,7 +30,7 @@ using namespace Pandora;
|
|||||||
using namespace Pandora_Strutils;
|
using namespace Pandora_Strutils;
|
||||||
|
|
||||||
#define PATH_SIZE _MAX_PATH+1
|
#define PATH_SIZE _MAX_PATH+1
|
||||||
#define PANDORA_VERSION ("7.0NG.754 Build 210531")
|
#define PANDORA_VERSION ("7.0NG.754 Build 210603")
|
||||||
|
|
||||||
string pandora_path;
|
string pandora_path;
|
||||||
string pandora_dir;
|
string pandora_dir;
|
||||||
|
@ -11,7 +11,7 @@ BEGIN
|
|||||||
VALUE "LegalCopyright", "Artica ST"
|
VALUE "LegalCopyright", "Artica ST"
|
||||||
VALUE "OriginalFilename", "PandoraAgent.exe"
|
VALUE "OriginalFilename", "PandoraAgent.exe"
|
||||||
VALUE "ProductName", "Pandora FMS Windows Agent"
|
VALUE "ProductName", "Pandora FMS Windows Agent"
|
||||||
VALUE "ProductVersion", "(7.0NG.754(Build 210531))"
|
VALUE "ProductVersion", "(7.0NG.754(Build 210603))"
|
||||||
VALUE "FileVersion", "1.0.0.0"
|
VALUE "FileVersion", "1.0.0.0"
|
||||||
END
|
END
|
||||||
END
|
END
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
package: pandorafms-console
|
package: pandorafms-console
|
||||||
Version: 7.0NG.754-210531
|
Version: 7.0NG.754-210603
|
||||||
Architecture: all
|
Architecture: all
|
||||||
Priority: optional
|
Priority: optional
|
||||||
Section: admin
|
Section: admin
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
|
|
||||||
pandora_version="7.0NG.754-210531"
|
pandora_version="7.0NG.754-210603"
|
||||||
|
|
||||||
package_pear=0
|
package_pear=0
|
||||||
package_pandora=1
|
package_pandora=1
|
||||||
|
@ -500,7 +500,7 @@ if (enterprise_installed()) {
|
|||||||
false,
|
false,
|
||||||
// Delete_groups.
|
// Delete_groups.
|
||||||
// Do not show the primary group in this selection.
|
// Do not show the primary group in this selection.
|
||||||
array_merge($secondary_groups_selected['plain'], [$agent['id_grupo']])
|
array_merge(($secondary_groups_selected['plain'] ?? []), [$agent['id_grupo']])
|
||||||
// Include_groups.
|
// Include_groups.
|
||||||
// Size.
|
// Size.
|
||||||
// Simple_multiple_options.
|
// Simple_multiple_options.
|
||||||
|
@ -1668,47 +1668,30 @@ if ($update_module) {
|
|||||||
'module_macros' => $module_macros,
|
'module_macros' => $module_macros,
|
||||||
];
|
];
|
||||||
|
|
||||||
if (preg_match('/http_auth_user/m', $values['plugin_parameter'])) {
|
|
||||||
$http_user_conf = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (preg_match('/http_auth_pass/m', $values['plugin_parameter'])) {
|
if ($id_module_type == 30 || $id_module_type == 31 || $id_module_type == 32 || $id_module_type == 33) {
|
||||||
$http_pass_conf = true;
|
$plugin_parameter_split = explode('
', $values['plugin_parameter']);
|
||||||
}
|
|
||||||
|
|
||||||
|
$values['plugin_parameter'] = '';
|
||||||
|
|
||||||
if (!$http_user_conf || !$http_pass_conf) {
|
foreach ($plugin_parameter_split as $key => $value) {
|
||||||
if ($id_module_type == 30 || $id_module_type == 31 || $id_module_type == 32 || $id_module_type == 33) {
|
if ($key == 1) {
|
||||||
$plugin_parameter_split = explode('
', $values['plugin_parameter']);
|
if ($http_user) {
|
||||||
|
$values['plugin_parameter'] .= 'http_auth_user '.$http_user.'
';
|
||||||
$values['plugin_parameter'] = '';
|
|
||||||
|
|
||||||
foreach ($plugin_parameter_split as $key => $value) {
|
|
||||||
if ($key == 1) {
|
|
||||||
if ($http_user) {
|
|
||||||
if ($http_user_conf) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
$values['plugin_parameter'] .= 'http_auth_user '.$http_user.'
';
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($http_pass) {
|
|
||||||
if ($http_user_pass) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
$values['plugin_parameter'] .= 'http_auth_pass '.$http_pass.'
';
|
|
||||||
}
|
|
||||||
|
|
||||||
$values['plugin_parameter'] .= $value.'
';
|
|
||||||
} else {
|
|
||||||
$values['plugin_parameter'] .= $value.'
';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($http_pass) {
|
||||||
|
$values['plugin_parameter'] .= 'http_auth_pass '.$http_pass.'
';
|
||||||
|
}
|
||||||
|
|
||||||
|
$values['plugin_parameter'] .= $value.'
';
|
||||||
|
} else {
|
||||||
|
$values['plugin_parameter'] .= $value.'
';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// In local modules, the interval is updated by agent.
|
// In local modules, the interval is updated by agent.
|
||||||
$module_kind = (int) get_parameter('moduletype');
|
$module_kind = (int) get_parameter('moduletype');
|
||||||
if ($module_kind == MODULE_DATA) {
|
if ($module_kind == MODULE_DATA) {
|
||||||
@ -2112,106 +2095,8 @@ if ($delete_module) {
|
|||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
enterprise_include_once('include/functions_config_agents.php');
|
// Also call base function to delete modules madafakas de los cojones.
|
||||||
enterprise_hook('config_agents_delete_module_in_conf', [modules_get_agentmodule_agent($id_borrar_modulo), modules_get_agentmodule_name($id_borrar_modulo)]);
|
modules_delete_agent_module($id_borrar_modulo);
|
||||||
|
|
||||||
// Init transaction.
|
|
||||||
$error = 0;
|
|
||||||
|
|
||||||
// First delete from tagente_modulo -> if not successful, increment
|
|
||||||
// error. NOTICE that we don't delete all data here, just marking for deletion
|
|
||||||
// and delete some simple data.
|
|
||||||
$values = [
|
|
||||||
'nombre' => 'pendingdelete',
|
|
||||||
'disabled' => 1,
|
|
||||||
'delete_pending' => 1,
|
|
||||||
];
|
|
||||||
$result = db_process_sql_update(
|
|
||||||
'tagente_modulo',
|
|
||||||
$values,
|
|
||||||
['id_agente_modulo' => $id_borrar_modulo]
|
|
||||||
);
|
|
||||||
if ($result === false) {
|
|
||||||
$error++;
|
|
||||||
} else {
|
|
||||||
// Set flag to update module status count.
|
|
||||||
db_process_sql(
|
|
||||||
'UPDATE tagente
|
|
||||||
SET update_module_count = 1, update_alert_count = 1
|
|
||||||
WHERE id_agente = '.$module_data['id_agente']
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
$result = db_process_sql_delete(
|
|
||||||
'tagente_estado',
|
|
||||||
['id_agente_modulo' => $id_borrar_modulo]
|
|
||||||
);
|
|
||||||
if ($result === false) {
|
|
||||||
$error++;
|
|
||||||
}
|
|
||||||
|
|
||||||
$result = db_process_sql_delete(
|
|
||||||
'tagente_datos_inc',
|
|
||||||
['id_agente_modulo' => $id_borrar_modulo]
|
|
||||||
);
|
|
||||||
if ($result === false) {
|
|
||||||
$error++;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (alerts_delete_alert_agent_module(
|
|
||||||
false,
|
|
||||||
['id_agent_module' => $id_borrar_modulo]
|
|
||||||
) === false
|
|
||||||
) {
|
|
||||||
$error++;
|
|
||||||
}
|
|
||||||
|
|
||||||
$result = db_process_delete_temp(
|
|
||||||
'ttag_module',
|
|
||||||
'id_agente_modulo',
|
|
||||||
$id_borrar_modulo
|
|
||||||
);
|
|
||||||
if ($result === false) {
|
|
||||||
$error++;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Trick to detect if we are deleting a synthetic module (avg or arithmetic)
|
|
||||||
// If result is empty then module doesn't have this type of submodules.
|
|
||||||
$ops_json = enterprise_hook('modules_get_synthetic_operations', [$id_borrar_modulo]);
|
|
||||||
$result_ops_synthetic = json_decode($ops_json);
|
|
||||||
if (!empty($result_ops_synthetic)) {
|
|
||||||
$result = enterprise_hook('modules_delete_synthetic_operations', [$id_borrar_modulo]);
|
|
||||||
if ($result === false) {
|
|
||||||
$error++;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
$result_components = enterprise_hook('modules_get_synthetic_components', [$id_borrar_modulo]);
|
|
||||||
$count_components = 1;
|
|
||||||
if (!empty($result_components)) {
|
|
||||||
// Get number of components pending to delete to know when it's needed to update orders.
|
|
||||||
$num_components = count($result_components);
|
|
||||||
$last_target_module = 0;
|
|
||||||
foreach ($result_components as $id_target_module) {
|
|
||||||
// Detects change of component or last component to update orders.
|
|
||||||
if (($count_components == $num_components)
|
|
||||||
|| ($last_target_module != $id_target_module)
|
|
||||||
) {
|
|
||||||
$update_orders = true;
|
|
||||||
} else {
|
|
||||||
$update_orders = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
$result = enterprise_hook('modules_delete_synthetic_operations', [$id_target_module, $id_borrar_modulo, $update_orders]);
|
|
||||||
|
|
||||||
if ($result === false) {
|
|
||||||
$error++;
|
|
||||||
}
|
|
||||||
|
|
||||||
$count_components++;
|
|
||||||
$last_target_module = $id_target_module;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check for errors.
|
// Check for errors.
|
||||||
if ($error != 0) {
|
if ($error != 0) {
|
||||||
|
@ -599,8 +599,12 @@ if ($moduletype == MODULE_DATA) {
|
|||||||
$table_advanced->colspan[1][1] = 2;
|
$table_advanced->colspan[1][1] = 2;
|
||||||
$interval_factor = 1;
|
$interval_factor = 1;
|
||||||
if (isset($id_agente)) {
|
if (isset($id_agente)) {
|
||||||
$agent_interval = agents_get_interval($id_agente);
|
$agent_interval = (float) agents_get_interval($id_agente);
|
||||||
$interval_factor = ($interval / $agent_interval);
|
if ($agent_interval > 0) {
|
||||||
|
$interval = (float) $interval;
|
||||||
|
$interval_factor = ($interval / $agent_interval);
|
||||||
|
}
|
||||||
|
|
||||||
$table_advanced->data[1][1] = human_time_description_raw($interval).' ('.sprintf(__('Agent interval x %s'), $interval_factor).') ';
|
$table_advanced->data[1][1] = human_time_description_raw($interval).' ('.sprintf(__('Agent interval x %s'), $interval_factor).') ';
|
||||||
} else {
|
} else {
|
||||||
$table_advanced->data[1][1] = sprintf(__('Agent interval x %s'), $interval_factor);
|
$table_advanced->data[1][1] = sprintf(__('Agent interval x %s'), $interval_factor);
|
||||||
|
@ -101,12 +101,29 @@ if ($id_policy_module) {
|
|||||||
$plugin_parameter = $module['plugin_parameter'];
|
$plugin_parameter = $module['plugin_parameter'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$plugin_parameter_split = explode('
', $plugin_parameter);
|
||||||
|
$plugin_parameter_final_split = '';
|
||||||
|
|
||||||
|
foreach ($plugin_parameter_split as $key => $value) {
|
||||||
|
if (strpos($value, 'http_auth_user') === false && strpos($value, 'http_auth_pass') === false) {
|
||||||
|
$plugin_parameter_final_split .= $value.'
';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (strpos($value, 'http_auth_user') !== false) {
|
||||||
|
$plugin_parameter_http_user = str_replace('http_auth_user ', '', $value);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (strpos($value, 'http_auth_pass') !== false) {
|
||||||
|
$plugin_parameter_http_pass = str_replace('http_auth_pass ', '', $value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ((bool) $adopt === false) {
|
if ((bool) $adopt === false) {
|
||||||
$data[1] = html_print_textarea(
|
$data[1] = html_print_textarea(
|
||||||
'plugin_parameter',
|
'plugin_parameter',
|
||||||
15,
|
15,
|
||||||
65,
|
65,
|
||||||
$plugin_parameter,
|
$plugin_parameter_final_split,
|
||||||
$disabledTextBecauseInPolicy,
|
$disabledTextBecauseInPolicy,
|
||||||
true,
|
true,
|
||||||
'resizev'
|
'resizev'
|
||||||
@ -116,7 +133,7 @@ if ((bool) $adopt === false) {
|
|||||||
'plugin_parameter',
|
'plugin_parameter',
|
||||||
15,
|
15,
|
||||||
65,
|
65,
|
||||||
$plugin_parameter,
|
$plugin_parameter_final_split,
|
||||||
false,
|
false,
|
||||||
true
|
true
|
||||||
);
|
);
|
||||||
@ -259,16 +276,12 @@ foreach ($texts as $code => $text) {
|
|||||||
"get_content",
|
"get_content",
|
||||||
"debug",
|
"debug",
|
||||||
"task_end",
|
"task_end",
|
||||||
"head",
|
"head"
|
||||||
"http_auth_user",
|
|
||||||
"http_auth_pass"
|
|
||||||
];
|
];
|
||||||
|
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
|
|
||||||
var plugin_parameter = $("#textarea_plugin_parameter");
|
var plugin_parameter = $("#textarea_plugin_parameter");
|
||||||
var http_auth_user = $('#text-http_user');
|
|
||||||
var http_auth_pass = $('#password-http_pass');
|
|
||||||
|
|
||||||
$(plugin_parameter).keyup(function() {
|
$(plugin_parameter).keyup(function() {
|
||||||
|
|
||||||
@ -278,18 +291,6 @@ foreach ($texts as $code => $text) {
|
|||||||
} else {
|
} else {
|
||||||
$('#button-btn_loadbasic').attr('disabled', 'disabled');
|
$('#button-btn_loadbasic').attr('disabled', 'disabled');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update http_auth_user from conf data
|
|
||||||
var http_auth_user_value = get_module_token_from_config('http_auth_user', plugin_parameter, "\n");
|
|
||||||
if (http_auth_user_value != "") {
|
|
||||||
http_auth_user.val(http_auth_user_value);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Update http_auth_pass from conf data
|
|
||||||
var http_auth_pass_value = get_module_token_from_config('http_auth_pass', plugin_parameter, "\n");
|
|
||||||
if (http_auth_pass_value != "") {
|
|
||||||
http_auth_pass.val(http_auth_pass_value);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#button-btn_loadbasic').click(function() {
|
$('#button-btn_loadbasic').click(function() {
|
||||||
@ -413,57 +414,6 @@ foreach ($texts as $code => $text) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
$(plugin_parameter).trigger('keyup');
|
$(plugin_parameter).trigger('keyup');
|
||||||
|
|
||||||
http_auth_user.keyup(function() {
|
|
||||||
config = plugin_parameter.val();
|
|
||||||
if (config.search("http_auth_user") == -1) {
|
|
||||||
var http_auth_user_end =
|
|
||||||
"http_auth_user " + this.value + "\n" + "task_end" + "\n";
|
|
||||||
plugin_parameter.val(config.replace(/^task_end.*$/m, http_auth_user_end));
|
|
||||||
} else {
|
|
||||||
plugin_parameter.val(
|
|
||||||
config.replace(/^http_auth_user.*$/m, "http_auth_user " + this.value)
|
|
||||||
);
|
|
||||||
// Hide success and error indicators
|
|
||||||
$(".checks").hide();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
http_auth_pass.keyup(function() {
|
|
||||||
config = plugin_parameter.val();
|
|
||||||
if (config.search("http_auth_pass") == -1) {
|
|
||||||
var http_auth_pass_end =
|
|
||||||
"http_auth_pass " + this.value + "\n" + "task_end" + "\n";
|
|
||||||
plugin_parameter.val(config.replace(/^task_end.*$/m, http_auth_pass_end));
|
|
||||||
} else {
|
|
||||||
plugin_parameter.val(
|
|
||||||
config.replace(/^http_auth_pass.*$/m, "http_auth_pass " + this.value)
|
|
||||||
);
|
|
||||||
// Hide success and error indicators
|
|
||||||
$(".checks").hide();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
function get_module_token_from_config(token_name, plugin_parameter, separator) {
|
|
||||||
var return_var = "";
|
|
||||||
if(token_name == null || token_name == '') {
|
|
||||||
return '';
|
|
||||||
}
|
|
||||||
|
|
||||||
data = plugin_parameter.val().split(separator);
|
|
||||||
len = data.length;
|
|
||||||
for (i = 0; i < len; i++) {
|
|
||||||
if (data[i][0] == "#") continue;
|
|
||||||
tokens = data[i].split(" ");
|
|
||||||
if (tokens.length == 0) continue;
|
|
||||||
token = tokens.shift();
|
|
||||||
if (token == token_name ) return_var = tokens.join(" ");
|
|
||||||
}
|
|
||||||
|
|
||||||
return_var = $.trim(return_var);
|
|
||||||
|
|
||||||
return return_var;
|
|
||||||
}
|
|
||||||
|
|
||||||
</script>
|
</script>
|
@ -20,7 +20,7 @@
|
|||||||
/**
|
/**
|
||||||
* Pandora build version and version
|
* Pandora build version and version
|
||||||
*/
|
*/
|
||||||
$build_version = 'PC210531';
|
$build_version = 'PC210603';
|
||||||
$pandora_version = 'v7.0NG.754';
|
$pandora_version = 'v7.0NG.754';
|
||||||
|
|
||||||
// Do not overwrite default timezone set if defined.
|
// Do not overwrite default timezone set if defined.
|
||||||
|
@ -2417,6 +2417,30 @@ function agents_delete_agent($id_agents, $disableACL=false)
|
|||||||
$id_agent
|
$id_agent
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// Process a controlled module ellimination, keeping the old behaviour
|
||||||
|
// a couple of lines below this section.
|
||||||
|
try {
|
||||||
|
$filter = ['id_agente' => $id_agent];
|
||||||
|
$modules = [];
|
||||||
|
$rows = \db_get_all_rows_filter(
|
||||||
|
'tagente_modulo',
|
||||||
|
$filter
|
||||||
|
);
|
||||||
|
|
||||||
|
if (is_array($rows) === true) {
|
||||||
|
foreach ($rows as $row) {
|
||||||
|
$modules[] = PandoraFMS\Module::build($row);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($modules as $module) {
|
||||||
|
$module->delete();
|
||||||
|
}
|
||||||
|
} catch (Exception $e) {
|
||||||
|
// Ignore.
|
||||||
|
error_log($e->getMessage().' in '.$e->getFile().':'.$e->getLine());
|
||||||
|
}
|
||||||
|
|
||||||
// The status of the module
|
// The status of the module
|
||||||
db_process_delete_temp('tagente_estado', 'id_agente', $id_agent);
|
db_process_delete_temp('tagente_estado', 'id_agente', $id_agent);
|
||||||
|
|
||||||
@ -2456,15 +2480,27 @@ function agents_delete_agent($id_agents, $disableACL=false)
|
|||||||
$target_filter
|
$target_filter
|
||||||
);
|
);
|
||||||
|
|
||||||
foreach ($commands as $command) {
|
if (is_array($commands) === true) {
|
||||||
$rcmd_id = $command['rcmd_id'];
|
foreach ($commands as $command) {
|
||||||
$rcmd = new RCMDFile($rcmd_id);
|
$rcmd_id = $command['rcmd_id'];
|
||||||
|
$rcmd = new RCMDFile($rcmd_id);
|
||||||
|
|
||||||
$command_targets = [];
|
$command_targets = [];
|
||||||
|
|
||||||
$command_targets = $rcmd->getTargets(false, $target_filter);
|
$command_targets = $rcmd->getTargets(false, $target_filter);
|
||||||
$rcmd->deleteTargets(array_keys($command_targets));
|
$rcmd->deleteTargets(array_keys($command_targets));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Remove agents from service child list.
|
||||||
|
enterprise_include_once('include/functions_services.php');
|
||||||
|
\enterprise_hook(
|
||||||
|
'service_elements_removal_tool',
|
||||||
|
[
|
||||||
|
$id_agent,
|
||||||
|
SERVICE_ELEMENT_AGENT,
|
||||||
|
]
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// tagente_datos_inc
|
// tagente_datos_inc
|
||||||
|
@ -524,10 +524,13 @@ function io_json_mb_encode($string, $encode_options=0)
|
|||||||
$v = json_encode($string, $encode_options);
|
$v = json_encode($string, $encode_options);
|
||||||
$v = preg_replace_callback(
|
$v = preg_replace_callback(
|
||||||
"/\\\\u([0-9a-zA-Z]{4})/",
|
"/\\\\u([0-9a-zA-Z]{4})/",
|
||||||
create_function(
|
function ($matches) {
|
||||||
'$matches',
|
return mb_convert_encoding(
|
||||||
'return mb_convert_encoding(pack("H*", $matches[1]), "UTF-8", "UTF-16");'
|
pack('H*', $matches[1]),
|
||||||
),
|
'UTF-8',
|
||||||
|
'UTF-16'
|
||||||
|
);
|
||||||
|
},
|
||||||
$v
|
$v
|
||||||
);
|
);
|
||||||
$v = preg_replace('/\\\\\//', '/', $v);
|
$v = preg_replace('/\\\\\//', '/', $v);
|
||||||
|
@ -387,7 +387,7 @@ function modules_change_disabled($id_agent_module, $new_value=1)
|
|||||||
*
|
*
|
||||||
* @param mixed Agent module id to be deleted. Accepts an array with ids.
|
* @param mixed Agent module id to be deleted. Accepts an array with ids.
|
||||||
*
|
*
|
||||||
* @return True if the module was deleted. False if not.
|
* @return boolean True if the module was deleted. False if not.
|
||||||
*/
|
*/
|
||||||
function modules_delete_agent_module($id_agent_module)
|
function modules_delete_agent_module($id_agent_module)
|
||||||
{
|
{
|
||||||
@ -455,6 +455,16 @@ function modules_delete_agent_module($id_agent_module)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Remove module from service child list.
|
||||||
|
enterprise_include_once('include/functions_services.php');
|
||||||
|
\enterprise_hook(
|
||||||
|
'service_elements_removal_tool',
|
||||||
|
[
|
||||||
|
$id_agent_module,
|
||||||
|
SERVICE_ELEMENT_MODULE,
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
alerts_delete_alert_agent_module(0, $where);
|
alerts_delete_alert_agent_module(0, $where);
|
||||||
|
|
||||||
db_process_sql_delete('tgraph_source', $where);
|
db_process_sql_delete('tgraph_source', $where);
|
||||||
@ -477,6 +487,130 @@ function modules_delete_agent_module($id_agent_module)
|
|||||||
);
|
);
|
||||||
db_process_sql_delete('ttag_module', $where);
|
db_process_sql_delete('ttag_module', $where);
|
||||||
|
|
||||||
|
$id_borrar_modulo = $id_agent_module;
|
||||||
|
|
||||||
|
enterprise_include_once('include/functions_config_agents.php');
|
||||||
|
enterprise_hook(
|
||||||
|
'config_agents_delete_module_in_conf',
|
||||||
|
[
|
||||||
|
modules_get_agentmodule_agent($id_borrar_modulo),
|
||||||
|
modules_get_agentmodule_name($id_borrar_modulo),
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
// Init transaction.
|
||||||
|
$error = 0;
|
||||||
|
|
||||||
|
// First delete from tagente_modulo -> if not successful, increment
|
||||||
|
// error. NOTICE that we don't delete all data here, just marking for deletion
|
||||||
|
// and delete some simple data.
|
||||||
|
$values = [
|
||||||
|
'nombre' => 'pendingdelete',
|
||||||
|
'disabled' => 1,
|
||||||
|
'delete_pending' => 1,
|
||||||
|
];
|
||||||
|
$result = db_process_sql_update(
|
||||||
|
'tagente_modulo',
|
||||||
|
$values,
|
||||||
|
['id_agente_modulo' => $id_borrar_modulo]
|
||||||
|
);
|
||||||
|
if ($result === false) {
|
||||||
|
$error++;
|
||||||
|
} else {
|
||||||
|
// Set flag to update module status count.
|
||||||
|
db_process_sql(
|
||||||
|
'UPDATE tagente
|
||||||
|
SET update_module_count = 1, update_alert_count = 1
|
||||||
|
WHERE id_agente = '.$id_agent
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
$result = db_process_sql_delete(
|
||||||
|
'tagente_estado',
|
||||||
|
['id_agente_modulo' => $id_borrar_modulo]
|
||||||
|
);
|
||||||
|
if ($result === false) {
|
||||||
|
$error++;
|
||||||
|
}
|
||||||
|
|
||||||
|
$result = db_process_sql_delete(
|
||||||
|
'tagente_datos_inc',
|
||||||
|
['id_agente_modulo' => $id_borrar_modulo]
|
||||||
|
);
|
||||||
|
if ($result === false) {
|
||||||
|
$error++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (alerts_delete_alert_agent_module(
|
||||||
|
false,
|
||||||
|
['id_agent_module' => $id_borrar_modulo]
|
||||||
|
) === false
|
||||||
|
) {
|
||||||
|
$error++;
|
||||||
|
}
|
||||||
|
|
||||||
|
$result = db_process_delete_temp(
|
||||||
|
'ttag_module',
|
||||||
|
'id_agente_modulo',
|
||||||
|
$id_borrar_modulo
|
||||||
|
);
|
||||||
|
if ($result === false) {
|
||||||
|
$error++;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Trick to detect if we are deleting a synthetic module (avg or arithmetic)
|
||||||
|
// If result is empty then module doesn't have this type of submodules.
|
||||||
|
$ops_json = enterprise_hook(
|
||||||
|
'modules_get_synthetic_operations',
|
||||||
|
[$id_borrar_modulo]
|
||||||
|
);
|
||||||
|
$result_ops_synthetic = json_decode($ops_json);
|
||||||
|
if (!empty($result_ops_synthetic)) {
|
||||||
|
$result = enterprise_hook(
|
||||||
|
'modules_delete_synthetic_operations',
|
||||||
|
[$id_borrar_modulo]
|
||||||
|
);
|
||||||
|
if ($result === false) {
|
||||||
|
$error++;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$result_components = enterprise_hook(
|
||||||
|
'modules_get_synthetic_components',
|
||||||
|
[$id_borrar_modulo]
|
||||||
|
);
|
||||||
|
$count_components = 1;
|
||||||
|
if (!empty($result_components)) {
|
||||||
|
// Get number of components pending to delete to know when it's needed to update orders.
|
||||||
|
$num_components = count($result_components);
|
||||||
|
$last_target_module = 0;
|
||||||
|
foreach ($result_components as $id_target_module) {
|
||||||
|
$update_orders = false;
|
||||||
|
// Detects change of component or last component to update orders.
|
||||||
|
if (($count_components == $num_components)
|
||||||
|
|| ($last_target_module != $id_target_module)
|
||||||
|
) {
|
||||||
|
$update_orders = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
$result = enterprise_hook(
|
||||||
|
'modules_delete_synthetic_operations',
|
||||||
|
[
|
||||||
|
$id_target_module,
|
||||||
|
$id_borrar_modulo,
|
||||||
|
$update_orders,
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
if ($result === false) {
|
||||||
|
$error++;
|
||||||
|
}
|
||||||
|
|
||||||
|
$count_components++;
|
||||||
|
$last_target_module = $id_target_module;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -588,6 +588,13 @@ class Agent extends Entity
|
|||||||
$this->fields['id_agente']
|
$this->fields['id_agente']
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// Delete modules.
|
||||||
|
if ($this->modules !== null) {
|
||||||
|
foreach ($this->modules as $module) {
|
||||||
|
$module->delete();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
unset($this->fields);
|
unset($this->fields);
|
||||||
unset($this->modules);
|
unset($this->modules);
|
||||||
}
|
}
|
||||||
|
@ -228,8 +228,10 @@ class Module extends Entity
|
|||||||
throw $e;
|
throw $e;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->nombre() === 'delete_pending') {
|
if ($this->nombre() === 'delete_pending'
|
||||||
return null;
|
|| $this->nombre() === 'pendingdelete'
|
||||||
|
) {
|
||||||
|
throw new \Exception('Object is pending to be deleted', 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($link_agent === true) {
|
if ($link_agent === true) {
|
||||||
@ -314,6 +316,30 @@ class Module extends Entity
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get/set for disable field, this method also takes in mind the status of
|
||||||
|
* assigned agent (if any).
|
||||||
|
*
|
||||||
|
* @param boolean|null $disabled Used in set operations.
|
||||||
|
*
|
||||||
|
* @return boolean|null Return disabled status for this module or null if
|
||||||
|
* set operation.
|
||||||
|
*/
|
||||||
|
public function disabled(?bool $disabled=null)
|
||||||
|
{
|
||||||
|
if ($disabled === null) {
|
||||||
|
if ($this->agent() !== null) {
|
||||||
|
return ((bool) $this->fields['disabled'] || (bool) $this->agent()->disabled());
|
||||||
|
}
|
||||||
|
|
||||||
|
return ((bool) $this->fields['disabled']);
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->fields['disabled'] = $disabled;
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Dynamically call methods in this object.
|
* Dynamically call methods in this object.
|
||||||
*
|
*
|
||||||
@ -392,9 +418,7 @@ class Module extends Entity
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
throw new \Exception(
|
return parent::__call($methodName, $params);
|
||||||
get_class($this).' error, method '.$methodName.' does not exist'
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1124,9 +1124,15 @@ if ($searchPage) {
|
|||||||
include 'general/noaccess.php';
|
include 'general/noaccess.php';
|
||||||
} else {
|
} else {
|
||||||
$sec = $main_sec;
|
$sec = $main_sec;
|
||||||
if (file_exists($page)) {
|
if (file_exists($page) === true) {
|
||||||
if (! extensions_is_extension($page)) {
|
if ((bool) extensions_is_extension($page) === false) {
|
||||||
include_once $page;
|
try {
|
||||||
|
include_once $page;
|
||||||
|
} catch (Exception $e) {
|
||||||
|
ui_print_error_message(
|
||||||
|
$e->getMessage().' in '.$e->getFile().':'.$e->getLine()
|
||||||
|
);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
if ($sec[0] == 'g') {
|
if ($sec[0] == 'g') {
|
||||||
extensions_call_godmode_function(basename($page));
|
extensions_call_godmode_function(basename($page));
|
||||||
|
@ -129,7 +129,7 @@
|
|||||||
<div style='height: 10px'>
|
<div style='height: 10px'>
|
||||||
<?php
|
<?php
|
||||||
$version = '7.0NG.754';
|
$version = '7.0NG.754';
|
||||||
$build = '210531';
|
$build = '210603';
|
||||||
$banner = "v$version Build $build";
|
$banner = "v$version Build $build";
|
||||||
|
|
||||||
error_reporting(0);
|
error_reporting(0);
|
||||||
|
@ -1325,7 +1325,14 @@ $agent_interfaces = agents_get_network_interfaces(
|
|||||||
['id_agente' => $id_agente]
|
['id_agente' => $id_agente]
|
||||||
);
|
);
|
||||||
|
|
||||||
$agent_interfaces_count = count($agent_interfaces[$id_agente]['interfaces']);
|
if (is_array($agent_interfaces[$id_agente]['interfaces']) !== true
|
||||||
|
|| is_object($agent_interfaces[$id_agente]['interfaces']) !== true
|
||||||
|
) {
|
||||||
|
$agent_interfaces_count = 0;
|
||||||
|
} else {
|
||||||
|
$agent_interfaces_count = count($agent_interfaces[$id_agente]['interfaces']);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if ($agent_interfaces_count > 0) {
|
if ($agent_interfaces_count > 0) {
|
||||||
$interfacetab['text'] = '<a href="index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente='.$id_agente.'&tab=interface">'.html_print_image(
|
$interfacetab['text'] = '<a href="index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente='.$id_agente.'&tab=interface">'.html_print_image(
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
#
|
#
|
||||||
%define name pandorafms_console
|
%define name pandorafms_console
|
||||||
%define version 7.0NG.754
|
%define version 7.0NG.754
|
||||||
%define release 210531
|
%define release 210603
|
||||||
|
|
||||||
# User and Group under which Apache is running
|
# User and Group under which Apache is running
|
||||||
%define httpd_name httpd
|
%define httpd_name httpd
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
#
|
#
|
||||||
%define name pandorafms_console
|
%define name pandorafms_console
|
||||||
%define version 7.0NG.754
|
%define version 7.0NG.754
|
||||||
%define release 210531
|
%define release 210603
|
||||||
|
|
||||||
# User and Group under which Apache is running
|
# User and Group under which Apache is running
|
||||||
%define httpd_name httpd
|
%define httpd_name httpd
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
#
|
#
|
||||||
%define name pandorafms_console
|
%define name pandorafms_console
|
||||||
%define version 7.0NG.754
|
%define version 7.0NG.754
|
||||||
%define release 210531
|
%define release 210603
|
||||||
%define httpd_name httpd
|
%define httpd_name httpd
|
||||||
# User and Group under which Apache is running
|
# User and Group under which Apache is running
|
||||||
%define httpd_name apache2
|
%define httpd_name apache2
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
package: pandorafms-server
|
package: pandorafms-server
|
||||||
Version: 7.0NG.754-210531
|
Version: 7.0NG.754-210603
|
||||||
Architecture: all
|
Architecture: all
|
||||||
Priority: optional
|
Priority: optional
|
||||||
Section: admin
|
Section: admin
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
|
|
||||||
pandora_version="7.0NG.754-210531"
|
pandora_version="7.0NG.754-210603"
|
||||||
|
|
||||||
package_cpan=0
|
package_cpan=0
|
||||||
package_pandora=1
|
package_pandora=1
|
||||||
|
@ -45,7 +45,7 @@ our @EXPORT = qw(
|
|||||||
|
|
||||||
# version: Defines actual version of Pandora Server for this module only
|
# version: Defines actual version of Pandora Server for this module only
|
||||||
my $pandora_version = "7.0NG.754";
|
my $pandora_version = "7.0NG.754";
|
||||||
my $pandora_build = "210531";
|
my $pandora_build = "210603";
|
||||||
our $VERSION = $pandora_version." ".$pandora_build;
|
our $VERSION = $pandora_version." ".$pandora_build;
|
||||||
|
|
||||||
# Setup hash
|
# Setup hash
|
||||||
|
@ -34,7 +34,7 @@ our @ISA = qw(Exporter);
|
|||||||
|
|
||||||
# version: Defines actual version of Pandora Server for this module only
|
# version: Defines actual version of Pandora Server for this module only
|
||||||
my $pandora_version = "7.0NG.754";
|
my $pandora_version = "7.0NG.754";
|
||||||
my $pandora_build = "210531";
|
my $pandora_build = "210603";
|
||||||
our $VERSION = $pandora_version." ".$pandora_build;
|
our $VERSION = $pandora_version." ".$pandora_build;
|
||||||
|
|
||||||
our %EXPORT_TAGS = ( 'all' => [ qw() ] );
|
our %EXPORT_TAGS = ( 'all' => [ qw() ] );
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
#
|
#
|
||||||
%define name pandorafms_server
|
%define name pandorafms_server
|
||||||
%define version 7.0NG.754
|
%define version 7.0NG.754
|
||||||
%define release 210531
|
%define release 210603
|
||||||
|
|
||||||
Summary: Pandora FMS Server
|
Summary: Pandora FMS Server
|
||||||
Name: %{name}
|
Name: %{name}
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
#
|
#
|
||||||
%define name pandorafms_server
|
%define name pandorafms_server
|
||||||
%define version 7.0NG.754
|
%define version 7.0NG.754
|
||||||
%define release 210531
|
%define release 210603
|
||||||
|
|
||||||
Summary: Pandora FMS Server
|
Summary: Pandora FMS Server
|
||||||
Name: %{name}
|
Name: %{name}
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
# **********************************************************************
|
# **********************************************************************
|
||||||
|
|
||||||
PI_VERSION="7.0NG.754"
|
PI_VERSION="7.0NG.754"
|
||||||
PI_BUILD="210531"
|
PI_BUILD="210603"
|
||||||
|
|
||||||
MODE=$1
|
MODE=$1
|
||||||
if [ $# -gt 1 ]; then
|
if [ $# -gt 1 ]; then
|
||||||
|
@ -35,7 +35,7 @@ use PandoraFMS::Config;
|
|||||||
use PandoraFMS::DB;
|
use PandoraFMS::DB;
|
||||||
|
|
||||||
# version: define current version
|
# version: define current version
|
||||||
my $version = "7.0NG.754 Build 210531";
|
my $version = "7.0NG.754 Build 210603";
|
||||||
|
|
||||||
# Pandora server configuration
|
# Pandora server configuration
|
||||||
my %conf;
|
my %conf;
|
||||||
|
@ -36,7 +36,7 @@ use Encode::Locale;
|
|||||||
Encode::Locale::decode_argv;
|
Encode::Locale::decode_argv;
|
||||||
|
|
||||||
# version: define current version
|
# version: define current version
|
||||||
my $version = "7.0NG.754 Build 210531";
|
my $version = "7.0NG.754 Build 210603";
|
||||||
|
|
||||||
# save program name for logging
|
# save program name for logging
|
||||||
my $progname = basename($0);
|
my $progname = basename($0);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user