mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-31 01:35:36 +02:00
ent 7914 status scaling based on time
This commit is contained in:
parent
4ed96e4a6e
commit
66a5c8f7eb
@ -1479,6 +1479,7 @@ if ($update_module || $create_module) {
|
||||
$each_ff = (int) get_parameter('each_ff', $module['each_ff']);
|
||||
$ff_timeout = (int) get_parameter('ff_timeout');
|
||||
$unit = (string) get_parameter('unit');
|
||||
$warning_time = (float) get_parameter('warning_time');
|
||||
if ($unit === '0') {
|
||||
$unit = '';
|
||||
}
|
||||
@ -1660,6 +1661,7 @@ if ($update_module) {
|
||||
'id_category' => $id_category,
|
||||
'disabled_types_event' => addslashes($disabled_types_event),
|
||||
'module_macros' => $module_macros,
|
||||
'warning_time' => $warning_time,
|
||||
];
|
||||
|
||||
|
||||
@ -1868,6 +1870,7 @@ if ($create_module) {
|
||||
'id_category' => $id_category,
|
||||
'disabled_types_event' => addslashes($disabled_types_event),
|
||||
'module_macros' => $module_macros,
|
||||
'warning_time' => $warning_time,
|
||||
];
|
||||
|
||||
if ($id_module_type == 30 || $id_module_type == 31 || $id_module_type == 32 || $id_module_type == 33) {
|
||||
|
@ -322,6 +322,7 @@ if ($id_agent_module) {
|
||||
$ff_type = $module['ff_type'];
|
||||
$each_ff = $module['each_ff'];
|
||||
$ff_timeout = $module['ff_timeout'];
|
||||
$warning_time = $module['warning_time'];
|
||||
// Select tag info.
|
||||
$id_tag = tags_get_module_tags($id_agent_module);
|
||||
|
||||
@ -452,6 +453,7 @@ if ($id_agent_module) {
|
||||
$max_critical = 0;
|
||||
$str_critical = '';
|
||||
$ff_event = 0;
|
||||
$warning_time = 0;
|
||||
|
||||
// New support for snmp v3.
|
||||
$snmp_version = 1;
|
||||
|
@ -467,14 +467,29 @@ if (modules_is_string_type($id_module_type) === false) {
|
||||
$table_simple->data[2][1] .= '</div>';
|
||||
}
|
||||
|
||||
$table_simple->data[3][0] .= '<span id="warning_time">'.__('Change to critical status after');
|
||||
$table_simple->data[3][1] .= html_print_input_text(
|
||||
'warning_time',
|
||||
$warning_time,
|
||||
'',
|
||||
5,
|
||||
255,
|
||||
true,
|
||||
$disabledBecauseInPolicy,
|
||||
false,
|
||||
'',
|
||||
$classdisabledBecauseInPolicy
|
||||
);
|
||||
$table_simple->data[3][1] .= ' <b>'.__('intervals in warning status.').'</b>';
|
||||
|
||||
if (!modules_is_string_type($id_module_type) || $edit) {
|
||||
$table_simple->data[2][2] = '<svg id="svg_dinamic" width="500" height="300"> </svg>';
|
||||
}
|
||||
|
||||
$table_simple->data[3][0] = __('Critical threshold');
|
||||
$table_simple->data[4][0] = __('Critical threshold');
|
||||
if (!modules_is_string_type($id_module_type) || $edit) {
|
||||
$table_simple->data[3][1] .= '<span id="minmax_critical"><em>'.__('Min. ').'</em>';
|
||||
$table_simple->data[3][1] .= html_print_input_text(
|
||||
$table_simple->data[4][1] .= '<span id="minmax_critical"><em>'.__('Min. ').'</em>';
|
||||
$table_simple->data[4][1] .= html_print_input_text(
|
||||
'min_critical',
|
||||
$min_critical,
|
||||
'',
|
||||
@ -486,8 +501,8 @@ if (!modules_is_string_type($id_module_type) || $edit) {
|
||||
'',
|
||||
$classdisabledBecauseInPolicy
|
||||
);
|
||||
$table_simple->data[3][1] .= '<br /><em>'.__('Max.').'</em>';
|
||||
$table_simple->data[3][1] .= html_print_input_text(
|
||||
$table_simple->data[4][1] .= '<br /><em>'.__('Max.').'</em>';
|
||||
$table_simple->data[4][1] .= html_print_input_text(
|
||||
'max_critical',
|
||||
$max_critical,
|
||||
'',
|
||||
@ -502,8 +517,8 @@ if (!modules_is_string_type($id_module_type) || $edit) {
|
||||
}
|
||||
|
||||
if (modules_is_string_type($id_module_type) || $edit) {
|
||||
$table_simple->data[3][1] .= '<span id="string_critical"><em>'.__('Str.').'</em>';
|
||||
$table_simple->data[3][1] .= html_print_input_text(
|
||||
$table_simple->data[4][1] .= '<span id="string_critical"><em>'.__('Str.').'</em>';
|
||||
$table_simple->data[4][1] .= html_print_input_text(
|
||||
'str_critical',
|
||||
str_replace('"', '', $str_critical),
|
||||
'',
|
||||
@ -517,33 +532,33 @@ if (modules_is_string_type($id_module_type) || $edit) {
|
||||
).'</span>';
|
||||
}
|
||||
|
||||
$table_simple->data[3][1] .= '<div id="critical_inverse"><em>'.__('Inverse interval').'</em>';
|
||||
$table_simple->data[3][1] .= html_print_checkbox('critical_inverse', 1, $critical_inverse, true, $disabledBecauseInPolicy);
|
||||
$table_simple->data[3][1] .= '</div>';
|
||||
$table_simple->data[4][1] .= '<div id="critical_inverse"><em>'.__('Inverse interval').'</em>';
|
||||
$table_simple->data[4][1] .= html_print_checkbox('critical_inverse', 1, $critical_inverse, true, $disabledBecauseInPolicy);
|
||||
$table_simple->data[4][1] .= '</div>';
|
||||
|
||||
|
||||
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] .= ui_print_help_tip('Defines threshold as a percentage of value decrease/increment', true);
|
||||
$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][1] .= '<div id="percentage_critical" /><em>'.__('Percentage').'</em>';
|
||||
$table_simple->data[4][1] .= ui_print_help_tip('Defines threshold as a percentage of value decrease/increment', true);
|
||||
$table_simple->data[4][1] .= html_print_checkbox('percentage_critical', 1, $percentage_critical, true, $disabledBecauseInPolicy);
|
||||
$table_simple->data[4][1] .= '</div>';
|
||||
}
|
||||
|
||||
$table_simple->data[4][0] = __('Historical data');
|
||||
$table_simple->data[5][0] = __('Historical data');
|
||||
if ($disabledBecauseInPolicy) {
|
||||
// If is disabled, we send a hidden in his place and print a false
|
||||
// checkbox because HTML dont send disabled fields
|
||||
// and could be disabled by error.
|
||||
$table_simple->data[4][1] = html_print_checkbox(
|
||||
$table_simple->data[5][1] = html_print_checkbox(
|
||||
'history_data_fake',
|
||||
1,
|
||||
$history_data,
|
||||
true,
|
||||
$disabledBecauseInPolicy
|
||||
);
|
||||
$table_simple->data[4][1] .= '<input type="hidden" name="history_data" value="'.(int) $history_data.'">';
|
||||
$table_simple->data[5][1] .= '<input type="hidden" name="history_data" value="'.(int) $history_data.'">';
|
||||
} else {
|
||||
$table_simple->data[4][1] = html_print_checkbox(
|
||||
$table_simple->data[5][1] = html_print_checkbox(
|
||||
'history_data',
|
||||
1,
|
||||
$history_data,
|
||||
|
@ -116,6 +116,7 @@ $max_critical = (float) get_parameter('max_critical');
|
||||
$str_critical = (string) get_parameter('str_critical');
|
||||
$ff_event = (int) get_parameter('ff_event');
|
||||
$history_data = (bool) get_parameter('history_data');
|
||||
$warning_time = (int) get_parameter('warning_time');
|
||||
|
||||
// Don't read as (float) because it lost it's decimals when put into MySQL
|
||||
// where are very big and PHP uses scientific notation, p.e:
|
||||
@ -407,6 +408,7 @@ if ($is_management_allowed === true && $create_component) {
|
||||
'name_oid' => $name_oid,
|
||||
'module_enabled' => $module_enabled,
|
||||
'enabled' => $enabled,
|
||||
'warning_time' => $warning_time,
|
||||
]
|
||||
);
|
||||
} else {
|
||||
@ -511,6 +513,7 @@ if ($is_management_allowed === true && $update_component) {
|
||||
'name_oid' => $name_oid,
|
||||
'module_enabled' => $module_enabled,
|
||||
'enabled' => $enabled,
|
||||
'warning_time' => $warning_time,
|
||||
]
|
||||
);
|
||||
} else {
|
||||
|
@ -101,6 +101,7 @@ if ($create_network_from_module) {
|
||||
$ff_event_critical = $data_module['min_ff_event_critical'];
|
||||
$ff_type = $data_module['ff_type'];
|
||||
$each_ff = $data_module['each_ff'];
|
||||
$warning_time = $data_module['warning_time'];
|
||||
}
|
||||
|
||||
$id_component_type = (int) get_parameter('id_component_type');
|
||||
@ -175,6 +176,7 @@ if (isset($id)) {
|
||||
$query_filter = $component['query_filters'];
|
||||
$module_enabled = $component['module_enabled'];
|
||||
$enabled = $component['enabled'];
|
||||
$warning_time = $component['warning_time'];
|
||||
|
||||
if ($type >= MODULE_TYPE_REMOTE_SNMP && $type <= MODULE_TYPE_REMOTE_SNMP_PROC) {
|
||||
// New support for snmp v3.
|
||||
@ -246,6 +248,7 @@ if (isset($id)) {
|
||||
$ff_event_critical = 0;
|
||||
$ff_type = 0;
|
||||
$each_ff = 0;
|
||||
$warning_time = 0;
|
||||
|
||||
$snmp_version = 1;
|
||||
$snmp3_auth_user = '';
|
||||
|
@ -198,13 +198,28 @@ $table->data[4][1] .= ui_print_help_tip('Defines threshold as a percentage of va
|
||||
$table->data[4][1] .= html_print_checkbox('percentage_warning', 1, $percentage_warning, true);
|
||||
$table->data[4][1] .= '</div>';
|
||||
|
||||
$table->data[5][0] .= '<span id="warning_time">'.__('Change to critical status after');
|
||||
$table->data[5][1] .= html_print_input_text(
|
||||
'warning_time',
|
||||
$warning_time,
|
||||
'',
|
||||
5,
|
||||
255,
|
||||
true,
|
||||
$disabledBecauseInPolicy,
|
||||
false,
|
||||
'',
|
||||
$classdisabledBecauseInPolicy
|
||||
);
|
||||
$table->data[5][1] .= ' <b>'.__('intervals in warning status.').'</b>';
|
||||
|
||||
$table->data[4][2] = '<svg id="svg_dinamic" width="500" height="300"> </svg>';
|
||||
$table->colspan[4][2] = 2;
|
||||
$table->rowspan[4][2] = 3;
|
||||
|
||||
$table->data[5][0] = __('Critical status');
|
||||
$table->data[5][1] = '<span id="minmax_critical"><em>'.__('Min.').' </em> ';
|
||||
$table->data[5][1] .= html_print_input_text(
|
||||
$table->data[6][0] = __('Critical status');
|
||||
$table->data[6][1] = '<span id="minmax_critical"><em>'.__('Min.').' </em> ';
|
||||
$table->data[6][1] .= html_print_input_text(
|
||||
'min_critical',
|
||||
$min_critical,
|
||||
'',
|
||||
@ -212,8 +227,8 @@ $table->data[5][1] .= html_print_input_text(
|
||||
15,
|
||||
true
|
||||
);
|
||||
$table->data[5][1] .= '<br /><em>'.__('Max.').'</em> ';
|
||||
$table->data[5][1] .= html_print_input_text(
|
||||
$table->data[6][1] .= '<br /><em>'.__('Max.').'</em> ';
|
||||
$table->data[6][1] .= html_print_input_text(
|
||||
'max_critical',
|
||||
$max_critical,
|
||||
'',
|
||||
@ -221,8 +236,8 @@ $table->data[5][1] .= html_print_input_text(
|
||||
15,
|
||||
true
|
||||
).'</span>';
|
||||
$table->data[5][1] .= '<span id="string_critical"><em>'.__('Str.').' </em> ';
|
||||
$table->data[5][1] .= html_print_input_text(
|
||||
$table->data[6][1] .= '<span id="string_critical"><em>'.__('Str.').' </em> ';
|
||||
$table->data[6][1] .= html_print_input_text(
|
||||
'str_critical',
|
||||
$str_critical,
|
||||
'',
|
||||
@ -230,28 +245,28 @@ $table->data[5][1] .= html_print_input_text(
|
||||
1024,
|
||||
true
|
||||
).'</span>';
|
||||
$table->data[5][1] .= '<div id="critical_inverse"><em>'.__('Inverse interval').'</em>';
|
||||
$table->data[5][1] .= html_print_checkbox('critical_inverse', 1, $critical_inverse, true);
|
||||
$table->data[5][1] .= '</div>';
|
||||
$table->data[6][1] .= '<div id="critical_inverse"><em>'.__('Inverse interval').'</em>';
|
||||
$table->data[6][1] .= html_print_checkbox('critical_inverse', 1, $critical_inverse, true);
|
||||
$table->data[6][1] .= '</div>';
|
||||
|
||||
$table->data[5][1] .= '<div id="percentage_critical"><em>'.__('Percentage').'</em>';
|
||||
$table->data[5][1] .= ui_print_help_tip('Defines threshold as a percentage of value decrease/increment', true);
|
||||
$table->data[5][1] .= html_print_checkbox('percentage_critical', 1, $percentage_critical, true);
|
||||
$table->data[5][1] .= '</div>';
|
||||
$table->data[6][1] .= '<div id="percentage_critical"><em>'.__('Percentage').'</em>';
|
||||
$table->data[6][1] .= ui_print_help_tip('Defines threshold as a percentage of value decrease/increment', true);
|
||||
$table->data[6][1] .= html_print_checkbox('percentage_critical', 1, $percentage_critical, true);
|
||||
$table->data[6][1] .= '</div>';
|
||||
|
||||
|
||||
$table->data[6][0] = __('FF threshold');
|
||||
$table->colspan[6][1] = 3;
|
||||
$table->data[7][0] = __('FF threshold');
|
||||
$table->colspan[7][1] = 3;
|
||||
|
||||
$table->data[6][1] = __('Keep counters');
|
||||
$table->data[6][1] .= html_print_checkbox(
|
||||
$table->data[7][1] = __('Keep counters');
|
||||
$table->data[7][1] .= html_print_checkbox(
|
||||
'ff_type',
|
||||
1,
|
||||
$ff_type,
|
||||
true
|
||||
).'<br />';
|
||||
|
||||
$table->data[6][1] .= html_print_radio_button(
|
||||
$table->data[7][1] .= html_print_radio_button(
|
||||
'each_ff',
|
||||
0,
|
||||
'',
|
||||
@ -259,7 +274,7 @@ $table->data[6][1] .= html_print_radio_button(
|
||||
true
|
||||
).' '.__('All state changing').' : ';
|
||||
|
||||
$table->data[6][1] .= html_print_input_text(
|
||||
$table->data[7][1] .= html_print_input_text(
|
||||
'ff_event',
|
||||
$ff_event,
|
||||
'',
|
||||
@ -267,15 +282,15 @@ $table->data[6][1] .= html_print_input_text(
|
||||
15,
|
||||
true
|
||||
).'<br />';
|
||||
$table->data[6][1] .= html_print_radio_button(
|
||||
$table->data[7][1] .= html_print_radio_button(
|
||||
'each_ff',
|
||||
1,
|
||||
'',
|
||||
$each_ff,
|
||||
true
|
||||
).' '.__('Each state changing').' : ';
|
||||
$table->data[6][1] .= __('To normal');
|
||||
$table->data[6][1] .= html_print_input_text(
|
||||
$table->data[7][1] .= __('To normal');
|
||||
$table->data[7][1] .= html_print_input_text(
|
||||
'ff_event_normal',
|
||||
$ff_event_normal,
|
||||
'',
|
||||
@ -283,8 +298,8 @@ $table->data[6][1] .= html_print_input_text(
|
||||
15,
|
||||
true
|
||||
).' ';
|
||||
$table->data[6][1] .= __('To warning');
|
||||
$table->data[6][1] .= html_print_input_text(
|
||||
$table->data[7][1] .= __('To warning');
|
||||
$table->data[7][1] .= html_print_input_text(
|
||||
'ff_event_warning',
|
||||
$ff_event_warning,
|
||||
'',
|
||||
@ -292,8 +307,8 @@ $table->data[6][1] .= html_print_input_text(
|
||||
15,
|
||||
true
|
||||
).' ';
|
||||
$table->data[6][1] .= __('To critical');
|
||||
$table->data[6][1] .= html_print_input_text(
|
||||
$table->data[7][1] .= __('To critical');
|
||||
$table->data[7][1] .= html_print_input_text(
|
||||
'ff_event_critical',
|
||||
$ff_event_critical,
|
||||
'',
|
||||
@ -302,41 +317,41 @@ $table->data[6][1] .= html_print_input_text(
|
||||
true
|
||||
);
|
||||
|
||||
$table->data[7][0] = __('Historical data');
|
||||
$table->data[7][1] = html_print_checkbox('history_data', 1, $history_data, true);
|
||||
$table->data[8][0] = __('Historical data');
|
||||
$table->data[8][1] = html_print_checkbox('history_data', 1, $history_data, true);
|
||||
|
||||
$table->data[8][0] = __('Min. Value');
|
||||
$table->data[8][1] = html_print_input_text('min', $min, '', 5, 15, true).' '.ui_print_help_tip(__('Any value below this number is discarted'), true);
|
||||
$table->data[8][2] = __('Max. Value');
|
||||
$table->data[8][3] = html_print_input_text('max', $max, '', 5, 15, true).' '.ui_print_help_tip(__('Any value over this number is discarted'), true);
|
||||
$table->data[9][0] = __('Unit');
|
||||
$table->data[9][1] = html_print_input_text('unit', $unit, '', 12, 25, true);
|
||||
$table->data[9][0] = __('Min. Value');
|
||||
$table->data[9][1] = html_print_input_text('min', $min, '', 5, 15, true).' '.ui_print_help_tip(__('Any value below this number is discarted'), true);
|
||||
$table->data[9][2] = __('Max. Value');
|
||||
$table->data[9][3] = html_print_input_text('max', $max, '', 5, 15, true).' '.ui_print_help_tip(__('Any value over this number is discarted'), true);
|
||||
$table->data[10][0] = __('Unit');
|
||||
$table->data[10][1] = html_print_input_text('unit', $unit, '', 12, 25, true);
|
||||
|
||||
$table->data[9][2] = __('Discard unknown events');
|
||||
$table->data[9][3] = html_print_checkbox(
|
||||
$table->data[10][2] = __('Discard unknown events');
|
||||
$table->data[10][3] = html_print_checkbox(
|
||||
'throw_unknown_events',
|
||||
1,
|
||||
network_components_is_disable_type_event($id, EVENTS_GOING_UNKNOWN),
|
||||
true
|
||||
);
|
||||
|
||||
$table->data[10][0] = __('Critical instructions').ui_print_help_tip(__('Instructions when the status is critical'), true);
|
||||
$table->data[10][1] = html_print_textarea('critical_instructions', 2, 65, $critical_instructions, '', true);
|
||||
$table->colspan[10][1] = 3;
|
||||
|
||||
$table->data[11][0] = __('Warning instructions').ui_print_help_tip(__('Instructions when the status is warning'), true);
|
||||
$table->data[11][1] = html_print_textarea('warning_instructions', 2, 65, $warning_instructions, '', true);
|
||||
$table->data[11][0] = __('Critical instructions').ui_print_help_tip(__('Instructions when the status is critical'), true);
|
||||
$table->data[11][1] = html_print_textarea('critical_instructions', 2, 65, $critical_instructions, '', true);
|
||||
$table->colspan[11][1] = 3;
|
||||
|
||||
$table->data[12][0] = __('Unknown instructions').ui_print_help_tip(__('Instructions when the status is unknown'), true);
|
||||
$table->data[12][1] = html_print_textarea('unknown_instructions', 2, 65, $unknown_instructions, '', true);
|
||||
$table->data[12][0] = __('Warning instructions').ui_print_help_tip(__('Instructions when the status is warning'), true);
|
||||
$table->data[12][1] = html_print_textarea('warning_instructions', 2, 65, $warning_instructions, '', true);
|
||||
$table->colspan[12][1] = 3;
|
||||
|
||||
$table->data[13][0] = __('Description');
|
||||
$table->data[13][1] = html_print_textarea('description', 2, 65, $description, '', true);
|
||||
$table->data[13][0] = __('Unknown instructions').ui_print_help_tip(__('Instructions when the status is unknown'), true);
|
||||
$table->data[13][1] = html_print_textarea('unknown_instructions', 2, 65, $unknown_instructions, '', true);
|
||||
$table->colspan[13][1] = 3;
|
||||
|
||||
$next_row = 14;
|
||||
$table->data[14][0] = __('Description');
|
||||
$table->data[14][1] = html_print_textarea('description', 2, 65, $description, '', true);
|
||||
$table->colspan[14][1] = 3;
|
||||
|
||||
$next_row = 15;
|
||||
|
||||
if (check_acl($config['id_user'], 0, 'PM')) {
|
||||
$table->data[$next_row][0] = __('Category');
|
||||
|
@ -408,6 +408,12 @@ $table->rowspan['warning-svg-row'][2] = 3;
|
||||
|
||||
push_table_row($data, 'warning-svg-row');
|
||||
|
||||
$data = [];
|
||||
$data[0] .= __('Change to critical status after');
|
||||
$data[1] .= html_print_input_text('warning_time', $warning_time, '', 5, 15, true);
|
||||
$data[1] .= ' <b>'.__('intervals in warning status.').'</b>';
|
||||
push_table_row($data, 'title-warning-time');
|
||||
|
||||
$data = [];
|
||||
$data[0] = __('Critical');
|
||||
// Critical interval values.
|
||||
|
Loading…
x
Reference in New Issue
Block a user