diff --git a/pandora_console/include/functions_events.php b/pandora_console/include/functions_events.php index 26ded59964..03d30bbc95 100644 --- a/pandora_console/include/functions_events.php +++ b/pandora_console/include/functions_events.php @@ -93,7 +93,7 @@ function events_get_events ($filter = false, $fields = false) { * * @return mixed False in case of error or invalid values passed. Event row otherwise */ -function events_get_event ($id, $fields = false) { +function events_get_event ($id, $fields = false, $meta = false) { if (empty ($id)) return false; global $config; @@ -103,7 +103,13 @@ function events_get_event ($id, $fields = false) { $fields[] = 'id_grupo'; } - $event = db_get_row ('tevento', 'id_evento', $id, $fields); + if($meta) { + $event = events_meta_get_event($id, array ('evento', 'id_agentmodule'), $history); + } + else { + $event = events_get_event ($id, array ('evento', 'id_agentmodule')); + } + if (! check_acl ($config['id_user'], $event['id_grupo'], 'ER')) return false; diff --git a/pandora_console/include/functions_reporting.php b/pandora_console/include/functions_reporting.php index 40232fd4d2..99102fcafb 100644 --- a/pandora_console/include/functions_reporting.php +++ b/pandora_console/include/functions_reporting.php @@ -159,22 +159,14 @@ function reporting_make_reporting_data($report = null, $id_report, $content); break; case 'custom_graph': + case 'automatic_custom_graph': $report['contents'][] = reporting_custom_graph( $report, $content, $type, $force_width_chart, - $force_height_chart, 'custom_graph'); - break; - case 'automatic_graph': - $report['contents'][] = - reporting_custom_graph( - $report, - $content, - $type, - $force_width_chart, - $force_height_chart, 'automatic_graph'); + $force_height_chart); break; case 'text': $report['contents'][] = reporting_text( @@ -2631,8 +2623,8 @@ function reporting_alert_report_group($report, $content) { $data_row['fired'] = array(); $firedTimes = get_module_alert_fired( - $alert['id_agent_module'], - $alert['id'], + $content['id_agent_module'], + $alert['id_alert_template'], (int) $content['period'], (int) $report["datetime"]); @@ -2739,7 +2731,7 @@ function reporting_alert_report_agent($report, $content) { $data_row['fired'] = array(); $firedTimes = get_module_alert_fired( $alert['id_agent_module'], - $alert['id'], + $alert['id_alert_template'], (int) $content['period'], (int) $report["datetime"]); @@ -3183,14 +3175,6 @@ function reporting_prediction_date($report, $content) { $return["date"] = reporting_get_date_text($report, $content); $return['label'] = (isset($content['style']['label'])) ? $content['style']['label'] : ''; - $module_name = io_safe_output( - modules_get_agentmodule_name($content['id_agent_module'])); - $agent_name = io_safe_output( - modules_get_agentmodule_agent_name ($content['id_agent_module'])); - - $return['agent_name'] = $agent_name; - $return['module_name'] = $module_name; - set_time_limit(500); $intervals_text = $content['text']; @@ -3757,6 +3741,7 @@ function reporting_availability($report, $content) { else { $items = $content['subitems']; } + @@ -4270,23 +4255,18 @@ function reporting_general($report, $content) { } function reporting_custom_graph($report, $content, $type = 'dinamic', - $force_width_chart = null, $force_height_chart = null, $type_report = "custom_graph") { + $force_width_chart = null, $force_height_chart = null) { global $config; require_once ($config["homedir"] . '/include/functions_graph.php'); - if ($type_report == 'automatic_graph') { - // Do none - } - else { - if ($config['metaconsole']) { - $id_meta = metaconsole_get_id_server($content["server_name"]); - - - $server = metaconsole_get_connection_by_id ($id_meta); - metaconsole_connect($server); - } + if ($config['metaconsole']) { + $id_meta = metaconsole_get_id_server($content["server_name"]); + + + $server = metaconsole_get_connection_by_id ($id_meta); + metaconsole_connect($server); } $graph = db_get_row ("tgraph", "id_graph", $content['id_gs']); @@ -4314,15 +4294,7 @@ function reporting_custom_graph($report, $content, $type = 'dinamic', $labels = array(); foreach ($graphs as $graph_item) { - if ($type_report == 'automatic_graph') { - array_push ($modules, array( - 'module' => $graph_item['id_agent_module'], - 'server' => $graph_item['id_server'])); - } - else { - array_push ($modules, $graph_item['id_agent_module']); - } - + array_push ($modules, $graph_item['id_agent_module']); array_push ($weights, $graph_item["weight"]); if (in_array('label',$content['style'])) { $item = array('type' => 'custom_graph', @@ -4373,13 +4345,8 @@ function reporting_custom_graph($report, $content, $type = 'dinamic', break; } - if ($type_report == 'automatic_graph') { - // Do none - } - else { - if ($config['metaconsole']) { - metaconsole_restore_db(); - } + if ($config['metaconsole']) { + metaconsole_restore_db(); } return reporting_check_structure_content($return); @@ -5474,21 +5441,17 @@ function reporting_get_stats_alerts($data, $links = false) { $table_al = html_get_predefined_table(); $tdata = array(); - $tdata[0] = html_print_image('images/bell.png', true, array('title' => __('Defined alerts'))); + $tdata[0] = html_print_image('images/bell.png', true, array('title' => __('Defined alerts')), false, false, false, true); $tdata[1] = $data["monitor_alerts"] <= 0 ? '-' : $data["monitor_alerts"]; $tdata[1] = '' . $tdata[1] . ''; - if($data["monitor_alerts"]>$data["total_agents"] && !enterprise_installed()){ - $tdata[2] = "
"; - } - - $tdata[3] = html_print_image('images/bell_error.png', true, array('title' => __('Fired alerts'))); - $tdata[4] = $data["monitor_alerts_fired"] <= 0 ? '-' : $data["monitor_alerts_fired"]; - $tdata[4] = '' . $tdata[4] . ''; + $tdata[2] = html_print_image('images/bell_error.png', true, array('title' => __('Fired alerts'))); + $tdata[3] = $data["monitor_alerts_fired"] <= 0 ? '-' : $data["monitor_alerts_fired"]; + $tdata[3] = '' . $tdata[3] . ''; $table_al->rowclass[] = ''; $table_al->data[] = $tdata; - if (!defined('METACONSOLE')) { + if (!is_metaconsole()) { $output = '
' . __('Defined and fired alerts') . @@ -5641,18 +5604,9 @@ function reporting_get_stats_agents_monitors($data) { $tdata[1] = $data["total_agents"] <= 0 ? '-' : $data["total_agents"]; $tdata[1] = '' . $tdata[1] . ''; - if($data["total_agents"]>500 && !enterprise_installed()){ - $tdata[2] = "
"; - } - - $tdata[3] = html_print_image('images/module.png', true, array('title' => __('Monitor checks'))); - $tdata[4] = $data["monitor_checks"] <= 0 ? '-' : $data["monitor_checks"]; - $tdata[4] = '' . $tdata[4] . ''; - - if(($data["monitor_checks"]/$data["total_agents"]>100) && !enterprise_installed()){ - $tdata[5] = "
"; - } - + $tdata[2] = html_print_image('images/module.png', true, array('title' => __('Monitor checks'))); + $tdata[3] = $data["monitor_checks"] <= 0 ? '-' : $data["monitor_checks"]; + $tdata[3] = '' . $tdata[3] . ''; $table_am->rowclass[] = ''; $table_am->data[] = $tdata; @@ -8300,12 +8254,12 @@ function reporting_get_stats_servers($tiny = true) { $table_srv->style[0] = $table_srv->style[2] = 'text-align: right; padding: 5px;'; $table_srv->style[1] = $table_srv->style[3] = 'text-align: left; padding: 5px;'; - $tdata = array();'' . format_numeric($server_performance ["total_local_modules"]) . ''; + $tdata = array(); $tdata[0] = html_print_image('images/module.png', true, array('title' => __('Total running modules'), 'width' => '25px')); $tdata[1] = '' . format_numeric($server_performance ["total_modules"]) . ''; - $tdata[2] = ' '; - $tdata[3] = '' . format_numeric($server_performance ["total_modules_rate"], 2) . ''; - $tdata[4] = html_print_image('images/module.png', true, array('title' => __('Ratio') . ': ' . __('Modules by second'), 'width' => '16px')) . '/sec '; + + $tdata[2] = '' . format_numeric($server_performance ["total_modules_rate"], 2) . ''; + $tdata[3] = html_print_image('images/module.png', true, array('title' => __('Ratio') . ': ' . __('Modules by second'), 'width' => '16px')) . '/sec '; $table_srv->rowclass[] = ''; $table_srv->data[] = $tdata; @@ -8320,13 +8274,9 @@ function reporting_get_stats_servers($tiny = true) { $tdata[0] = html_print_image('images/database.png', true, array('title' => __('Local modules'), 'width' => '25px')); $tdata[1] = '' . format_numeric($server_performance ["total_local_modules"]) . ''; - - $tdata[2] = ' '; - - $tdata[3] = '' . + $tdata[2] = '' . format_numeric($server_performance ["local_modules_rate"], 2) . ''; - - $tdata[4] = html_print_image('images/module.png', true, array('title' => __('Ratio') . ': ' . __('Modules by second'), 'width' => '16px')) . '/sec '; + $tdata[3] = html_print_image('images/module.png', true, array('title' => __('Ratio') . ': ' . __('Modules by second'), 'width' => '16px')) . '/sec '; $table_srv->rowclass[] = ''; $table_srv->data[] = $tdata; @@ -8336,16 +8286,8 @@ function reporting_get_stats_servers($tiny = true) { $tdata[0] = html_print_image('images/network.png', true, array('title' => __('Remote modules'), 'width' => '25px')); $tdata[1] = '' . format_numeric($server_performance ["total_remote_modules"]) . ''; - if($server_performance ["total_remote_modules"]>10000 && !enterprise_installed()){ - $tdata[2] = "
"; - } - else{ - $tdata[2] = ' '; - } - - - $tdata[3] = '' . format_numeric($server_performance ["remote_modules_rate"], 2) . ''; - $tdata[4] = html_print_image('images/module.png', true, array('title' => __('Ratio') . ': ' . __('Modules by second'), 'width' => '16px')) . '/sec '; + $tdata[2] = '' . format_numeric($server_performance ["remote_modules_rate"], 2) . ''; + $tdata[3] = html_print_image('images/module.png', true, array('title' => __('Ratio') . ': ' . __('Modules by second'), 'width' => '16px')) . '/sec '; $table_srv->rowclass[] = ''; $table_srv->data[] = $tdata; @@ -8445,15 +8387,8 @@ function reporting_get_stats_servers($tiny = true) { array('title' => __('Total events'), 'width' => '25px')); $tdata[1] = '' . format_numeric($system_events) . ''; - - if($system_events > 50000 && !enterprise_installed()){ - $tdata[2] = "
"; - } - - else{ - $tdata[3] = " "; - } - $table_srv->colspan[count($table_srv->data)][1] = 2; + + $table_srv->colspan[count($table_srv->data)][1] = 3; $table_srv->rowclass[] = ''; $table_srv->data[] = $tdata; } diff --git a/pandora_console/include/functions_ui.php b/pandora_console/include/functions_ui.php index afb4ea55b2..5bddb81e2b 100755 --- a/pandora_console/include/functions_ui.php +++ b/pandora_console/include/functions_ui.php @@ -554,7 +554,7 @@ function ui_print_group_icon ($id_group, $return = false, $path = "groups_small" $output .= '  '; else { $output .= html_print_image("images/" . $path . "/" . $icon . ".png", - true, array("style" => $style, "class" => "bot", "alt" => groups_get_name($id_group, true), "title" => groups_get_name ($id_group, true))); + true, array("style" => $style, "class" => "bot", "alt" => groups_get_name($id_group, true), "title" => groups_get_name ($id_group, true)), false, false, false, true); } } @@ -629,7 +629,7 @@ function ui_print_os_icon ($id_os, $name = true, $return = false, if (empty ($icon)) { if ($only_src) { $output = html_print_image("images/" . $subfolter . "/unknown.png", - true, $options, true, $relative); + true, $options, true, $relative, false, true); } else { return "-"; @@ -637,13 +637,13 @@ function ui_print_os_icon ($id_os, $name = true, $return = false, } else if ($apply_skin) { if ($only_src) { - $output = html_print_image("images/" . $subfolter . "/" . $icon, true, $options, true, $relative); + $output = html_print_image("images/" . $subfolter . "/" . $icon, true, $options, true, $relative, false, true); } else { if (!isset($options['title'])) { $options['title'] = $os_name; } - $output = html_print_image("images/" . $subfolter . "/" . $icon, true, $options, false, $relative); + $output = html_print_image("images/" . $subfolter . "/" . $icon, true, $options, false, $relative, false, true); } } else @@ -1807,6 +1807,8 @@ function ui_pagination ($count, $url = false, $offset = 0, * @return string HTML code if return parameter is true. */ function ui_print_session_action_icon ($action, $return = false) { + global $config; + $key_icon = array( 'acl' => 'images/delete.png', 'agent' => 'images/agent.png', @@ -1835,7 +1837,7 @@ function ui_print_session_action_icon ($action, $return = false) { $output = ''; foreach($key_icon as $key => $icon) { if (stristr($action, $key) !== false) { - $output = html_print_image($icon, true, array('title' => $action)) . ' '; + $output = html_print_image($icon, true, array('title' => $action), false, false, false, true) . ' '; break; } } @@ -2076,7 +2078,7 @@ function ui_print_status_image ($type, $title = "", $return = false, $options = $options['title'] = $title; - return html_print_image ($imagepath, $return, $options); + return html_print_image ($imagepath, $return, $options, false, false, false, true); } /** diff --git a/pandora_console/mobile/index.php b/pandora_console/mobile/index.php index 70c4e12a54..55b84a724c 100644 --- a/pandora_console/mobile/index.php +++ b/pandora_console/mobile/index.php @@ -18,7 +18,7 @@ if (function_exists ('mb_internal_encoding')) { mb_internal_encoding ("UTF-8"); } -$develop_bypass = 1; +$develop_bypass = 0; require_once("include/ui.class.php"); require_once("include/system.class.php"); @@ -69,8 +69,8 @@ $system = System::getInstance(); //~ In this moment doesn't work the version mobile when have metaconsole version. //~ In the future versions of pandora maybe is added a mobile version of PandoraFMS Metaconsole version. -if ($system->getConfig('metaconsole')) - header ("Location: " . $system->getConfig('homeurl') . "enterprise/meta"); +//~ if ($system->getConfig('metaconsole')) + //~ header ("Location: " . $system->getConfig('homeurl') . "enterprise/meta"); require_once($system->getConfig('homedir').'/include/constants.php'); diff --git a/pandora_console/mobile/operation/agent.php b/pandora_console/mobile/operation/agent.php index 1fb7958679..2bb7877278 100644 --- a/pandora_console/mobile/operation/agent.php +++ b/pandora_console/mobile/operation/agent.php @@ -23,9 +23,17 @@ class Agent { $system = System::getInstance(); $this->id = $system->getRequest('id', 0); - $this->agent = agents_get_agents(array( - 'disabled' => 0, - 'id_agente' => $this->id), array('*')); + + if (!$system->getConfig('metaconsole')) { + $this->agent = agents_get_agents(array( + 'disabled' => 0, + 'id_agente' => $this->id), array('*')); + } + else { + $this->agent = agents_get_meta_agents(array( + 'disabled' => 0, + 'id_agente' => $this->id), array('*')); + } if (!empty($this->agent)) { $this->agent = $this->agent[0]; @@ -90,7 +98,7 @@ class Agent { $ui->createPage(); if ($this->id != 0) { - $agent_name = (string) agents_get_name ($this->id); + $agent_name = (string) $this->agent['nombre']; $ui->createDefaultHeader( sprintf('%s', $agent_name), @@ -121,8 +129,17 @@ class Agent { } - $addresses = agents_get_addresses($this->id); - $address = agents_get_address($this->id); + if ($system->getConfig('metaconsole')) { + metaconsole_connect(null, $this->agent['id_tmetaconsole_setup']); + $addresses = agents_get_addresses($this->agent['id_tagente']); + } + else + $addresses = agents_get_addresses($this->id); + + if ($system->getConfig('metaconsole')) + metaconsole_restore_db(); + + $address = $this->agent['direccion']; foreach ($addresses as $k => $add) { if ($add == $address) { unset($addresses[$k]); @@ -154,7 +171,9 @@ class Agent { $html .= $last_contact; $html .= $description; $html .= ''; - + if ($system->getConfig('metaconsole')) { + metaconsole_connect(null, $this->agent['id_tmetaconsole_setup']); + } $ui->contentGridAddCell($html, 'agent_details'); ob_start(); $html = '
'; @@ -170,26 +189,38 @@ class Agent { $html .= '
'; $html .= '
'; $html .= '
'; + $ui->contentGridAddCell($html, 'agent_graphs'); $ui->contentEndGrid(); - + if ($system->getConfig('metaconsole')) + metaconsole_restore_db(); $modules = new Modules(); - $filters = array('id_agent' => $this->id, 'all_modules' => true, 'status' => -1); + if ($system->getConfig('metaconsole')) + $filters = array('id_agent' => $this->agent['id_tagente'], 'all_modules' => true, 'status' => -1); + else + $filters = array('id_agent' => $this->id, 'all_modules' => true, 'status' => -1); $modules->setFilters($filters); $modules->disabledColumns(array('agent')); $ui->contentBeginCollapsible(__('Modules')); $ui->contentCollapsibleAddItem($modules->listModulesHtml(0, true)); $ui->contentEndCollapsible(); + if ($system->getConfig('metaconsole')) { + metaconsole_connect(null, $this->agent['id_tmetaconsole_setup']); + } $alerts = new Alerts(); - $filters = array('id_agent' => $this->id, 'all_alerts' => true); + if ($system->getConfig('metaconsole')) + $filters = array('id_agent' => $this->agent['id_tagente'], 'all_alerts' => true); + else + $filters = array('id_agent' => $this->id, 'all_alerts' => true); $alerts->setFilters($filters); $alerts->disabledColumns(array('agent')); $ui->contentBeginCollapsible(__('Alerts')); $ui->contentCollapsibleAddItem($alerts->listAlertsHtml(true)); $ui->contentEndCollapsible(); - + if ($system->getConfig('metaconsole')) + metaconsole_restore_db(); $events = new Events(); $events->addJavascriptDialog(); diff --git a/pandora_console/mobile/operation/agents.php b/pandora_console/mobile/operation/agents.php index 6dae8ab623..3430d088b9 100644 --- a/pandora_console/mobile/operation/agents.php +++ b/pandora_console/mobile/operation/agents.php @@ -223,40 +223,76 @@ class Agents { OR comentarios LIKE '%" . $this->free_search . "%') "; } - $total = agents_get_agents(array( - 'disabled' => 0, - 'id_grupo' => $this->group, - 'search' => $search_sql, - 'status' => $this->status), - array ('COUNT(*) AS total'), 'AR', false); + if (!$system->getConfig('metaconsole')) { + $total = agents_get_agents(array( + 'disabled' => 0, + 'id_grupo' => $this->group, + 'search' => $search_sql, + 'status' => $this->status), + array ('COUNT(*) AS total'), 'AR', false); + } + else { + $total = agents_get_meta_agents(array( + 'disabled' => 0, + 'id_grupo' => $this->group, + 'search' => $search_sql, + 'status' => $this->status), + array ('COUNT(*) AS total'), 'AR', false); + } $total = isset($total[0]['total']) ? $total[0]['total'] : 0; $order = array('field' => 'nombre COLLATE utf8_general_ci', 'field2' => 'nombre COLLATE utf8_general_ci', 'order' => 'ASC'); - $agents_db = agents_get_agents(array( - 'disabled' => 0, - 'id_grupo' => $this->group, - 'search' => $search_sql, - 'status' => $this->status, - 'offset' => (int) $page * $system->getPageSize(), - 'limit' => (int) $system->getPageSize()), - array ('id_agente', - 'id_grupo', - 'id_os', - 'nombre', - 'ultimo_contacto', - 'intervalo', - 'comentarios description', - 'quiet', - 'normal_count', - 'warning_count', - 'critical_count', - 'unknown_count', - 'notinit_count', - 'total_count', - 'fired_count'), - 'AR', $order); - + if (!$system->getConfig('metaconsole')) { + $agents_db = agents_get_agents(array( + 'disabled' => 0, + 'id_grupo' => $this->group, + 'search' => $search_sql, + 'status' => $this->status, + 'offset' => (int) $page * $system->getPageSize(), + 'limit' => (int) $system->getPageSize()), + array ('id_agente', + 'id_grupo', + 'id_os', + 'nombre', + 'ultimo_contacto', + 'intervalo', + 'comentarios description', + 'quiet', + 'normal_count', + 'warning_count', + 'critical_count', + 'unknown_count', + 'notinit_count', + 'total_count', + 'fired_count'), + 'AR', $order); + } + else { + $agents_db = agents_get_meta_agents(array( + 'disabled' => 0, + 'id_grupo' => $this->group, + 'search' => $search_sql, + 'status' => $this->status, + 'offset' => (int) $page * $system->getPageSize(), + 'limit' => (int) $system->getPageSize()), + array ('id_agente', + 'id_grupo', + 'id_os', + 'nombre', + 'ultimo_contacto', + 'intervalo', + 'comentarios description', + 'quiet', + 'normal_count', + 'warning_count', + 'critical_count', + 'unknown_count', + 'notinit_count', + 'total_count', + 'fired_count'), + 'AR', $order); + } if (empty($agents_db)) $agents_db = array(); @@ -340,7 +376,7 @@ class Agents { if ($system->getPageSize() < $listAgents['total']) { $ui->contentAddHtml('
' . - html_print_image('images/spinner.gif', true) . + html_print_image('images/spinner.gif', true, false, false, false, false, true) . ' ' . __('Loading...') . '
'); diff --git a/pandora_console/mobile/operation/events.php b/pandora_console/mobile/operation/events.php index 106971661e..18977219e5 100644 --- a/pandora_console/mobile/operation/events.php +++ b/pandora_console/mobile/operation/events.php @@ -80,6 +80,7 @@ class Events { $events = array(); $end = 1; + foreach ($events_db as $event) { $end = 0; @@ -101,7 +102,7 @@ class Events { $img_st = str_replace("white.png", "dark.png", $img_st); } - $status_icon = html_print_image($img_st, true); + $status_icon = html_print_image($img_st, true, false, false, false, false, true); $row = array(); $row[] = '' . __('Event Name') . '
' . io_safe_output($event['evento']) . '
'; @@ -130,13 +131,17 @@ class Events { $id_event = $system->getRequest('id_event', 0); - $event = events_get_event($id_event); + $meta = false; + if ($system->getConfig('metaconsole')) + $meta = true; + + $event = events_get_event($id_event, false, $meta); if ($event) { //Check if it is a event from module. if ($event['id_agentmodule'] > 0) { $event['module_graph_link'] = '' . - html_print_image('images/chart_curve.png', true, array ("style" => 'vertical-align: middle;')) . + html_print_image('images/chart_curve.png', true, array ("style" => 'vertical-align: middle;'), false, false, false, true) . ''; } else { @@ -220,7 +225,7 @@ class Events { array ("class" => "image_status", "width" => 12, "height" => 12, - "title" => $event_criticity)); + "title" => $event_criticity), false, false, false, true); if ($event['estado'] == 1) { $user_ack = db_get_value('fullname', 'tusuario', 'id_user', $event['id_usuario']); @@ -252,7 +257,7 @@ class Events { } $event["status"] = $title_st; $event["status"] .= ' '; - $event["status"] .= html_print_image($img_st,true); + $event["status"] .= html_print_image($img_st,true, false, false, false, false, true); $event["group"] = groups_get_name ($event["id_grupo"], true); $event["group"] .= ui_print_group_icon ($event["id_grupo"], true); @@ -720,7 +725,7 @@ class Events { } $system = System::getInstance(); - $groups = users_get_groups($system->getConfig('id_user'), 'IR'); + $groups = users_get_groups($system->getConfig('id_user'), 'ER'); //Group selection if ($this->group > 0 && in_array ($this->group, array_keys ($groups))) { @@ -758,13 +763,18 @@ class Events { $pagination = $system->getPageSize(); } + $meta = false; + if ($system->getConfig('metaconsole')) + $meta = true; + $events_db = events_get_events_grouped($sql_post, - $offset, $pagination, false, false); + $offset, $pagination, $meta, false); + if (empty($events_db)) { $events_db = array(); } - $total_events = events_get_total_events_grouped($sql_post); + $total_events = events_get_total_events_grouped($sql_post, $meta); return array('events' => $events_db, 'total' => $total_events); } @@ -783,7 +793,7 @@ class Events { $ui->contentAddHtml($table->getHTML()); $ui->contentAddHtml('
' . - html_print_image('images/spinner.gif', true) . + html_print_image('images/spinner.gif', true, false, false, false, false, true) . ' ' . __('Loading...') . '
' . $no_events); diff --git a/pandora_console/mobile/operation/groups.php b/pandora_console/mobile/operation/groups.php index 820751cbe2..38ccdcb465 100644 --- a/pandora_console/mobile/operation/groups.php +++ b/pandora_console/mobile/operation/groups.php @@ -13,9 +13,11 @@ // GNU General Public License for more details. include_once("../include/functions_users.php"); +include_once("../include/functions_groupview.php"); class Groups { private $correct_acl = false; + private $acl = 'AR'; private $groups = array(); private $status = array(); @@ -23,7 +25,7 @@ class Groups { function __construct() { $system = System::getInstance(); - if ($system->checkACL()) { + if ($system->checkACL($this->acl)) { $this->correct_acl = true; $this->groups = $this->getListGroups(); @@ -71,11 +73,41 @@ class Groups { $ui->contentAddHtml('
'); $count = 0; + $url_agent = 'index.php?page=agents&group=%s&status=%s'; + $url_modules = 'index.php?page=modules&group=%s&status=%s'; + foreach ($this->groups as $group) { + // Calculate entire row color + if ($group["_monitors_alerts_fired_"] > 0) { + $color_class = 'group_view_alrm'; + $status_image = ui_print_status_image ('agent_alertsfired_ball.png', "", true); + } + elseif ($group["_monitors_critical_"] > 0) { + $color_class = 'group_view_crit'; + $status_image = ui_print_status_image ('agent_critical_ball.png', "", true); + } + elseif ($group["_monitors_warning_"] > 0) { + $color_class = 'group_view_warn'; + $status_image = ui_print_status_image ('agent_warning_ball.png', "", true); + } + elseif ($group["_monitors_ok_"] > 0) { + + $color_class = 'group_view_ok'; + $status_image = ui_print_status_image ('agent_ok_ball.png', "", true); + } + elseif (($group["_monitors_unknown_"] > 0) || ($group["_agents_unknown_"] > 0)) { + $color_class = 'group_view_unk'; + $status_image = ui_print_status_image ('agent_no_monitors_ball.png', "", true); + } + else { + $color_class = ''; + $status_image = ui_print_status_image ('agent_no_data_ball.png', "", true); + } + $group['icon'] = ($group['icon'] == '') ? 'world' : $group['icon']; $ui->contentAddHtml('