checkACL($this->acl)) {
$this->correct_acl = true;
}
else {
$this->correct_acl = false;
}
}
public function show() {
if (!$this->correct_acl) {
$this->show_fail_acl();
}
else {
$this->show_tactical();
}
}
public function ajax($parameter2 = false) {
$system = System::getInstance();
if (!$this->correct_acl) {
return;
}
else {
switch ($parameter2) {
case 'render_status_pie':
$links = $system->getRequest('links', '');
$data = $system->getRequest('data', '');
$data = str_replace('\\','',$data);
$links = str_replace('\\','',$links);
$width = $system->getRequest('width', 230);
$max_width = 399;
if($width > $max_width) {
$width = $max_width;
}
echo reporting_get_stats_modules_status(json_decode($data, true), $width, $width/2, json_decode($links, true));
exit;
}
}
}
private function show_fail_acl() {
$error['type'] = 'onStart';
$error['title_text'] = __('You don\'t have access to this page');
$error['content_text'] = __('Access to this page is restricted to authorized users only, please contact system administrator if you need assistance.
Please know that all attempts to access this page are recorded in security logs of Pandora System Database');
if (class_exists("HomeEnterprise"))
$home = new HomeEnterprise();
else
$home = new Home();
$home->show($error);
}
private function show_tactical() {
$ui = Ui::getInstance();
$ui->createPage();
$ui->createDefaultHeader(__("Tactical view"),
$ui->createHeaderButton(
array('icon' => 'back',
'pos' => 'left',
'text' => __('Back'),
'href' => 'index.php?page=home')));
$ui->showFooter(false);
$ui->beginContent();
$ui->contentBeginGrid('responsive');
//~ $data = reporting_get_group_stats();
$all_data = tactical_status_modules_agents($config['id_user'], $user_strict, 'AR', $user_strict);
$data = array();
$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['total_agents'] = (int) $all_data['_total_agents_'];
$data["monitor_checks"] = (int) $all_data['_monitor_checks_'];
// Percentages
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);
}
$data['mobile'] = true;
$formatted_data = reporting_get_stats_indicators($data, 100, 10, false);
$formatted_data_untiny = reporting_get_stats_indicators($data, 140, 15, false);
$overview = '
' . $formatted_data['server_health']['title'] . ' | ' . $formatted_data['server_health']['graph'] . ' | ' . $formatted_data_untiny['server_health']['graph'] . ' |
' . $formatted_data['monitor_health']['title'] . ' | ' . $formatted_data['monitor_health']['graph'] . ' | ' . $formatted_data_untiny['monitor_health']['graph'] . ' |
' . $formatted_data['module_sanity']['title'] . ' | ' . $formatted_data['module_sanity']['graph'] . ' | ' . $formatted_data_untiny['module_sanity']['graph'] . ' |
' . $formatted_data['alert_level']['title'] . ' | ' . $formatted_data['alert_level']['graph'] . ' | ' . $formatted_data_untiny['alert_level']['graph'] . ' |