diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index cb6467bda4..36627ceb47 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,26 @@ +2010-09-21 Miguel de Dios + + * include/functions_html.php: in function "print_select_groups" and function + "print_select_from_sql" added source code to check $config['text_char_long'] + for show small text in this widgets. + + * include/functions.php: in function "get_event_types" and "get_priorities" + added source code to check $config['text_char_long'] for show small text in + this widgets. And in function "get_priority_class" cleaned source code. + + * operation/agentes/status_monitor.php, operation/events/events.php: cleaned + source code style. + + * images/pandora.ico.gif: added image file for to use in the mobile footer. + + * mobile/operation/agents/monitor_status.php, + mobile/operation/agents/view_agents.php, + mobile/operation/agents/tactical.php, + mobile/operation/agents/group_view.php, mobile/operation/events/events.php, + mobile/include/style/main.css, mobile/include/functions_web.php, + mobile/index.php, general/footer.php: continued the develop, yep the + Pandora Console Mobile is complete (only rest the bugs). + 2010-09-21 Sergio Martin * include/functions_db.php diff --git a/pandora_console/general/footer.php b/pandora_console/general/footer.php index 3c6752dd87..12819d4377 100644 --- a/pandora_console/general/footer.php +++ b/pandora_console/general/footer.php @@ -26,7 +26,7 @@ if (! file_exists ($config["homedir"] . $license_file)) { } echo ''; -echo 'Pandora FMS '.$pandora_version.' - Build '.$build_version; +echo sprintf(__('Pandora FMS %s - Build %s', $pandora_version, $build_version)); echo '
'; echo ''. __('Page generated at') . ' '. print_timestamp ($time, true, array ("prominent" => "timestamp")); //Always use timestamp here echo ''; diff --git a/pandora_console/images/pandora.ico.gif b/pandora_console/images/pandora.ico.gif new file mode 100644 index 0000000000..aea148651b Binary files /dev/null and b/pandora_console/images/pandora.ico.gif differ diff --git a/pandora_console/include/functions.php b/pandora_console/include/functions.php index 919522f574..08c7977d70 100644 --- a/pandora_console/include/functions.php +++ b/pandora_console/include/functions.php @@ -779,7 +779,10 @@ function is_module_uncompressed ($module_type) { * @return array module_name Module name to check. */ function get_event_types () { + global $config; + $types = array (); + $types['unknown'] = __('Unknown'); $types['critical'] = __('Monitor Critical'); @@ -794,6 +797,12 @@ function get_event_types () { $types['system'] = __('System'); $types['error'] = __('Error'); + if (isset($config['text_char_long'])) { + foreach ($types as $key => $type) { + $types[$key] = printTruncateText($type, $config['text_char_long'], false, true, false); + } + } + return $types; } @@ -803,6 +812,8 @@ function get_event_types () { * @return array An array with all the priorities. */ function get_priorities () { + global $config; + $priorities = array (); $priorities[0] = __('Maintenance'); $priorities[1] = __('Informational'); @@ -810,6 +821,12 @@ function get_priorities () { $priorities[3] = __('Warning'); $priorities[4] = __('Critical'); + if (isset($config['text_char_long'])) { + foreach ($priorities as $key => $priority) { + $priorities[$key] = printTruncateText($priority, $config['text_char_long'], false, true, false); + } + } + return $priorities; } @@ -844,20 +861,26 @@ function get_priority_name ($priority) { * * @return string CSS priority class. */ -function get_priority_class ($priority) { +function get_priority_class($priority) { switch ($priority) { - case 0: - return "datos_blue"; - case 1: - return "datos_grey"; - case 2: - return "datos_green"; - case 3: - return "datos_yellow"; - case 4: - return "datos_red"; - default: - return "datos_grey"; + case 0: + return "datos_blue"; + break; + case 1: + return "datos_grey"; + break; + case 2: + return "datos_green"; + break; + case 3: + return "datos_yellow"; + break; + case 4: + return "datos_red"; + break; + default: + return "datos_grey"; + break; } } diff --git a/pandora_console/include/functions_html.php b/pandora_console/include/functions_html.php index 7d8a9c2be9..3270090a13 100644 --- a/pandora_console/include/functions_html.php +++ b/pandora_console/include/functions_html.php @@ -164,6 +164,7 @@ function print_select_style ($fields, $name, $selected = '', $style='', $script function print_select_groups($id_user = false, $privilege = "AR", $returnAllGroup = true, $name, $selected = '', $script = '', $nothing = '', $nothing_value = 0, $return = false, $multiple = false, $sort = true, $class = '', $disabled = false, $style = false, $option_style = false, $id_group = false) { + global $config; $user_groups = get_user_groups ($id_user, $privilege, $returnAllGroup, true); @@ -179,7 +180,14 @@ function print_select_groups($id_user = false, $privilege = "AR", $returnAllGrou $fields = array(); foreach ($user_groups_tree as $group) { - $fields[$group['id_grupo']] = str_repeat("    ", $group['deep']) . $group['nombre']; + if (isset($config['text_char_long'])) { + $groupName = printTruncateText($group['nombre'], $config['text_char_long'], false, true, false); + } + else { + $groupName = $group['nombre']; + } + + $fields[$group['id_grupo']] = str_repeat("    ", $group['deep']) . $groupName; } $output = print_select ($fields, $name, $selected, $script, $nothing, $nothing_value, @@ -332,6 +340,7 @@ function print_select ($fields, $name, $selected = '', $script = '', $nothing = */ function print_select_from_sql ($sql, $name, $selected = '', $script = '', $nothing = '', $nothing_value = '0', $return = false, $multiple = false, $sort = true, $disabled = false, $style = false) { + global $config; $fields = array (); $result = get_db_all_rows_sql ($sql); @@ -341,7 +350,12 @@ function print_select_from_sql ($sql, $name, $selected = '', $script = '', $noth foreach ($result as $row) { $id = array_shift($row); $value = array_shift($row); - $fields[$id] = $value; + if (isset($config['text_char_long'])) { + $fields[$id] = printTruncateText($value, $config['text_char_long'], false, true, false); + } + else { + $fields[$id] = $value; + } } return print_select ($fields, $name, $selected, $script, $nothing, $nothing_value, $return, $multiple, $sort,'',$disabled, $style); diff --git a/pandora_console/mobile/include/functions_web.php b/pandora_console/mobile/include/functions_web.php index 9c9b2dc11f..696d01a637 100644 --- a/pandora_console/mobile/include/functions_web.php +++ b/pandora_console/mobile/include/functions_web.php @@ -13,30 +13,74 @@ // GNU General Public License for more details. function menu() { + $enterpriseHook = enterprise_include('mobile/include/functions_web.php'); + ?>
- - +
-
+ + \ No newline at end of file diff --git a/pandora_console/mobile/include/style/main.css b/pandora_console/mobile/include/style/main.css index d3b1b238e3..8169b88495 100644 --- a/pandora_console/mobile/include/style/main.css +++ b/pandora_console/mobile/include/style/main.css @@ -18,9 +18,12 @@ input { border: 1px solid; } -.icon_menu { - width: 50px; - height: 50px; +.tactical_link { + text-decoration: none; +} + +.tactical_link:hover { + text-decoration: underline; } .orange { @@ -79,6 +82,16 @@ tr.rowPair:hover { tr.rowOdd:hover { background-color: #E0E0E0 } + +#footer { + background: #000; + height: 30px; + color: #fff; + text-align: center; + margin-top: 20px; + font-size: 10px; +} + /*----------------INI-MENU----------------------------------------------------*/ #top_menu { background: #3F4E2F; @@ -88,7 +101,7 @@ tr.rowOdd:hover { } #margin_bottom_menu { - margin-bottom: 17px; + /*margin-bottom: 17px;*/ } #menu { @@ -96,7 +109,7 @@ tr.rowOdd:hover { } #down_button { - height: 15px; + height: 20px; background: #fff; } @@ -106,11 +119,30 @@ tr.rowOdd:hover { padding-right: 10px; } -#button_menu_up { - display: none; +.icon_menu { + width: 30px; + height: 30px; } /*----------------END-MENU----------------------------------------------------*/ +/*----------------INI-EVENTS ROW BACKGROUND-----------------------------------*/ +.datos_green, .datos_greenf9 { + background-color: #BBFFA4; +} +.datos_red, .datos_redf9 { + background-color: #FFC0B5; +} +.datos_yellow, .datos_yellowf9 { + background-color: #F4FFBF; +} +.datos_blue, .datos_bluef9 { + background-color: #CDE2EA; +} +.datos_grey, .datos_greyf9 { + background-color: #E4E4E4; +} +/*----------------END-EVENTS ROW BACKGROUND-----------------------------------*/ + /*----------------INI-TABLE---------------------------------------------------*/ th { background-color:#9EAC8B; diff --git a/pandora_console/mobile/index.php b/pandora_console/mobile/index.php index ac4e3fdccd..aa79841788 100644 --- a/pandora_console/mobile/index.php +++ b/pandora_console/mobile/index.php @@ -23,6 +23,8 @@ require_once('operation/agents/tactical.php'); require_once('operation/agents/group_view.php'); require_once('operation/agents/view_alerts.php'); require_once('operation/events/events.php'); +require_once('operation/agents/monitor_status.php'); +$enterpriseHook = enterprise_include('mobile/include/enterprise.class.php'); $system = new System(); @@ -34,15 +36,15 @@ $user->hackinjectConfig(); ?> - XXX + Pandora FMS - <?php echo __('the Flexible Monitoring System (mobile version)'); ?> - +
-
+ getRequest('action'); switch ($action) { @@ -54,8 +56,8 @@ $user->hackinjectConfig(); $user->hackinjectConfig(); menu(); - if (! give_acl ($system->getConfig('id_user'), 0, "AR")) { - audit_db ($system->getConfig('id_user'), $_SERVER['REMOTE_ADDR'], "ACL Violation", + if (! give_acl($system->getConfig('id_user'), 0, "AR")) { + audit_db($system->getConfig('id_user'), $_SERVER['REMOTE_ADDR'], "ACL Violation", "Trying to access Agent Data view"); require ("../general/noaccess.php"); return; @@ -76,10 +78,15 @@ $user->hackinjectConfig(); menu(); $page = $system->getRequest('page', 'tactical'); switch ($page) { + case 'reports': + if ($enterpriseHook !== ENTERPRISE_NOT_HOOK) { + $enterprise = new Enterprise($page); + } + break; default: case 'tactical': - if (! give_acl ($system->getConfig('id_user'), 0, "AR")) { - audit_db ($system->getConfig('id_user'), $_SERVER['REMOTE_ADDR'], "ACL Violation", + if (! give_acl($system->getConfig('id_user'), 0, "AR")) { + audit_db($system->getConfig('id_user'), $_SERVER['REMOTE_ADDR'], "ACL Violation", "Trying to access Agent Data view"); require ("../general/noaccess.php"); return; @@ -89,8 +96,8 @@ $user->hackinjectConfig(); $tactical->show(); break; case 'agents': - if (! give_acl ($system->getConfig('id_user'), 0, "AR")) { - audit_db ($system->getConfig('id_user'), $_SERVER['REMOTE_ADDR'], "ACL Violation", + if (! give_acl($system->getConfig('id_user'), 0, "AR")) { + audit_db($system->getConfig('id_user'), $_SERVER['REMOTE_ADDR'], "ACL Violation", "Trying to access Agent Data view"); require ("../general/noaccess.php"); return; @@ -115,8 +122,8 @@ $user->hackinjectConfig(); } break; case 'servers': - if (! give_acl ($system->getConfig('id_user'), 0, "PM")) { - audit_db ($system->getConfig('id_user'), $_SERVER['REMOTE_ADDR'], "ACL Violation", + if (! give_acl($system->getConfig('id_user'), 0, "PM")) { + audit_db($system->getConfig('id_user'), $_SERVER['REMOTE_ADDR'], "ACL Violation", "Trying to access Agent Data view"); require ("../general/noaccess.php"); return; @@ -126,8 +133,8 @@ $user->hackinjectConfig(); $viewServers->show(); break; case 'alerts': - if (! give_acl ($system->getConfig('id_user'), 0, "PM")) { - audit_db ($system->getConfig('id_user'), $_SERVER['REMOTE_ADDR'], "ACL Violation", + if (! give_acl($system->getConfig('id_user'), 0, "PM")) { + audit_db($system->getConfig('id_user'), $_SERVER['REMOTE_ADDR'], "ACL Violation", "Trying to access Agent Data view"); require ("../general/noaccess.php"); return; @@ -137,8 +144,8 @@ $user->hackinjectConfig(); $viewAlerts->show(); break; case 'groups': - if (! give_acl ($system->getConfig('id_user'), 0, "PM")) { - audit_db ($system->getConfig('id_user'), $_SERVER['REMOTE_ADDR'], "ACL Violation", + if (! give_acl($system->getConfig('id_user'), 0, "PM")) { + audit_db($system->getConfig('id_user'), $_SERVER['REMOTE_ADDR'], "ACL Violation", "Trying to access Agent Data view"); require ("../general/noaccess.php"); return; @@ -148,8 +155,8 @@ $user->hackinjectConfig(); $groupView->show(); break; case 'events': - if (! give_acl ($system->getConfig('id_user'), 0, "IR")) { - audit_db ($system->getConfig('id_user'), $_SERVER['REMOTE_ADDR'], "ACL Violation", + if (! give_acl($system->getConfig('id_user'), 0, "IR")) { + audit_db($system->getConfig('id_user'), $_SERVER['REMOTE_ADDR'], "ACL Violation", "Trying to access event viewer"); require ("general/noaccess.php"); return; @@ -158,12 +165,28 @@ $user->hackinjectConfig(); $eventsView = new EventsView(); $eventsView->show(); break; + case 'monitor': + if (! give_acl($system->getConfig('id_user'), 0, "AR")) { + audit_db ($system->getConfig('id_user'), $_SERVER['REMOTE_ADDR'], "ACL Violation", + "Trying to access Agent Data view"); + require ("../general/noaccess.php"); + return; + } + + $monitorStatus = new MonitorStatus($user); + $monitorStatus->show(); + break; } } break; } ?>
+ isLogged()) { + footer(); + } + ?> head = array(); $table->head[0] = ' '; - $table->head[1] = '' . __('T') . ''; - $table->head[2] = '' . __('A') . ''; - $table->head[3] = '' . __('U') . ''; - $table->head[4] = '' . __('N') . ''; - $table->head[5] = '' . __('N') . ''; - $table->head[6] = '' . __('W') . ''; - $table->head[7] = '' . __('C') . ''; - $table->head[8] = '' . __('A') . ''; +// $table->head[1] = '' . __('T') . ''; +// $table->head[2] = '' . __('A') . ''; + $table->head[3] = '' . __('Unk') . ''; +// $table->head[4] = '' . __('N') . ''; + $table->head[5] = '' . __('Nor') . ''; +// $table->head[6] = '' . __('W') . ''; +// $table->head[7] = '' . __('C') . ''; + $table->head[8] = '' . __('Aler') . ''; $rowPair = false; $iterator = 0; @@ -62,14 +62,14 @@ class GroupView { $groupName = get_group_name($idGroup); - $data[] = '' . $groupName . ''; - $data[] = $groupData['total_agents']; - $data[] = $groupData['agents_unknown']; + $data[] = '' . $groupName . ''; +// $data[] = $groupData['total_agents']; +// $data[] = $groupData['agents_unknown']; $data[] = $groupData['monitor_unknown']; - $data[] = $groupData['monitor_not_init']; +// $data[] = $groupData['monitor_not_init']; $data[] = $groupData["monitor_ok"]; - $data[] = $groupData["monitor_warning"]; - $data[] = $groupData["monitor_critical"]; +// $data[] = $groupData["monitor_warning"]; +// $data[] = $groupData["monitor_critical"]; $data[] = $groupData["monitor_alerts_fired"]; $table->data[] = $data; diff --git a/pandora_console/mobile/operation/agents/monitor_status.php b/pandora_console/mobile/operation/agents/monitor_status.php new file mode 100644 index 0000000000..6bc60ef5b5 --- /dev/null +++ b/pandora_console/mobile/operation/agents/monitor_status.php @@ -0,0 +1,224 @@ +system = $system; + $this->user = $user; + + $this->offset = $this->system->getRequest("offset", 0); + } + + public function show() { + global $config; + $config['text_char_long'] = 12; + + $group = $this->system->getRequest("group", 0); //0 = all + $modulegroup = $this->system->getRequest("modulegroup", 0); //0 = all + $status = $this->system->getRequest("status", -1); //-1 = all + $search = $this->system->getRequest('filter_text', ''); + + $table = null; + $table->width = '100%'; + $table->colspan[1][2] = 2; + + $table->data[0][0] = '' . __('G') . ''; + $table->data[0][1] = print_select_groups($this->system->getConfig("id_user"), "IR", true, 'group', $group, '', '', 0, true, false, false, 'w130'); + $table->data[0][2] = '' . __('M') . ''; + $fields = array (); + $fields[-1] = __('All'); + $fields[0] = __('Normal'); + $fields[1] = __('Warning'); + $fields[2] = __('Critical'); + $fields[3] = __('Unknown'); + $fields[4] = __('Not normal'); //default + $fields[5] = __('Not init'); + foreach ($fields as $key => $field) { + $fields[$key] = printTruncateText($field, $config['text_char_long'], false, true, false); + } + $table->data[0][3] = print_select ($fields, "status", $status, '', '', -1, true); + $table->data[1][0] = '' . __('M') . ''; + $table->data[1][1] = print_select_from_sql ("SELECT * FROM tmodule_group ORDER BY name", + 'module_group', $modulegroup, '',__('All'), 0, true); + $table->data[1][2] = print_input_text('search', $search, '', 5, 20, true); + $table->data[1][2] .= ""; + + echo "
"; + print_table($table); + echo "
"; + + + + + // Agent group selector + if (($group > 0) && (give_acl($system->getConfig('id_user'), $group, "AR"))) { + $sqlGroup = sprintf (" AND tagente.id_grupo = %d", $ag_group); + } + else { + $user_groups_all = get_user_groups ($this->user->getIdUser(), "AR"); + $user_groups = array_keys ($user_groups_all); + $user_groupsText = implode(',', $user_groups); + + // User has explicit permission on group 1 ? + $sqlGroup = " AND tagente.id_grupo IN (" . $user_groupsText . ")"; + } + + + + // Status selector + $sqlStatus = ''; + if ($status == 0) { //Normal + $sqlStatus = " AND tagente_estado.estado = 0 + AND (utimestamp > 0 OR (tagente_modulo.id_tipo_modulo IN(21,22,23,100))) "; + } + elseif ($status == 2) { //Critical + $sqlStatus = " AND tagente_estado.estado = 1 AND utimestamp > 0"; + } + elseif ($status == 1) { //Warning + $sqlStatus = " AND tagente_estado.estado = 2 AND utimestamp > 0"; + } + elseif ($status == 4) { //Not normal + $sqlStatus = " AND tagente_estado.estado <> 0"; + } + elseif ($status == 3) { //Unknown + $sqlStatus = " AND tagente_estado.estado = 3"; + } + elseif ($status == 5) { //Not init + $sqlStatus = " AND tagente_estado.utimestamp = 0 AND tagente_modulo.id_tipo_modulo NOT IN (21,22,23,100)"; + } + + + + // Module group + $sqlModuleGroup = ''; + if ($modulegroup > 0) { + $sqlModuleGroup = sprintf (" AND tagente_modulo.id_module_group = '%d'", $modulegroup); + } + + + // Freestring selector + $sqlFreeSearch = ''; + if ($search != "") { + $sqlFreeSearch = sprintf (" AND (tagente.nombre LIKE '%%%s%%' OR tagente_modulo.nombre LIKE '%%%s%%' OR tagente_modulo.descripcion LIKE '%%%s%%')", $search, $search, $search); + } + + + $selectSQL = 'SELECT tagente_modulo.id_agente_modulo, + tagente.intervalo AS agent_interval, tagente.nombre AS agent_name, + tagente_modulo.nombre AS module_name, + tagente_modulo.id_agente_modulo, tagente_modulo.history_data, + tagente_modulo.flag AS flag, tagente.id_grupo AS id_group, + tagente.id_agente AS id_agent, + tagente_modulo.id_tipo_modulo AS module_type, + tagente_modulo.module_interval, tagente_estado.datos, + tagente_estado.estado, tagente_estado.utimestamp AS utimestamp'; + + $sql = ' FROM tagente, tagente_modulo, tagente_estado + WHERE tagente.id_agente = tagente_modulo.id_agente + AND tagente_modulo.disabled = 0 + AND tagente.disabled = 0 + AND tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo + ' . $sqlGroup . ' + ' . $sqlStatus . ' + ' . $sqlModuleGroup . ' + ' . $sqlFreeSearch . ' + ORDER BY tagente.id_grupo, tagente.nombre'; + + $total = get_db_value_sql('SELECT COUNT(*) ' . $sql); + + + $rows = get_db_all_rows_sql($selectSQL . $sql . ' LIMIT ' . $this->offset . ', ' . $this->system->getPageSize()); + + if ($rows === false) $rows = array(); + + + $table = null; + $table->width = '100%'; + + $table->data = array(); + $rowPair = false; + $iterator = 0; + foreach ($rows as $row) { + if ($rowPair) + $table->rowclass[$iterator] = 'rowPair'; + else + $table->rowclass[$iterator] = 'rowOdd'; + $rowPair = !$rowPair; + $iterator++; + + $data = array(); + + if($row['utimestamp'] == 0 && (($row['module_type'] < 21 || $row['module_type'] > 23) && $row['module_type'] != 100)){ + $statusImg = print_status_image(STATUS_MODULE_NO_DATA, __('NOT INIT'), true); + } + elseif ($row["estado"] == 0) { + $statusImg = print_status_image(STATUS_MODULE_OK, __('NORMAL').": ".$row["datos"], true); + } + elseif ($row["estado"] == 1) { + $statusImg = print_status_image(STATUS_MODULE_CRITICAL, __('CRITICAL').": ".$row["datos"], true); + } + elseif ($row["estado"] == 2) { + $statusImg = print_status_image(STATUS_MODULE_WARNING, __('WARNING').": ".$row["datos"], true); + } + else { + $last_status = get_agentmodule_last_status($row['id_agente_modulo']); + switch($last_status) { + case 0: + $statusImg = print_status_image(STATUS_MODULE_OK, __('UNKNOWN')." - ".__('Last status')." ".__('NORMAL').": ".$row["datos"], true); + break; + case 1: + $statusImg = print_status_image(STATUS_MODULE_CRITICAL, __('UNKNOWN')." - ".__('Last status')." ".__('CRITICAL').": ".$row["datos"], true); + break; + case 2: + $statusImg = print_status_image(STATUS_MODULE_WARNING, __('UNKNOWN')." - ".__('Last status')." ".__('WARNING').": ".$row["datos"], true); + break; + } + } + + $data[] = str_replace('' . printTruncateText($row['agent_name'], 25, true, true) . ''; + $data[] = '' . + printTruncateText($row['module_name'], 25, true, true) . ''; + if (is_numeric($row["datos"])) + $data[] = format_numeric($row["datos"]); + else + $data[] = "".substr(safe_output($row["datos"]),0,12).""; + + $data[] = print_timestamp ($row["utimestamp"], true, array('units' => 'tiny')); + + $table->data[] = $data; + } + + print_table($table); + + $pagination = pagination ($total, + get_url_refresh (array ()), + 0, 0, true); + + $pagination = str_replace('images/go_first.png', '../images/go_first.png', $pagination); + $pagination = str_replace('images/go_previous.png', '../images/go_previous.png', $pagination); + $pagination = str_replace('images/go_next.png', '../images/go_next.png', $pagination); + $pagination = str_replace('images/go_last.png', '../images/go_last.png', $pagination); + + echo $pagination; + } +} +?> \ No newline at end of file diff --git a/pandora_console/mobile/operation/agents/tactical.php b/pandora_console/mobile/operation/agents/tactical.php index 83aac2fc00..c638358c8b 100644 --- a/pandora_console/mobile/operation/agents/tactical.php +++ b/pandora_console/mobile/operation/agents/tactical.php @@ -53,22 +53,22 @@ class Tactical { $table->data[8][0] = $table->data[8][1] = ''; $table->data[0][1] = "

" . __('Monitor checks') . "

"; - $table->data[1][2] = __('Monitor checks'); - $table->data[1][3] = $data["monitor_checks"]; - $table->data[2][2] = '' . __('Monitors critical') . ''; - $table->data[2][3] = '' . $data["monitor_critical"] . ''; - $table->data[3][2] = '' . __('Monitors warning') .''; - $table->data[3][3] = '' . $data["monitor_warning"] . ''; - $table->data[4][2] = '' . __('Monitors normal') . ''; - $table->data[4][3] = '' . $data["monitor_ok"] . ''; - $table->data[5][2] = '' . __('Monitors unknown') . ''; - $table->data[5][3] = '' . $data["monitor_unknown"] . ''; - $table->data[6][2] = '' . __('Monitors not init') . ''; - $table->data[6][3] = '' . $data["monitor_not_init"] . ''; - $table->data[7][2] = '' . __('Alerts defined') . ''; - $table->data[7][3] = '' . $data["monitor_alerts"] . ''; - $table->data[8][2] = '' . __('Alerts fired') . ''; - $table->data[8][3] = '' . $data["monitor_alerts_fired"] . ''; + $table->data[1][2] = '' . __('Monitor checks') . ''; + $table->data[1][3] = '' . $data["monitor_checks"] . ''; + $table->data[2][2] = '' . __('Monitors critical') . ''; + $table->data[2][3] = '' . $data["monitor_critical"] . ''; + $table->data[3][2] = '' . __('Monitors warning') .''; + $table->data[3][3] = '' . $data["monitor_warning"] . ''; + $table->data[4][2] = '' . __('Monitors normal') . ''; + $table->data[4][3] = '' . $data["monitor_ok"] . ''; + $table->data[5][2] = '' . __('Monitors unknown') . ''; + $table->data[5][3] = '' . $data["monitor_unknown"] . ''; + $table->data[6][2] = '' . __('Monitors not init') . ''; + $table->data[6][3] = '' . $data["monitor_not_init"] . ''; + $table->data[7][2] = '' . __('Alerts defined') . ''; + $table->data[7][3] = '' . $data["monitor_alerts"] . ''; + $table->data[8][2] = '' . __('Alerts fired') . ''; + $table->data[8][3] = '' . $data["monitor_alerts_fired"] . ''; print_table($table); @@ -100,8 +100,8 @@ class Tactical { $table = null; //$table->width = '100%'; $table->align[1] = 'right'; - $table->data[0][0] = '' . __('Total agents') . ''; - $table->data[0][1] = '' . $data["total_agents"] . ''; + $table->data[0][0] = '' . __('Total agents') . ''; + $table->data[0][1] = '' . $data["total_agents"] . ''; $table->data[1][0] = '' . __('Uninitialized modules') . ''; $table->data[1][1] = '' . $data["server_sanity"] . ''; $table->data[2][0] = '' . __('Agents unknown') . ''; diff --git a/pandora_console/mobile/operation/agents/view_agents.php b/pandora_console/mobile/operation/agents/view_agents.php index de16164e2b..a2c57a3682 100644 --- a/pandora_console/mobile/operation/agents/view_agents.php +++ b/pandora_console/mobile/operation/agents/view_agents.php @@ -36,8 +36,10 @@ class ViewAgents { private function showForm() { echo "
"; print_input_hidden('page', 'agents'); + global $config; + $config['text_char_long'] = 12; print_select_groups($this->user->getIdUser(), "AR", true, 'filter_group', $this->filterGroup); - print_input_text('filter_text', $this->filterText, __('Free text search'), 10, 20); + print_input_text('filter_text', $this->filterText, __('Free text search'), 5, 20); echo ""; echo ""; } diff --git a/pandora_console/mobile/operation/events/events.php b/pandora_console/mobile/operation/events/events.php index 99d852da2d..48ac7df5af 100644 --- a/pandora_console/mobile/operation/events/events.php +++ b/pandora_console/mobile/operation/events/events.php @@ -24,6 +24,9 @@ class EventsView { } function show() { + global $config; + $config['text_char_long'] = 12; + $offset = $this->system->getRequest("offset", 0); $ev_group = $this->system->getRequest("ev_group", 0); //0 = all $event_type = get_parameter ("event_type", ''); // 0 all @@ -48,7 +51,7 @@ class EventsView { $table->data[0][3] = print_select ($types, 'event_type', $event_type, '', __('All'), '', true); $table->data[1][0] = '' . __('S') . ''; $table->data[1][1] = print_select (get_priorities (), "severity", $severity, '', __('All'), '-1', true); - $table->data[1][2] = print_input_text('search', $search, '', 10, 20, true); + $table->data[1][2] = print_input_text('search', $search, '', 5, 20, true); $table->data[1][2] .= ""; echo ""; @@ -116,9 +119,7 @@ class EventsView { $sql_count = str_replace('*', 'COUNT(*)', $sql); - $sql = $sql . ' LIMIT %d,%d'; - - $sql = sprintf($sql, $offset, $this->system->getPageSize()); + $sql = $sql . sprintf(' LIMIT %d,%d', $offset, $this->system->getPageSize()); $count = get_db_value_sql($sql_count); @@ -130,7 +131,7 @@ class EventsView { $table = null; $table->width = '100%'; $table->head = array(); - $table->head[0] = '' . __('S') . ''; +// $table->head[0] = '' . __('S') . ''; // $table->head[1] = '' . __('G') . ''; // $table->head[2] = '' . __('T') . ''; $table->head[3] = '' . __('T') . ''; @@ -138,6 +139,7 @@ class EventsView { $table->head[5] = '' . __('Agent') . ''; $table->data = array(); + $iterator = 0; foreach ($rows as $row) { $data = array(); @@ -160,14 +162,17 @@ class EventsView { break; } - $data[] = '' . - print_image ($img, true, - array ("class" => "image_status", - "width" => 15, - "height" => 15, - "title" => get_priority_name($row["criticity"]))) . ''; + $table->rowclass[$iterator] = get_priority_class($row["criticity"]); + $iterator++; + +// $data[] = '' . +// print_image ($img, true, +// array ("class" => "image_status", +// "width" => 15, +// "height" => 15, +// "title" => get_priority_name($row["criticity"]))) . ''; // $data[] = ' 'tiny')); - $data[] = printTruncateText($row["evento"], 40, true, true); + $data[] = $row["evento"]; if ($row["event_type"] == "system") { $data[] = printTruncateText(__('System'), 20, true, true); } elseif ($row["id_agente"] > 0) { // Agent name - $data[] = printTruncateText(get_agent_name($row["id_agente"]), 20, true, true); + $data[] = '' . printTruncateText(get_agent_name($row["id_agente"]), 20, true, true) . ''; } else { $data[] = printTruncateText(__('Alert SNMP'), 20, true, true); diff --git a/pandora_console/operation/agentes/status_monitor.php b/pandora_console/operation/agentes/status_monitor.php index 4406652e66..a89f4a8697 100644 --- a/pandora_console/operation/agentes/status_monitor.php +++ b/pandora_console/operation/agentes/status_monitor.php @@ -97,7 +97,8 @@ $sql = " FROM tagente, tagente_modulo, tagente_estado // Agent group selector if ($ag_group > 0 && give_acl ($config["id_user"], $ag_group, "AR")) { $sql .= sprintf (" AND tagente.id_grupo = %d", $ag_group); -} else { +} +else { // User has explicit permission on group 1 ? $sql .= " AND tagente.id_grupo IN (".$user_groups.")"; } @@ -222,13 +223,17 @@ foreach ($result as $row) { if($row['utimestamp'] == 0 && (($row['module_type'] < 21 || $row['module_type'] > 23) && $row['module_type'] != 100)){ $data[5] = print_status_image(STATUS_MODULE_NO_DATA, __('NOT INIT'), true); - } elseif ($row["estado"] == 0) { + } + elseif ($row["estado"] == 0) { $data[5] = print_status_image(STATUS_MODULE_OK, __('NORMAL').": ".$row["datos"], true); - } elseif ($row["estado"] == 1) { + } + elseif ($row["estado"] == 1) { $data[5] = print_status_image(STATUS_MODULE_CRITICAL, __('CRITICAL').": ".$row["datos"], true); - } elseif ($row["estado"] == 2) { + } + elseif ($row["estado"] == 2) { $data[5] = print_status_image(STATUS_MODULE_WARNING, __('WARNING').": ".$row["datos"], true); - } else { + } + else { $last_status = get_agentmodule_last_status($row['id_agente_modulo']); switch($last_status) { case 0: diff --git a/pandora_console/operation/events/events.php b/pandora_console/operation/events/events.php index a3cad0faf5..b36e0cd4b7 100644 --- a/pandora_console/operation/events/events.php +++ b/pandora_console/operation/events/events.php @@ -218,7 +218,7 @@ else { echo ""; } -if($section == 'validate' && $ids[0] == -1){ +if (($section == 'validate') && ($ids[0] == -1)) { $section = 'list'; print_error_message (__('No events selected')); }