Modules percentage threshold form

This commit is contained in:
Calvo 2021-11-24 11:33:36 +01:00
parent 5b49372e99
commit 4dd931f277
18 changed files with 434 additions and 143 deletions

View File

@ -0,0 +1,16 @@
START TRANSACTION;
ALTER TABLE `tagente_modulo` ADD COLUMN `percentage_critical` tinyint(1) UNSIGNED DEFAULT 0;
ALTER TABLE `tagente_modulo` ADD COLUMN `percentage_warning` tinyint(1) UNSIGNED DEFAULT 0;
ALTER TABLE `tnetwork_component` ADD COLUMN `percentage_critical` tinyint(1) UNSIGNED DEFAULT 0;
ALTER TABLE `tnetwork_component` ADD COLUMN `percentage_warning` tinyint(1) UNSIGNED DEFAULT 0;
ALTER TABLE `tlocal_component` ADD COLUMN `percentage_critical` tinyint(1) UNSIGNED DEFAULT 0;
ALTER TABLE `tlocal_component` ADD COLUMN `percentage_warning` tinyint(1) UNSIGNED DEFAULT 0;
ALTER TABLE `tpolicy_modules` ADD COLUMN `percentage_warning` tinyint(1) UNSIGNED DEFAULT 0;
ALTER TABLE `tpolicy_modules` ADD COLUMN `percentage_critical` tinyint(1) UNSIGNED DEFAULT 0;
COMMIT;

View File

@ -172,6 +172,8 @@ ALTER TABLE tagente_modulo ADD COLUMN `dynamic_min` bigint(20) default '0';
ALTER TABLE tagente_modulo ADD COLUMN `prediction_sample_window` int(10) default 0;
ALTER TABLE tagente_modulo ADD COLUMN `prediction_samples` int(4) default 0;
ALTER TABLE tagente_modulo ADD COLUMN `prediction_threshold` int(4) default 0;
ALTER TABLE tagente_modulo ADD COLUMN `percentage_critical` tinyint(1) UNSIGNED DEFAULT 0;
ALTER TABLE tagente_modulo ADD COLUMN `percentage_warning` tinyint(1) UNSIGNED DEFAULT 0;
-- ---------------------------------------------------------------------
-- Table `tagente_estado`
@ -189,3 +191,21 @@ ALTER TABLE tgraph_source ADD COLUMN `id_server` int(11) NOT NULL default 0;
-- ---------------------------------------------------------------------
ALTER TABLE tevent_filter ADD COLUMN `id_agent_module` int(25) DEFAULT 0;
ALTER TABLE tevent_filter ADD COLUMN `id_agent` int(25) DEFAULT 0;
-- ---------------------------------------------------------------------
-- Table `tevent_filter`
-- ---------------------------------------------------------------------
ALTER TABLE `tnetwork_component` ADD COLUMN `percentage_critical` tinyint(1) UNSIGNED DEFAULT 0;
ALTER TABLE `tnetwork_component` ADD COLUMN `percentage_warning` tinyint(1) UNSIGNED DEFAULT 0;
-- ---------------------------------------------------------------------
-- Table `tevent_filter`
-- ---------------------------------------------------------------------
ALTER TABLE `tlocal_component` ADD COLUMN `percentage_critical` tinyint(1) UNSIGNED DEFAULT 0;
ALTER TABLE `tlocal_component` ADD COLUMN `percentage_warning` tinyint(1) UNSIGNED DEFAULT 0;
-- ---------------------------------------------------------------------
-- Table `tevent_filter`
-- ---------------------------------------------------------------------
ALTER TABLE `tpolicy_modules` ADD COLUMN `percentage_critical` tinyint(1) UNSIGNED DEFAULT 0;
ALTER TABLE `tpolicy_modules` ADD COLUMN `percentage_warning` tinyint(1) UNSIGNED DEFAULT 0;

View File

