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->data[0][0] = $status; $table->rowclass[] = ''; $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 ''; // Close welcome panel. echo '
';