diff --git a/pandora_console/general/logon_ok.php b/pandora_console/general/logon_ok.php index 059443eff6..920e4ace8e 100644 --- a/pandora_console/general/logon_ok.php +++ b/pandora_console/general/logon_ok.php @@ -30,341 +30,3 @@ use PandoraFMS\TacticalView\GeneralTacticalView; $tacticalView = new GeneralTacticalView(); $tacticalView->render(); -return; -// Temporal return for develop. - // Config functions. -require_once 'include/config.php'; - -// This solves problems in enterprise load. -global $config; - -check_login(); -// ACL Check. -if (check_acl($config['id_user'], 0, 'AR') === 0) { - db_pandora_audit( - AUDIT_LOG_ACL_VIOLATION, - 'Trying to access Default view' - ); - include 'general/noaccess.php'; - exit; -} - -require_once 'include/functions_reporting.php'; -require_once 'include/functions_tactical.php'; -require_once $config['homedir'].'/include/functions_graph.php'; - -if (tags_has_user_acl_tags()) { - ui_print_tags_warning(); -} - -$all_data = tactical_status_modules_agents( - $config['id_user'], - false, - 'AR' -); -$data = []; - -$data['monitor_not_init'] = (int) $all_data['_monitors_not_init_']; -$data['monitor_unknown'] = (int) $all_data['_monitors_unknown_']; -$data['monitor_ok'] = (int) $all_data['_monitors_ok_']; -$data['monitor_warning'] = (int) $all_data['_monitors_warning_']; -$data['monitor_critical'] = (int) $all_data['_monitors_critical_']; -$data['monitor_not_normal'] = (int) $all_data['_monitor_not_normal_']; -$data['monitor_alerts'] = (int) $all_data['_monitors_alerts_']; -$data['monitor_alerts_fired'] = (int) $all_data['_monitors_alerts_fired_']; -$data['monitor_total'] = (int) $all_data['_monitor_total_']; - - -$data['total_agents'] = (int) $all_data['_total_agents_']; - -$data['monitor_checks'] = (int) $all_data['_monitor_checks_']; -if (!empty($all_data)) { - if ($data['monitor_not_normal'] > 0 && $data['monitor_checks'] > 0) { - $data['monitor_health'] = format_numeric((100 - ($data['monitor_not_normal'] / ($data['monitor_checks'] / 100))), 1); - } else { - $data['monitor_health'] = 100; - } - - if ($data['monitor_not_init'] > 0 && $data['monitor_checks'] > 0) { - $data['module_sanity'] = format_numeric((100 - ($data['monitor_not_init'] / ($data['monitor_checks'] / 100))), 1); - } else { - $data['module_sanity'] = 100; - } - - if (isset($data['alerts'])) { - if ($data['monitor_alerts_fired'] > 0 && $data['alerts'] > 0) { - $data['alert_level'] = format_numeric((100 - ($data['monitor_alerts_fired'] / ($data['alerts'] / 100))), 1); - } else { - $data['alert_level'] = 100; - } - } else { - $data['alert_level'] = 100; - $data['alerts'] = 0; - } - - $data['monitor_bad'] = ($data['monitor_critical'] + $data['monitor_warning']); - - if ($data['monitor_bad'] > 0 && $data['monitor_checks'] > 0) { - $data['global_health'] = format_numeric((100 - ($data['monitor_bad'] / ($data['monitor_checks'] / 100))), 1); - } else { - $data['global_health'] = 100; - } - - $data['server_sanity'] = format_numeric((100 - $data['module_sanity']), 1); -} - -ui_require_css_file('logon'); - -echo '
'; - -// -// Overview Table. -// -$table = new stdClass(); -$table->class = 'no-class'; -$table->cellpadding = 4; -$table->cellspacing = 4; -$table->head = []; -$table->data = []; -$table->headstyle[0] = 'text-align:center;'; -$table->width = '100%'; -$table->head_colspan[0] = 4; - -// Indicators. -$tdata = []; -$stats = reporting_get_stats_indicators($data, 120, 10, false); -$status = ''; -foreach ($stats as $stat) { - $status .= ''; -} - -$status .= '
'.$stat['title'].''.$stat['graph'].'
'; -$table->rowclass = []; -$table->rowclass[0] = 'w100p'; -$table->rowclass[1] = 'w100p'; -$table->rowclass[2] = 'w100p'; -$table->rowclass[3] = 'w100p'; -$table->rowclass[4] = 'w100p'; -$table->rowclass[5] = 'w100p'; -$table->data[0][0] = $status; - -$table->data[] = $tdata; - -// Alerts. -$tdata = []; -$tdata[0] = reporting_get_stats_alerts($data); -$table->rowclass[] = ''; -$table->data[] = $tdata; - -// Modules by status. -$tdata = []; - -$data_agents = [ - __('Critical') => $data['monitor_critical'], - __('Warning') => $data['monitor_warning'], - __('Normal') => $data['monitor_ok'], - __('Unknown') => $data['monitor_unknown'], - __('Not init') => $data['monitor_not_init'], -]; - -$tdata[0] = reporting_get_stats_modules_status($data, 180, 100, false, $data_agents); -$table->rowclass[] = ''; -$table->data[] = $tdata; - -// Total agents and modules. -$tdata = []; -$tdata[0] = reporting_get_stats_agents_monitors($data); -$table->rowclass[] = ''; -$table->data[] = $tdata; - -// Users. -if (users_is_admin() || check_acl($config['id_user'], 0, 'UM')) { - $tdata = []; - $tdata[0] = reporting_get_stats_users($data); - $table->rowclass[] = ''; - $table->data[] = $tdata; -} - -ui_toggle( - html_print_table($table, true), - __('%s Overview', get_product_name()), - '', - 'overview', - false -); -unset($table); - -echo '