#12695 wip removing warnings

This commit is contained in:
Jonathan 2024-02-08 17:17:17 +01:00
parent 56e26ab3d5
commit 6e1fb2f061
11 changed files with 98 additions and 21 deletions

View File

@ -55,7 +55,7 @@ if ($id_field) {
$display_on_front = $field['display_on_front'];
$is_password_type = $field['is_password_type'];
$combo_values = $field['combo_values'] ? $field['combo_values'] : '';
$is_combo_enable = $config['is_combo_enable'];
$is_combo_enable = (isset($config['is_combo_enable']) === true) ? $config['is_combo_enable'] : false;
$is_link_enabled = $field['is_link_enabled'];
$header_title = __('Update agent custom field');
} else {
@ -162,6 +162,10 @@ $table->data[2][0] = html_print_label_input_block(
)
);
if (isset($config['is_combo_enable']) === false) {
$config['is_combo_enable'] = false;
}
$table->data[2][1] = html_print_label_input_block(
__('Enabled combo'),
html_print_checkbox_switch_extended(

View File

@ -116,6 +116,10 @@ if ($display_loading === true || $running_create === true || $running_delete) {
$table_load->size = [];
$table_load->size[0] = '50%';
$table_load->size[1] = '50%';
$list_mkup = '';
if (isset($operation['id']) === false) {
$operation['id'] = 0;
}
$table_load->data['row0'][] = progress_bar(
0,

View File

@ -186,9 +186,9 @@ if ($action === 'create_demo_data') {
}
$modules_data = $ini_agent_data['modules'];
$inventory = $ini_agent_data['inventory'];
$inventory_values = $ini_agent_data['inventory_values'];
$traps = $ini_agent_data['traps'];
$inventory = (isset($ini_agent_data['inventory']) === true) ? $ini_agent_data['inventory'] : '';
$inventory_values = (isset($ini_agent_data['inventory_values']) === true) ? $ini_agent_data['inventory_values'] : '';
$traps = (isset($ini_agent_data['traps']) === true) ? $ini_agent_data['traps'] : '';
$address_network = $agent_data['address_network'];
@ -435,11 +435,15 @@ if ($action === 'create_demo_data') {
$module_description = '';
if (isset($modules_array['description']) === true && is_string($modules_array['description']) === true) {
if (isset($mac) === false) {
$mac = '';
}
$module_description = str_replace('_mac_', $mac, $modules_array['description']);
}
$values = [
'unit' => $modules_array['unit'],
'unit' => (isset($modules_array['unit']) === true) ? $modules_array['unit'] : '',
'descripcion' => $module_description,
'id_tipo_modulo' => $id_tipo,
'id_module_group' => ($modules_array['group'] ?? 0),
@ -597,8 +601,12 @@ if ($action === 'create_demo_data') {
while (1) {
// Insert in tmodule_inventory.
$modules_array = [];
foreach ($inventory as $key => $value) {
$modules_array[$key] = ($value[$module_access_idx] ?? null);
if (isset($inventory) === true) {
if ($inventory !== '') {
foreach ($inventory as $key => $value) {
$modules_array[$key] = ($value[$module_access_idx] ?? null);
}
}
}
$module_access_idx++;
@ -3307,6 +3315,26 @@ if ($action === 'create_demo_data') {
$module_values['module_interval'] = $interval;
$module_values['id_modulo'] = 4;
$module_values['id_plugin'] = $created_plugin_id;
if (isset($traps_target_ip) === false) {
$traps_target_ip = '';
}
if (isset($traps_community) === false) {
$traps_community = '';
}
if (isset($tentacle_target_ip) === false) {
$tentacle_target_ip = '';
}
if (isset($tentacle_port) === false) {
$tentacle_port = '';
}
if (isset($tentacle_extra_options) === false) {
$tentacle_extra_options = '';
}
$module_values['macros'] = '{"1":{"macro":"_field1_","desc":"Agents files folder path","help":"","value":"/usr/share/pandora_server/util/plugin/demodata_agents","hide":""},"2":{"macro":"_field2_","desc":"Number of agents","help":"","value":"'.$total_agents_to_create.'","hide":""},"3":{"macro":"_field3_","desc":"Traps target IP","help":"","value":"'.$traps_target_ip.'","hide":""},"4":{"macro":"_field4_","desc":"Traps community","help":"","value":"'.$traps_community.'","hide":""},"5":{"macro":"_field5_","desc":"Tentacle target IP","help":"","value":"'.$tentacle_target_ip.'","hide":""},"6":{"macro":"_field6_","desc":"Tentacle port","help":"","value":"'.$tentacle_port.'","hide":""},"7":{"macro":"_field7_","desc":"Tentacle extra options","help":"","value":"'.$tentacle_extra_options.'","hide":""}}';
$id_plugin_module = modules_create_agent_module(

View File

@ -738,6 +738,22 @@ class Tree
if ($module['showGraphs']) {
$tresholds = true;
if (isset($module['min_warning']) === false) {
$module['min_warning'] = '';
}
if (isset($module['max_warning']) === false) {
$module['max_warning'] = '';
}
if (isset($module['min_critical']) === false) {
$module['min_critical'] = '';
}
if (isset($module['max_critical']) === false) {
$module['max_critical'] = '';
}
if (empty((float) $module['min_warning']) === true
&& empty((float) $module['max_warning']) === true
&& empty($module['warning_inverse']) === true

View File

@ -621,6 +621,10 @@ class TreeGroup extends Tree
protected function getDisplayHierarchy()
{
if (isset($this->filter['searchHirearchy']) === false) {
$this->filter['searchHirearchy'] = '';
}
return $this->filter['searchHirearchy'] ||
(empty($this->filter['searchAgent']) && empty($this->filter['searchModule']));
}

View File

@ -196,7 +196,7 @@ function groupview_get_groups_list($id_user=false, $access='AR', $is_not_paginat
$list[$id_group]['_monitors_not_init_'] = (int) $modules_counters[$id_group]['total_module_not_init'];
$list[$id_group]['_monitors_ok_'] = (int) $modules_counters[$id_group]['total_module_normal'];
$list[$id_group]['_monitor_checks_'] = (int) $modules_counters[$id_group]['total_module'];
$list[$id_group]['_monitor_not_normal_'] = ($list[$group['id_grupo']]['_monitor_checks_'] - $list[$group['id_grupo']]['_monitors_ok_']);
$list[$id_group]['_monitor_not_normal_'] = ($modules_counters[$id_group]['total_module'] - $modules_counters[$id_group]['total_module_normal']);
$list[$id_group]['_monitors_alerts_fired_'] = (int) $modules_counters[$id_group]['total_module_alerts'];
}

View File

@ -2700,6 +2700,14 @@ function modules_get_agentmodule_data_for_humans($module)
if ($data_macro !== false) {
$salida = $data_macro;
} else {
if (isset($module['current_interval']) === false) {
$module['current_interval'] = 0;
}
if (isset($module['module_name']) === false) {
$module['module_name'] = 0;
}
$salida = ui_print_module_string_value(
$module['datos'],
empty($module['id']) ? $module['id_agente_modulo'] : $module['id'],

View File

@ -6764,6 +6764,10 @@ function ui_print_module_string_value(
$value = io_safe_input($value);
}
if (isset($module) === false) {
$module['datos'] = '';
}
$is_snapshot = is_snapshot_data($module['datos']);
$is_large_image = is_text_to_black_string($module['datos']);
if (($config['command_snapshot']) && ($is_snapshot || $is_large_image)) {

View File

@ -206,6 +206,10 @@ if ($load_filter_id > 0) {
$loaded_filter = db_get_row_sql($sql);
}
if (isset($loaded_filter) === false) {
$loaded_filter['id_filter'] = 0;
}
if ($loaded_filter['id_filter'] > 0) {
$query_filter['id_filter'] = $load_filter_id;
$filter = db_get_row_filter('tagent_filter', $query_filter, false);

View File

@ -80,8 +80,7 @@ if ($config['realtimestats'] == 0) {
$updated_time .= __('Last update').' : '.ui_print_timestamp(db_get_sql('SELECT min(utimestamp) FROM tgroup_stat'), true);
$updated_time .= '</a>';
} else {
// $updated_info = __("Updated at realtime");
$updated_info = '';
$updated_time = '';
}
// Header.
@ -211,6 +210,10 @@ if ($count == 1) {
}
}
if (isset($offset) === false) {
$offset = 0;
}
if (empty($result_groups) === false) {
$pagination = ui_pagination(
$count,

View File

@ -962,17 +962,19 @@ if (is_ajax() === true) {
$tmp->id_grupo = $tmp->group_name;
}
if (strlen($tmp->id_grupo) >= 10) {
$tmp->id_grupo = ui_print_truncate_text(
$tmp->id_grupo,
10,
false,
true,
false,
'&hellip;',
true,
true,
);
if (isset($tmp->id_grupo) === true) {
if (strlen($tmp->id_grupo) >= 10) {
$tmp->id_grupo = ui_print_truncate_text(
$tmp->id_grupo,
10,
false,
true,
false,
'&hellip;',
true,
true,
);
}
}
// Module name.