@ -96,6 +96,8 @@ if (isset($_POST['template_id'])) {
'str_critical' => $row2['str_critical'],
'critical_inverse' => $row2['critical_inverse'],
'warning_inverse' => $row2['warning_inverse'],
'percentage_warning' => $row2['percentage_warning'],
'percentage_critical' => $row2['percentage_critical'],
'critical_instructions' => $row2['critical_instructions'],
'warning_instructions' => $row2['warning_instructions'],
'unknown_instructions' => $row2['unknown_instructions'],

View File

@ -1541,6 +1541,8 @@ if ($update_module || $create_module) {
$unknown_instructions = (string) get_parameter('unknown_instructions');
$critical_inverse = (int) get_parameter('critical_inverse');
$warning_inverse = (int) get_parameter('warning_inverse');
$percentage_critical = (int) get_parameter('percentage_critical');
$percentage_warning = (int) get_parameter('percentage_warning');
$id_category = (int) get_parameter('id_category');
@ -1694,6 +1696,8 @@ if ($update_module) {
'unknown_instructions' => $unknown_instructions,
'critical_inverse' => $critical_inverse,
'warning_inverse' => $warning_inverse,
'percentage_critical' => $percentage_critical,
'percentage_warning' => $percentage_warning,
'cron_interval' => $cron_interval,
'id_category' => $id_category,
'disabled_types_event' => addslashes($disabled_types_event),
@ -1900,6 +1904,8 @@ if ($create_module) {
'unknown_instructions' => $unknown_instructions,
'critical_inverse' => $critical_inverse,
'warning_inverse' => $warning_inverse,
'percentage_critical' => $percentage_critical,
'percentage_warning' => $percentage_warning,
'cron_interval' => $cron_interval,
'id_category' => $id_category,
'disabled_types_event' => addslashes($disabled_types_event),

View File

@ -704,6 +704,8 @@ if ((bool) $checked === true) {
'quiet',
'critical_inverse',
'warning_inverse',
'percentage_critical',
'percentage_warning',
'id_policy_module',
]
);

View File

@ -99,6 +99,9 @@ if (is_ajax()) {
$component['str_critical'] = io_safe_output($component['str_critical']);
$component['warning_inverse'] = (bool) $component['warning_inverse'];
$component['critical_inverse'] = (bool) $component['critical_inverse'];
$component['percentage_warning'] = (bool) $component['percentage_warning'];
$component['percentage_critical'] = (bool) $component['percentage_critical'];
echo io_json_mb_encode($component);
return;
@ -328,6 +331,9 @@ if ($id_agent_module) {
$critical_inverse = $module['critical_inverse'];
$warning_inverse = $module['warning_inverse'];
$percentage_critical = $module['percentage_critical'];
$percentage_warning = $module['percentage_warning'];
$id_category = $module['id_category'];
@ -467,6 +473,8 @@ if ($id_agent_module) {
$critical_inverse = '';
$warning_inverse = '';
$percentage_critical = '';
$percentage_warning = '';
$each_ff = 0;
$ff_event_normal = '';

View File

@ -459,6 +459,12 @@ if (modules_is_string_type($id_module_type) || $edit) {
$table_simple->data[2][1] .= '<br /><em>'.__('Inverse interval').'</em>';
$table_simple->data[2][1] .= html_print_checkbox('warning_inverse', 1, $warning_inverse, true, $disabledBecauseInPolicy);
if (modules_is_string_type($id_module_type) === false) {
$table_simple->data[2][1] .= '<div id="percentage_warning"><em>'.__('Percentage').'</em>';
$table_simple->data[2][1] .= html_print_checkbox('percentage_warning', 1, $percentage_warning, true, $disabledBecauseInPolicy);
$table_simple->data[2][1] .= '</div>';
}
if (!modules_is_string_type($id_module_type) || $edit) {
$table_simple->data[2][2] = '<svg id="svg_dinamic" width="500" height="300"> </svg>';
}
@ -512,6 +518,12 @@ if (modules_is_string_type($id_module_type) || $edit) {
$table_simple->data[3][1] .= '<br /><em>'.__('Inverse interval').'</em>';
$table_simple->data[3][1] .= html_print_checkbox('critical_inverse', 1, $critical_inverse, true, $disabledBecauseInPolicy);
if (modules_is_string_type($id_module_type) === false) {
$table_simple->data[3][1] .= '<div id="percentage_critical" /><em>'.__('Percentage').'</em>';
$table_simple->data[3][1] .= html_print_checkbox('percentage_critical', 1, $percentage_critical, true, $disabledBecauseInPolicy);
$table_simple->data[3][1] .= '</div>';
}
$table_simple->data[4][0] = __('Historical data');
if ($disabledBecauseInPolicy) {
// If is disabled, we send a hidden in his place and print a false
@ -1551,6 +1563,8 @@ $(document).ready (function () {
$('#minmax_critical').show();
$('#minmax_warning').show();
$('#svg_dinamic').show();
$('#percentage_warning').show();
$('#percentage_critical').show();
}
else {
// String types
@ -1559,6 +1573,8 @@ $(document).ready (function () {
$('#minmax_critical').hide();
$('#minmax_warning').hide();
$('#svg_dinamic').hide();
$('#percentage_warning').hide();
$('#percentage_critical').hide();
}
if (type_name_selected.match(/async/) == null) {

View File

@ -613,6 +613,26 @@ $table->data['edit1'][1] = '<table width="100%">';
);
$table->data['edit1'][1] .= '</td>';
$table->data['edit1'][1] .= '</tr>';
$table->data['edit1'][1] .= '<tr>';
$table->data['edit1'][1] .= '<td>';
$table->data['edit1'][1] .= '<em>'.__('Percentage').'</em>';
$table->data['edit1'][1] .= '</td>';
$table->data['edit1'][1] .= '<td align="right">';
$table->data['edit1'][1] .= html_print_select(
[
'' => __('No change'),
'1' => __('Yes'),
'0' => __('No'),
],
'percentage_warning',
'',
'',
'',
'',
true
);
$table->data['edit1'][1] .= '</td>';
$table->data['edit1'][1] .= '</tr>';
$table->data['edit1'][1] .= '</table>';
$table->data['edit1'][2] = __('Critical status');
@ -682,6 +702,27 @@ $table->data['edit1'][1] = '<table width="100%">';
);
$table->data['edit1'][3] .= '</td>';
$table->data['edit1'][3] .= '</tr>';
$table->data['edit1'][3] .= '<tr>';
$table->data['edit1'][3] .= '<td>';
$table->data['edit1'][3] .= '<em>'.__('Percentage').'</em>';
$table->data['edit1'][3] .= '</td>';
$table->data['edit1'][3] .= '<td align="right">';
$table->data['edit1'][3] .= html_print_select(
[
'' => __('No change'),
'1' => __('Yes'),
'0' => __('No'),
],
'percentage_critical',
'',
'',
'',
'',
true
);
$table->data['edit1'][3] .= '</td>';
$table->data['edit1'][3] .= '</tr>';
$table->data['edit1'][3] .= '</table>';
$table->data['edit1_1'][0] = '<b>'.__('Description').'</b>';
@ -1571,6 +1612,12 @@ $(document).ready (function () {
else if (this.id == "checkbox-warning_inverse") {
return; //Do none
}
else if (this.id == "checkbox-percentage_critical") {
return; //Do none
}
else if (this.id == "checkbox-percentage_warning") {
return; //Do none
}
else if (this.id == "checkbox-critical_inverse") {
return; //Do none
}
@ -1950,6 +1997,8 @@ function process_manage_edit($module_name, $agents_select=null, $module_status='
'history_data',
'critical_inverse',
'warning_inverse',
'percentage_warning',
'percentage_critical',
'critical_instructions',
'warning_instructions',
'unknown_instructions',

View File

@ -130,6 +130,9 @@ $warning_instructions = (string) get_parameter('warning_instructions');
$unknown_instructions = (string) get_parameter('unknown_instructions');
$critical_inverse = (int) get_parameter('critical_inverse');
$warning_inverse = (int) get_parameter('warning_inverse');
$percentage_critical = (int) get_parameter('percentage_critical');
$percentage_warning = (int) get_parameter('percentage_warning');
$id_category = (int) get_parameter('id_category');
$id_tag_selected = (array) get_parameter('id_tag_selected');
$pure = get_parameter('pure', 0);
@ -383,6 +386,8 @@ if ($is_management_allowed === true && $create_component) {
'unknown_instructions' => $unknown_instructions,
'critical_inverse' => $critical_inverse,
'warning_inverse' => $warning_inverse,
'percentage_warning' => $percentage_warning,
'percentage_critical' => $percentage_critical,
'id_category' => $id_category,
'tags' => $tags,
'disabled_types_event' => $disabled_types_event,
@ -482,6 +487,8 @@ if ($is_management_allowed === true && $update_component) {
'unknown_instructions' => $unknown_instructions,
'critical_inverse' => $critical_inverse,
'warning_inverse' => $warning_inverse,
'percentage_warning' => $percentage_warning,
'percentage_critical' => $percentage_critical,
'id_category' => $id_category,
'tags' => $tags,
'disabled_types_event' => $disabled_types_event,

View File

@ -93,6 +93,8 @@ if ($create_network_from_module) {
$unknown_instructions = $data_module['unknown_instructions'];
$critical_inverse = $data_module['critical_inverse'];
$warning_inverse = $data_module['warning_inverse'];
$percentage_critical = $data_module['percentage_critical'];
$percentage_warning = $data_module['percentage_warning'];
$id_category = $data_module['id_category'];
$ff_event_normal = $data_module['min_ff_event_normal'];
$ff_event_warning = $data_module['min_ff_event_warning'];
@ -150,7 +152,9 @@ if (isset($id)) {
$warning_instructions = $component['warning_instructions'];
$unknown_instructions = $component['unknown_instructions'];
$critical_inverse = $component['critical_inverse'];
$percentage_critical = $component['percentage_critical'];
$warning_inverse = $component['warning_inverse'];
$percentage_warning = $component['percentage_warning'];
$id_category = $component['id_category'];
$tags = $component['tags'];
$ff_event_normal = $component['min_ff_event_normal'];
@ -233,6 +237,8 @@ if (isset($id)) {
$unknown_instructions = '';
$critical_inverse = 0;
$warning_inverse = 0;
$percentage_critical = 0;
$percentage_warning = 0;
$id_category = 0;
$tags = '';
$ff_event_normal = 0;

View File

@ -188,6 +188,10 @@ $table->data[4][1] .= html_print_input_text(
$table->data[4][1] .= '<br /><em>'.__('Inverse interval').'</em>';
$table->data[4][1] .= html_print_checkbox('warning_inverse', 1, $warning_inverse, true);
$table->data[4][1] .= '<div id="percentage_warning"><em>'.__('Percentage').'</em>';
$table->data[4][1] .= html_print_checkbox('percentage_warning', 1, $percentage_warning, true);
$table->data[4][1] .= '</div>';
$table->data[4][2] = '<svg id="svg_dinamic" width="500" height="300"> </svg>';
$table->colspan[4][2] = 2;
$table->rowspan[4][2] = 3;
@ -223,6 +227,11 @@ $table->data[5][1] .= html_print_input_text(
$table->data[5][1] .= '<br /><em>'.__('Inverse interval').'</em>';
$table->data[5][1] .= html_print_checkbox('critical_inverse', 1, $critical_inverse, true);
$table->data[5][1] .= '<div id="percentage_critical"><em>'.__('Percentage').'</em>';
$table->data[5][1] .= html_print_checkbox('percentage_critical', 1, $percentage_critical, true);
$table->data[5][1] .= '</div>';
$table->data[6][0] = __('FF threshold');
$table->colspan[6][1] = 3;
@ -518,6 +527,9 @@ $next_row++;
$('#string_warning').hide();
$('#minmax_critical').show();
$('#minmax_warning').show();
$('#percentage_warning').show();
$('#percentage_critical').show();
}
else {
// String types
@ -525,6 +537,8 @@ $next_row++;
$('#string_warning').show();
$('#minmax_critical').hide();
$('#minmax_warning').hide();
$('#percentage_warning').hide();
$('#percentage_critical').hide();
}
});

View File

@ -391,6 +391,8 @@ $data[1] .= html_print_input_text('str_warning', $str_warning, '', 5, 1024, true
// Warning inverse values.
$data[1] .= '<br /><em>'.__('Inverse interval').'</em>&nbsp;';
$data[1] .= html_print_checkbox('warning_inverse', 1, $warning_inverse, true);
$data[1] .= '<br /><em>'.__('Percentage').'</em>&nbsp;';
$data[1] .= html_print_checkbox('percentage_warning', 1, $percentage_warning, true);
$data[2] = '<svg id="svg_dinamic" width="500" height="300"> </svg>';
$table->colspan['warning-svg-row'][2] = 2;
@ -427,6 +429,9 @@ $data[1] .= html_print_input_text('str_critical', $str_critical, '', 5, 1024, tr
// Critical inverse values.
$data[1] .= '<br /><em>'.__('Inverse interval').'</em>&nbsp;';
$data[1] .= html_print_checkbox('critical_inverse', 1, $critical_inverse, true);
$data[1] .= '<br /><em>'.__('Percentage').'</em>&nbsp;';
$data[1] .= html_print_checkbox('percentage_critical', 1, $percentage_critical, true);
push_table_row($data, 'critical-row');

View File

@ -1441,6 +1441,10 @@ class AgentWizard extends HTML
$result[$value]['criticalInv'] = $data[$k];
} else if (empty(preg_match('/module-warning-inv/', $k)) === false) {
$result[$value]['warningInv'] = $data[$k];
} else if (empty(preg_match('/module-warning-perc/', $k)) === false) {
$result[$value]['warningPerc'] = $data[$k.'_sent'];
} else if (empty(preg_match('/module-critical-perc/', $k)) === false) {
$result[$value]['criticalPerc'] = $data[$k.'_sent'];
} else if (empty(preg_match('/module-type/', $k)) === false) {
$result[$value]['moduleType'] = $data[$k];
} else if (empty(preg_match('/module-unit/', $k)) === false) {
@ -1856,6 +1860,8 @@ class AgentWizard extends HTML
$values['max_warning'] = $candidate['warningMax'];
$values['min_critical'] = $candidate['criticalMin'];
$values['max_critical'] = $candidate['criticalMax'];
$values['percentage_warning'] = $candidate['warningPerc'];
$values['percentage_critical'] = $candidate['criticalPerc'];
}
$values['warning_inverse'] = $candidate['warningInv'];
@ -2292,6 +2298,8 @@ class AgentWizard extends HTML
$tmp->max_warning($candidate['warningMax']);
$tmp->min_critical($candidate['criticalMin']);
$tmp->max_critical($candidate['criticalMax']);
$tmp->percentage_warning($candidate['warningPerc']);
$tmp->percentage_critical($candidate['criticalPerc']);
}
$tmp->warning_inverse($candidate['warningInv']);
@ -2457,6 +2465,8 @@ class AgentWizard extends HTML
'min_critical' => $moduleData['module_thresholds']['min_critical'],
'max_critical' => $moduleData['module_thresholds']['max_critical'],
'inv_critical' => $moduleData['module_thresholds']['inv_critical'],
'perc_warning' => $moduleData['module_thresholds']['perc_warning'],
'perc_critical' => $moduleData['module_thresholds']['perc_critical'],
'module_enabled' => $moduleData['default_enabled'],
'name_oid' => $moduleData['value'],
'value' => $moduleData['value'],
@ -2636,6 +2646,8 @@ class AgentWizard extends HTML
'min_critical' => $moduleData['module_thresholds']['min_critical'],
'max_critical' => $moduleData['module_thresholds']['max_critical'],
'inv_critical' => $moduleData['module_thresholds']['inv_critical'],
'perc_warning' => $moduleData['module_thresholds']['perc_warning'],
'perc_critical' => $moduleData['module_thresholds']['perc_critical'],
'module_enabled' => $moduleData['module_enabled'],
'current_value' => $currentValue,
'name_oid' => $moduleData['value'],
@ -3280,6 +3292,8 @@ class AgentWizard extends HTML
nc.min_critical,
nc.max_critical,
nc.critical_inverse AS `inv_critical`,
nc.percentage_warning AS `perc_warning`,
nc.percentage_critical AS `perc_critical`,
nc.module_enabled,
%s,
nc.scan_type,
@ -3867,9 +3881,11 @@ class AgentWizard extends HTML
$table->width = '100%';
$table->class = 'info_table';
// Subheaders for Warning and Critical columns.
$subheaders = '<span class=\'font_w300 mrgn_lft_0.8em\'>Min.</span>';
$subheaders .= '<span class=\'font_w300 mrgn_lft_1.6em\'>Max.</span>';
$subheaders .= '<span class=\'font_w300 mrgn_lft_2em\'>Inv.</span>';
$subheaders = '<span class=\'wizard-colum-levels font_w300 mrgn_lft_0.8em\'>Min.</span>';
$subheaders .= '<span class=\'wizard-colum-levels font_w300 mrgn_lft_1.6em\'>Max.</span>';
$subheaders .= '<span class=\'wizard-colum-levels font_w300 mrgn_lft_2em\'>Inv.</span>';
$subheaders .= '<span class=\'wizard-colum-levels font_w300 mrgn_lft_2em\'>%.</span>';
// Warning header.
$warning_header = html_print_div(
[
@ -4081,7 +4097,7 @@ class AgentWizard extends HTML
);
$data_warning .= html_print_div(
[
'class' => 'wizard-column-levels',
'class' => 'wizard-column-levels-check',
'style' => 'margin-top: 0.3em;',
'content' => html_print_checkbox(
'module-warning-inv-'.$uniqueId,
@ -4096,6 +4112,23 @@ class AgentWizard extends HTML
],
true
);
$data_warning .= html_print_div(
[
'class' => 'wizard-column-levels-check',
'style' => 'margin-top: 0.3em;',
'content' => html_print_checkbox(
'module-warning-perc-'.$uniqueId,
$module['perc_warning'],
$module['perc_warning'],
true,
false,
'',
false,
'form="form-create-modules"'
),
],
true
);
$data[3] = $data_warning;
// Critical column.
$data[4] = '';
@ -4148,7 +4181,7 @@ class AgentWizard extends HTML
$data[4] .= html_print_div(
[
'class' => 'wizard-column-levels',
'class' => 'wizard-column-levels-check',
'style' => 'margin-top: 0.3em;',
'content' => html_print_checkbox(
'module-critical_inv_'.$uniqueId,
@ -4164,6 +4197,24 @@ class AgentWizard extends HTML
true
);
$data[4] .= html_print_div(
[
'class' => 'wizard-column-levels-check',
'style' => 'margin-top: 0.3em;',
'content' => html_print_checkbox(
'module-critical-perc-'.$uniqueId,
$module['perc_critical'],
$module['perc_critical'],
true,
false,
'',
false,
'form="form-create-modules"'
),
],
true
);
if (is_string($module['module_enabled']) === true) {
if ($module['module_enabled'] === false || $module['module_enabled'] === '0') {
$module['module_enabled'] = false;
@ -4528,12 +4579,14 @@ class AgentWizard extends HTML
'default_enabled' => true,
'module_enabled' => false,
'module_thresholds' => [
'min_warning' => $min_warning,
'max_warning' => $max_warning,
'inv_warning' => $inv_warning,
'min_critical' => $min_critical,
'max_critical' => $max_critical,
'inv_critical' => $inv_critical,
'min_warning' => $min_warning,
'max_warning' => $max_warning,
'inv_warning' => $inv_warning,
'min_critical' => $min_critical,
'max_critical' => $max_critical,
'inv_critical' => $inv_critical,
'perc_warning' => false,
'perc_critical' => false,
],
];
@ -4583,12 +4636,14 @@ class AgentWizard extends HTML
'default_enabled' => true,
'module_enabled' => false,
'module_thresholds' => [
'min_warning' => '0',
'max_warning' => '0',
'inv_warning' => false,
'min_critical' => '0',
'max_critical' => '0',
'inv_critical' => false,
'min_warning' => '0',
'max_warning' => '0',
'inv_warning' => false,
'min_critical' => '0',
'max_critical' => '0',
'inv_critical' => false,
'perc_warning' => false,
'perc_critical' => false,
],
];
@ -4635,12 +4690,14 @@ class AgentWizard extends HTML
'default_enabled' => true,
'module_enabled' => false,
'module_thresholds' => [
'min_warning' => '0',
'max_warning' => '0',
'inv_warning' => false,
'min_critical' => $minc,
'max_critical' => $maxc,
'inv_critical' => false,
'min_warning' => '0',
'max_warning' => '0',
'inv_warning' => false,
'min_critical' => $minc,
'max_critical' => $maxc,
'inv_critical' => false,
'perc_warning' => false,
'perc_critical' => false,
],
];
}
@ -4723,12 +4780,14 @@ class AgentWizard extends HTML
'module_enabled' => false,
'module_unit' => '%',
'module_thresholds' => [
'min_warning' => '0',
'max_warning' => '0',
'inv_warning' => false,
'min_critical' => '85',
'max_critical' => '0',
'inv_critical' => false,
'min_warning' => '0',
'max_warning' => '0',
'inv_warning' => false,
'min_critical' => '85',
'max_critical' => '0',
'inv_critical' => false,
'perc_warning' => false,
'perc_critical' => false,
],
];
@ -4760,12 +4819,14 @@ class AgentWizard extends HTML
'module_enabled' => false,
'module_unit' => '%',
'module_thresholds' => [
'min_warning' => '0',
'max_warning' => '0',
'inv_warning' => false,
'min_critical' => '0',
'max_critical' => '0',
'inv_critical' => false,
'min_warning' => '0',
'max_warning' => '0',
'inv_warning' => false,
'min_critical' => '0',
'max_critical' => '0',
'inv_critical' => false,
'perc_warning' => false,
'perc_critical' => false,
],
];
@ -4797,12 +4858,14 @@ class AgentWizard extends HTML
'module_enabled' => false,
'module_unit' => '%',
'module_thresholds' => [
'min_warning' => '0',
'max_warning' => '0',
'inv_warning' => false,
'min_critical' => '0',
'max_critical' => '0',
'inv_critical' => false,
'min_warning' => '0',
'max_warning' => '0',
'inv_warning' => false,
'min_critical' => '0',
'max_critical' => '0',
'inv_critical' => false,
'perc_warning' => false,
'perc_critical' => false,
],
];
}
@ -4826,12 +4889,14 @@ class AgentWizard extends HTML
'default_enabled' => false,
'module_enabled' => false,
'module_thresholds' => [
'min_warning' => '0',
'max_warning' => '0',
'inv_warning' => false,
'min_critical' => '0',
'max_critical' => '0',
'inv_critical' => false,
'min_warning' => '0',
'max_warning' => '0',
'inv_warning' => false,
'min_critical' => '0',
'max_critical' => '0',
'inv_critical' => false,
'perc_warning' => false,
'perc_critical' => false,
],
];
// IfInDiscards.
@ -4851,12 +4916,14 @@ class AgentWizard extends HTML
'default_enabled' => false,
'module_enabled' => false,
'module_thresholds' => [
'min_warning' => '0',
'max_warning' => '0',
'inv_warning' => false,
'min_critical' => '0',
'max_critical' => '0',
'inv_critical' => false,
'min_warning' => '0',
'max_warning' => '0',
'inv_warning' => false,
'min_critical' => '0',
'max_critical' => '0',
'inv_critical' => false,
'perc_warning' => false,
'perc_critical' => false,
],
];
// IfOutDiscards.
@ -4876,12 +4943,14 @@ class AgentWizard extends HTML
'default_enabled' => false,
'module_enabled' => false,
'module_thresholds' => [
'min_warning' => '0',
'max_warning' => '0',
'inv_warning' => false,
'min_critical' => '0',
'max_critical' => '0',
'inv_critical' => false,
'min_warning' => '0',
'max_warning' => '0',
'inv_warning' => false,
'min_critical' => '0',
'max_critical' => '0',
'inv_critical' => false,
'perc_warning' => false,
'perc_critical' => false,
],
];
// IfInErrors.
@ -4901,12 +4970,14 @@ class AgentWizard extends HTML
'default_enabled' => false,
'module_enabled' => false,
'module_thresholds' => [
'min_warning' => '0',
'max_warning' => '0',
'inv_warning' => false,
'min_critical' => '0',
'max_critical' => '0',
'inv_critical' => false,
'min_warning' => '0',
'max_warning' => '0',
'inv_warning' => false,
'min_critical' => '0',
'max_critical' => '0',
'inv_critical' => false,
'perc_warning' => false,
'perc_critical' => false,
],
];
// IfOutErrors.
@ -4926,12 +4997,14 @@ class AgentWizard extends HTML
'default_enabled' => false,
'module_enabled' => false,
'module_thresholds' => [
'min_warning' => '0',
'max_warning' => '0',
'inv_warning' => false,
'min_critical' => '0',
'max_critical' => '0',
'inv_critical' => false,
'min_warning' => '0',
'max_warning' => '0',
'inv_warning' => false,
'min_critical' => '0',
'max_critical' => '0',
'inv_critical' => false,
'perc_warning' => false,
'perc_critical' => false,
],
];
@ -4994,12 +5067,14 @@ class AgentWizard extends HTML
'default_enabled' => true,
'module_enabled' => false,
'module_thresholds' => [
'min_warning' => '0',
'max_warning' => '0',
'inv_warning' => false,
'min_critical' => '0',
'max_critical' => '0',
'inv_critical' => false,
'min_warning' => '0',
'max_warning' => '0',
'inv_warning' => false,
'min_critical' => '0',
'max_critical' => '0',
'inv_critical' => false,
'perc_warning' => false,
'perc_critical' => false,
],
];
@ -5020,12 +5095,14 @@ class AgentWizard extends HTML
'default_enabled' => true,
'module_enabled' => false,
'module_thresholds' => [
'min_warning' => '0',
'max_warning' => '0',
'inv_warning' => false,
'min_critical' => '0',
'max_critical' => '0',
'inv_critical' => false,
'min_warning' => '0',
'max_warning' => '0',
'inv_warning' => false,
'min_critical' => '0',
'max_critical' => '0',
'inv_critical' => false,
'perc_warning' => false,
'perc_critical' => false,
],
];
@ -5046,12 +5123,14 @@ class AgentWizard extends HTML
'default_enabled' => false,
'module_enabled' => false,
'module_thresholds' => [
'min_warning' => '0',
'max_warning' => '0',
'inv_warning' => false,
'min_critical' => '0',
'max_critical' => '0',
'inv_critical' => false,
'min_warning' => '0',
'max_warning' => '0',
'inv_warning' => false,
'min_critical' => '0',
'max_critical' => '0',
'inv_critical' => false,
'perc_warning' => false,
'perc_critical' => false,
],
];
// IfOutUcastPkts.
@ -5071,12 +5150,14 @@ class AgentWizard extends HTML
'default_enabled' => false,
'module_enabled' => false,
'module_thresholds' => [
'min_warning' => '0',
'max_warning' => '0',
'inv_warning' => false,
'min_critical' => '0',
'max_critical' => '0',
'inv_critical' => false,
'min_warning' => '0',
'max_warning' => '0',
'inv_warning' => false,
'min_critical' => '0',
'max_critical' => '0',
'inv_critical' => false,
'perc_warning' => false,
'perc_critical' => false,
],
];
// IfInNUcastPkts.
@ -5096,12 +5177,14 @@ class AgentWizard extends HTML
'default_enabled' => false,
'module_enabled' => false,
'module_thresholds' => [
'min_warning' => '0',
'max_warning' => '0',
'inv_warning' => false,
'min_critical' => '0',
'max_critical' => '0',
'inv_critical' => false,
'min_warning' => '0',
'max_warning' => '0',
'inv_warning' => false,
'min_critical' => '0',
'max_critical' => '0',
'inv_critical' => false,
'perc_warning' => false,
'perc_critical' => false,
],
];
// IfOutNUcastPkts.
@ -5121,12 +5204,14 @@ class AgentWizard extends HTML
'default_enabled' => false,
'module_enabled' => false,
'module_thresholds' => [
'min_warning' => '0',
'max_warning' => '0',
'inv_warning' => false,
'min_critical' => '0',
'max_critical' => '0',
'inv_critical' => false,
'min_warning' => '0',
'max_warning' => '0',
'inv_warning' => false,
'min_critical' => '0',
'max_critical' => '0',
'inv_critical' => false,
'perc_warning' => false,
'perc_critical' => false,
],
];
@ -5189,12 +5274,14 @@ class AgentWizard extends HTML
'default_enabled' => true,
'module_enabled' => false,
'module_thresholds' => [
'min_warning' => '0',
'max_warning' => '0',
'inv_warning' => false,
'min_critical' => '0',
'max_critical' => '0',
'inv_critical' => false,
'min_warning' => '0',
'max_warning' => '0',
'inv_warning' => false,
'min_critical' => '0',
'max_critical' => '0',
'inv_critical' => false,
'perc_warning' => false,
'perc_critical' => false,
],
];
@ -5215,12 +5302,14 @@ class AgentWizard extends HTML
'default_enabled' => true,
'module_enabled' => false,
'module_thresholds' => [
'min_warning' => '0',
'max_warning' => '0',
'inv_warning' => false,
'min_critical' => '0',
'max_critical' => '0',
'inv_critical' => false,
'min_warning' => '0',
'max_warning' => '0',
'inv_warning' => false,
'min_critical' => '0',
'max_critical' => '0',
'inv_critical' => false,
'perc_warning' => false,
'perc_critical' => false,
],
];
@ -5241,12 +5330,14 @@ class AgentWizard extends HTML
'default_enabled' => false,
'module_enabled' => false,
'module_thresholds' => [
'min_warning' => '0',
'max_warning' => '0',
'inv_warning' => false,
'min_critical' => '0',
'max_critical' => '0',
'inv_critical' => false,
'min_warning' => '0',
'max_warning' => '0',
'inv_warning' => false,
'min_critical' => '0',
'max_critical' => '0',
'inv_critical' => false,
'perc_warning' => false,
'perc_critical' => false,
],
];
@ -5267,12 +5358,14 @@ class AgentWizard extends HTML
'default_enabled' => false,
'module_enabled' => false,
'module_thresholds' => [
'min_warning' => '0',
'max_warning' => '0',
'inv_warning' => false,
'min_critical' => '0',
'max_critical' => '0',
'inv_critical' => false,
'min_warning' => '0',
'max_warning' => '0',
'inv_warning' => false,
'min_critical' => '0',
'max_critical' => '0',
'inv_critical' => false,
'perc_warning' => false,
'perc_critical' => false,
],
];
// IfHCInNUcastPkts.
@ -5292,12 +5385,14 @@ class AgentWizard extends HTML
'default_enabled' => false,
'module_enabled' => false,
'module_thresholds' => [
'min_warning' => '0',
'max_warning' => '0',
'inv_warning' => false,
'min_critical' => '0',
'max_critical' => '0',
'inv_critical' => false,
'min_warning' => '0',
'max_warning' => '0',
'inv_warning' => false,
'min_critical' => '0',
'max_critical' => '0',
'inv_critical' => false,
'perc_warning' => false,
'perc_critical' => false,
],
];
// IfOutNUcastPkts.
@ -5317,12 +5412,14 @@ class AgentWizard extends HTML
'default_enabled' => false,
'module_enabled' => false,
'module_thresholds' => [
'min_warning' => '0',
'max_warning' => '0',
'inv_warning' => false,
'min_critical' => '0',
'max_critical' => '0',
'inv_critical' => false,
'min_warning' => '0',
'max_warning' => '0',
'inv_warning' => false,
'min_critical' => '0',
'max_critical' => '0',
'inv_critical' => false,
'perc_warning' => false,
'perc_critical' => false,
],
];

