WIP: Policy synthetic op: Creating modules
This commit is contained in:
parent
fd48d6eba6
commit
e41dc13ac2
|
@ -1,3 +1,4 @@
|
|||
-- Active: 1696349857571@@172.16.0.2@3306
|
||||
START TRANSACTION;
|
||||
|
||||
ALTER TABLE `tevento`
|
||||
|
@ -24,6 +25,18 @@ ADD COLUMN `regex` TEXT NULL AFTER `private_filter_user`;
|
|||
|
||||
UPDATE `tdiscovery_apps` SET `version` = '1.1' WHERE `short_name` = 'pandorafms.oracle';
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `tpolicy_modules_synth` (
|
||||
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
`id_agent_module_source` INT UNSIGNED NOT NULL DEFAULT 0,
|
||||
`id_agent_module_target` INT UNSIGNED NOT NULL DEFAULT 0,
|
||||
`fixed_value` DOUBLE NOT NULL DEFAULT 0,
|
||||
`operation` enum ('ADD', 'SUB', 'DIV', 'MUL', 'AVG', 'NOP') NOT NULL DEFAULT 'NOP',
|
||||
`order` INT NOT NULL DEFAULT 0,
|
||||
FOREIGN KEY (`id_agent_module_target`) REFERENCES tpolicy_modules(`id`)
|
||||
ON DELETE CASCADE ON UPDATE CASCADE,
|
||||
PRIMARY KEY (id)
|
||||
);
|
||||
|
||||
SET @id_app := (SELECT `id_app` FROM `tdiscovery_apps` WHERE `short_name` = 'pandorafms.oracle');
|
||||
|
||||
UPDATE `tdiscovery_apps_tasks_macros` SET `value` = 'agents_group_id=__taskGroupID__ interval=__taskInterval__ user=_dbuser_ password=_dbpass_ thick_mode=_thickMode_ client_path=_clientPath_ threads=_threads_ modules_prefix=_prefixModuleName_ execute_custom_queries=_executeCustomQueries_ analyze_connections=_checkConnections_ engine_uptime=_checkUptime_ query_stats=_queryStats_ cache_stats=_checkCache_ fragmentation_ratio=_checkFragmentation_ check_tablescpaces=_checkTablespaces_' WHERE `macro` = '_tempfileConf_' AND `id_task` IN (SELECT `id_rt` FROM `trecon_task` WHERE `id_app` = @id_app);
|
||||
|
|
|
@ -869,6 +869,9 @@ var textsToTranslate = {
|
|||
"None": "<?php __('None'); ?>",
|
||||
};
|
||||
|
||||
var url = 'include/ajax/module';
|
||||
var id_source = '<?php echo $id_agente; ?>';
|
||||
|
||||
var icons = {
|
||||
'load_icon': '<?php html_print_image('images/spinner.gif', false); ?>',
|
||||
'error_icon': '<?php html_print_image('images/error_red.png', false); ?>',
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
|
||||
enterprise_include_once('include/functions_policies.php');
|
||||
enterprise_include_once('godmode/agentes/module_manager_editor_prediction.php');
|
||||
enterprise_include_once('include/functions_modules.php');
|
||||
require_once 'include/functions_agents.php';
|
||||
|
||||
$disabledBecauseInPolicy = false;
|
||||
|
@ -37,9 +38,21 @@ $id_agente = get_parameter('id_agente', '');
|
|||
$agent_name = get_parameter('agent_name', agents_get_alias($id_agente));
|
||||
$id_agente_modulo = get_parameter('id_agent_module', 0);
|
||||
$custom_integer_2 = get_parameter('custom_integer_2', 0);
|
||||
$sql = 'SELECT *
|
||||
FROM tagente_modulo
|
||||
WHERE id_agente_modulo = '.$id_agente_modulo;
|
||||
$id_policy_module = get_parameter('id_policy_module', 0);
|
||||
$policy = false;
|
||||
|
||||
if (strstr($page, 'policy_modules') !== false) {
|
||||
$sql = 'SELECT *
|
||||
FROM tpolicy_modules
|
||||
WHERE id = '.$id_policy_module;
|
||||
$policy = true;
|
||||
$id_agente_modulo = $id_policy_module;
|
||||
} else {
|
||||
$sql = 'SELECT *
|
||||
FROM tagente_modulo
|
||||
WHERE id_agente_modulo = '.$id_agente_modulo;
|
||||
}
|
||||
|
||||
$row = db_get_row_sql($sql);
|
||||
$is_service = false;
|
||||
$is_synthetic = false;
|
||||
|
@ -47,9 +60,10 @@ $is_synthetic_avg = false;
|
|||
$ops = false;
|
||||
if ($row !== false && is_array($row) === true) {
|
||||
$prediction_module = $row['prediction_module'];
|
||||
$custom_integer_2 = $row['custom_integer_2'];
|
||||
// Services are an Enterprise feature.
|
||||
$custom_integer_1 = $row['custom_integer_1'];
|
||||
$custom_integer_2 = $row['custom_integer_2'];
|
||||
$custom_string_1 = $row['custom_string_1'];
|
||||
$custom_integer_2 = $row['custom_integer_2'];
|
||||
|
||||
switch ((int) $prediction_module) {
|
||||
case MODULE_PREDICTION_SERVICE:
|
||||
|
@ -60,7 +74,10 @@ if ($row !== false && is_array($row) === true) {
|
|||
case MODULE_PREDICTION_SYNTHETIC:
|
||||
$ops_json = enterprise_hook(
|
||||
'modules_get_synthetic_operations',
|
||||
[$id_agente_modulo]
|
||||
[
|
||||
$id_agente_modulo,
|
||||
$policy,
|
||||
]
|
||||
);
|
||||
|
||||
$ops = json_decode($ops_json, true);
|
||||
|
@ -83,6 +100,7 @@ if ($row !== false && is_array($row) === true) {
|
|||
case MODULE_PREDICTION_TRENDING:
|
||||
$selected = 'trending_selected';
|
||||
$prediction_module = $custom_integer_1;
|
||||
|
||||
break;
|
||||
|
||||
case MODULE_PREDICTION_PLANNING:
|
||||
|
@ -222,7 +240,31 @@ if (strstr($page, 'policy_modules') === false) {
|
|||
}
|
||||
|
||||
$data[0] = $predictionModuleInput;
|
||||
$data[1] = html_print_select([__('Weekly'), __('Monthly'), __('Daily')], 'custom_integer_2', $custom_integer_2, '', '', 0, true, false, true, '', false, 'width: 100%;');
|
||||
$data[1] = html_print_select(
|
||||
[
|
||||
'0' => __('Weekly'),
|
||||
'1' => __('Monthly'),
|
||||
'2' => __('Daily'),
|
||||
],
|
||||
'custom_integer_2',
|
||||
$module['custom_integer_2'],
|
||||
'',
|
||||
'',
|
||||
0,
|
||||
true,
|
||||
false,
|
||||
true,
|
||||
'',
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
'',
|
||||
false,
|
||||
false,
|
||||
true
|
||||
);
|
||||
$data[1] .= html_print_input_hidden('id_agente_module_prediction', $id_agente, true);
|
||||
|
||||
$table_simple->cellclass['prediction_module'][0] = 'w33p';
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
*/
|
||||
|
||||
use PandoraFMS\Enterprise\Metaconsole\Node;
|
||||
use PandoraFMS\Agent;
|
||||
|
||||
// Begin.
|
||||
if (check_login()) {
|
||||
|
@ -82,6 +83,7 @@ if (check_login()) {
|
|||
$update_monitor_filter = get_parameter('update_monitor_filter', 0);
|
||||
$delete_monitor_filter = get_parameter('delete_monitor_filter', 0);
|
||||
$get_cluster_module_detail = (bool) get_parameter('get_cluster_module_detail', 0);
|
||||
$get_combo_modules = (bool) get_parameter('get_combo_modules', false);
|
||||
|
||||
if ($get_agent_modules_json_by_name === true) {
|
||||
$agent_name = get_parameter('agent_name');
|
||||
|
@ -2842,4 +2844,19 @@ if (check_login()) {
|
|||
<?php
|
||||
return;
|
||||
}
|
||||
|
||||
if ($get_combo_modules === true) {
|
||||
$id_agent = get_parameter('id_source');
|
||||
$modules = db_get_all_rows_filter(
|
||||
'tagente_modulo',
|
||||
['id_agente' => $id_agent],
|
||||
[
|
||||
'id_agente_modulo as id',
|
||||
'nombre as name',
|
||||
]
|
||||
);
|
||||
|
||||
echo json_encode($modules);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4535,4 +4535,19 @@ CREATE TABLE IF NOT EXISTS `tpandora_cve` (
|
|||
`cvss_score` DOUBLE DEFAULT NULL,
|
||||
`cvss_vector` VARCHAR(255) DEFAULT NULL,
|
||||
PRIMARY KEY (`cve_id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4;
|
||||
|
||||
-- -----------------------------------------------------
|
||||
-- Table `tmodule_synth`
|
||||
-- -----------------------------------------------------
|
||||
CREATE TABLE IF NOT EXISTS `tpolicy_modules_synth` (
|
||||
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
`id_agent_module_source` INT UNSIGNED NOT NULL DEFAULT 0,
|
||||
`id_agent_module_target` INT UNSIGNED NOT NULL DEFAULT 0,
|
||||
`fixed_value` DOUBLE NOT NULL DEFAULT 0,
|
||||
`operation` enum ('ADD', 'SUB', 'DIV', 'MUL', 'AVG', 'NOP') NOT NULL DEFAULT 'NOP',
|
||||
`order` INT NOT NULL DEFAULT 0,
|
||||
FOREIGN KEY (`id_agent_module_target`) REFERENCES tpolicy_modules(`id`)
|
||||
ON DELETE CASCADE ON UPDATE CASCADE,
|
||||
PRIMARY KEY (id)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4;
|
Loading…
Reference in New Issue