diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index 09c59854aa..678591d308 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,21 @@ +2009-03-25 Evi Vanoost + + * include/functions_db.php: Made get_server_info more informational + + * operation/servers/view_server.php: Uses new get_server_info layout + + * operation/agentes/tactical.php: Use print_table and get_server_info + + * operation/menu.php: Removed incident search + + * operation/incidents/incident_search.php: Removed - now sits in incident + + * operation/incidents/incident.php: Added more search capabilities + + * operation/visual_console/index.php: Relative width and alignment + + * operation/visual_console/render_view.php: Small fixes + 2009-03-25 Sancho Lerena * extras/pandoradb_migrate_v2.x_to_v3.0.sql: Added field missing in diff --git a/pandora_console/include/functions_db.php b/pandora_console/include/functions_db.php index 35f23409a4..c9e25bc93a 100644 --- a/pandora_console/include/functions_db.php +++ b/pandora_console/include/functions_db.php @@ -2628,32 +2628,51 @@ function get_server_info ($id_server = -1) { $return = array (); foreach ($result as $server) { - if ($server["network_server"] == 1) { + if ($server['network_server'] == 1) { + $server["img"] = print_image ("images/network.png", true, array ("title" => __('Network Server'))); $server["type"] = "network"; $id_modulo = 2; - } elseif ($server["data_server"] == 1) { + } elseif ($server['data_server'] == 1) { + $server["img"] = print_image ("images/data.png", true, array ("title" => __('Data Server'))); $server["type"] = "data"; $id_modulo = 1; - } elseif ($server["plugin_server"] == 1) { - $server["type"] = "plugin"; - $id_modulo = 4; - } elseif ($server["wmi_server"] == 1) { - $server["type"] = "wmi"; - $id_modulo = 6; - } elseif ($server["recon_server"] == 1) { - $server["type"] = "recon"; - $id_modulo = 0; - } elseif ($server["snmp_server"] == 1) { + } elseif ($server['snmp_server'] == 1) { + $server["img"] = print_image ("images/snmp.png", true, array ("title" => __('SNMP Server'))); $server["type"] = "snmp"; $id_modulo = 0; - } elseif ($server["prediction_server"] == 1) { + } elseif ($server['recon_server'] == 1) { + $server["img"] = print_image ("images/recon.png", true, array ("title" => __('Recon Server'))); + $server["type"] = "recon"; + $id_modulo = 0; + } elseif ($server['export_server'] == 1) { + $server["img"] = print_image ("images/database_refresh.png", true, array ("title" => __('Export Server'))); + $server["type"] = "export"; + $id_modulo = 0; + } elseif ($server['wmi_server'] == 1) { + $server["img"] = print_image ("images/wmi.png", true, array ("title" => __('WMI Server'))); + $server["type"] = "wmi"; + $id_modulo = 6; + } elseif ($server['prediction_server'] == 1) { + $server["img"] = print_image ("images/chart_bar.png", true, array ("title" => __('Prediction Server'))); $server["type"] = "prediction"; $id_modulo = 5; + } elseif ($server['plugin_server'] == 1) { + $server["img"] = print_image ("images/plugin.png", true, array ("title" => __('Plugin Server'))); + $server["type"] = "plugin"; + $id_modulo = 4; } else { + $server["img"] = ''; $server["type"] = "unknown"; $id_modulo = 0; } + if ($server['master'] == 1) { + $server["img"] .= print_image ("images/master.png", true, array ("title" => __('Master Server'))); + } + if ($server['checksum'] == 1){ + $server["img"] .= print_image ("images/binary.png", true, array ("title" => __('MD5 Check'))); + } + if (empty ($modules_info[$server["id_server"]])) { $server["modules"] = 0; } else { @@ -2686,25 +2705,30 @@ function get_server_info ($id_server = -1) { if (!empty ($result["module_lag"])) { $server["module_lag"] = $result["module_lag"]; } - - $server["load"] = round ($server["modules"] / $server["modules_total"] * 100); } else { switch ($server["type"]) { case "recon": + $server["name"] = ''.$server["name"].''; + + //Get recon taks info $tasks = get_db_all_rows_sql ("SELECT status, utimestamp FROM trecon_task WHERE id_recon_server = ".$server["id_server"]); if (empty ($tasks)) { $tasks = array (); } - //Jobs running on this recon server + //Total jobs running on this recon server $server["modules"] = count ($tasks); + //Total recon jobs (all servers) $server["modules_total"] = $recon_total; - $server["load"] = round ($server["modules"] / $server["modules_total"] * 100); + //Lag (take average active time of all active tasks) + $server["module_lag"] = 0; $lags = array (); foreach ($tasks as $task) { if ($task["status"] > 0 && $task["status"] <= 100) { $lags[] = $time - $task["utimestamp"]; + //Module lag is actually the number of jobs that is currently running + $server["module_lag"]++; } } if (count ($lags) > 0) { @@ -2715,6 +2739,10 @@ function get_server_info ($id_server = -1) { break; } } + $server["lag_txt"] = ($server["lag"] == 0 ? '-' : human_time_description_raw ($server["lag"])) . " / ". $server["module_lag"]; + if ($server["modules_total"] > 0) { + $server["load"] = round ($server["modules"] / $server["modules_total"] * 100); + } //Push the raw data on the return stack $return[$server["id_server"]] = $server; diff --git a/pandora_console/operation/agentes/tactical.php b/pandora_console/operation/agentes/tactical.php index ac6aaafcbb..bd4fb32694 100644 --- a/pandora_console/operation/agentes/tactical.php +++ b/pandora_console/operation/agentes/tactical.php @@ -155,60 +155,56 @@ echo '
'; // Server information $serverinfo = get_server_info (); -$total_modules = get_agent_modules_count (); $cells = array (); -if ($serverinfo) { - - echo ''; - echo ' - - - '; - echo ' - - - - - '; - - foreach ($serverinfo as $server_id => $server_info) { - $data = array (); - $data[0] = $server_info["name"]; - - if ($server_info["status"] == 0){ - $data[1] = print_image ("images/pixel_red.png", true, array ("width" => 20, "height" => 20)); - } else { - $data[1] = print_image ("images/pixel_green.png", true, array ("width" => 20, "height" => 20)); - } - - if ($server_info["modules"] > 0 && $total_modules > 0) { - $percent = $server_info["modules"] / ($total_modules / 100); - } else { - $percent = 0; - } - $data[2] = print_image ("reporting/fgraph.php?tipo=progress&percent=".$percent."&height=20&width=80", - true, array ("title" => $server_info["modules"]." ".__('of')." ".$total_modules)); - - $data[3] = $server_info["lag"]." / ".$server_info["module_lag"]; - - array_push ($cells, $data); - } - - foreach ($cells as $key => $row) { - //Switch class around - $class = (($key % 2) ? "datos2" : "datos"); - echo ' - - - - - '; - } - echo '
'.__('Tactical server information').'
'.__('Name').''.__('Status').''.__('Load').''.__('Lag').print_help_icon ("serverlag", true).'
'.$row[0].''.$row[1].''.$row[2].''.$row[3].'
'; -} else { - echo '
'.__('There are no servers configured into the database').'
'; +if ($serverinfo === false) { + $serverinfo = array (); } + +$table->class = "databox"; +$table->cellpadding = 4; +$table->cellspacing = 4; +$table->width = "100%"; + +$table->title = __('Tactical server information'); +$table->titlestyle = "background-color:#799E48;"; + +$table->head = array (); +$table->head[0] = __('Name'); +$table->head[1] = __('Status'); +$table->head[2] = __('Load'); +$table->head[3] = __('Lag').' '.print_help_icon ("serverlag", true); +$table->align[1] = 'center'; +$table->align[2] = 'center'; +$table->align[3] = 'right'; + +$table->data = array (); + +foreach ($serverinfo as $server) { + $data = array (); + $data[0] = $server["name"]; + + if ($server["status"] == 0){ + $data[1] = print_image ("images/pixel_red.png", true, array ("width" => 20, "height" => 20)); + } else { + $data[1] = print_image ("images/pixel_green.png", true, array ("width" => 20, "height" => 20)); + } + + $data[2] = print_image ("reporting/fgraph.php?tipo=progress&percent=".$server["load"]."&height=20&width=80", + true, array ("title" => $server["lag_txt"])); + + $data[3] = $server["lag_txt"]; + + array_push ($table->data, $data); +} + +if (!empty ($table->data)) { + print_table ($table); +} else { + echo '
'.__('There are no servers configured in the database').'
'; +} +unset ($table); + print_events_table ("", 10, 570); echo '
'; diff --git a/pandora_console/operation/incidents/incident.php b/pandora_console/operation/incidents/incident.php index 34dc4248be..5385a98da6 100644 --- a/pandora_console/operation/incidents/incident.php +++ b/pandora_console/operation/incidents/incident.php @@ -128,15 +128,15 @@ if ($texto != "") $filter .= sprintf (" AND (titulo LIKE '%%%s%%' OR descripcion LIKE '%%%s%%')", $texto, $texto); $usuario = (string) get_parameter ("usuario", "All"); -if ($usuario != "All") +if ($usuario != "") $filter .= sprintf (" AND id_usuario = '%s'", $usuario); $estado = (int) get_parameter ("estado", -1); -if ($estado != -1) //-1 = All +if ($estado > 0) //-1 = All $filter .= sprintf (" AND estado = %d", $estado); $grupo = (int) get_parameter ("grupo", 1); -if ($grupo != 1) { +if ($grupo > 1) { $filter .= sprintf (" AND id_grupo = %d", $grupo); if (give_acl ($config['id_user'], $grupo, "IM") == 0) { audit_db ($config["id_user"],$config["remote_addr"],"ACL Forbidden","User tried to read incidents from group without access"); @@ -172,21 +172,19 @@ echo '

'.__('Incident management').' > '.__('Manage incidents').'

'.__('Filter').'

'; $fields = get_incidents_status (); -$fields[-1] = __('All incidents'); - -print_select ($fields, "estado", $estado, 'javascript:this.form.submit();', '', '', false, false, false, 'w155'); +print_select ($fields, "estado", $estado, 'javascript:this.form.submit();', __('All incidents'), -1, false, false, false, 'w155'); //Legend echo '

'.__('Status').'

'; +echo '

'.__('Status').'

'; foreach (get_incidents_status () as $id => $str) { print_incidents_status_img ($id); echo ' - ' . $str . '
'; } -echo '

'.__('Priority').'

'; +echo '

'.__('Priority').'

'; foreach (get_incidents_priorities () as $id => $str) { print_incidents_priority_img ($id); echo ' - ' . $str . '
'; @@ -195,25 +193,25 @@ foreach (get_incidents_priorities () as $id => $str) { echo ''; $fields = get_incidents_priorities (); -$fields[-1] = __('All priorities'); -print_select ($fields, "prioridad", $prioridad, 'javascript:this.form.submit();', '','',false,false,false,'w155'); +print_select ($fields, "prioridad", $prioridad, 'javascript:this.form.submit();', __('All priorities'), -1,false,false,false,'w155'); -echo ''; +echo ''; -print_select ($groups, "grupo", $grupo, 'javascript:this.form.submit();','','',false,false,false,'w155'); +print_select (get_users_info (), "usuario", $usuario, 'javascript:this.form.submit();', __('All users'), "", false, false, false, "w155"); -echo ''; +echo ''; + +print_select ($groups, "grupo", $grupo, 'javascript:this.form.submit();', '', '',false,false,false,'w155'); -// Pass search parameters for possible future filter searching by user -print_input_hidden ("usuario", $usuario); -print_input_hidden ("texto", $texto); +echo ''; -echo ""; +print_input_text ('texto', $texto, '', 45); +echo ' '; +print_input_image ("submit", "images/zoom.png", __('Search'), 'padding:0;', false, array ("alt" => __('Search'))); + +echo ""; +echo ''; if ($count < 1) { echo '
'.__('No incidents match your search filter').'

'; @@ -240,7 +238,7 @@ if ($count < 1) { echo '
'; // Show headers - $table->width = 750; + $table->width = "100%"; $table->class = "databox"; $table->cellpadding = 4; $table->cellspacing = 4; diff --git a/pandora_console/operation/incidents/incident_search.php b/pandora_console/operation/incidents/incident_search.php deleted file mode 100644 index 8698bcfd9e..0000000000 --- a/pandora_console/operation/incidents/incident_search.php +++ /dev/null @@ -1,51 +0,0 @@ -".__('Incident management')." > ".__('Please select a search criterion').""; -echo '
-
- - - -
'.__('Created by:').''; - -print_select (get_users_info (), "usuario", "All", '', __('All'), "All", false, false, false, "w120"); - -echo '
'.__('Search text').': (*)'; - -print_input_text ('texto', '', '', 45); - -echo '
'.__('(*) The text search will look for all words entered as a substring in the title and description of each incident').' -
'; - -print_submit_button (__('Search'), 'uptbutton', false, 'class="sub search"'); - -echo '
'; -?> diff --git a/pandora_console/operation/menu.php b/pandora_console/operation/menu.php index e5773b2ff7..732df27862 100644 --- a/pandora_console/operation/menu.php +++ b/pandora_console/operation/menu.php @@ -102,9 +102,7 @@ if (give_acl ($config['id_user'], 0, "IR") == 1) { $menu["incidencias"]["refr"] = 60; $menu["incidencias"]["id"] = "oper-incidents"; - $sub = array (); - $sub["operation/incidents/incident_search"]["text"] = __('Search incidents'); - + $sub = array (); $sub["operation/incidents/incident_statistics"]["text"] = __('Statistics'); $menu["incidencias"]["sub"] = $sub; diff --git a/pandora_console/operation/servers/view_server.php b/pandora_console/operation/servers/view_server.php index 9651021f61..a09ce98e07 100644 --- a/pandora_console/operation/servers/view_server.php +++ b/pandora_console/operation/servers/view_server.php @@ -62,12 +62,8 @@ $table->data = array (); foreach ($servers as $server) { $data = array (); - if ($server["recon_server"] == 1) { - $data[0] = ''.$server["name"].''; - } else { - $data[0] = "".$server['name'].""; - } - + $data[0] = "".$server['name'].""; + if ($server['status'] == 0) { $data[1] = print_image ("images/pixel_red.png", true, array ("width" => 20, "height" => 20)); } else { @@ -75,41 +71,10 @@ foreach ($servers as $server) { } // Load - $data[2] = print_image ("reporting/fgraph.php?tipo=progress&percent=".$server["load"]."&height=20&width=80", true); + $data[2] = print_image ("reporting/fgraph.php?tipo=progress&percent=".$server["load"]."&height=20&width=80", true, array ("title" => $server["lag_txt"])); $data[3] = $server["modules"] . " ".__('of')." ". $server["modules_total"]; - $data[4] = ''.($server["lag"] == 0 ? '-' : human_time_description_raw ($server["lag"])) . " / ". $server["module_lag"].''; - $data[5] = ''; - if ($server['network_server'] == 1) { - $data[5] .= print_image ("images/network.png", true, array ("title" => __('Network Server'))); - } - if ($server['data_server'] == 1) { - $data[5] .= print_image ("images/data.png", true, array ("title" => __('Data Server'))); - } - if ($server['snmp_server'] == 1) { - $data[5] .= print_image ("images/snmp.png", true, array ("title" => __('SNMP Server'))); - } - if ($server['recon_server'] == 1) { - $data[5] .= print_image ("images/recon.png", true, array ("title" => __('Recon Server'))); - } - if ($server['export_server'] == 1) { - $data[5] .= print_image ("images/database_refresh.png", true, array ("title" => __('Export Server'))); - } - if ($server['wmi_server'] == 1) { - $data[5] .= print_image ("images/wmi.png", true, array ("title" => __('WMI Server'))); - } - if ($server['prediction_server'] == 1) { - $data[5] .= print_image ("images/chart_bar.png", true, array ("title" => __('Prediction Server'))); - } - if ($server['plugin_server'] == 1) { - $data[5] .= print_image ("images/plugin.png", true, array ("title" => __('Plugin Server'))); - } - if ($server['master'] == 1) { - $data[5] .= print_image ("images/master.png", true, array ("title" => __('Master Server'))); - } - if ($server['checksum'] == 1){ - $data[5] .= print_image ("images/binary.png", true, array ("title" => __('MD5 Check'))); - } - $data[5] .= ''; + $data[4] = ''.$server["lag_txt"].''; + $data[5] = ''.$server["img"].''; $data[6] = $server['version']; $data[7] = print_timestamp ($server['keepalive'], true); diff --git a/pandora_console/operation/visual_console/index.php b/pandora_console/operation/visual_console/index.php index e1e63b1213..a4826b6f8b 100644 --- a/pandora_console/operation/visual_console/index.php +++ b/pandora_console/operation/visual_console/index.php @@ -24,13 +24,14 @@ echo "

".__('Visual console')." > ".__('Summary')."

"; require_once ('include/functions_visual_map.php'); $layouts = get_user_layouts (); -$table->width = 500; +$table->width = "70%"; $table->data = array (); $table->head = array (); $table->head[0] = __('Name'); $table->head[1] = __('Group'); $table->head[2] = __('Elements'); $table->align = array (); +$table->align[1] = 'center'; $table->align[2] = 'center'; foreach ($layouts as $layout) { diff --git a/pandora_console/operation/visual_console/render_view.php b/pandora_console/operation/visual_console/render_view.php index 11c85e0865..f51622776a 100644 --- a/pandora_console/operation/visual_console/render_view.php +++ b/pandora_console/operation/visual_console/render_view.php @@ -67,20 +67,20 @@ if ($config["pure"] == 0) { } if (give_acl ($config["id_user"], $id_group, "AW")) - echo ""; + echo ''.print_image ("images/setup.png", true, array ("title" => __('Setup'))).''; echo ''; print_pandora_visual_map ($id_layout); $values = array (); -$values[5] = "5 ". __('seconds'); -$values[30] = "30 ". __('seconds'); -$values[60] = "1 ". __('minutes'); -$values[120] = "2 ". __('minutes'); -$values[300] = "5 ". __('minutes'); -$values[600] = "10 ". __('minutes'); -$values[1800] = "30 ". __('minutes'); +$values[5] = human_time_description_raw (5); +$values[30] = human_time_description_raw (30); +$values[60] = human_time_description_raw (60); +$values[120] = human_time_description_raw (120); +$values[300] = human_time_description_raw (300); +$values[600] = human_time_description_raw (600); +$values[1800] = human_time_description_raw (1800); $table->width = 500; $table->data = array ();