View File

@ -532,6 +532,8 @@ function network_components_create_module_from_network_component($id_network_com
'min_ff_event',
'critical_inverse',
'warning_inverse',
'percentage_warning',
'percentage_critical',
'module_critical_instructions',
'module_warning_instructions',
'module_unknown_instructions',

View File

@ -1279,6 +1279,8 @@ function snmp_browser_create_modules_snmp(
'unknown_instructions' => '',
'critical_inverse' => 0,
'warning_inverse' => 0,
'percentage_warning' => 0,
'percentage_critical' => 0,
'id_category' => 0,
'tags' => '',
'disabled_types_event' => '{"going_unknown":1}',
@ -1336,6 +1338,8 @@ function snmp_browser_create_modules_snmp(
'unknown_instructions' => '',
'critical_inverse' => 0,
'warning_inverse' => 0,
'percentage_warning' => 0,
'percentage_critical' => 0,
'id_category' => 0,
'disabled_types_event' => '{"going_unknown":1}',
'min_ff_event_normal' => 0,
@ -1394,6 +1398,8 @@ function snmp_browser_create_modules_snmp(
'unknown_instructions' => '',
'critical_inverse' => 0,
'warning_inverse' => 0,
'percentage_warning' => 0,
'percentage_critical' => 0,
'id_category' => 0,
'disabled_types_event' => '{"going_unknown":1}',
'min_ff_event_normal' => 0,

View File

@ -105,6 +105,8 @@ function configure_modules_form() {
$("#text-unit").attr("value", "");
$("#checkbox-critical_inverse").attr("value", 0);
$("#checkbox-warning_inverse").attr("value", 0);
$("#checkbox-percentage_warning").attr("value", 0);
$("#checkbox-percentage_critical").attr("value", 0);
$("#checkbox-ff_type").attr("value", 0);
$("#textarea_critical_instructions").attr("value", "");
$("#textarea_warning_instructions").attr("value", "");
@ -205,6 +207,16 @@ function configure_modules_form() {
data["critical_inverse"]
);
$("#checkbox-warning_inverse").prop("uncheck", data["warning_inverse"]);
$("#checkbox-percentage_warning").prop(
"uncheck",
data["percentage_warning"]
);
$("#checkbox-percentage_critical").prop(
"uncheck",
data["percentage_critical"]
);
$("#component_loading").hide();
$("#id_module_type").change();
if ($("#id_category").is("select")) {
@ -464,6 +476,15 @@ function configure_modules_form() {
data["critical_inverse"]
);
$("#checkbox-warning_inverse").prop("checked", data["warning_inverse"]);
$("#checkbox-percentage_warning").prop(
"uncheck",
data["percentage_warning"]
);
$("#checkbox-percentage_critical").prop(
"uncheck",
data["percentage_critical"]
);
$("#component_loading").hide();
$("#id_module_type").change();
if ($("#id_category").is("select")) {

View File

@ -148,6 +148,12 @@ ul.wizard li > textarea {
text-align: center;
}
.wizard-column-levels-check {
float: left;
width: 17%;
text-align: center;
}
.action_button_list {
height: 60px;
}

View File

@ -267,6 +267,8 @@ CREATE TABLE IF NOT EXISTS `tagente_modulo` (
`parent_module_id` int(10) unsigned NOT NULL default 0,
`cps` int NOT NULL default 0,
`debug_content` varchar(200),
`percentage_critical` tinyint(1) unsigned default '0',
`percentage_warning` tinyint(1) unsigned default '0',
PRIMARY KEY (`id_agente_modulo`),
KEY `main_idx` (`id_agente_modulo`,`id_agente`),
KEY `tam_agente` (`id_agente`),
@ -982,6 +984,8 @@ CREATE TABLE IF NOT EXISTS `tnetwork_component` (
`scan_filters` text NOT NULL,
`query_filters` text NOT NULL,
`enabled` tinyint(1) UNSIGNED DEFAULT 1,
`percentage_critical` tinyint(1) unsigned default '0',
`percentage_warning` tinyint(1) unsigned default '0',
PRIMARY KEY (`id_nc`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
@ -2420,6 +2424,8 @@ CREATE TABLE IF NOT EXISTS `tlocal_component` (
`prediction_sample_window` int(10) default 0,
`prediction_samples` int(4) default 0,
`prediction_threshold` int(4) default 0,
`percentage_critical` tinyint(1) UNSIGNED DEFAULT 0,
`percentage_warning` tinyint(1) UNSIGNED DEFAULT 0,
PRIMARY KEY (`id`),
FOREIGN KEY (`id_network_component_group`) REFERENCES tnetwork_component_group(`id_sg`)
ON DELETE CASCADE ON UPDATE CASCADE
@ -2500,6 +2506,8 @@ CREATE TABLE IF NOT EXISTS `tpolicy_modules` (
`prediction_samples` int(4) default 0,
`prediction_threshold` int(4) default 0,
`cps` int NOT NULL DEFAULT 0,
`percentage_warning` tinyint(1) UNSIGNED DEFAULT 0,
`percentage_critical` tinyint(1) UNSIGNED DEFAULT 0,
PRIMARY KEY (`id`),
KEY `main_idx` (`id_policy`),
UNIQUE (`id_policy`, `name`)