From 550204aed65e245859515ddb06a8e924e69097bc Mon Sep 17 00:00:00 2001 From: zarzuelo Date: Tue, 19 Jul 2011 09:28:09 +0000 Subject: [PATCH] 2011-07-19 Sergio Martin * include/functions_graph.php include/graphs/functions_fsgraph.php include/graphs/fgraph.php include/functions_reporting.php include/pandora_graph.php include/functions_visual_map.php include/ajax/visual_console_builder.ajax.php include/config_process.php include/functions_custom_graphs.php include/fgraph.php include/functions_fsgraph.php operation/incidents/incident_statistics.php operation/agentes/estado_generalagente.php operation/agentes/graphs.php operation/agentes/tactical.php operation/agentes/stat_win.php operation/servers/view_server.php operation/servers/view_server_detail.php operation/integria_incidents/incident_statistics.php operation/events/event_statistics.php operation/events/events_list.php operation/reporting/reporting_xml.php mobile/operation/agents/view_agents.php mobile/operation/agents/tactical.php general/logon_ok.php godmode/admin_access_logs.php godmode/db/db_info.php godmode/db/db_purge.php godmode/reporting/graph_builder.preview.php: Delete old graphic engine functions and rename the new ones to the final name (delete '2' suffix) git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4585 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_console/ChangeLog | 33 + pandora_console/general/logon_ok.php | 6 +- pandora_console/godmode/admin_access_logs.php | 2 +- pandora_console/godmode/db/db_info.php | 11 +- pandora_console/godmode/db/db_purge.php | 2 +- .../reporting/graph_builder.preview.php | 2 +- .../ajax/visual_console_builder.ajax.php | 2 +- pandora_console/include/config_process.php | 3 +- pandora_console/include/fgraph.php | 2641 ----------------- .../include/functions_custom_graphs.php | 7 +- pandora_console/include/functions_fsgraph.php | 370 --- pandora_console/include/functions_graph.php | 112 +- .../include/functions_reporting.php | 9 +- .../include/functions_visual_map.php | 12 +- pandora_console/include/graphs/fgraph.php | 2 +- .../include/graphs/functions_fsgraph.php | 28 +- pandora_console/include/pandora_graph.php | 99 - .../mobile/operation/agents/tactical.php | 10 +- .../mobile/operation/agents/view_agents.php | 4 +- .../agentes/estado_generalagente.php | 8 +- pandora_console/operation/agentes/graphs.php | 2 +- .../operation/agentes/stat_win.php | 10 +- .../operation/agentes/tactical.php | 10 +- .../operation/events/event_statistics.php | 6 +- .../operation/events/events_list.php | 2 +- .../incidents/incident_statistics.php | 10 +- .../incident_statistics.php | 10 +- .../operation/reporting/reporting_xml.php | 6 +- .../operation/servers/view_server.php | 2 +- .../operation/servers/view_server_detail.php | 2 +- 30 files changed, 171 insertions(+), 3252 deletions(-) delete mode 100644 pandora_console/include/fgraph.php delete mode 100644 pandora_console/include/functions_fsgraph.php delete mode 100644 pandora_console/include/pandora_graph.php diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index 9292aa2106..f9b7f702f9 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,36 @@ +2011-07-19 Sergio Martin + + * include/functions_graph.php + include/graphs/functions_fsgraph.php + include/graphs/fgraph.php + include/functions_reporting.php + include/pandora_graph.php + include/functions_visual_map.php + include/ajax/visual_console_builder.ajax.php + include/config_process.php + include/functions_custom_graphs.php + include/fgraph.php + include/functions_fsgraph.php + operation/incidents/incident_statistics.php + operation/agentes/estado_generalagente.php + operation/agentes/graphs.php + operation/agentes/tactical.php + operation/agentes/stat_win.php + operation/servers/view_server.php + operation/servers/view_server_detail.php + operation/integria_incidents/incident_statistics.php + operation/events/event_statistics.php + operation/events/events_list.php + operation/reporting/reporting_xml.php + mobile/operation/agents/view_agents.php + mobile/operation/agents/tactical.php + general/logon_ok.php + godmode/admin_access_logs.php + godmode/db/db_info.php + godmode/db/db_purge.php + godmode/reporting/graph_builder.preview.php: Delete old graphic engine + functions and rename the new ones to the final name (delete '2' suffix) + 2011-07-18 Sergio Martin * godmode/massive/massive_operations.php: Fixed acl last fix diff --git a/pandora_console/general/logon_ok.php b/pandora_console/general/logon_ok.php index 07f2004b13..4d9ebb9e0c 100644 --- a/pandora_console/general/logon_ok.php +++ b/pandora_console/general/logon_ok.php @@ -78,13 +78,13 @@ $table->width = "100%"; $table->data[0][0] =''.__('Monitor health').''; $table->data[1][0] = - progress_bar2($data["monitor_health"], 280, 20, $data["monitor_health"].'% '.__('of monitors up'), 0); + progress_bar($data["monitor_health"], 280, 20, $data["monitor_health"].'% '.__('of monitors up'), 0); $table->data[2][0] = ''.__('Module sanity').''; $table->data[3][0] = - progress_bar2($data["module_sanity"], 280, 20, $data["module_sanity"].'% '.__('of total modules inited'), 0); + progress_bar($data["module_sanity"], 280, 20, $data["module_sanity"].'% '.__('of total modules inited'), 0); $table->data[4][0] = ''.__('Alert level').''; $table->data[5][0] = - progress_bar2($data["alert_level"], 280, 20, $data["alert_level"].'% '.__('of defined alerts not fired'), 0); + progress_bar($data["alert_level"], 280, 20, $data["alert_level"].'% '.__('of defined alerts not fired'), 0); html_print_table ($table); unset ($table); diff --git a/pandora_console/godmode/admin_access_logs.php b/pandora_console/godmode/admin_access_logs.php index 5a4bd7485f..b091553e21 100644 --- a/pandora_console/godmode/admin_access_logs.php +++ b/pandora_console/godmode/admin_access_logs.php @@ -78,7 +78,7 @@ echo ''; echo ''; echo '
'; -echo graphic_user_activity2(300, 140); +echo graphic_user_activity(300, 140); echo '
'; echo '
 
'; diff --git a/pandora_console/godmode/db/db_info.php b/pandora_console/godmode/db/db_info.php index 4c580ce4a7..25940d0c6a 100644 --- a/pandora_console/godmode/db/db_info.php +++ b/pandora_console/godmode/db/db_info.php @@ -18,10 +18,9 @@ // Load global vars global $config; -require_once ($config["homedir"] . '/include/functions_graph.php'); -require_once($config['homedir'] . "/include/functions_agents.php"); -require_once($config['homedir'] . "/include/functions_modules.php"); -require_once($config['homedir'] . "/include/functions_fsgraph.php"); +require_once ($config['homedir'] . '/include/functions_graph.php'); +require_once($config['homedir'] . '/include/functions_agents.php'); +require_once($config['homedir'] . '/include/functions_modules.php'); ui_print_page_header (__('Database maintenance').' » '.__('Database information'), "images/god8.png", false, "", true); @@ -43,7 +42,7 @@ if (! check_acl ($config['id_user'], 0, "DM")) { - A more powerful selection (by Agent, by Module, etc). */ -echo grafico_db_agentes_purge2(0, 600, 400); +echo grafico_db_agentes_purge(0, 600, 400); echo '
'; echo ''; @@ -56,7 +55,7 @@ echo ''; echo '

'; echo '

'.__('Packets per agent').'

'; -echo grafico_db_agentes_paquetes2(700, 300); +echo grafico_db_agentes_paquetes(700, 300); echo '
'; echo ''.__('Press here to get database information as text').' ' . html_print_image("images/down.png", true, array("alt" => "down", "title" => "down")) . '
'; diff --git a/pandora_console/godmode/db/db_purge.php b/pandora_console/godmode/db/db_purge.php index 7d4f20828b..3d38d6ed35 100644 --- a/pandora_console/godmode/db/db_purge.php +++ b/pandora_console/godmode/db/db_purge.php @@ -36,7 +36,7 @@ $id_agent = (int) get_parameter_post ("agent", -1); ui_print_page_header (__('Database maintenance').' » '.__('Database purge'), "images/god8.png", false, "", true); -echo grafico_db_agentes_purge2($id_agent); +echo grafico_db_agentes_purge($id_agent); echo '

'; echo '

'.__('Get data from agent').'

'; diff --git a/pandora_console/godmode/reporting/graph_builder.preview.php b/pandora_console/godmode/reporting/graph_builder.preview.php index 643e3ca1c6..f650000461 100644 --- a/pandora_console/godmode/reporting/graph_builder.preview.php +++ b/pandora_console/godmode/reporting/graph_builder.preview.php @@ -139,7 +139,7 @@ echo ""; if(!empty($modules)) { require_once ($config["homedir"] . '/include/functions_graph.php'); - echo graphic_combined_module2(explode (',', $modules), explode (',', $weights), $period, $width, $height, + echo graphic_combined_module(explode (',', $modules), explode (',', $weights), $period, $width, $height, 'Combined%20Sample%20Graph', '', $events, 0, 0, $stacked, $unixdate); } else { diff --git a/pandora_console/include/ajax/visual_console_builder.ajax.php b/pandora_console/include/ajax/visual_console_builder.ajax.php index 3e32aa4f2d..b913d627d1 100644 --- a/pandora_console/include/ajax/visual_console_builder.ajax.php +++ b/pandora_console/include/ajax/visual_console_builder.ajax.php @@ -69,7 +69,7 @@ switch ($action) { echo json_encode($return); break; case 'get_image_sparse': - $img = grafico_modulo_sparse2($id_agent_module, + $img = grafico_modulo_sparse($id_agent_module, $period, false, $width, $height, '', null, false, 0, false, 0, '', 0, 0, true, true); diff --git a/pandora_console/include/config_process.php b/pandora_console/include/config_process.php index a95d88bf83..2f72a220f0 100644 --- a/pandora_console/include/config_process.php +++ b/pandora_console/include/config_process.php @@ -28,6 +28,8 @@ $pandora_version = 'v4.0dev'; /* Help to debug problems. Override global PHP configuration */ if (!isset($develop_bypass)) $develop_bypass = 0; +$develop_bypass = 1; + if ($develop_bypass != 1) { // error_reporting(E_ALL); @@ -156,7 +158,6 @@ db_connect(); // Function include_graphs_dependencies() it's called in the code below require_once("include_graph_dependencies.php"); -//require_once("include/fgraph.php"); include_graphs_dependencies($config['homedir'].'/'); ?> diff --git a/pandora_console/include/fgraph.php b/pandora_console/include/fgraph.php deleted file mode 100644 index 8aa1b96f34..0000000000 --- a/pandora_console/include/fgraph.php +++ /dev/null @@ -1,2641 +0,0 @@ -getIdUser(); - } - } -} - -//Fixed the graph for cron (that it's login) -if (($_SERVER['SERVER_ADDR'] != $_SERVER['REMOTE_ADDR']) - && ($_SERVER['REMOTE_ADDR'] != '127.0.0.1')) { - // Session check - check_login (); -} - -/** - * Show a brief error message in a PNG graph - * - * @param string image File that show when has a problem. - */ -function graphic_error ($image = 'image_problem.opaque.png') { - global $config; - - Header ('Content-type: image/png'); - - $image_file = $config['homedir'].'/images/'.$image; - - $img = imagecreatefromPng ($image_file); - - //imagealphablending ($img, true); - //imagesavealpha ($img, true); - imagepng ($img); - exit; -} - -/** - * Return a MySQL timestamp date, formatted with actual date MINUS X minutes, - * - * @param int Date in unix format (timestamp) - * - * @return string Formatted date string (YY-MM-DD hh:mm:ss) - */ -function dame_fecha ($mh) { - $mh *= 60; - return date ("Y-m-d H:i:00", time() - $mh); -} - -/** - * Return a short timestamp data, D/M h:m - * - * @param int Date in unix format (timestamp) - * - * @return string Formatted date string - */ -function dame_fecha_grafico_timestamp ($timestamp) { - return date ('d/m H:i', $timestamp); -} - -/** - * Produces a combined/user defined PNG graph - * - * @param array List of source modules - * @param array List of weighs for each module - * @param int Period (in seconds) - * @param int Width, in pixels - * @param int Height, in pixels - * @param string Title for graph - * @param string Unit name, for render in legend - * @param int Show events in graph (set to 1) - * @param int Show alerts in graph (set to 1) - * @param int Pure mode (without titles) (set to 1) - * @param int Date to start of getting info. - * - * @return Mixed - */ -function graphic_combined_module ($module_list, $weight_list, $period, $width, $height, - $title, $unit_name, $show_events = 0, $show_alerts = 0, $pure = 0, $stacked = 0, $date = 0) { - global $config; - global $graphic_type; - - // Set variables - if ($date == 0) $date = get_system_time(); - $datelimit = $date - $period; - $resolution = $config['graph_res'] * 50; //Number of points of the graph - $interval = (int) ($period / $resolution); - $module_number = count ($module_list); - - // interval - This is the number of "rows" we are divided the time to fill data. - // more interval, more resolution, and slower. - // periodo - Gap of time, in seconds. This is now to (now-periodo) secs - - // Init weights - for ($i = 0; $i < $module_number; $i++) { - if (! isset ($weight_list[$i])) { - $weight_list[$i] = 1; - } else if ($weight_list[$i] == 0) { - $weight_list[$i] = 1; - } - } - - // Set data containers - for ($i = 0; $i < $resolution; $i++) { - $timestamp = $datelimit + ($interval * $i); - - $graph[$timestamp]['count'] = 0; - $graph[$timestamp]['timestamp_bottom'] = $timestamp; - $graph[$timestamp]['timestamp_top'] = $timestamp + $interval; - $graph[$timestamp]['min'] = 0; - $graph[$timestamp]['max'] = 0; - $graph[$timestamp]['event'] = 0; - $graph[$timestamp]['alert'] = 0; - } - - // Calculate data for each module - for ($i = 0; $i < $module_number; $i++) { - - $agent_module_id = $module_list[$i]; - $agent_name = modules_get_agentmodule_agent_name ($agent_module_id); - $agent_id = agents_get_agent_id ($agent_name); - $module_name = modules_get_agentmodule_name ($agent_module_id); - $module_name_list[$i] = $agent_name." / ".substr ($module_name, 0, 40); - $id_module_type = modules_get_agentmodule_type ($agent_module_id); - $module_type = modules_get_moduletype_name ($id_module_type); - $uncompressed_module = is_module_uncompressed ($module_type); - if ($uncompressed_module) { - $avg_only = 1; - } - - // Get event data (contains alert data too) - if ($show_events == 1 || $show_alerts == 1) { - $events = db_get_all_rows_filter ('tevento', - array ('id_agentmodule' => $agent_module_id, - "utimestamp > $datelimit", - "utimestamp < $date", - 'order' => 'utimestamp ASC'), - array ('evento', 'utimestamp', 'event_type')); - if ($events === false) { - $events = array (); - } - } - - // Get module data - $data = db_get_all_rows_filter ('tagente_datos', - array ('id_agente_modulo' => $agent_module_id, - "utimestamp > $datelimit", - "utimestamp < $date", - 'order' => 'utimestamp ASC'), - array ('datos', 'utimestamp')); - if ($data === false) { - $data = array (); - } - - // Uncompressed module data - if ($uncompressed_module) { - $min_necessary = 1; - - // Compressed module data - } else { - // Get previous data - $previous_data = modules_get_previous_data ($agent_module_id, $datelimit); - if ($previous_data !== false) { - $previous_data['utimestamp'] = $datelimit; - array_unshift ($data, $previous_data); - } - - // Get next data - $nextData = modules_get_next_data ($agent_module_id, $date); - if ($nextData !== false) { - array_push ($data, $nextData); - } else if (count ($data) > 0) { - // Propagate the last known data to the end of the interval - $nextData = array_pop ($data); - array_push ($data, $nextData); - $nextData['utimestamp'] = $date; - array_push ($data, $nextData); - } - - $min_necessary = 2; - } - - // Set initial conditions - $graph_values[$i] = array(); - - // Check available data - if (count ($data) < $min_necessary) { - continue; - } - - // Data iterator - $j = 0; - - // Event iterator - $k = 0; - - // Set initial conditions - $graph_values[$i] = array(); - if ($data[0]['utimestamp'] == $datelimit) { - $previous_data = $data[0]['datos']; - $j++; - } else { - $previous_data = 0; - } - - // Calculate chart data - for ($l = 0; $l < $resolution; $l++) { - $timestamp = $datelimit + ($interval * $l); - - $total = 0; - $count = 0; - - // Read data that falls in the current interval - $interval_min = $previous_data; - $interval_max = $previous_data; - while (isset ($data[$j]) && $data[$j]['utimestamp'] >= $timestamp && $data[$j]['utimestamp'] < ($timestamp + $interval)) { - if ($data[$j]['datos'] > $interval_max) { - $interval_max = $data[$j]['datos']; - } else if ($data[$j]['datos'] < $interval_max) { - $interval_min = $data[$j]['datos']; - } - $total += $data[$j]['datos']; - $count++; - $j++; - } - - // Average - if ($count > 0) { - $total /= $count; - } - - // Read events and alerts that fall in the current interval - $event_value = 0; - $alert_value = 0; - while (isset ($events[$k]) && $events[$k]['utimestamp'] >= $timestamp && $events[$k]['utimestamp'] <= ($timestamp + $interval)) { - if ($show_events == 1) { - $event_value++; - } - if ($show_alerts == 1 && substr ($events[$k]['event_type'], 0, 5) == 'alert') { - $alert_value++; - } - $k++; - } - - // Data - if ($count > 0) { - $graph_values[$i][$timestamp] = $total * $weight_list[$i]; - $previous_data = $total; - // Compressed data - } else { - if ($uncompressed_module || ($timestamp > time ())) { - $graph_values[$i][$timestamp] = 0; - } else { - $graph_values[$i][$timestamp] = $previous_data * $weight_list[$i]; - } - } - } - } - - for ($i = 0; $i < $module_number; $i++) { - if ($weight_list[$i] != 1) - $module_name_list[$i] .= " (x". format_numeric ($weight_list[$i], 1).")"; - } - - if ($period <= 3600) { - $title_period = __('Last hour'); - $time_format = 'G:i:s'; - } elseif ($period <= 86400) { - $title_period = __('Last day'); - $time_format = 'G:i'; - } elseif ($period <= 604800) { - $title_period = __('Last week'); - $time_format = 'M j'; - } elseif ($period <= 2419200) { - $title_period = __('Last month'); - $time_format = 'M j'; - } else { - $title_period = __('Last %s days', format_numeric (($period / (3600 * 24)), 2)); - $time_format = 'M j'; - } - - if (! $graphic_type) { - ///FLASH - return fs_combined_chart ($graph_values, $graph, $module_name_list, $width, $height, $stacked, $resolution / 10, $time_format); - } - - //IMAGE - $engine = get_graph_engine ($period); - - $engine->width = $width; - $engine->height = $height; - $engine->data = &$graph_values; - $engine->legend = $module_name_list; - $engine->fontpath = $config['fontpath']; - $engine->title = ""; - $engine->subtitle = ""; - $engine->show_title = !$pure; - $engine->stacked = $stacked; - $engine->xaxis_interval = $resolution; - $events = false; - $alerts = false; - if (!isset($max_value)) { - $max_value = 0; - } - $engine->combined_graph ($graph, $events, $alerts, $unit_name, $max_value, $stacked); -} - -/** - * Print a pie graph with module data of agents - * - * @param integer id_agent Agent ID - * @param integer width pie graph width - * @param integer height pie graph height - */ -function graphic_agentmodules ($id_agent, $width, $height) { - global $config; - - $data = array (); - $sql = sprintf ('SELECT ttipo_modulo.nombre, COUNT(id_agente_modulo) - FROM tagente_modulo,ttipo_modulo - WHERE id_tipo_modulo = id_tipo AND id_agente = %d - GROUP BY id_tipo_modulo', $id_agent); - $modules = db_get_all_rows_sql ($sql); - foreach ($modules as $module) { - $data[$module['nombre']] = $module[1]; - } - generic_pie_graph ($width, $height, $data); -} - -/** - * Print a graph with access data of agents - * - * @param integer id_agent Agent ID - * @param integer width pie graph width - * @param integer height pie graph height - * @param integer period time period - */ -function graphic_agentaccess ($id_agent, $width, $height, $period = 0) { - global $config; - global $graphic_type; - - $data = array (); - - $resolution = $config["graph_res"] * ($period * 2 / $width); // Number of "slices" we want in graph - - $interval = (int) ($period / $resolution); - $date = get_system_time (); - $datelimit = $date - $period; - $periodtime = floor ($period / $interval); - $time = array (); - $data = array (); - - for ($i = 0; $i < $interval; $i++) { - $bottom = $datelimit + ($periodtime * $i); - if (! $graphic_type) { - $name = date('G:i', $bottom); - } else { - $name = $bottom; - } - - $top = $datelimit + ($periodtime * ($i + 1)); - switch ($config["dbtype"]) { - case "mysql": - case "postgresql": - $data[$name] = (int) db_get_value_filter ('COUNT(*)', - 'tagent_access', - array ('id_agent' => $id_agent, - 'utimestamp > '.$bottom, - 'utimestamp < '.$top)); - break; - case "oracle": - $data[$name] = (int) db_get_value_filter ('count(*)', - 'tagent_access', - array ('id_agent' => $id_agent, - 'utimestamp > '.$bottom, - 'utimestamp < '.$top)); - break; - } - } - - if (! $graphic_type) { - return fs_2d_area_chart ($data, $width, $height, $resolution / 1000, ';decimalPrecision=0'); - } - - $engine = get_graph_engine ($period); - - $engine->width = $width; - $engine->height = $height; - $engine->data = $data; - $engine->max_value = max ($data); - $engine->show_title = false; - $engine->fontpath = $config['fontpath']; - $engine->xaxis_interval = floor ($width / 72); - $engine->xaxis_format = 'date'; - $engine->watermark = false; - $engine->show_grid = false; - - $engine->single_graph (); -} - -/** - * Print a graph with event data of agents - * - * @param integer id_agent Agent ID - * @param integer width pie graph width - * @param integer height pie graph height - * @param integer period time period - */ -function graphic_agentevents ($id_agent, $width, $height, $period = 0) { - global $config; - global $graphic_type; - - $data = array (); - - $resolution = $config['graph_res'] * ($period * 2 / $width); // Number of "slices" we want in graph - - $interval = (int) ($period / $resolution); - $date = get_system_time (); - $datelimit = $date - $period; - $periodtime = floor ($period / $interval); - $time = array (); - $data = array (); - - for ($i = 0; $i < $interval; $i++) { - $bottom = $datelimit + ($periodtime * $i); - if (! $graphic_type) { - $name = date('H\h', $bottom); - } else { - $name = $bottom; - } - - $top = $datelimit + ($periodtime * ($i + 1)); - $criticity = (int) db_get_value_filter ('criticity', - 'tevento', - array ('id_agente' => $id_agent, - 'utimestamp > '.$bottom, - 'utimestamp < '.$top)); - - switch ($criticity) { - case 3: $data[$name] = 'E5DF63'; - break; - case 4: $data[$name] = 'FF3C4B'; - break; - default: $data[$name] = '9ABD18'; - } - - } - - if (! $graphic_type) { - return fs_agent_event_chart ($data, $width, $height, $resolution / 750); - } -} - -/** - * Print a pie graph with incidents data - */ -function graph_incidents_status () { - global $config; - global $graphic_type; - $data = array (0, 0, 0, 0); - - $data = array (); - $data[__('Open incident')] = 0; - $data[__('Closed incident')] = 0; - $data[__('Outdated')] = 0; - $data[__('Invalid')] = 0; - - $incidents = db_get_all_rows_filter ('tincidencia', - array ('estado' => array (0, 2, 3, 13)), - array ('estado')); - if ($incidents === false) - $incidents = array (); - foreach ($incidents as $incident) { - if ($incident["estado"] == 0) - $data[__("Open incident")]++; - if ($incident["estado"] == 2) - $data[__("Closed incident")]++; - if ($incident["estado"] == 3) - $data[__("Outdated")]++; - if ($incident["estado"] == 13) - $data[__("Invalid")]++; - } - - if (! $graphic_type) { - return fs_3d_pie_chart ($data, 370, 180); - } - - generic_pie_graph (370, 180, $data); -} - -/** - * Print a pie graph with priodity incident - */ -function grafico_incidente_prioridad () { - global $config; - global $graphic_type; - - $data_tmp = array (0, 0, 0, 0, 0, 0); - $sql = 'SELECT COUNT(id_incidencia) n_incidents, prioridad - FROM tincidencia - GROUP BY prioridad - ORDER BY 2 DESC'; - $incidents = db_get_all_rows_sql ($sql); - - if($incidents == false) { - $incidents = array(); - } - foreach ($incidents as $incident) { - if ($incident['prioridad'] < 5) - $data_tmp[$incident['prioridad']] = $incident['n_incidents']; - else - $data_tmp[5] += $incident['n_incidents']; - } - $data = array (__('Informative') => $data_tmp[0], - __('Low') => $data_tmp[1], - __('Medium') => $data_tmp[2], - __('Serious') => $data_tmp[3], - __('Very serious') => $data_tmp[4], - __('Maintenance') => $data_tmp[5]); - - if (! $graphic_type) { - return fs_3d_pie_chart ($data, 320, 200); - } - - generic_pie_graph (320, 200, $data); -} - -/** - * Print a pie graph with incident data by group - */ -function graphic_incident_group () { - global $config; - global $graphic_type; - - $data = array (); - $max_items = 5; - $sql = sprintf ('SELECT COUNT(id_incidencia) n_incidents, nombre - FROM tincidencia,tgrupo - WHERE tgrupo.id_grupo = tincidencia.id_grupo - GROUP BY tgrupo.id_grupo ORDER BY 1 DESC LIMIT %d', - $max_items); - $incidents = db_get_all_rows_sql ($sql); - - if($incidents == false) { - $incidents = array(); - } - foreach ($incidents as $incident) { - $data[$incident['nombre']] = $incident['n_incidents']; - } - - if (! $graphic_type) { - return fs_3d_pie_chart ($data, 320, 200); - } - - generic_pie_graph (320, 200, $data); -} - -/** - * Print a graph with access data of agents - * - * @param integer id_agent Agent ID - * @param integer width pie graph width - * @param integer height pie graph height - * @param integer period time period - */ -function graphic_incident_user () { - global $config; - global $graphic_type; - - $data = array (); - $max_items = 5; - $sql = sprintf ('SELECT COUNT(id_incidencia) n_incidents, id_usuario - FROM tincidencia - GROUP BY id_usuario - ORDER BY 1 DESC LIMIT %d', $max_items); - $incidents = db_get_all_rows_sql ($sql); - - if($incidents == false) { - $incidents = array(); - } - foreach ($incidents as $incident) { - if($incident['id_usuario'] == false) { - $name = __('System'); - } - else { - $name = $incident['id_usuario']; - } - - $data[$name] = $incident['n_incidents']; - } - - if (! $graphic_type) { - return fs_3d_pie_chart ($data, 320, 200); - } - - generic_pie_graph (320, 200, $data); -} - -/** - * Print a pie graph with users activity in a period of time - * - * @param integer width pie graph width - * @param integer height pie graph height - * @param integer period time period - */ -function graphic_user_activity ($width = 350, $height = 230) { - global $config; - global $graphic_type; - - $data = array (); - $max_items = 5; - switch ($config['dbtype']) { - case "mysql": - case "postgresql": - $sql = sprintf ('SELECT COUNT(id_usuario) n_incidents, id_usuario - FROM tsesion - GROUP BY id_usuario - ORDER BY 1 DESC LIMIT %d', $max_items); - break; - case "oracle": - $sql = sprintf ('SELECT COUNT(id_usuario) n_incidents, id_usuario - FROM tsesion - WHERE rownum <= %d - GROUP BY id_usuario - ORDER BY 1 DESC', $max_items); - break; - } - $logins = db_get_all_rows_sql ($sql); - - if($logins == false) { - $logins = array(); - } - foreach ($logins as $login) { - $data[$login['id_usuario']] = $login['n_incidents']; - } - - if (! $graphic_type) { - return fs_3d_pie_chart ($data, $width, $height); - } - - generic_pie_graph ($width, $height, $data); -} - -/** - * Print a pie graph with access data of incidents source - * - * @param integer width pie graph width - * @param integer height pie graph height - */ -function graphic_incident_source ($width = 320, $height = 200) { - global $config; - global $graphic_type; - - $data = array (); - $max_items = 5; - - switch ($config["dbtype"]) { - case "mysql": - $sql = sprintf ('SELECT COUNT(id_incidencia) n_incident, origen - FROM tincidencia GROUP BY `origen` - ORDER BY 1 DESC LIMIT %d', $max_items); - break; - case "postgresql": - $sql = sprintf ('SELECT COUNT(id_incidencia) n_incident, origen - FROM tincidencia GROUP BY "origen" - ORDER BY 1 DESC LIMIT %d', $max_items); - break; - case "oracle": - $sql = sprintf ('SELECT COUNT(id_incidencia) n_incident, origen - FROM tincidencia WHERE rownum <= %d GROUP BY origen - ORDER BY 1 DESC', $max_items); - break; - } - $origins = db_get_all_rows_sql ($sql); - - if($origins == false) { - $origins = array(); - } - foreach ($origins as $origin) { - $data[$origin['origen']] = $origin['n_incident']; - } - - if (! $graphic_type) { - return fs_3d_pie_chart ($data, $width, $height); - } - - generic_pie_graph ($width, $height, $data); -} - -/** - * Print a horizontal bar graph with modules data of agents - * - * @param integer height graph height - * @param integer width graph width - */ -function graph_db_agentes_modulos ($width, $height) { - global $config; - global $graphic_type; - - $data = array (); - - switch ($config['dbtype']){ - case "mysql": - case "postgresql": - $modules = db_get_all_rows_sql ('SELECT COUNT(id_agente_modulo), id_agente - FROM tagente_modulo - GROUP BY id_agente - ORDER BY 1 DESC LIMIT 10'); - break; - case "oracle": - $modules = db_get_all_rows_sql ('SELECT COUNT(id_agente_modulo), id_agente - FROM tagente_modulo - WHERE rownum <= 10 - GROUP BY id_agente - ORDER BY 1 DESC'); - break; - } - if ($modules === false) - $modules = array (); - - foreach ($modules as $module) { - $agent_name = agents_get_name ($module['id_agente'], "none"); - switch ($config['dbtype']){ - case "mysql": - case "postgresql": - $data[$agent_name] = $module['COUNT(id_agente_modulo)']; - break; - case "oracle": - $data[$agent_name] = $module['count(id_agente_modulo)']; - break; - } - } - - if (! $graphic_type) { - return fs_3d_bar_chart ($data, $width, $height); - } - - generic_horizontal_bar_graph ($width, $height, $data); -} - -/** - * Print a pie graph with events data of users - * - * @param integer height pie graph height - * @param integer period time period - */ -function grafico_eventos_usuario ($width, $height) { - global $config; - global $graphic_type; - - $data = array (); - $max_items = 5; - switch ($config["dbtype"]) { - case "mysql": - case "postgresql": - $sql = sprintf ('SELECT COUNT(id_evento) events, id_usuario - FROM tevento - GROUP BY id_usuario - ORDER BY 1 DESC LIMIT %d', $max_items); - break; - case "oracle": - $sql = sprintf ('SELECT * FROM (SELECT COUNT(id_evento) events, id_usuario - FROM tevento - GROUP BY id_usuario - ORDER BY 1 DESC) WHERE rownum <= %d', $max_items); - break; - } - $events = db_get_all_rows_sql ($sql); - - if ($events === false) { - $events = array(); - } - - foreach ($events as $event) { - $data['id_usuario'] = $event['events']; - } - - if (! $graphic_type) { - return fs_3d_pie_chart ($data, $width, $height); - } - - //generic_pie_graph ($width, $height, $data); -} - -/** - * Print a pie graph with events data in 320x200 size - * - * @param string filter Filter for query in DB - */ -function grafico_eventos_total ($filter = "") { - global $config; - global $graphic_type; - - $filter = str_replace ( "\\" , "", $filter); - $data = array (); - $legend = array (); - $total = 0; - - $sql = "SELECT COUNT(id_evento) FROM tevento WHERE criticity = 0 $filter"; - $data[__('Maintenance')] = db_get_sql ($sql); - - $sql = "SELECT COUNT(id_evento) FROM tevento WHERE criticity = 1 $filter"; - $data[__('Informational')] = db_get_sql ($sql); - - $sql = "SELECT COUNT(id_evento) FROM tevento WHERE criticity = 2 $filter"; - $data[__('Normal')] = db_get_sql ($sql); - - $sql = "SELECT COUNT(id_evento) FROM tevento WHERE criticity = 3 $filter"; - $data[__('Warning')] = db_get_sql ($sql); - - $sql = "SELECT COUNT(id_evento) FROM tevento WHERE criticity = 4 $filter"; - $data[__('Critical')] = db_get_sql ($sql); - - asort ($data); - - if (! $graphic_type) { - return fs_3d_pie_chart ($data, 320, 200); - } - - generic_pie_graph (320, 200, $data); -} - -/** - * Print a pie graph with events data of agent - * - * @param integer width pie graph width - * @param integer height pie graph height - * @param integer id_agent Agent ID - */ -function graph_event_module ($width = 300, $height = 200, $id_agent) { - global $config; - global $graphic_type; - - $data = array (); - $max_items = 6; - - switch ($config["dbtype"]) { - case "mysql": - case "postgresql": - $sql = sprintf ('SELECT COUNT(id_evento) as count_number, nombre - FROM tevento, tagente_modulo - WHERE id_agentmodule = id_agente_modulo - AND disabled = 0 AND tevento.id_agente = %d - GROUP BY id_agentmodule LIMIT %d', $id_agent, $max_items); - break; - case "oracle": - $sql = sprintf ('SELECT count_number, nombre FROM (SELECT COUNT(id_evento) as count_number, dbms_lob.substr(nombre,4000,1) as nombre, id_agentmodule - FROM tevento, tagente_modulo - WHERE (id_agentmodule = id_agente_modulo - AND disabled = 0 AND tevento.id_agente = %d) AND rownum <= %d - GROUP BY dbms_lob.substr(nombre,4000,1),id_agentmodule)', $id_agent, $max_items); - break; - } - $events = db_get_all_rows_sql ($sql); - if ($events === false) { - if (! $graphic_type) { - return fs_error_image2 (); - } - graphic_error (); - return; - } - - - foreach ($events as $event) { - $data[$event['nombre'].' ('.$event['count_number'].')'] = $event["count_number"]; - } - - /* System events */ - $sql = "SELECT COUNT(*) FROM tevento WHERE id_agentmodule = 0 AND id_agente = $id_agent"; - $value = db_get_sql ($sql); - if ($value > 0) { - $data[__('System').' ('.$value.')'] = $value; - } - asort ($data); - - // Take only the first $max_items values - if (sizeof ($data) >= $max_items) { - $data = array_slice ($data, 0, $max_items); - } - - if (! $graphic_type) { - return fs_3d_pie_chart ($data, $width, $height); - } - - generic_pie_graph ($width, $height, $data, - array ('zoom' => 75, - 'show_legend' => false)); -} - -/** - * Print a pie graph with events data of group - * - * @param integer width pie graph width - * @param integer height pie graph height - * @param string url - */ -function grafico_eventos_grupo ($width = 300, $height = 200, $url = "") { - global $config; - global $graphic_type; - - $url = html_entity_decode (rawurldecode ($url), ENT_QUOTES); //It was urlencoded, so we urldecode it - $data = array (); - $loop = 0; - define ('NUM_PIECES_PIE', 6); - - $badstrings = array (";", "SELECT ", "DELETE ", "UPDATE ", "INSERT ", "EXEC"); - //remove bad strings from the query so queries like ; DELETE FROM don't pass - $url = str_ireplace ($badstrings, "", $url); - - //This will give the distinct id_agente, give the id_grupo that goes - //with it and then the number of times it occured. GROUP BY statement - //is required if both DISTINCT() and COUNT() are in the statement - switch ($config["dbtype"]) { - case "mysql": - case "postgresql": - $sql = sprintf ('SELECT DISTINCT(id_agente) AS id_agente, id_grupo, COUNT(id_agente) AS count - FROM tevento WHERE 1=1 %s - GROUP BY id_agente ORDER BY count DESC', $url); - break; - case "oracle": - $sql = sprintf ('SELECT DISTINCT(id_agente) AS id_agente, id_grupo, COUNT(id_agente) AS count - FROM tevento WHERE 1=1 %s - GROUP BY id_agente, id_grupo ORDER BY count DESC', $url); - break; - } - - $result = db_get_all_rows_sql ($sql); - if ($result === false) { - $result = array(); - } - - foreach ($result as $row) { - if (!check_acl ($config["id_user"], $row["id_grupo"], "AR") == 1) - continue; - - if ($loop >= NUM_PIECES_PIE) { - if (!isset ($data[__('Other')])) - $data[__('Other')] = 0; - $data[__('Other')] += $row["count"]; - } else { - if ($row["id_agente"] == 0) { - $name = __('SYSTEM')." (".$row["count"].")"; - } else { - $name = mb_substr (agents_get_name ($row["id_agente"], "lower"), 0, 14)." (".$row["count"].")"; - } - $data[$name] = $row["count"]; - } - $loop++; - } - - if (! $graphic_type) { - return fs_3d_pie_chart ($data, $width, $height); - } - - error_reporting (0); - generic_pie_graph ($width, $height, $data, array ('show_legend' => false)); -} - -/** - * Print a single graph with data - * - * @param integer width graph width - * @param integer height graph height - * @param mixed data Data for make the graph - * @param integer interval interval to print - */ -function generic_single_graph ($width = 380, $height = 200, &$data, $interval = 1) { - global $config; - - if (sizeof ($data) == 0) - graphic_error (); - - $engine = get_graph_engine (); - $engine->width = $width; - $engine->height = $height; - $engine->data = &$data; - $engine->max_value = max ($data); - $engine->fontpath = $config['fontpath']; - $engine->xaxis_interval = $interval; - - $engine->single_graph (); -} - -/** - * Print a vertical bar graph with data - * - * @param integer width graph width - * @param integer height graph height - * @param mixed data Data for make the graph - * @param string legend Legend to show in graph - */ -function generic_vertical_bar_graph ($width = 380, $height = 200, &$data, &$legend = '') { - global $config; - - if (sizeof ($data) == 0) - graphic_error (); - - $engine = get_graph_engine (); - - $engine->width = $width; - $engine->height = $height; - $engine->data = &$data; - $engine->max_value = max ($data); - $engine->legend = &$legend; - $engine->fontpath = $config['fontpath']; - $engine->vertical_bar_graph (); -} - -/** - * Print a horizontal bar graph with data - * - * @param integer width graph width - * @param integer height graph height - * @param mixed data Data for make the graph - * @param string legend Legend to show in graph - */ -function generic_horizontal_bar_graph ($width = 380, $height = 200, &$data, $legend = false) { - global $config; - - if (sizeof ($data) == 0) - graphic_error (); - - $engine = get_graph_engine (); - - $engine->width = $width; - $engine->height = $height; - $engine->data = &$data; - $engine->legend = &$legend; - $engine->fontpath = $config['fontpath']; - - $engine->horizontal_bar_graph (); -} - -/** - * Print a pie graph with data - * - * @param integer width pie graph width - * @param integer height pie graph height - * @param mixed data Data for make the graph - * @param mixed options Options for show graph as 'show_title', 'show_legend' and 'zoom' - */ -function generic_pie_graph ($width = 300, $height = 200, &$data, $options = false) { - global $config; - - if (sizeof ($data) == 0) - graphic_error (); - - $show_title = false; - $show_legend = true; - $zoom = 85; - if (is_array ($options)) { - if (isset ($options['show_title'])) - $show_title = (bool) $options['show_title']; - if (isset ($options['show_legend'])) - $show_legend = (bool) $options['show_legend']; - if (isset ($options['zoom'])) - $zoom = (bool) $options['zoom']; - } - - $engine = get_graph_engine (); - - $engine->width = $width; - $engine->height = $height; - $engine->data = &$data; - $engine->zoom = $zoom; - $engine->legend = array_keys ($data); - $engine->show_legend = $show_legend; - $engine->show_title = $show_title; - $engine->zoom = 50; - $engine->fontpath = $config['fontpath']; - $engine->pie_graph (); -} - -/** - * Print a horizontal bar graph with packets data of agents - * - * @param integer width pie graph width - * @param integer height pie graph height - */ -function grafico_db_agentes_paquetes ($width = 380, $height = 300) { - global $config; - global $graphic_type; - - $data = array (); - $legend = array (); - - $agents = agents_get_group_agents (array_keys (users_get_groups ()), false, "none"); - $count = agents_get_modules_data_count (array_keys ($agents)); - unset ($count["total"]); - arsort ($count, SORT_NUMERIC); - $count = array_slice ($count, 0, 8, true); - - foreach ($count as $agent_id => $value) { - $data[$agents[$agent_id]] = $value; - } - - if (! $graphic_type) { - return fs_3d_bar_chart ($data, $width, $height); - } - - generic_horizontal_bar_graph ($width, $height, $data, $legend); -} - -/** - * Print a pie graph with purge data of agent - * - * @param integer id_agent ID of agent to show - * @param integer width pie graph width - * @param integer height pie graph height - */ -function grafico_db_agentes_purge ($id_agent, $width, $height) { - global $config; - global $graphic_type; - - if ($id_agent < 1) { - $id_agent = -1; - $query = ""; - } else { - $modules = agents_get_modules ($id_agent); - $query = sprintf (" AND id_agente_modulo IN (%s)", implode (",", array_keys ($modules))); - } - - // All data (now) - $time["all"] = get_system_time (); - - // 1 day ago - $time["1day"] = $time["all"] - 86400; - - // 1 week ago - $time["1week"] = $time["all"] - 604800; - - // 1 month ago - $time["1month"] = $time["all"] - 2592000; - - // Three months ago - $time["3month"] = $time["all"] - 7776000; - - $data[__("Today")] = db_get_sql (sprintf ("SELECT COUNT(*) FROM tagente_datos WHERE utimestamp > %d %s", $time["1day"], $query), 0, true); - $data["1 ".__("Week")] = db_get_sql (sprintf ("SELECT COUNT(*) FROM tagente_datos WHERE utimestamp > %d %s", $time["1week"], $query), 0, true); - $data["1 ".__("Month")] = db_get_sql (sprintf ("SELECT COUNT(*) FROM tagente_datos WHERE utimestamp > %d %s", $time["1month"], $query), 0, true); - $data["3 ".__("Months")] = db_get_sql (sprintf ("SELECT COUNT(*) FROM tagente_datos WHERE utimestamp > %d %s", $time["3month"], $query), 0, true); - $data[__("Older")] = db_get_sql (sprintf ("SELECT COUNT(*) FROM tagente_datos WHERE 1=1 %s", $query)); - - $data[__("Today")] += db_get_sql (sprintf ("SELECT COUNT(*) FROM tagente_datos_string WHERE utimestamp > %d %s", $time["1day"], $query), 0, true); - $data["1 ".__("Week")] += db_get_sql (sprintf ("SELECT COUNT(*) FROM tagente_datos_string WHERE utimestamp > %d %s", $time["1week"], $query), 0, true); - $data["1 ".__("Month")] += db_get_sql (sprintf ("SELECT COUNT(*) FROM tagente_datos_string WHERE utimestamp > %d %s", $time["1month"], $query), 0, true); - $data["3 ".__("Months")] += db_get_sql (sprintf ("SELECT COUNT(*) FROM tagente_datos_string WHERE utimestamp > %d %s", $time["3month"], $query), 0, true); - $data[__("Older")] += db_get_sql (sprintf ("SELECT COUNT(*) FROM tagente_datos_string WHERE 1=1 %s", $query), 0, true); - - $data[__("Today")] += db_get_sql (sprintf ("SELECT COUNT(*) FROM tagente_datos_log4x WHERE utimestamp > %d %s", $time["1day"], $query), 0, true); - $data["1 ".__("Week")] += db_get_sql (sprintf ("SELECT COUNT(*) FROM tagente_datos_log4x WHERE utimestamp > %d %s", $time["1week"], $query), 0, true); - $data["1 ".__("Month")] += db_get_sql (sprintf ("SELECT COUNT(*) FROM tagente_datos_log4x WHERE utimestamp > %d %s", $time["1month"], $query), 0, true); - $data["3 ".__("Months")] += db_get_sql (sprintf ("SELECT COUNT(*) FROM tagente_datos_log4x WHERE utimestamp > %d %s", $time["3month"], $query), 0, true); - $data[__("Older")] += db_get_sql (sprintf ("SELECT COUNT(*) FROM tagente_datos_log4x WHERE 1=1 %s", $query), 0, true); - - $data[__("Older")] = $data[__("Older")] - $data["3 ".__("Months")]; - - if (! $graphic_type) { - return fs_3d_pie_chart ($data, $width, $height); - } - - generic_pie_graph ($width, $height, $data); -} - -/** - * Draw a dynamic progress bar using GDlib directly - * - * @param integer progress bar progress - * @param integer height pie graph height - * @param integer width pie graph width - * @param integer mode style of graph (0 or 1) - */ -function progress_bar ($progress, $width, $height, $mode = 1) { - global $config; - - if ($progress > 100 || $progress < 0) { - graphic_error ('outof.png'); - } - - $engine = get_graph_engine (); - - $engine->width = $width; - $engine->height = $height; - $engine->fontpath = $config['fontpath']; - - if ($mode == 0) { - $engine->background_color = '#E6E6D2'; - $engine->show_title = false; - if ($progress > 70) - $color = '#B0FF54'; - elseif ($progress > 50) - $color = '#FFE654'; - elseif ($progress > 30) - $color = '#FF9A54'; - else - $color = '#EE0000'; - } else { - $engine->background_color = '#FFFFFF'; - $engine->show_title = true; - $engine->title = format_numeric ($progress).' %'; - $color = '#2C5196'; - } - - $engine->progress_bar ($progress, $color); -} - -function grafico_modulo_sparse ($agent_module_id, $period, $show_events, - $width, $height , $title, $unit_name, - $show_alerts, $avg_only = 0, $pure = false, - $date = 0, $baseline = 0, $return_data = 0, $show_title = true) { - global $config; - global $graphic_type; - - // Set variables - if ($date == 0) $date = get_system_time(); - $datelimit = $date - $period; - $resolution = $config['graph_res'] * 50; //Number of points of the graph - $interval = (int) ($period / $resolution); - $agent_name = modules_get_agentmodule_agent_name ($agent_module_id); - $agent_id = agents_get_agent_id ($agent_name); - $module_name = modules_get_agentmodule_name ($agent_module_id); - $id_module_type = modules_get_agentmodule_type ($agent_module_id); - $module_type = modules_get_moduletype_name ($id_module_type); - $uncompressed_module = is_module_uncompressed ($module_type); - if ($uncompressed_module) { - $avg_only = 1; - } - - // Get event data (contains alert data too) - if ($show_events == 1 || $show_alerts == 1) { - $events = db_get_all_rows_filter ('tevento', - array ('id_agentmodule' => $agent_module_id, - "utimestamp > $datelimit", - "utimestamp < $date", - 'order' => 'utimestamp ASC'), - array ('evento', 'utimestamp', 'event_type')); - if ($events === false) { - $events = array (); - } - } - - // Get module data - $data = db_get_all_rows_filter ('tagente_datos', - array ('id_agente_modulo' => $agent_module_id, - "utimestamp > $datelimit", - "utimestamp < $date", - 'order' => 'utimestamp ASC'), - array ('datos', 'utimestamp'), 'AND', true); - if ($data === false) { - $data = array (); - } - - // Uncompressed module data - if ($uncompressed_module) { - $min_necessary = 1; - - // Compressed module data - } else { - // Get previous data - $previous_data = modules_get_previous_data ($agent_module_id, $datelimit); - if ($previous_data !== false) { - $previous_data['utimestamp'] = $datelimit; - array_unshift ($data, $previous_data); - } - - // Get next data - $nextData = modules_get_next_data ($agent_module_id, $date); - if ($nextData !== false) { - array_push ($data, $nextData); - } else if (count ($data) > 0) { - // Propagate the last known data to the end of the interval - $nextData = array_pop ($data); - array_push ($data, $nextData); - $nextData['utimestamp'] = $date; - array_push ($data, $nextData); - } - - $min_necessary = 2; - } - - // Check available data - if (count ($data) < $min_necessary) { - if (!$graphic_type) { - return fs_error_image2 (); - } - graphic_error (); - } - - // Data iterator - $j = 0; - - // Event iterator - $k = 0; - - // Set initial conditions - $chart = array(); - if ($data[0]['utimestamp'] == $datelimit) { - $previous_data = $data[0]['datos']; - $j++; - } else { - $previous_data = 0; - } - - // Get baseline data - $baseline_data = array (); - if ($baseline == 1) { - $baseline_data = enterprise_hook ('reporting_enterprise_get_baseline', array ($agent_module_id, $period, $width, $height , $title, $unit_name, $date)); - if ($baseline_data === ENTERPRISE_NOT_HOOK) { - $baseline_data = array (); - } - } - - // Calculate chart data - for ($i = 0; $i < $resolution; $i++) { - $timestamp = $datelimit + ($interval * $i); - - $total = 0; - $count = 0; - - // Read data that falls in the current interval - $interval_min = false; - $interval_max = false; - while (isset ($data[$j]) && $data[$j]['utimestamp'] >= $timestamp && $data[$j]['utimestamp'] < ($timestamp + $interval)) { - if ($interval_min === false) { - $interval_min = $data[$j]['datos']; - } - if ($interval_max === false) { - $interval_max = $data[$j]['datos']; - } - - if ($data[$j]['datos'] > $interval_max) { - $interval_max = $data[$j]['datos']; - } else if ($data[$j]['datos'] < $interval_max) { - $interval_min = $data[$j]['datos']; - } - $total += $data[$j]['datos']; - $count++; - $j++; - } - - // Data in the interval - if ($count > 0) { - $total /= $count; - } - - // Read events and alerts that fall in the current interval - $event_value = 0; - $alert_value = 0; - while (isset ($events[$k]) && $events[$k]['utimestamp'] >= $timestamp && $events[$k]['utimestamp'] <= ($timestamp + $interval)) { - if ($show_events == 1) { - $event_value++; - } - if ($show_alerts == 1 && substr ($events[$k]['event_type'], 0, 5) == 'alert') { - $alert_value++; - } - $k++; - } - - // Data - if ($count > 0) { - $chart[$timestamp]['sum'] = $total; - $chart[$timestamp]['min'] = $interval_min; - $chart[$timestamp]['max'] = $interval_max; - $previous_data = $total; - // Compressed data - } else { - if ($uncompressed_module || ($timestamp > time ())) { - $chart[$timestamp]['sum'] = 0; - $chart[$timestamp]['min'] = 0; - $chart[$timestamp]['max'] = 0; - } else { - $chart[$timestamp]['sum'] = $previous_data; - $chart[$timestamp]['min'] = $previous_data; - $chart[$timestamp]['max'] = $previous_data; - } - } - - $chart[$timestamp]['count'] = 0; - $chart[$timestamp]['timestamp_bottom'] = $timestamp; - $chart[$timestamp]['timestamp_top'] = $timestamp + $interval; - $chart[$timestamp]['event'] = $event_value; - $chart[$timestamp]['alert'] = $alert_value; - $chart[$timestamp]['baseline'] = array_shift ($baseline_data); - if ($chart[$timestamp]['baseline'] == NULL) { - $chart[$timestamp]['baseline'] = 0; - } - } - - // Return chart data and don't draw - if ($return_data == 1) { - return $chart; - } - - // Get min, max and avg (less efficient but centralized for all modules and reports) - $min_value = round(reporting_get_agentmodule_data_min ($agent_module_id, $period, $date), 2); - $max_value = round(reporting_get_agentmodule_data_max ($agent_module_id, $period, $date), 2); - $avg_value = round(reporting_get_agentmodule_data_average ($agent_module_id, $period, $date), 2); - - // Fix event and alert scale - $event_max = $max_value * 1.25; - foreach ($chart as $timestamp => $chart_data) { - if ($chart_data['event'] > 0) { - $chart[$timestamp]['event'] = $event_max; - } - if ($chart_data['alert'] > 0) { - $chart[$timestamp]['alert'] = $event_max; - } - } - - // Set the title and time format - if ($period <= 3600) { - $title_period = __('Last hour'); - $time_format = 'G:i:s'; - } - elseif ($period <= 86400) { - $title_period = __('Last day'); - $time_format = 'G:i'; - } - elseif ($period <= 604800) { - $title_period = __('Last week'); - $time_format = 'M j'; - } - elseif ($period <= 2419200) { - $title_period = __('Last month'); - $time_format = 'M j'; - } - else { - $title_period = __('Last %s days', format_numeric (($period / (3600 * 24)), 2)); - $time_format = 'M j'; - } - - // Only show caption if graph is not small - if ($width > MIN_WIDTH_CAPTION && $height > MIN_HEIGHT) - // Flash chart - $caption = __('Max. Value') . ': ' . $max_value . ' ' . __('Avg. Value') . ': ' . $avg_value . ' ' . __('Min. Value') . ': ' . $min_value; - else - $caption = array(); - - if (! $graphic_type) { - return fs_module_chart ($chart, $width, $height, $avg_only, $resolution / 10, $time_format, $show_events, $show_alerts, $caption, $baseline); - } - - $engine = get_graph_engine ($period); - $engine->width = $width; - $engine->height = $height; - $engine->data = &$chart; - $engine->xaxis_interval = $resolution; - $engine->title = ""; - $engine->subtitle = $caption; - $engine->show_title = $show_title; - $engine->max_value = $max_value; - $engine->min_value = $min_value; - $engine->events = (bool) $show_events; - $engine->alert_top = false; - $engine->alert_bottom = false;; - if (! $pure) { - $engine->legend = &$legend; - } - $engine->fontpath = $config['fontpath']; - - $engine->sparse_graph ($period, $avg_only, $min_value, $max_value, $unit_name, $baseline); -} - -function grafico_modulo_boolean ($agent_module_id, $period, $show_events, - $width, $height , $title, $unit_name, $show_alerts, $avg_only = 0, $pure=0, - $date = 0 ) { - global $config; - global $graphic_type; - - // Set variables - if ($date == 0) $date = get_system_time(); - $datelimit = $date - $period; - $resolution = $config['graph_res'] * 50; //Number of points of the graph - $interval = (int) ($period / $resolution); - $agent_name = modules_get_agentmodule_agent_name ($agent_module_id); - $agent_id = agents_get_agent_id ($agent_name); - $module_name = modules_get_agentmodule_name ($agent_module_id); - $id_module_type = modules_get_agentmodule_type ($agent_module_id); - $module_type = modules_get_moduletype_name ($id_module_type); - $uncompressed_module = is_module_uncompressed ($module_type); - if ($uncompressed_module) { - $avg_only = 1; - } - - // Get event data (contains alert data too) - if ($show_events == 1 || $show_alerts == 1) { - $events = db_get_all_rows_filter ('tevento', - array ('id_agentmodule' => $agent_module_id, - "utimestamp > $datelimit", - "utimestamp < $date", - 'order' => 'utimestamp ASC'), - array ('evento', 'utimestamp', 'event_type')); - if ($events === false) { - $events = array (); - } - } - - // Get module data - $data = db_get_all_rows_filter ('tagente_datos', - array ('id_agente_modulo' => $agent_module_id, - "utimestamp > $datelimit", - "utimestamp < $date", - 'order' => 'utimestamp ASC'), - array ('datos', 'utimestamp')); - if ($data === false) { - $data = array (); - } - - // Uncompressed module data - if ($uncompressed_module) { - $min_necessary = 1; - - // Compressed module data - } else { - // Get previous data - $previous_data = modules_get_previous_data ($agent_module_id, $datelimit); - if ($previous_data !== false) { - $previous_data['utimestamp'] = $datelimit; - array_unshift ($data, $previous_data); - } - - // Get next data - $nextData = modules_get_next_data ($agent_module_id, $date); - if ($nextData !== false) { - array_push ($data, $nextData); - } else if (count ($data) > 0) { - // Propagate the last known data to the end of the interval - $nextData = array_pop ($data); - array_push ($data, $nextData); - $nextData['utimestamp'] = $date; - array_push ($data, $nextData); - } - - $min_necessary = 2; - } - - // Check available data - if (count ($data) < $min_necessary) { - if (!$graphic_type) { - return fs_error_image2 (); - } - graphic_error (); - } - - // Data iterator - $j = 0; - - // Event iterator - $k = 0; - - // Set initial conditions - $chart = array(); - if ($data[0]['utimestamp'] == $datelimit) { - $previous_data = $data[0]['datos']; - $j++; - } else { - $previous_data = 0; - } - - // Calculate chart data - for ($i = 0; $i < $resolution; $i++) { - $timestamp = $datelimit + ($interval * $i); - - $zero = 0; - $total = 0; - $count = 0; - - // Read data that falls in the current interval - while (isset ($data[$j]) && $data[$j]['utimestamp'] >= $timestamp && $data[$j]['utimestamp'] <= ($timestamp + $interval)) { - if ($data[$j]['datos'] == 0) { - $zero = 1; - } else { - $total += $data[$j]['datos']; - $count++; - } - - $j++; - } - - // Average - if ($count > 0) { - $total /= $count; - } - - // Read events and alerts that fall in the current interval - $event_value = 0; - $alert_value = 0; - while (isset ($events[$k]) && $events[$k]['utimestamp'] >= $timestamp && $events[$k]['utimestamp'] < ($timestamp + $interval)) { - if ($show_events == 1) { - $event_value++; - } - if ($show_alerts == 1 && substr ($events[$k]['event_type'], 0, 5) == 'alert') { - $alert_value++; - } - $k++; - } - - // Data and zeroes (draw a step) - if ($zero == 1 && $count > 0) { - $chart[$timestamp]['sum'] = $total; - $chart[$timestamp + 1] = array ('sum' => 0, - 'count' => 0, - 'timestamp_bottom' => $timestamp, - 'timestamp_top' => $timestamp + $interval, - 'min' => 0, - 'max' => 0, - 'event' => $event_value, - 'alert' => $alert_value); - $previous_data = 0; - // Just zeros - } else if ($zero == 1) { - $chart[$timestamp]['sum'] = 0; - $previous_data = 0; - // No zeros - } else if ($count > 0) { - $chart[$timestamp]['sum'] = $total; - $previous_data = $total; - // Compressed data - } else { - if ($uncompressed_module || ($timestamp > time ())) { - $chart[$timestamp]['sum'] = 0; - } else { - $chart[$timestamp]['sum'] = $previous_data; - } - } - - ////$chart[$timestamp]['count'] = 0; - //////////// - //$chart[$timestamp]['timestamp_bottom'] = $timestamp; - //$chart[$timestamp]['timestamp_top'] = $timestamp + $interval; - /////////// - $chart[$timestamp]['min'] = 0; - $chart[$timestamp]['max'] = 0; - $chart[$timestamp]['event'] = $event_value; - $chart[$timestamp]['alert'] = $alert_value; - } - - // Get min, max and avg (less efficient but centralized for all modules and reports) - $min_value = round(reporting_get_agentmodule_data_min ($agent_module_id, $period, $date), 2); - $max_value = round(reporting_get_agentmodule_data_max ($agent_module_id, $period, $date), 2); - $avg_value = round(reporting_get_agentmodule_data_average ($agent_module_id, $period, $date), 2); - - // Fix event and alert scale - $event_max = $max_value * 1.25; - foreach ($chart as $timestamp => $chart_data) { - if ($chart_data['event'] > 0) { - $chart[$timestamp]['event'] = $event_max; - } - if ($chart_data['alert'] > 0) { - $chart[$timestamp]['alert'] = $event_max; - } - } - - // Set the title and time format - if ($period <= 3600) { - $title_period = __('Last hour'); - $time_format = 'G:i:s'; - } - elseif ($period <= 86400) { - $title_period = __('Last day'); - $time_format = 'G:i'; - } - elseif ($period <= 604800) { - $title_period = __('Last week'); - $time_format = 'M j'; - } - elseif ($period <= 2419200) { - $title_period = __('Last month'); - $time_format = 'M j'; - } - else { - $title_period = __('Last %s days', format_numeric (($period / (3600 * 24)), 2)); - $time_format = 'M j'; - } - - // Flash chart - $caption = __('Max. Value') . ': ' . $max_value . ' ' . __('Avg. Value') . ': ' . $avg_value . ' ' . __('Min. Value') . ': ' . $min_value; - if (! $graphic_type) { - return fs_module_chart ($chart, $width, $height, $avg_only, $resolution / 10, $time_format, $show_events, $show_alerts, $caption); - } - - $chart_data = array (); - foreach ($chart as $chart_element) { - $chart_data[$chart_element['timestamp_bottom']] = $chart_element['sum']; - } - - // Image chart - $engine = get_graph_engine ($period); - - $engine->width = $width; - $engine->height = $height; - $engine->data = &$chart_data; - $engine->max_value = 1; - $engine->legend = array ($module_name); - $engine->title = ""; - $engine->subtitle = $caption; - $engine->show_title = true; - $engine->events = false; - $engine->fontpath = $config['fontpath']; - $engine->alert_top = false; - $engine->alert_bottom = false;; - - $engine->xaxis_interval = $resolution / 10; // Fixed to 10 ticks - $engine->xaxis_format = 'date'; - - $engine->single_graph (); - - return; -} - -/** - * Draw a graph of Module string data of agent - * - * @param integer id_agent_modulo Agent Module ID - * @param integer show_event show event (1 or 0) - * @param integer height graph height - * @param integer width graph width - * @param string title graph title - * @param string unit_name String of unit name - * @param integer show alerts (1 or 0) - * @param integer avg_only calcules avg only (1 or 0) - * @param integer pure Fullscreen (1 or 0) - * @param integer date date - */ -function grafico_modulo_string ($agent_module_id, $period, $show_events, - $width, $height , $title, $unit_name, $show_alerts, $avg_only = 0, $pure=0, - $date = 0) { - global $config; - global $graphic_type; - - // Set variables - if ($date == 0) $date = get_system_time(); - $datelimit = $date - $period; - $resolution = $config['graph_res'] * 50; //Number of points of the graph - $interval = (int) ($period / $resolution); - $agent_name = modules_get_agentmodule_agent_name ($agent_module_id); - $agent_id = agents_get_agent_id ($agent_name); - $module_name = modules_get_agentmodule_name ($agent_module_id); - $id_module_type = modules_get_agentmodule_type ($agent_module_id); - $module_type = modules_get_moduletype_name ($id_module_type); - $uncompressed_module = is_module_uncompressed ($module_type); - if ($uncompressed_module) { - $avg_only = 1; - } - - // Get event data (contains alert data too) - if ($show_events == 1 || $show_alerts == 1) { - $events = db_get_all_rows_filter ('tevento', - array ('id_agentmodule' => $agent_module_id, - "utimestamp > $datelimit", - "utimestamp < $date", - 'order' => 'utimestamp ASC'), - array ('evento', 'utimestamp', 'event_type')); - if ($events === false) { - $events = array (); - } - } - - // Get module data - $data = db_get_all_rows_filter ('tagente_datos_string', - array ('id_agente_modulo' => $agent_module_id, - "utimestamp > $datelimit", - "utimestamp < $date", - 'order' => 'utimestamp ASC'), - array ('datos', 'utimestamp')); - if ($data === false) { - $data = array (); - } - - // Uncompressed module data - if ($uncompressed_module) { - $min_necessary = 1; - - // Compressed module data - } else { - // Get previous data - $previous_data = modules_get_previous_data ($agent_module_id, $datelimit, 1); - if ($previous_data !== false) { - $previous_data['utimestamp'] = $datelimit; - array_unshift ($data, $previous_data); - } - - // Get next data - $nextData = modules_get_next_data ($agent_module_id, $date, 1); - if ($nextData !== false) { - array_push ($data, $nextData); - } else if (count ($data) > 0) { - // Propagate the last known data to the end of the interval - $nextData = array_pop ($data); - array_push ($data, $nextData); - $nextData['utimestamp'] = $date; - array_push ($data, $nextData); - } - - $min_necessary = 2; - } - - // Check available data - if (count ($data) < $min_necessary) { - if (!$graphic_type) { - return fs_error_image2 (); - } - graphic_error (); - } - - // Data iterator - $j = 0; - - // Event iterator - $k = 0; - - // Set initial conditions - $chart = array(); - if ($data[0]['utimestamp'] == $datelimit) { - $previous_data = 1; - $j++; - } else { - $previous_data = 0; - } - - // Calculate chart data - for ($i = 0; $i < $resolution; $i++) { - $timestamp = $datelimit + ($interval * $i); - - $count = 0; - // Read data that falls in the current interval - while (isset ($data[$j]) !== null && $data[$j]['utimestamp'] >= $timestamp && $data[$j]['utimestamp'] <= ($timestamp + $interval)) { - $count++; - $j++; - } - - // Read events and alerts that fall in the current interval - $event_value = 0; - $alert_value = 0; - while (isset ($events[$k]) && $events[$k]['utimestamp'] >= $timestamp && $events[$k]['utimestamp'] <= ($timestamp + $interval)) { - if ($show_events == 1) { - $event_value++; - } - if ($show_alerts == 1 && substr ($events[$k]['event_type'], 0, 5) == 'alert') { - $alert_value++; - } - $k++; - } - - // Data in the interval - if ($count > 0) { - $chart[$timestamp]['sum'] = $count; - $previous_data = $total; - // Compressed data - } else { - $chart[$timestamp]['sum'] = $previous_data; - } - - $chart[$timestamp]['count'] = 0; - $chart[$timestamp]['timestamp_bottom'] = $timestamp; - $chart[$timestamp]['timestamp_top'] = $timestamp + $interval; - $chart[$timestamp]['min'] = 0; - $chart[$timestamp]['max'] = 0; - $chart[$timestamp]['event'] = $event_value; - $chart[$timestamp]['alert'] = $alert_value; - } - - // Get min, max and avg (less efficient but centralized for all modules and reports) - $min_value = round(reporting_get_agentmodule_data_min ($agent_module_id, $period, $date), 2); - $max_value = round(reporting_get_agentmodule_data_max ($agent_module_id, $period, $date), 2); - $avg_value = round(reporting_get_agentmodule_data_average ($agent_module_id, $period, $date), 2); - - // Fix event and alert scale - $event_max = $max_value * 1.25; - foreach ($chart as $timestamp => $chart_data) { - if ($chart_data['event'] > 0) { - $chart[$timestamp]['event'] = $event_max; - } - if ($chart_data['alert'] > 0) { - $chart[$timestamp]['alert'] = $event_max; - } - } - - // Set the title and time format - if ($period <= 3600) { - $title_period = __('Last hour'); - $time_format = 'G:i:s'; - } - elseif ($period <= 86400) { - $title_period = __('Last day'); - $time_format = 'G:i'; - } - elseif ($period <= 604800) { - $title_period = __('Last week'); - $time_format = 'M j'; - } - elseif ($period <= 2419200) { - $title_period = __('Last month'); - $time_format = 'M j'; - } - else { - $title_period = __('Last %s days', format_numeric (($period / (3600 * 24)), 2)); - $time_format = 'M j'; - } - - // Flash chart - $caption = __('Max. Value') . ': ' . $max_value . ' ' . __('Avg. Value') . ': ' . $avg_value . ' ' . __('Min. Value') . ': ' . $min_value; - - if (! $graphic_type) { - return fs_module_chart ($chart, $width, $height, $avg_only, $resolution / 10, $time_format, $show_events, $show_alerts, $caption); - } - - - $chart_data = array (); - foreach ($chart as $chart_element) { - $chart_data[$chart_element['timestamp_bottom']] = $chart_element['sum']; - } - - $engine = get_graph_engine ($period); - - $engine->width = $width; - $engine->height = $height; - $engine->data = &$chart_data; - $engine->max_value = max ($chart_data); - - $engine->legend = array ($module_name); - $engine->title = ""; - $engine->subtitle = $caption; - $engine->show_title = true; - $engine->events = false; - $engine->fontpath = $config['fontpath']; - $engine->alert_top = false; - $engine->alert_bottom = false;; - - $engine->xaxis_interval = $resolution/5; - $engine->yaxis_interval = 1; - $engine->xaxis_format = 'datetime'; - - $engine->single_graph (); - return; -} - -function grafico_modulo_log4x ($id_agente_modulo, $periodo, $show_event, - $width, $height , $title, $unit_name, $show_alert, $avg_only = 0, $pure=0, - $date = 0) -{ - - grafico_modulo_log4x_trace("
");
-
-	if ($date == "")
-		$now = time ();
-	else
-	        $now = $date;
-
-        $fechatope = $now - $periodo; // limit date
-
-	$nombre_agente = modules_get_agentmodule_agent_name ($id_agente_modulo);
-	$nombre_modulo = modules_get_agentmodule_name ($id_agente_modulo);
-	$id_agente = agents_get_agent_id ($nombre_agente);
-
-
-        $one_second = 1;
-        $one_minute = 60 * $one_second;
-        $one_hour = 60 * $one_minute;
-        $one_day = 24 * $one_hour;
-        $one_week = 7 * $one_day;
-
-        $adjust_time = $one_minute; // 60 secs
-
-        if ($periodo == 86400) // day
-                $adjust_time = $one_hour;
-        elseif ($periodo == 604800) // week
-                $adjust_time =$one_day;
-        elseif ($periodo == 3600) // hour
-                $adjust_time = 10 * $one_minute;
-        elseif ($periodo == 2419200) // month
-                $adjust_time = $one_week;
-        else
-                $adjust_time = $periodo / 12.0;
-
-        $num_slices = $periodo / $adjust_time;
-
-        $fechatope_index = grafico_modulo_log4x_index($fechatope, $adjust_time);
-
-        $sql1="SELECT utimestamp, SEVERITY " .
-                " FROM tagente_datos_log4x " .
-                " WHERE id_agente_modulo = $id_agente_modulo AND utimestamp > $fechatope and utimestamp < $now";
-
-        $valores = array();
-
-        $max_count = -1;
-        $min_count = 9999999;
-
-        grafico_modulo_log4x_trace("$sql1");
-
-        $rows = 0;
-        
-        $first = true;
-        while ($row = db_get_all_row_by_steps_sql($first, $result, $sql1)){
-        		$first = false;
-        	
-                $rows++;
-                $utimestamp = $row[0];
-                $severity = $row[1];
-                $severity_num = $row[2];
-
-                if (!isset($valores[$severity]))
-                        $valores[$severity] = array();
-
-                $dest = grafico_modulo_log4x_index($utimestamp, $adjust_time);
-
-                $index = (($dest - $fechatope_index) / $adjust_time) - 1;
-
-                if (!isset($valores[$severity][$index])) {
-                        $valores[$severity][$index] = array();
-                        $valores[$severity][$index]['pivot'] = $dest;
-                        $valores[$severity][$index]['count'] = 0;
-                        $valores[$severity][$index]['alerts'] = 0;
-                }
-
-                $valores[$severity][$index]['count']++;
-
-                $max_count = max($max_count, $valores[$severity][$index]['count']);
-                $min_count = min($min_count, $valores[$severity][$index]['count']);
-       }
-
-        grafico_modulo_log4x_trace("$rows rows");
-
-        // Create graph
-        // *************
-
-        grafico_modulo_log4x_trace(__LINE__);
-
-	//set_error_handler("myErrorHandler");
-
-        grafico_modulo_log4x_trace(__LINE__);
-	set_include_path(get_include_path() . PATH_SEPARATOR . getcwd() . "/../../include");
-
-	require_once 'Image/Graph.php';
-
-        grafico_modulo_log4x_trace(__LINE__);
-
-        $Graph =& Image_Graph::factory('graph', array($width, $height));
- 
-        grafico_modulo_log4x_trace(__LINE__);
-
-
-
-
-
-        // add a TrueType font
-        $Font =& $Graph->addNew('font', $config['fontpath']); // C:\WINNT\Fonts\ARIAL.TTF
-        $Font->setSize(7);
-
-        $Graph->setFont($Font);
-
-        if ($periodo == 86400)
-                $title_period = $lang_label["last_day"];
-        elseif ($periodo == 604800)
-                $title_period = $lang_label["last_week"];
-        elseif ($periodo == 3600)
-                $title_period = $lang_label["last_hour"];
-        elseif ($periodo == 2419200)
-                $title_period = $lang_label["last_month"];
-        else {
-                $suffix = $lang_label["days"];
-                $graph_extension = $periodo / (3600*24); // in days
-
-                if ($graph_extension < 1) {
-                        $graph_extension = $periodo / (3600); // in hours
-                        $suffix = $lang_label["hours"];
-                }
-                //$title_period = "Last ";
-                $title_period = format_numeric($graph_extension,2)." $suffix";
-        }
-
-        $title_period = html_entity_decode($title_period);
-
-        grafico_modulo_log4x_trace(__LINE__);
-
-        if ($pure == 0){
-                $Graph->add(
-                        Image_Graph::horizontal(
-                                Image_Graph::vertical(
-                                        Image_Graph::vertical(
-                                                $Title = Image_Graph::factory('title', array('   Pandora FMS Graph - '.strtoupper($nombre_agente)." - " .$title_period, 10)),
-                                                $Subtitle = Image_Graph::factory('title', array('     '.$title, 7)),
-                                                90
-                                        ),
-                                        $Plotarea = Image_Graph::factory('plotarea', array('Image_Graph_Axis', 'Image_Graph_Axis')),
-                                        15 // If you change this, change the 0.85 below
-                                ),
-                                Image_Graph::vertical(
-                                        $Legend = Image_Graph::factory('legend'),
-                                        $PlotareaMinMax = Image_Graph::factory('plotarea'),
-                                        65
-                                ),
-                                85 // If you change this, change the 0.85 below
-                        )
-                );
-
-                $Legend->setPlotarea($Plotarea);
-                $Title->setAlignment(IMAGE_GRAPH_ALIGN_LEFT);
-                $Subtitle->setAlignment(IMAGE_GRAPH_ALIGN_LEFT);
-        } else { // Pure, without title and legends
-                $Graph->add($Plotarea = Image_Graph::factory('plotarea', array('Image_Graph_Axis', 'Image_Graph_Axis')));
-        }
-
-        grafico_modulo_log4x_trace(__LINE__);
-
-        $dataset = array();
-
-        $severities = array("FATAL", "ERROR", "WARN", "INFO", "DEBUG", "TRACE");
-        $colors = array("black", "red", "orange", "yellow", "#3300ff", 'magenta');
-
-        $max_bubble_radius = $height * 0.6 / (count($severities) + 1); // this is the size for the max_count
-        $y = count($severities) - 1;
-        $i = 0;
-
-        foreach($severities as $severity) {
-                $dataset[$i] = Image_Graph::factory('dataset');
-                $dataset[$i]->setName($severity);
-
-                if (isset($valores[$severity])){
-                        $data =& $valores[$severity];
-                        while (list($index, $data2) = each($data)) {
-                                $count = $data2['count'];
-                                $pivot = $data2['pivot'];
-
-                                //$x = $scale * $index;
-                                $x = 100.0 * ($pivot - $fechatope) / ($now - $fechatope);
-                                if ($x > 100) $x = 100;
-
-                                $size = grafico_modulo_log4x_bubble_size($count, $max_count, $max_bubble_radius);
-
-                                // pivot is the value in the X axis
-                                // y is the number of steps (from the bottom of the graphics) (zero based)
-                                // x is the position of the bubble, in % from the left (0% = full left, 100% = full right)
-                                // size is the radius of the bubble
-                                // value is the value associated with the bubble (needed to calculate the leyend)
-                                //
-                                $dataset[$i]->addPoint($pivot, $y, array("x" => $x, "size" => $size, "value" => $count));
-                        }
-                } else {
-                        // There's a problem when we have no data ...
-                        // This was the first try.. didnt work
-                        //$dataset[$i]->addPoint($now, -1, array("x" => 0, "size" => 0));
-                }
-
-                $y--;
-                $i++;
-        }
-
-        grafico_modulo_log4x_trace(__LINE__);
-
-        // create the 1st plot as smoothed area chart using the 1st dataset
-        $Plot =& $Plotarea->addNew('bubble', array(&$dataset));
-        $Plot->setFont($Font);
-
-        $AxisX =& $Plotarea->getAxis(IMAGE_GRAPH_AXIS_X);
-        $AxisX->setDataPreprocessor(Image_Graph::factory('Image_Graph_DataPreprocessor_Function', 'grafico_modulo_log4x_format_x_axis'));
-        $AxisX->forceMinimum($fechatope);
-        $AxisX->forceMaximum($now);
-
-        $minIntervalWidth = $Plot->getTextWidth("88/88/8888");
-        $interval_x = $adjust_time;
-
-        while (true) {
-                $intervalWidth = $width * 0.85 * $interval_x/ $periodo;
-                if ($intervalWidth >= $minIntervalWidth)
-                        break;
-
-                $interval_x *= 2;
-        }
-
-        $AxisX->setLabelInterval($interval_x);
-        $AxisX->setLabelOption("showtext",true);
-
-        //*
-        $GridY2 =& $Plotarea->addNew('line_grid');
-        $GridY2->setLineColor('gray');
-        $GridY2->setFillColor('lightgray@0.05');
-        $GridY2->_setPrimaryAxis($AxisX);
-        //$GridY2->setLineStyle(Image_Graph::factory('Image_Graph_Line_Dotted', array("white", "gray", "gray", "gray")));
-        $GridY2->setLineStyle(Image_Graph::factory('Image_Graph_Line_Formatted', array(array("transparent", "transparent", "transparent", "gray"))));
-        //*/
-        //grafico_modulo_log4x_trace(print_r($AxisX, true));
-
-        $AxisY =& $Plotarea->getAxis(IMAGE_GRAPH_AXIS_Y);
-        $AxisY->setDataPreprocessor(Image_Graph::factory('Image_Graph_DataPreprocessor_Function', 'grafico_modulo_log4x_format_y_axis'));
-        $AxisY->setLabelOption("showtext",true);
-        //$AxisY->setLabelInterval(0);
-        //$AxisY->showLabel(IMAGE_GRAPH_LABEL_ZERO);
-
-        //*
-        $GridY2 =& $Plotarea->addNew('line_grid');
-        $GridY2->setLineColor('gray');
-        $GridY2->setFillColor('lightgray@0.05');
-        $GridY2->_setPrimaryAxis($AxisY);
-        $GridY2->setLineStyle(Image_Graph::factory('Image_Graph_Line_Formatted', array(array("transparent", "transparent", "transparent", "gray"))));
-        //*/
-
-        $AxisY->forceMinimum(0);
-        $AxisY->forceMaximum(count($severities) + 1) ;
-
-        // set line colors
-        $FillArray =& Image_Graph::factory('Image_Graph_Fill_Array');
-
-        $Plot->setFillStyle($FillArray);
-        foreach($colors as $color)
-                $FillArray->addColor($color);
-
-        grafico_modulo_log4x_trace(__LINE__);
-
-        $FillArray->addColor('green@0.6');
-        //$AxisY_Weather =& $Plotarea->getAxis(IMAGE_GRAPH_AXIS_Y);
-
-        // Show events !
-        if ($show_event == 1){
-                $Plot =& $Plotarea->addNew('Plot_Impulse', array($dataset_event));
-                $Plot->setLineColor( 'red' );
-                $Marker_event =& Image_Graph::factory('Image_Graph_Marker_Cross');
-                $Plot->setMarker($Marker_event);
-                $Marker_event->setFillColor( 'red' );
-                $Marker_event->setLineColor( 'red' );
-                $Marker_event->setSize ( 5 );
-        }
-
-        $Axis =& $PlotareaMinMax->getAxis(IMAGE_GRAPH_AXIS_X);
-        $Axis->Hide();
-        $Axis =& $PlotareaMinMax->getAxis(IMAGE_GRAPH_AXIS_Y);
-        $Axis->Hide();
-
-        $plotMinMax =& $PlotareaMinMax->addNew('bubble', array(&$dataset, true));
-
-        grafico_modulo_log4x_trace(__LINE__);
-
-        $Graph->done();
-
-        grafico_modulo_log4x_trace(__LINE__);
-}
-
-function grafico_modulo_log4x_index($x, $interval)
-{
-        return $x + $interval - (($x - 1) % $interval) - 1;
-}
-
-function grafico_modulo_log4x_trace($str)
-{
-        //echo "$str\n";
-}
-
-function grafico_modulo_log4x_bubble_size($count, $max_count, $max_bubble_radius)
-{
-        //Superformula de ROA
-        $r0 = 1.5;
-        $r1 = $max_bubble_radius;
-        $v2 = pow($max_count,1/2.0);
-
-        return $r1*pow($count,1/2.0)/($v2)+$r0;
-
-
-         // Esta custion no sirve paaaaaaaaaaaa naaaaaaaaaaaaaaaadaaaaaaaaaaaaaa
-         //Cementerio de formulas ... QEPD
-        $a = pow(($r1 - $r0)/(pow($v2,1/4.0)-1),4);
-        $b = $r0 - pow($a,1/4.0);
-
-        return pow($a * $count, 1/4.0) + $b;
-
-        $r = pow($count / pow(3.1415, 3), 0.25);
-
-        $q = 0.9999;
-        $x = $count;
-        $x0 = $max_count;
-        $y0 = $max_size;
-
-        $y = 4 * $y0 * $x * (((1 - 2 * $q) / (2 * $x0))* $x + ((4 * $q - 1) / 4)) / $x0;
-
-        return $y;
-
-        return 3 * (0.3796434104 + pow($count * 0.2387394557, 0.333333333));
-
-        return sqrt($count / 3.1415);
-        return 5 + log($count);
-}
-
-function grafico_modulo_log4x_format_x_axis ( $number , $decimals=2, $dec_point=".", $thousands_sep=",")
-{
-        // $number is the unix time in the local timezone
-
-        //$dtZone = new DateTimeZone(date_default_timezone_get());
-        //$d = new DateTime("now", $dtZone);
-        //$offset = $dtZone->getOffset($d);
-        //$number -= $offset;
-
-        return date("d/m", $number) . "\n" . date("H:i", $number);
-}
-
-function grafico_modulo_log4x_format_y_axis ( $number , $decimals=2, $dec_point=".", $thousands_sep=",")
-{
-        $n = "";
-
-        switch($number) {
-	        case 6: $n = "FATAL"; break;
-	        case 5: $n = "ERROR"; break;
-	        case 4: $n = "WARN"; break;
-	        case 3: $n = "INFO"; break;
-	        case 2: $n = "DEBUG"; break;
-	        case 1: $n = "TRACE"; break;
-        }
-
-        return "$n";
-}
-
-/**
- * Print a custom SQL-defined graph 
- * 
- * @param integer ID of report content, used to get SQL code to get information for graph
- * @param integer height graph height
- * @param integer width graph width
- * @param integer Graph type 1 vbar, 2 hbar, 3 pie
- */
-function graph_custom_sql_graph ($id, $width, $height, $type = 1) {
-	global $config;
-
-    $report_content = db_get_row ('treport_content', 'id_rc', $id);
-    if ($report_content["external_source"] != ""){
-        $sql = io_safe_output ($report_content["external_source"]);
-    }
-    else {
-    	$sql = db_get_row('treport_custom_sql', 'id', $report_content["treport_custom_sql_id"]);
-    	$sql = io_safe_output($sql['sql']);
-    }
-
-	$data_result = db_get_all_rows_sql ($sql);
-
-	if ($data_result === false)
-		$data_result = array ();
-
-	$data = array ();
-	
-	foreach ($data_result as $data_item) {
-		$data[$data_item["label"]] = $data_item["value"];
-	}
-
-    switch ($type) {
-        case 1: // vertical bar
-            generic_vertical_bar_graph ($width, $height, $data);
-            break;
-        case 2: // horizontal bar
-            generic_horizontal_bar_graph ($width, $height, $data);
-            break;
-        case 3: // Pie
-            generic_pie_graph ($width, $height, $data);
-            break;
-    }
-}
-
-function myErrorHandler($errno, $errstr, $errfile, $errline)
-{
-    switch ($errno) {
-    case E_USER_ERROR:
-        echo "My ERROR [$errno] $errstr
\n"; - echo " Fatal error on line $errline in file $errfile"; - echo ", PHP " . PHP_VERSION . " (" . PHP_OS . ")
\n"; - echo "Aborting...
\n"; - exit(1); - break; - - case E_USER_WARNING: - echo "My WARNING [$errno] $errstr
\n"; - break; - - case E_USER_NOTICE: - echo "My NOTICE [$errno] $errstr
\n"; - break; - - default: - echo "[$errno] $errfile:$errline $errstr
\n"; - break; - } - - /* Don't execute PHP internal error handler */ - return true; -} - -// ************************************************************************** -// ************************************************************************** -// MAIN Code - Parse get parameters -// ************************************************************************** -// ************************************************************************** - -// Generic parameter handling -// ************************** -$id_agent = (int) get_parameter ('id_agent'); -$tipo = (string) get_parameter ('tipo'); -$pure = (bool) get_parameter ('pure'); -$period = (int) get_parameter ('period', 86400); -$interval = (int) get_parameter ('interval', 300); -$id = (string) get_parameter ('id'); -$weight_l = (string) get_parameter ('weight_l'); -$width = (int) get_parameter ('width', 450); -$height = (int) get_parameter ('height', 200); -// Decode received parameter ($label) in base 64 codification -$label = base64_decode((string) get_parameter ('label', '')); -$color = (string) get_parameter ('color', '#226677'); -$percent = (int) get_parameter ('percent', 100); -$zoom = (int) get_parameter ('zoom', 100); -$zoom /= 100; -if ($zoom <= 0 || $zoom > 1) - $zoom = 1; -$unit_name = (string) get_parameter ('unit_name'); -$draw_events = (int) get_parameter ('draw_events'); -$avg_only = (int) get_parameter ('avg_only'); -$draw_alerts = (int) get_parameter ('draw_alerts'); -$value1 = get_parameter ('value1'); -$value2 = get_parameter ('value2'); -$value3 = get_parameter("value3", 0); -$value4 = get_parameter ('value4'); -$stacked = get_parameter ("stacked", 0); -$date = get_parameter ("date"); -$graphic_type = (string) get_parameter ('tipo'); -$mode = get_parameter ("mode", 1); -$url = get_parameter ("url"); -$report_id = (int) get_parameter ("report_id", 0); -$baseline = (int) get_parameter ('baseline', 0); -$daysWeek = (string) get_parameter ('daysWeek', null); -$array = (string) get_parameter('array', null); -if ($graphic_type) { - switch ($graphic_type) { - case 'sparse': - grafico_modulo_sparse ($id, $period, $draw_events, $width, $height, - $label, $unit_name, $draw_alerts, $avg_only, $pure, $date, $baseline); - break; - case 'sparse_mobile': - grafico_modulo_sparse($id, $period, $draw_events, $width, $height, - $label, $unit_name, $draw_alerts, $avg_only, $pure, $date, - 0, 0, false); - break; - case "boolean": - grafico_modulo_boolean ($id, $period, $draw_events, $width, $height , - $label, $unit_name, $draw_alerts, 1, $pure, $date); - - break; - case "estado_incidente": - graph_incidents_status (); - - break; - case "prioridad_incidente": - grafico_incidente_prioridad (); - - break; - case "db_agente_modulo": - graph_db_agentes_modulos ($width, $height); - - break; - case "db_agente_paquetes": - grafico_db_agentes_paquetes ($width, $height); - - break; - case "db_agente_purge": - grafico_db_agentes_purge ($id, $width, $height); - - break; - case "event_module": - graph_event_module ($width, $height, $id_agent); - - break; - case "group_events": - grafico_eventos_grupo ($width, $height,$url); - - break; - case "user_events": - grafico_eventos_usuario ($width, $height); - - break; - case "total_events": - grafico_eventos_total (); - - break; - case "group_incident": - graphic_incident_group (); - - break; - case "user_incident": - graphic_incident_user (); - - break; - case "source_incident": - graphic_incident_source (); - - break; - case "user_activity": - graphic_user_activity ($width, $height); - - break; - case "agentaccess": - graphic_agentaccess ($id, $width, $height, $period); - - break; - case "agentmodules": - graphic_agentmodules ($id, $width, $height); - - break; - case "progress": - $percent = (int) get_parameter ('percent'); - progress_bar ($percent,$width,$height, $mode); - - break; - case "combined": - // Split id to get all parameters - $module_list = array(); - $module_list = explode (",", $id); - $weight_list = array(); - $weight_list = explode (",", $weight_l); - graphic_combined_module ($module_list, $weight_list, $period, $width, $height, - $label, $unit_name, $draw_events, $draw_alerts, $pure, $stacked, $date); - - break; - case "alerts_fired_pipe": - $data = array (); - $data[__('Alerts fired')] = (float) get_parameter ('fired'); - $data[__('Alerts not fired')] = (float) get_parameter ('not_fired'); - generic_pie_graph ($width, $height, $data); - - break; - case 'monitors_health_pipe': - $data = array (); - $data[__('Monitors OK')] = (float) get_parameter ('not_down'); - $data[__('Monitors BAD')] = (float) get_parameter ('down'); - generic_pie_graph ($width, $height, $data); - - break; - case 'string': - grafico_modulo_string ($id, $period, $draw_events, $width, $height, $label, $unit_name, $draw_alerts, $avg_only, $pure, $date); - break; - - case 'log4x': - grafico_modulo_log4x ($id, $period, $draw_events, $width, $height, $label, $unit_name, $draw_alerts, $avg_only, $pure, $date); - break; - - case 'sql_graph_vbar': - graph_custom_sql_graph ($report_id, $width, $height, 1); - break; - - case 'sql_graph_hbar': - graph_custom_sql_graph ($report_id, $width, $height, 2); - break; - - case 'sql_graph_pie': - graph_custom_sql_graph ($report_id, $width, $height, 3); - break; - - case 'sla_horizontal_graph': - graph_sla_horizontal ($id, $period, $value1, $value2, $daysWeek, $value3, $value4, $percent, $width, $height); - break; - case 'generic_pie_graph': - $data_pie_graph = array(); - $data_pie_graph = json_decode(io_safe_output($array), true); - generic_pie_graph ($width, $height, $data_pie_graph, array ('show_legend' => true)); - break; - case 'generic_horizontal_bar_graph': - $data_pie_graph = array(); - $data_pie_graph = json_decode(io_safe_output($array), true); - generic_horizontal_bar_graph ($width, $height, $data_pie_graph); - break; - - case 'graphic_error': - default: - graphic_error (); - } -} - -// For / url has problems rendering http://xxxx//include/FusionCharts/fussionCharts.js -// just make a substitution in / case -if ($config["homeurl"] == "/") - $pre_url = ""; -else - $pre_url = $config["homeurl"]; -?> - - - - diff --git a/pandora_console/include/functions_custom_graphs.php b/pandora_console/include/functions_custom_graphs.php index d1b5942abc..dbea4cdc69 100644 --- a/pandora_console/include/functions_custom_graphs.php +++ b/pandora_console/include/functions_custom_graphs.php @@ -24,11 +24,8 @@ * @global array Contents all var configs for the local instalation. */ global $config; -if ($config['flash_charts']) { - require_once ('include/fgraph.php'); -} -require_once ($config["homedir"] . '/include/functions_graph.php'); +require_once ($config['homedir'] . '/include/functions_graph.php'); require_once ($config['homedir'] . '/include/functions_users.php'); /** @@ -110,7 +107,7 @@ function custom_graphs_print ($id_graph, $height, $width, $period, $stacked, $re array_push ($weights, $source['weight']); } - $output = graphic_combined_module2($modules, $weights, $period, $width, $height, + $output = graphic_combined_module($modules, $weights, $period, $width, $height, '', '', 0, 0, 0, $stacked, $date); if ($return) diff --git a/pandora_console/include/functions_fsgraph.php b/pandora_console/include/functions_fsgraph.php deleted file mode 100644 index 7d76515e74..0000000000 --- a/pandora_console/include/functions_fsgraph.php +++ /dev/null @@ -1,370 +0,0 @@ -'; - $output .= ''; - return $output; -} - -// Returns a 3D bar chart -function fs_3d_bar_chart ($data, $width, $height) { - global $config; - - if (sizeof ($data) == 0) { - return fs_error_image (); - } - - // Generate the XML - $chart = new FusionCharts('Column3D', $width, $height); - - $empty = 1; - foreach ($data as $name => $value) { - if ($value > 0) { - $empty = 0; - } - $chart->addChartData($value, 'name=' . clean_flash_string($name) . ';color=95BB04'); - } - - $chart->setChartParams('showNames=1;rotateNames=1;showValues=0;showPercentageValues=0;showLimits=0;baseFontSize=9;' . ($empty == 1 ? ';yAxisMinValue=0;yAxisMaxValue=1' : '')); - - // Return the code - return get_chart_code ($chart, $width, $height, 'include/FusionCharts/FCF_Column3D.swf'); -} - -// Returns a 3D pie chart -function fs_3d_pie_chart ($data, $width, $height) { - global $config; - - if (sizeof ($data) == 0) { - return fs_error_image (); - } - - // Generate the XML - $chart = new FusionCharts('Pie3D', $width, $height); - $chart->setChartParams('showNames=1;showValues=0;showPercentageValues=0;baseFontSize=9'); - - $empty = 1; - foreach ($data as $name => $value) { - if ($value > 0) { - $empty = 0; - } - $chart->addChartData($value, 'name=' . clean_flash_string($name)); - } - - // Chart is not empty, but all elements are 0 - if ($empty == 1) { - return fs_error_image (); - } - - // Return the code - return get_chart_code ($chart, $width, $height, 'include/FusionCharts/FCF_Pie3D.swf'); -} - -// Returns a 2D area chart -function fs_2d_area_chart ($data, $width, $height, $step = 1, $params = '') { - global $config; - - if (sizeof ($data) == 0) { - return fs_error_image (); - } - - // Generate the XML - $chart = new FusionCharts('Area2D', $width, $height); - - $count = 0; - $num_vlines = 0; - $empty = 1; - foreach ($data as $name => $value) { - if ($count++ % $step == 0) { - $show_name = '1'; - $num_vlines++; - } else { - $show_name = '0'; - } - if ($value > 0) { - $empty = 0; - } - $chart->addChartData($value, 'name=' . clean_flash_string($name) . ';showName=' . $show_name . ';color=95BB04'); - } - - $chart->setChartParams('numVDivLines=' . $num_vlines . ';showAlternateVGridColor=1;showNames=1;rotateNames=1;showValues=0;baseFontSize=9;showLimits=0;showAreaBorder=1;areaBorderThickness=1;areaBorderColor=000000' . ($empty == 1 ? ';yAxisMinValue=0;yAxisMaxValue=1' : '') . $params); - - // Return the code - return get_chart_code ($chart, $width, $height, 'include/FusionCharts/FCF_Area2D.swf'); -} - -// Returns a Pandora FMS module chart -function fs_module_chart ($data, $width, $height, $avg_only = 1, $step = 10, $time_format = 'G:i', $show_events = 0, $show_alerts = 0, $caption = '', $baseline = 0) { - global $config; - - $graph_type = "MSArea2D"; //MSLine is possible also - - // Generate the XML - $chart = new FusionCharts($graph_type, $width, $height); - $num_vlines = 0; - $count = 0; - - // NO caption needed (graph avg/max/min stats are in the legend now) - /* - if ($caption != '') { - $chart->setChartParam("caption", $caption); - } - */ - - $total_max = 0; - $total_avg = 0; - $total_min = 0; - - // Create categories - foreach ($data as $value) { - - $total_avg +=$value["sum"]; - - if ($avg_only != 1){ - if ($value["max"] > $total_max) - $total_max =$value["max"]; - if ($value["min"] < $total_min) - $total_min =$value["min"]; - } - - if ($count++ % $step == 0) { - $show_name = '1'; - $num_vlines++; - } else { - $show_name = '0'; - } - $chart->addCategory(date($time_format, $value['timestamp_bottom']), 'hoverText=' . date (html_entity_decode ($config['date_format'], ENT_QUOTES, "UTF-8"), $value['timestamp_bottom']) . ';showName=' . $show_name); - } - - if ($count > 0) - $total_avg = format_for_graph($total_avg / $count); - else - $total_avg = 0; - - $total_min = format_for_graph ($total_min); - $total_max = format_for_graph ($total_max); - - // Event chart - if ($show_events == 1) { - $chart->addDataSet(__('Events'), 'alpha=50;showAreaBorder=1;areaBorderColor=#ff7f00;color=#ff7f00'); - foreach ($data as $value) { - $chart->addChartData($value['event']); - } - } - - // Alert chart - if ($show_alerts == 1) { - $chart->addDataSet(__('Alerts'), 'alpha=50;showAreaBorder=1;areaBorderColor=#ff0000;color=#ff0000'); - foreach ($data as $value) { - $chart->addChartData($value['alert']); - } - } - - // Max chart - if ($avg_only == 0) { - $chart->addDataSet(__('Max')." ($total_max)", 'color=' . $config['graph_color3']); - foreach ($data as $value) { - $chart->addChartData($value['max']); - } - } - - // Avg chart - $empty = 1; - $chart->addDataSet(__('Avg'). " ($total_avg)", 'color=' . $config['graph_color2']); - foreach ($data as $value) { - if ($value['sum'] > 0) { - $empty = 0; - } - $chart->addChartData($value['sum']); - } - - // Min chart - if ($avg_only == 0) { - $chart->addDataSet(__('Min'). " ($total_min)", 'color=' . $config['graph_color1']); - foreach ($data as $value) { - $chart->addChartData($value['min']); - } - } - - // Baseline chart - if ($baseline == 1) { - $chart->addDataSet(__('Baseline'), 'color=0097BD;alpha=10;showAreaBorder=0;'); - foreach ($data as $value) { - $chart->addChartData($value['baseline']); - } - } - - $chart->setChartParams('animation=0;numVDivLines=' . $num_vlines . ';showShadow=0;showAlternateVGridColor=1;showNames=1;rotateNames=1;lineThickness=0.1;anchorRadius=0.5;showValues=0;baseFontSize=9;showLimits=0;showAreaBorder=1;areaBorderThickness=0.1;areaBorderColor=000000' . ($empty == 1 ? ';yAxisMinValue=0;yAxisMaxValue=1' : '')); - - $random_number = rand (); - $div_id = 'chart_div_' . $random_number; - $chart_id = 'chart_' . $random_number; - $output = '
'; - $pre_url = ($config["homeurl"] == "/") ? '' : $config["homeurl"]; - - $output .= ''; - $output .= ''; - return $output; -} - -// Returns a Pandora FMS combined chart -function fs_combined_chart ($data, $categories, $sets, $width, $height, $type = 1, $step = 10, $time_format = 'G:i') { - global $config; - - if (sizeof ($data) == 0) { - return fs_error_image (); - } - - // Generate the XML - switch ($type) { - case 0: $chart_type = 'MSArea2D'; - break; - case 1: $chart_type = 'StackedArea2D'; - break; - case 2: $chart_type = 'MSLine'; - break; - case 3: $chart_type = 'MSLine'; - break; - default: $chart_type = 'StackedArea2D'; - } - - $chart = new FusionCharts($chart_type, $width, $height); - - // Create categories - $count = 0; - $num_vlines = 0; - foreach ($categories as $category) { - if ($count++ % $step == 0) { - $show_name = '1'; - $num_vlines++; - } else { - $show_name = '0'; - } - - $chart->addCategory(date($time_format, $category['timestamp_bottom']), 'hoverText=' . date (html_entity_decode ($config['date_format'], ENT_QUOTES, "UTF-8"), $category['timestamp_bottom']) . ';showName=' . $show_name); - } - - // Stack charts - - $empty = 1; - $prev = array(); - for ($i = 0; $i < sizeof ($data); $i++) { - $chart->addDataSet ($sets[$i]); - foreach ($data[$i] as $indice => $value) { - // Custom code to do the stack lines, because library doesn't do itself - if ($type == 3){ - if ($i > 0){ - $prev[$indice] = $prev[$indice] + $value; - } else { - $prev[$indice] = $value; - } - $myvalue = $prev[$indice]; - $chart->addChartData($myvalue); - } else { - $chart->addChartData($value); - } - } - } - - - $chart->setChartParams('legendAllowDrag=1;legendMarkerCircle=1;animation=0;numVDivLines=' . $num_vlines . ';showShadow=0; showAlternateVGridColor=1;showNames=1;lineThickness=2;anchorRadius=0.7;rotateNames=1;divLineAlpha=30;showValues=0;baseFontSize=9;showLimits=0;showAreaBorder=1;showPlotBorder=1;plotBorderThickness=0;areaBorderThickness=0;areaBorderColor=000000' . ($empty == 1 ? ';yAxisMinValue=0;yAxisMaxValue=1' : '')); - - // Return the code - return get_chart_code ($chart, $width, $height, 'include/FusionCharts/FCF_' . $chart_type . '.swf'); -} - -// Returns a Pandora FMS agent event chart -function fs_agent_event_chart ($data, $width, $height, $step = 1) { - global $config; - - if (sizeof ($data) == 0) { - return fs_error_image (); - } - - // Generate the XML - $chart = new FusionCharts('Area2D', $width, $height); - - $count = 0; - $num_vlines = 0; - foreach ($data as $name => $value) { - if ($count++ % $step == 0) { - $show_name = '1'; - $num_vlines++; - } else { - $show_name = '0'; - } - $chart->addChartData(1, 'name=' . clean_flash_string($name) . ';showName=' . $show_name . ';color=' . $value); - } - - $chart->setChartParams('numDivLines=0;numVDivLines=0;showNames=1;rotateNames=0;showValues=0;baseFontSize=9;showLimits=0;showAreaBorder=0;areaBorderThickness=1;canvasBgColor=9ABD18'); - - // Return the code - return get_chart_code ($chart, $width, $height, 'include/FusionCharts/FCF_Area2D.swf'); -} - -// Clean FLASH string strips non-valid characters for flashchart -function clean_flash_string ($string) { - $string = html_entity_decode ($string, ENT_QUOTES, "UTF-8"); - $string = str_replace('&', '', $string); - $string = str_replace(' ', '', $string); - $string = str_replace ('"', '', $string); - return substr ($string, 0, 20); -} - -// Prints an error image -function fs_error_image () { - global $config; - - return html_print_image("images/image_problem.png", true, array("border" => '0')); -} - -?> diff --git a/pandora_console/include/functions_graph.php b/pandora_console/include/functions_graph.php index 1ecab6161c..87c2c6b676 100755 --- a/pandora_console/include/functions_graph.php +++ b/pandora_console/include/functions_graph.php @@ -25,7 +25,7 @@ define("GRAPH_STACKED_AREA", 1); define("GRAPH_LINE", 2); define("GRAPH_STACKED_LINE", 3); -function grafico_modulo_sparse2 ($agent_module_id, $period, $show_events, +function grafico_modulo_sparse ($agent_module_id, $period, $show_events, $width, $height , $title = '', $unit_name = null, $show_alerts = false, $avg_only = 0, $pure = false, $date = 0, $unit = '', $baseline = 0, $return_data = 0, $show_title = true, @@ -106,7 +106,7 @@ function grafico_modulo_sparse2 ($agent_module_id, $period, $show_events, // Check available data if (count ($data) < $min_necessary) { if (!$graphic_type) { - return fs_error_image2 (); + return fs_error_image (); } graphic_error (); } @@ -333,7 +333,7 @@ function grafico_modulo_sparse2 ($agent_module_id, $period, $show_events, * * @return Mixed */ -function graphic_combined_module2 ($module_list, $weight_list, $period, $width, $height, +function graphic_combined_module ($module_list, $weight_list, $period, $width, $height, $title, $unit_name, $show_events = 0, $show_alerts = 0, $pure = 0, $stacked = 0, $date = 0, $only_image = false, $homeurl = '', $ttl = 1) { global $config; @@ -685,7 +685,7 @@ function graphic_combined_module2 ($module_list, $weight_list, $period, $width, * @param integer height pie graph height * @param integer period time period */ -function graphic_agentaccess2 ($id_agent, $width, $height, $period = 0) { +function graphic_agentaccess ($id_agent, $width, $height, $period = 0) { global $config; global $graphic_type; @@ -743,7 +743,7 @@ function graphic_agentaccess2 ($id_agent, $width, $height, $period = 0) { * @param integer height pie graph height * @param integer id_agent Agent ID */ -function graph_event_module2 ($width = 300, $height = 200, $id_agent) { +function graph_event_module ($width = 300, $height = 200, $id_agent) { global $config; global $graphic_type; @@ -770,7 +770,7 @@ function graph_event_module2 ($width = 300, $height = 200, $id_agent) { $events = db_get_all_rows_sql ($sql); if ($events === false) { if (! $graphic_type) { - return fs_error_image2 (); + return fs_error_image (); } graphic_error (); return; @@ -794,7 +794,7 @@ function graph_event_module2 ($width = 300, $height = 200, $id_agent) { $config['fontpath'], $config['font_size']); } -function progress_bar2($progress, $width, $height, $title = '', $mode = 1) { +function progress_bar($progress, $width, $height, $title = '', $mode = 1) { global $config; $out_of_lim_str = __("Out of limits"); @@ -825,7 +825,7 @@ function graph_sla_slicebar ($id, $period, $sla_min, $sla_max, $date, $daysWeek * @param integer width pie graph width * @param integer height pie graph height */ -function grafico_db_agentes_purge2 ($id_agent, $width, $height) { +function grafico_db_agentes_purge ($id_agent, $width, $height) { global $config; global $graphic_type; @@ -886,7 +886,7 @@ function grafico_db_agentes_purge2 ($id_agent, $width, $height) { * @param integer width pie graph width * @param integer height pie graph height */ -function grafico_db_agentes_paquetes2($width = 380, $height = 300) { +function grafico_db_agentes_paquetes($width = 380, $height = 300) { global $config; global $graphic_type; @@ -970,7 +970,7 @@ function graph_db_agentes_modulos2($width, $height) { * @param integer height pie graph height * @param integer period time period */ -function graphic_user_activity2 ($width = 350, $height = 230) { +function graphic_user_activity ($width = 350, $height = 230) { global $config; global $graphic_type; @@ -1009,7 +1009,7 @@ function graphic_user_activity2 ($width = 350, $height = 230) { /** * Print a pie graph with priodity incident */ -function grafico_incidente_prioridad2 () { +function grafico_incidente_prioridad () { global $config; global $graphic_type; @@ -1044,7 +1044,7 @@ function grafico_incidente_prioridad2 () { /** * Print a pie graph with incidents data */ -function graph_incidents_status2 () { +function graph_incidents_status () { global $config; global $graphic_type; $data = array (0, 0, 0, 0); @@ -1079,7 +1079,7 @@ function graph_incidents_status2 () { /** * Print a pie graph with incident data by group */ -function graphic_incident_group2 () { +function graphic_incident_group () { global $config; global $graphic_type; @@ -1112,7 +1112,7 @@ function graphic_incident_group2 () { * @param integer height pie graph height * @param integer period time period */ -function graphic_incident_user2 () { +function graphic_incident_user () { global $config; global $graphic_type; @@ -1149,7 +1149,7 @@ function graphic_incident_user2 () { * @param integer width pie graph width * @param integer height pie graph height */ -function graphic_incident_source2($width = 320, $height = 200) { +function graphic_incident_source($width = 320, $height = 200) { global $config; global $graphic_type; @@ -1194,7 +1194,7 @@ function graphic_incident_source2($width = 320, $height = 200) { * @param integer height pie graph height * @param string url */ -function grafico_eventos_grupo2 ($width = 300, $height = 200, $url = "") { +function grafico_eventos_grupo ($width = 300, $height = 200, $url = "") { global $config; global $graphic_type; @@ -1260,7 +1260,7 @@ function grafico_eventos_grupo2 ($width = 300, $height = 200, $url = "") { * * @param string filter Filter for query in DB */ -function grafico_eventos_total2($filter = "") { +function grafico_eventos_total($filter = "") { global $config; global $graphic_type; @@ -1297,7 +1297,7 @@ function grafico_eventos_total2($filter = "") { * @param integer height pie graph height * @param integer period time period */ -function grafico_eventos_usuario2 ($width, $height) { +function grafico_eventos_usuario ($width, $height) { global $config; global $graphic_type; @@ -1337,7 +1337,7 @@ function grafico_eventos_usuario2 ($width, $height) { * @param integer width graph width * @param integer Graph type 1 vbar, 2 hbar, 3 pie */ -function graph_custom_sql_graph2 ($id, $width, $height, $type = 'sql_graph_vbar', $only_image = false, $homeurl = '', $ttl = 1) { +function graph_custom_sql_graph ($id, $width, $height, $type = 'sql_graph_vbar', $only_image = false, $homeurl = '', $ttl = 1) { global $config; $report_content = db_get_row ('treport_content', 'id_rc', $id); @@ -1407,7 +1407,7 @@ function graph_custom_sql_graph2 ($id, $width, $height, $type = 'sql_graph_vbar' * @param integer height pie graph height * @param integer period time period */ -function graphic_agentevents2 ($id_agent, $width, $height, $period = 0) { +function graphic_agentevents ($id_agent, $width, $height, $period = 0) { global $config; global $graphic_type; @@ -1450,12 +1450,12 @@ function graphic_agentevents2 ($id_agent, $width, $height, $period = 0) { } if (! $graphic_type) { - return fs_agent_event_chart2 ($data, $width, $height, $resolution / 750); + return fs_agent_event_chart ($data, $width, $height, $resolution / 750); } } // Clean FLASH string strips non-valid characters for flashchart -function clean_flash_string2 ($string) { +function clean_flash_string ($string) { $string = html_entity_decode ($string, ENT_QUOTES, "UTF-8"); $string = str_replace('&', '', $string); $string = str_replace(' ', '', $string); @@ -1464,11 +1464,11 @@ function clean_flash_string2 ($string) { } // Returns a Pandora FMS agent event chart -function fs_agent_event_chart2 ($data, $width, $height, $step = 1) { +function fs_agent_event_chart ($data, $width, $height, $step = 1) { global $config; if (sizeof ($data) == 0) { - return fs_error_image2 (); + return fs_error_image (); } // Generate the XML @@ -1483,24 +1483,24 @@ function fs_agent_event_chart2 ($data, $width, $height, $step = 1) { } else { $show_name = '0'; } - $chart->addChartData(1, 'name=' . clean_flash_string2($name) . ';showName=' . $show_name . ';color=' . $value); + $chart->addChartData(1, 'name=' . clean_flash_string($name) . ';showName=' . $show_name . ';color=' . $value); } $chart->setChartParams('numDivLines=0;numVDivLines=0;showNames=1;rotateNames=0;showValues=0;baseFontSize=9;showLimits=0;showAreaBorder=0;areaBorderThickness=1;canvasBgColor=9ABD18'); // Return the code - return get_chart_code2 ($chart, $width, $height, 'include/FusionCharts/FCF_Area2D.swf'); + return get_chart_code ($chart, $width, $height, 'include/FusionCharts/FCF_Area2D.swf'); } // Prints an error image -function fs_error_image2 () { +function fs_error_image () { global $config; return html_print_image("images/image_problem.png", true, array("border" => '0')); } -function grafico_modulo_boolean2 ($agent_module_id, $period, $show_events, +function grafico_modulo_boolean ($agent_module_id, $period, $show_events, $width, $height , $title, $unit_name, $show_alerts, $avg_only = 0, $pure=0, $date = 0, $only_image = false, $homeurl = '') { global $config; @@ -1578,7 +1578,7 @@ function grafico_modulo_boolean2 ($agent_module_id, $period, $show_events, // Check available data if (count ($data) < $min_necessary) { if (!$graphic_type) { - return fs_error_image2 (); + return fs_error_image (); } graphic_error (); } @@ -1814,7 +1814,7 @@ function grafico_modulo_boolean2 ($agent_module_id, $period, $show_events, * @param integer pure Fullscreen (1 or 0) * @param integer date date */ -function grafico_modulo_string2 ($agent_module_id, $period, $show_events, +function grafico_modulo_string ($agent_module_id, $period, $show_events, $width, $height , $title, $unit_name, $show_alerts, $avg_only = 0, $pure=0, $date = 0, $only_image = false, $homeurl = '') { global $config; @@ -1892,7 +1892,7 @@ function grafico_modulo_string2 ($agent_module_id, $period, $show_events, // Check available data if (count ($data) < $min_necessary) { if (!$graphic_type) { - return fs_error_image2 (); + return fs_error_image (); } graphic_error (); } @@ -2033,12 +2033,12 @@ function grafico_modulo_string2 ($agent_module_id, $period, $show_events, $config['fontpath'], $config['font_size'], ""); } -function grafico_modulo_log4x_2 ($id_agente_modulo, $periodo, $show_event, +function grafico_modulo_log4x ($id_agente_modulo, $periodo, $show_event, $width, $height , $title, $unit_name, $show_alert, $avg_only = 0, $pure=0, $date = 0) { - grafico_modulo_log4x_trace2("
");
+        grafico_modulo_log4x_trace("
");
 
 	if ($date == "")
 		$now = time ();
@@ -2073,7 +2073,7 @@ function grafico_modulo_log4x_2 ($id_agente_modulo, $periodo, $show_event,
 
         $num_slices = $periodo / $adjust_time;
 
-        $fechatope_index = grafico_modulo_log4x_index2($fechatope, $adjust_time);
+        $fechatope_index = grafico_modulo_log4x_index($fechatope, $adjust_time);
 
         $sql1="SELECT utimestamp, SEVERITY " .
                 " FROM tagente_datos_log4x " .
@@ -2084,7 +2084,7 @@ function grafico_modulo_log4x_2 ($id_agente_modulo, $periodo, $show_event,
         $max_count = -1;
         $min_count = 9999999;
 
-        grafico_modulo_log4x_trace2("$sql1");
+        grafico_modulo_log4x_trace("$sql1");
 
         $rows = 0;
         
@@ -2100,7 +2100,7 @@ function grafico_modulo_log4x_2 ($id_agente_modulo, $periodo, $show_event,
                 if (!isset($valores[$severity]))
                         $valores[$severity] = array();
 
-                $dest = grafico_modulo_log4x_index2($utimestamp, $adjust_time);
+                $dest = grafico_modulo_log4x_index($utimestamp, $adjust_time);
 
                 $index = (($dest - $fechatope_index) / $adjust_time) - 1;
 
@@ -2117,25 +2117,25 @@ function grafico_modulo_log4x_2 ($id_agente_modulo, $periodo, $show_event,
                 $min_count = min($min_count, $valores[$severity][$index]['count']);
        }
 
-        grafico_modulo_log4x_trace2("$rows rows");
+        grafico_modulo_log4x_trace("$rows rows");
 
         // Create graph
         // *************
 
-        grafico_modulo_log4x_trace2(__LINE__);
+        grafico_modulo_log4x_trace(__LINE__);
 
 	//set_error_handler("myErrorHandler");
 
-        grafico_modulo_log4x_trace2(__LINE__);
+        grafico_modulo_log4x_trace(__LINE__);
 	set_include_path(get_include_path() . PATH_SEPARATOR . getcwd() . "/../../include");
 
 	require_once 'Image/Graph.php';
 
-        grafico_modulo_log4x_trace2(__LINE__);
+        grafico_modulo_log4x_trace(__LINE__);
 
         $Graph =& Image_Graph::factory('graph', array($width, $height));
  
-        grafico_modulo_log4x_trace2(__LINE__);
+        grafico_modulo_log4x_trace(__LINE__);
 
 
 
@@ -2169,7 +2169,7 @@ function grafico_modulo_log4x_2 ($id_agente_modulo, $periodo, $show_event,
 
         $title_period = html_entity_decode($title_period);
 
-        grafico_modulo_log4x_trace2(__LINE__);
+        grafico_modulo_log4x_trace(__LINE__);
 
         if ($pure == 0){
                 $Graph->add(
@@ -2199,7 +2199,7 @@ function grafico_modulo_log4x_2 ($id_agente_modulo, $periodo, $show_event,
                 $Graph->add($Plotarea = Image_Graph::factory('plotarea', array('Image_Graph_Axis', 'Image_Graph_Axis')));
         }
 
-        grafico_modulo_log4x_trace2(__LINE__);
+        grafico_modulo_log4x_trace(__LINE__);
 
         $dataset = array();
 
@@ -2224,7 +2224,7 @@ function grafico_modulo_log4x_2 ($id_agente_modulo, $periodo, $show_event,
                                 $x = 100.0 * ($pivot - $fechatope) / ($now - $fechatope);
                                 if ($x > 100) $x = 100;
 
-                                $size = grafico_modulo_log4x_bubble_size2($count, $max_count, $max_bubble_radius);
+                                $size = grafico_modulo_log4x_bubble_size($count, $max_count, $max_bubble_radius);
 
                                 // pivot is the value in the X axis
                                 // y is the number of steps (from the bottom of the graphics) (zero based)
@@ -2244,14 +2244,14 @@ function grafico_modulo_log4x_2 ($id_agente_modulo, $periodo, $show_event,
                 $i++;
         }
 
-        grafico_modulo_log4x_trace2(__LINE__);
+        grafico_modulo_log4x_trace(__LINE__);
 
         // create the 1st plot as smoothed area chart using the 1st dataset
         $Plot =& $Plotarea->addNew('bubble', array(&$dataset));
         $Plot->setFont($Font);
 
         $AxisX =& $Plotarea->getAxis(IMAGE_GRAPH_AXIS_X);
-        $AxisX->setDataPreprocessor(Image_Graph::factory('Image_Graph_DataPreprocessor_Function', 'grafico_modulo_log4x_format_x_axis2'));
+        $AxisX->setDataPreprocessor(Image_Graph::factory('Image_Graph_DataPreprocessor_Function', 'grafico_modulo_log4x_format_x_axis'));
         $AxisX->forceMinimum($fechatope);
         $AxisX->forceMaximum($now);
 
@@ -2277,10 +2277,10 @@ function grafico_modulo_log4x_2 ($id_agente_modulo, $periodo, $show_event,
         //$GridY2->setLineStyle(Image_Graph::factory('Image_Graph_Line_Dotted', array("white", "gray", "gray", "gray")));
         $GridY2->setLineStyle(Image_Graph::factory('Image_Graph_Line_Formatted', array(array("transparent", "transparent", "transparent", "gray"))));
         //*/
-        //grafico_modulo_log4x_trace2(print_r($AxisX, true));
+        //grafico_modulo_log4x_trace(print_r($AxisX, true));
 
         $AxisY =& $Plotarea->getAxis(IMAGE_GRAPH_AXIS_Y);
-        $AxisY->setDataPreprocessor(Image_Graph::factory('Image_Graph_DataPreprocessor_Function', 'grafico_modulo_log4x_format_y_axis2'));
+        $AxisY->setDataPreprocessor(Image_Graph::factory('Image_Graph_DataPreprocessor_Function', 'grafico_modulo_log4x_format_y_axis'));
         $AxisY->setLabelOption("showtext",true);
         //$AxisY->setLabelInterval(0);
         //$AxisY->showLabel(IMAGE_GRAPH_LABEL_ZERO);
@@ -2303,7 +2303,7 @@ function grafico_modulo_log4x_2 ($id_agente_modulo, $periodo, $show_event,
         foreach($colors as $color)
                 $FillArray->addColor($color);
 
-        grafico_modulo_log4x_trace2(__LINE__);
+        grafico_modulo_log4x_trace(__LINE__);
 
         $FillArray->addColor('green@0.6');
         //$AxisY_Weather =& $Plotarea->getAxis(IMAGE_GRAPH_AXIS_Y);
@@ -2326,24 +2326,24 @@ function grafico_modulo_log4x_2 ($id_agente_modulo, $periodo, $show_event,
 
         $plotMinMax =& $PlotareaMinMax->addNew('bubble', array(&$dataset, true));
 
-        grafico_modulo_log4x_trace2(__LINE__);
+        grafico_modulo_log4x_trace(__LINE__);
 
         $Graph->done();
 
-        grafico_modulo_log4x_trace2(__LINE__);
+        grafico_modulo_log4x_trace(__LINE__);
 }
 
-function grafico_modulo_log4x_index2($x, $interval)
+function grafico_modulo_log4x_index($x, $interval)
 {
         return $x + $interval - (($x - 1) % $interval) - 1;
 }
 
-function grafico_modulo_log4x_trace2($str)
+function grafico_modulo_log4x_trace($str)
 {
         //echo "$str\n";
 }
 
-function grafico_modulo_log4x_bubble_size2($count, $max_count, $max_bubble_radius)
+function grafico_modulo_log4x_bubble_size($count, $max_count, $max_bubble_radius)
 {
         //Superformula de ROA
         $r0 = 1.5;
@@ -2377,7 +2377,7 @@ function grafico_modulo_log4x_bubble_size2($count, $max_count, $max_bubble_radiu
         return 5 + log($count);
 }
 
-function grafico_modulo_log4x_format_x_axis2 ( $number , $decimals=2, $dec_point=".", $thousands_sep=",")
+function grafico_modulo_log4x_format_x_axis ( $number , $decimals=2, $dec_point=".", $thousands_sep=",")
 {
         // $number is the unix time in the local timezone
 
@@ -2389,7 +2389,7 @@ function grafico_modulo_log4x_format_x_axis2 ( $number , $decimals=2, $dec_point
         return date("d/m", $number) . "\n" . date("H:i", $number);
 }
 
-function grafico_modulo_log4x_format_y_axis2 ( $number , $decimals=2, $dec_point=".", $thousands_sep=",")
+function grafico_modulo_log4x_format_y_axis ( $number , $decimals=2, $dec_point=".", $thousands_sep=",")
 {
         $n = "";
 
diff --git a/pandora_console/include/functions_reporting.php b/pandora_console/include/functions_reporting.php
index 90439a9550..c926fb0e01 100644
--- a/pandora_console/include/functions_reporting.php
+++ b/pandora_console/include/functions_reporting.php
@@ -25,7 +25,6 @@
 require_once ($config["homedir"]."/include/functions.php");
 require_once ($config["homedir"]."/include/functions_db.php");
 require_once ($config["homedir"]."/include/functions_agents.php");
-//include_once ($config["homedir"]."/include/fgraph.php");
 include_once($config["homedir"] . "/include/functions_groups.php");
 require_once ('functions_graph.php');
 include_once($config['homedir'] . "/include/functions_modules.php");
@@ -2051,7 +2050,7 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
 			
 			$data = array ();
 			
-			$data[0] = grafico_modulo_sparse2($content['id_agent_module'], $content['period'],
+			$data[0] = grafico_modulo_sparse($content['id_agent_module'], $content['period'],
 				false, $sizgraph_w, $sizgraph_h, '', '', false, true, true,
 				$report["datetime"], '', 0, 0, true, true);
 			
@@ -2077,7 +2076,7 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
 			}
 			
 			$data = array ();
-			$data[0] = grafico_modulo_sparse2($layout_data['id_agente_modulo'], $content['period'],
+			$data[0] = grafico_modulo_sparse($layout_data['id_agente_modulo'], $content['period'],
 				false, $sizgraph_w, $sizgraph_h, '', '', false, true, true,
 				$report["datetime"], '', true, 0, true, true);
 			array_push ($table->data, $data);
@@ -2121,7 +2120,7 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
 			$data = array ();
 			
 			require_once ($config["homedir"] . '/include/functions_graph.php');
-			$data[0] = 	graphic_combined_module2(
+			$data[0] = 	graphic_combined_module(
 				$modules,
 				$weights,
 				$content['period'],
@@ -2589,7 +2588,7 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
 			
 			$data = array ();
 			
-			$data[0] = graph_custom_sql_graph2($content["id_rc"], $sizgraph_w, 200, $content["type"], true);
+			$data[0] = graph_custom_sql_graph($content["id_rc"], $sizgraph_w, 200, $content["type"], true);
 
 			array_push($table->data, $data);
 			break;
diff --git a/pandora_console/include/functions_visual_map.php b/pandora_console/include/functions_visual_map.php
index 2a264bc746..4f671c6024 100644
--- a/pandora_console/include/functions_visual_map.php
+++ b/pandora_console/include/functions_visual_map.php
@@ -117,12 +117,12 @@ function visual_map_print_item($layoutData) {
 			
 			echo '
'; echo $text . '
'; - echo progress_bar2($percentile, $width, 15); + echo progress_bar($percentile, $width, 15); echo '
'; break; case MODULE_GRAPH: - $img = grafico_modulo_sparse2($id_module, $period, 0, $width, + $img = grafico_modulo_sparse($id_module, $period, 0, $width, $height, '', null, false, 0, false, 0, '', 0, 0, true, true); $img = str_replace('>', 'class="image" id="image_' . $id . '" />', $img); @@ -877,9 +877,9 @@ function visual_map_print_visual_map ($id_layout, $show_links = true, $draw_line echo "
"; if ($resizedMap) - echo progress_bar2($percentile, ((integer)($proportion * $width)), 15); + echo progress_bar($percentile, ((integer)($proportion * $width)), 15); else - echo progress_bar2($percentile, $width, 15); + echo progress_bar($percentile, $width, 15); if ($endTagA) echo ''; @@ -930,12 +930,12 @@ function visual_map_print_visual_map ($id_layout, $show_links = true, $draw_line // ATTENTION: DO NOT USE & here because is bad-translated and doesnt work // resulting fault image links :( - echo grafico_modulo_sparse2 ($layout_data['id_agente_modulo'], $layout_data['period'], + echo grafico_modulo_sparse ($layout_data['id_agente_modulo'], $layout_data['period'], false, ((integer)($proportion * $layout_data['width'])), ((integer)($proportion * $layout_data['height'])), '', null, false, 0, false, 0, '', 0, 0, true, true); } else { - echo grafico_modulo_sparse2 ($layout_data['id_agente_modulo'], $layout_data['period'], + echo grafico_modulo_sparse ($layout_data['id_agente_modulo'], $layout_data['period'], false, $layout_data['width'], $layout_data['height'], '', null, false, 0, false, 0, '', 0, 0, true, true); } diff --git a/pandora_console/include/graphs/fgraph.php b/pandora_console/include/graphs/fgraph.php index bae9b24af6..9a1c4981b5 100755 --- a/pandora_console/include/graphs/fgraph.php +++ b/pandora_console/include/graphs/fgraph.php @@ -407,7 +407,7 @@ function pie_graph($graph_type, $flash_chart, $chart_data, $width, $height, return fs_2d_pie_chart (array_values($chart_data), array_keys($chart_data), $width, $height); break; case "3d": - return fs_3d_pie_chart2(array_values($chart_data), array_keys($chart_data), $width, $height); + return fs_3d_pie_chart(array_values($chart_data), array_keys($chart_data), $width, $height); break; } } diff --git a/pandora_console/include/graphs/functions_fsgraph.php b/pandora_console/include/graphs/functions_fsgraph.php index efc789b49f..c5bee76ed4 100755 --- a/pandora_console/include/graphs/functions_fsgraph.php +++ b/pandora_console/include/graphs/functions_fsgraph.php @@ -462,7 +462,7 @@ function date_to_epoch ($date) { } // Returns the code needed to display the chart -function get_chart_code2 ($chart, $width, $height, $swf) { +function get_chart_code ($chart, $width, $height, $swf) { $random_number = rand (); $div_id = 'chart_div_' . $random_number; $chart_id = 'chart_' . $random_number; @@ -480,7 +480,7 @@ function get_chart_code2 ($chart, $width, $height, $swf) { } // Prints a 3D pie chart -function fs_3d_pie_chart2 ($data, $names, $width, $height, $background = "EEEEEE") { +function fs_3d_pie_chart ($data, $names, $width, $height, $background = "EEEEEE") { if ((sizeof ($data) != sizeof ($names)) OR (sizeof($data) == 0) ){ return; } @@ -492,11 +492,11 @@ function fs_3d_pie_chart2 ($data, $names, $width, $height, $background = "EEEEEE $chart->setChartParams($params); for ($i = 0; $i < sizeof ($data); $i++) { - $chart->addChartData($data[$i], 'name=' . clean_flash_string2($names[$i])); + $chart->addChartData($data[$i], 'name=' . clean_flash_string($names[$i])); } // Return the code - return get_chart_code2 ($chart, $width, $height, 'include/graphs/FusionCharts/FCF_Pie3D.swf'); + return get_chart_code ($chart, $width, $height, 'include/graphs/FusionCharts/FCF_Pie3D.swf'); } // Prints a 2D pie chart @@ -512,11 +512,11 @@ function fs_2d_pie_chart ($data, $names, $width, $height, $background = "EEEEEE" $chart->setChartParams($params); for ($i = 0; $i < sizeof ($data); $i++) { - $chart->addChartData($data[$i], 'name=' . clean_flash_string2($names[$i])); + $chart->addChartData($data[$i], 'name=' . clean_flash_string($names[$i])); } // Return the code - return get_chart_code2 ($chart, $width, $height, 'include/graphs/FusionCharts/FCF_Pie2D.swf'); + return get_chart_code ($chart, $width, $height, 'include/graphs/FusionCharts/FCF_Pie2D.swf'); } // Returns a 2D column chart @@ -583,7 +583,7 @@ function fs_2d_column_chart ($data, $width, $height) { if ($value > 0) { $empty = 0; } - $chart->addChartData($value, 'name=' . clean_flash_string2($name) . ';showName=' . $show_name . ';color=95BB04'); + $chart->addChartData($value, 'name=' . clean_flash_string($name) . ';showName=' . $show_name . ';color=95BB04'); } } @@ -658,7 +658,7 @@ function fs_2d_hcolumn_chart ($data, $width, $height) { if ($value > 0) { $empty = 0; } - $chart->addChartData($value, 'name=' . clean_flash_string2($name) . ';showName=' . $show_name/* . ';color=95BB04'*/); + $chart->addChartData($value, 'name=' . clean_flash_string($name) . ';showName=' . $show_name/* . ';color=95BB04'*/); } } @@ -667,7 +667,7 @@ function fs_2d_hcolumn_chart ($data, $width, $height) { $chart->setChartParams($params.';numVDivLines='.$num_vlines.($empty == 1 ? ';yAxisMinValue=0;yAxisMaxValue=1' : '')); // Return the code - return get_chart_code2 ($chart, $width, $height, 'include/graphs/FusionCharts/FCF_Bar2D.swf'); + return get_chart_code ($chart, $width, $height, 'include/graphs/FusionCharts/FCF_Bar2D.swf'); } // Returns a 3D column chart @@ -695,14 +695,14 @@ function fs_3d_column_chart ($data, $width, $height) { if ($value > 0) { $empty = 0; } - $chart->addChartData($value, 'name=' . clean_flash_string2($name) . ';showName=' . $show_name . ';color=95BB04'); + $chart->addChartData($value, 'name=' . clean_flash_string($name) . ';showName=' . $show_name . ';color=95BB04'); } $chart->setChartParams('decimalPrecision=0;showAlternateVGridColor=1; numVDivLines='.$num_vlines.';showNames=1;rotateNames=1;showValues=0;showPercentageValues=0;showLimits=0;baseFontSize=9;' . ($empty == 1 ? ';yAxisMinValue=0;yAxisMaxValue=1' : '')); // Return the code - return get_chart_code2 ($chart, $width, $height, 'include/graphs/FusionCharts/FCF_Column2D.swf'); + return get_chart_code ($chart, $width, $height, 'include/graphs/FusionCharts/FCF_Column2D.swf'); } // Prints a Gantt chart @@ -828,7 +828,7 @@ function fs_gantt_chart ($title, $from, $to, $tasks, $milestones, $width, $heigh // Tasks foreach ($tasks as $task) { - $chart->addGanttProcess (clean_flash_string2($task['name']), 'id=' . $task['id'] . ';link=' . urlencode($task['link'])); + $chart->addGanttProcess (clean_flash_string($task['name']), 'id=' . $task['id'] . ';link=' . urlencode($task['link'])); $chart->addGanttTask (__('Planned'), 'start=' . $task['start'] . ';end=' . $task['end'] . ';id=' . $task['id'] . ';processId=' . $task['id'] . ';color=4b3cff;height=5;topPadding=10;animation=0'); @@ -849,7 +849,7 @@ function fs_gantt_chart ($title, $from, $to, $tasks, $milestones, $width, $heigh if ($milestones !== '') { $chart->addGanttProcess (__('Milestones'), 'id=0'); foreach ($milestones as $milestone) { - $chart->addGanttTask (clean_flash_string2($milestone['name']), 'start=' . $milestone['date'] . ';end=' . $milestone['date'] . ';id=ms-' . $milestone['id'] . ';processId=0;color=ffffff;alpha=0;height=60;topPadding=0;animation=0'); + $chart->addGanttTask (clean_flash_string($milestone['name']), 'start=' . $milestone['date'] . ';end=' . $milestone['date'] . ';id=ms-' . $milestone['id'] . ';processId=0;color=ffffff;alpha=0;height=60;topPadding=0;animation=0'); $chart->addGanttMilestone ('ms-' . $milestone['id'], 'date=' . $milestone['date'] . ';radius=8;color=efbb07;shape=star;numSides=3;borderThickness=1'); } } @@ -858,7 +858,7 @@ function fs_gantt_chart ($title, $from, $to, $tasks, $milestones, $width, $heigh $chart->addTrendLine ('start=' . date ('d/m/Y') . ';displayValue='. __('Today') . ';color=666666;isTrendZone=1;alpha=20'); // Return the code - return get_chart_code2 ($chart, $width, $height, 'include/graphs/FusionCharts/FCF_Gantt.swf'); + return get_chart_code ($chart, $width, $height, 'include/graphs/FusionCharts/FCF_Gantt.swf'); } ?> diff --git a/pandora_console/include/pandora_graph.php b/pandora_console/include/pandora_graph.php deleted file mode 100644 index 94834fd147..0000000000 --- a/pandora_console/include/pandora_graph.php +++ /dev/null @@ -1,99 +0,0 @@ -load_palette ($config['graphics_palette']); - } else { - exit; - } - - $engine->graph_color[1] = $config['graph_color1']; - $engine->graph_color[2] = $config['graph_color2']; - $engine->graph_color[3] = $config['graph_color3']; - - $engine->graph_color[4] = "#FED000"; // Yellow - $engine->graph_color[5] = "#00FEF0"; // Cyan - $engine->graph_color[6] = "#FF81EC"; // Pink - $engine->graph_color[7] = "#FF8D00"; // Orange - $engine->graph_color[8] = "#7E7E7E"; // Grey - $engine->graph_color[9] = "#000000"; // Black - - if ($period <= 86400) - $engine->date_format = 'g:iA'; - elseif ($period <= 604800) - $engine->date_format = 'd/m'; - else - $engine->date_format = 'd/m/y'; - - return $engine; -} - -?> diff --git a/pandora_console/mobile/operation/agents/tactical.php b/pandora_console/mobile/operation/agents/tactical.php index 51b6c3dd5d..5c886a147c 100644 --- a/pandora_console/mobile/operation/agents/tactical.php +++ b/pandora_console/mobile/operation/agents/tactical.php @@ -43,16 +43,16 @@ class Tactical { $table->data[0][0] = "

" . __('Status') . "

" ; $table->data[1][0] = '' . __('G') . ' '; $table->data[1][1] = - progress_bar2($data["global_health"], 70, 8, '', 0); + progress_bar($data["global_health"], 70, 8, '', 0); $table->data[2][0] = '' . __('M') . ' '; $table->data[2][1] = - progress_bar2($data["monitor_health"], 70, 8, '', 0); + progress_bar($data["monitor_health"], 70, 8, '', 0); $table->data[3][0] = '' . __('M') . ' '; $table->data[3][1] = - progress_bar2($data["module_sanity"], 70, 8, '', 0); + progress_bar($data["module_sanity"], 70, 8, '', 0); $table->data[4][0] = '' . __('A') . ' '; $table->data[4][1] = - progress_bar2($data["alert_level"], 70, 8, '', 0); + progress_bar($data["alert_level"], 70, 8, '', 0); $table->data[5][0] = $table->data[5][1] = ''; $table->data[6][0] = $table->data[6][1] = ''; $table->data[7][0] = $table->data[7][1] = ''; @@ -116,4 +116,4 @@ class Tactical { html_print_table($table); } } -?> \ No newline at end of file +?> diff --git a/pandora_console/mobile/operation/agents/view_agents.php b/pandora_console/mobile/operation/agents/view_agents.php index 1bb4643fc4..bc458db1ae 100644 --- a/pandora_console/mobile/operation/agents/view_agents.php +++ b/pandora_console/mobile/operation/agents/view_agents.php @@ -409,7 +409,7 @@ class viewGraph { echo "

" . __('Graph') . "

"; - echo grafico_modulo_sparse2($this->idAgentModule, $this->period, 0, 240, + echo grafico_modulo_sparse($this->idAgentModule, $this->period, 0, 240, 120, io_safe_output($this->agentModule['nombre']), null, true, 0, true, 0, true, true, true, true); @@ -538,4 +538,4 @@ class viewGraph { echo $pagination; } } -?> \ No newline at end of file +?> diff --git a/pandora_console/operation/agentes/estado_generalagente.php b/pandora_console/operation/agentes/estado_generalagente.php index 2fc542e823..e6131713ed 100644 --- a/pandora_console/operation/agentes/estado_generalagente.php +++ b/pandora_console/operation/agentes/estado_generalagente.php @@ -52,13 +52,13 @@ echo '
 
'; echo '
'; echo ''.__('Agent access rate (24h)').'
'; -graphic_agentaccess2($id_agente, 280, 110, 86400); +graphic_agentaccess($id_agente, 280, 110, 86400); echo '
 
'; echo ''.__('Events generated -by module-').'
'; -echo graph_event_module2 (290, 120, $id_agente); +echo graph_event_module (290, 120, $id_agente); if ($config['flash_charts']) { - echo graphic_agentevents2 ($id_agente, 290, 60, 86400); + echo graphic_agentevents ($id_agente, 290, 60, 86400); } echo '
'; @@ -177,7 +177,7 @@ if ($agent['timezone_offset'] != 0) { $progress = agents_get_next_contact($id_agente); echo ''.__('Next agent contact').''; -echo '' . progress_bar2($progress, 200, 20) . ''; +echo '' . progress_bar($progress, 200, 20) . ''; // Custom fields $fields = db_get_all_rows_filter('tagent_custom_fields', array('display_on_front' => 1)); diff --git a/pandora_console/operation/agentes/graphs.php b/pandora_console/operation/agentes/graphs.php index 32a63a4a52..7cfa7fdb4d 100644 --- a/pandora_console/operation/agentes/graphs.php +++ b/pandora_console/operation/agentes/graphs.php @@ -126,7 +126,7 @@ else foreach ($modulesChecked as $idModuleShowGraph => $value) { echo "

" . $modules[$idModuleShowGraph] . '

'; $unit = modules_get_unit ($idModuleShowGraph); - echo grafico_modulo_sparse2($idModuleShowGraph, $period, $draw_events, $width, $height, + echo grafico_modulo_sparse($idModuleShowGraph, $period, $draw_events, $width, $height, $modules[$idModuleShowGraph], null, $draw_alerts, $avg_only, false, $date, $unit); } diff --git a/pandora_console/operation/agentes/stat_win.php b/pandora_console/operation/agentes/stat_win.php index e0cc57eb89..4d2250140e 100644 --- a/pandora_console/operation/agentes/stat_win.php +++ b/pandora_console/operation/agentes/stat_win.php @@ -148,24 +148,24 @@ $urlImage .= $config['dbhost'] . $config['homeurl'] . '/'; // switch ($graph_type) { case 'boolean': - echo grafico_modulo_boolean2 ($id, $period, $draw_events, $width, $height, + echo grafico_modulo_boolean ($id, $period, $draw_events, $width, $height, $label, null, $draw_alerts, 1, false, $date, false, $urlImage); break; case 'sparse': - echo grafico_modulo_sparse2 ($id, $period, $draw_events, $width, $height, + echo grafico_modulo_sparse ($id, $period, $draw_events, $width, $height, $label, null, $draw_alerts, $avg_only, false, $date, '', $baseline, 0, true, false, $urlImage); break; case 'string': - echo grafico_modulo_string2 ($id, $period, $draw_events, $width, $height, + echo grafico_modulo_string ($id, $period, $draw_events, $width, $height, $label, null, $draw_alerts, 1, false, $date, false, $urlImage); break; case 'log4x': - echo grafico_modulo_log4x_2 ($id, $period, $draw_events, $width, $height, + echo grafico_modulo_log4x ($id, $period, $draw_events, $width, $height, $label, $unit_name, $draw_alerts, 1, $pure, $date, 1); break; default: - echo fs_error_image2 ('../images'); + echo fs_error_image ('../images'); break; } diff --git a/pandora_console/operation/agentes/tactical.php b/pandora_console/operation/agentes/tactical.php index e8ecff685e..c5f856c9d8 100644 --- a/pandora_console/operation/agentes/tactical.php +++ b/pandora_console/operation/agentes/tactical.php @@ -86,28 +86,28 @@ $table->data[0][0] =''.__('Global health').''; $table->style[1] = "padding-top:4px; padding-bottom:4px;"; $table->data[1][0] = - progress_bar2($data["global_health"], 140, 20, $data["global_health"].'% '.__('of monitors OK'), 0); + progress_bar($data["global_health"], 140, 20, $data["global_health"].'% '.__('of monitors OK'), 0); $table->style[2] = "padding-top:4px; padding-bottom:4px;"; $table->data[2][0] =''.__('Monitor health').''; $table->style[3] = "padding-top:4px; padding-bottom:4px;"; $table->data[3][0] = - progress_bar2($data["monitor_health"], 140, 20, $data["monitor_health"].'% '.__('of monitors up'), 0); + progress_bar($data["monitor_health"], 140, 20, $data["monitor_health"].'% '.__('of monitors up'), 0); $table->style[4] = "padding-top:4px; padding-bottom:4px;"; $table->data[4][0] = ''.__('Module sanity').''; $table->style[5] = "padding-top:4px; padding-bottom:4px;"; $table->data[5][0] = - progress_bar2($data["module_sanity"], 140, 20, $data["module_sanity"].'% '.__('of total modules inited'), 0); + progress_bar($data["module_sanity"], 140, 20, $data["module_sanity"].'% '.__('of total modules inited'), 0); $table->style[6] = "padding-top:4px; padding-bottom:4px;"; $table->data[6][0] = ''.__('Alert level').''; $table->style[7] = "padding-top:4px; padding-bottom:4px;"; $table->data[7][0] = - progress_bar2($data["alert_level"], 140, 20, $data["alert_level"].'% '.__('of defined alerts not fired'), 0); + progress_bar($data["alert_level"], 140, 20, $data["alert_level"].'% '.__('of defined alerts not fired'), 0); html_print_table ($table); unset ($table); @@ -275,7 +275,7 @@ if($is_admin) { if ($server["type"] != "snmp") { $data[3] = - progress_bar2($server["load"], 80, 20); + progress_bar($server["load"], 80, 20); if ($server["type"] != "recon"){ $data[4] = $server["lag_txt"]; diff --git a/pandora_console/operation/events/event_statistics.php b/pandora_console/operation/events/event_statistics.php index fb714b32b1..0e1947b143 100644 --- a/pandora_console/operation/events/event_statistics.php +++ b/pandora_console/operation/events/event_statistics.php @@ -33,16 +33,16 @@ ui_print_page_header (__('Statistics'), "images/lightning_go.png",false, false); echo ""; echo ""; echo "'; echo "
"; echo "

".__('Event graph')."

"; -echo grafico_eventos_total2(); +echo grafico_eventos_total(); echo "
"; echo "

".__('Event graph by user')."

"; -echo grafico_eventos_usuario2(300, 200); +echo grafico_eventos_usuario(300, 200); echo "
"; echo "

".__('Event graph by group')."

"; -echo grafico_eventos_grupo2(300, 200); +echo grafico_eventos_grupo(300, 200); echo '
"; diff --git a/pandora_console/operation/events/events_list.php b/pandora_console/operation/events/events_list.php index b05cdec0d0..b5928a711d 100644 --- a/pandora_console/operation/events/events_list.php +++ b/pandora_console/operation/events/events_list.php @@ -252,7 +252,7 @@ html_print_submit_button (__('Update'), '', false, 'class="sub upd"'); echo ""; //This is the filter div echo '
'; -echo grafico_eventos_grupo2(220, 180, rawurlencode ($sql_post)); +echo grafico_eventos_grupo(220, 180, rawurlencode ($sql_post)); echo '
'; echo '
 
'; echo ''; diff --git a/pandora_console/operation/incidents/incident_statistics.php b/pandora_console/operation/incidents/incident_statistics.php index b833786b70..985b345374 100755 --- a/pandora_console/operation/incidents/incident_statistics.php +++ b/pandora_console/operation/incidents/incident_statistics.php @@ -30,19 +30,19 @@ ui_print_page_header (__('Statistics'), "images/book_edit.png", false, "", false echo '

'.__('Incidents by status').'

'; -echo graph_incidents_status2 (); +echo graph_incidents_status (); echo '

'.__('Incidents by priority').'

'; -echo grafico_incidente_prioridad2 (); +echo grafico_incidente_prioridad (); echo '

'.__('Incidents by group').'

'; -echo graphic_incident_group2(); +echo graphic_incident_group(); echo '

'.__('Incidents by user').'

'; -echo graphic_incident_user2(); +echo graphic_incident_user(); echo '

'.__('Incidents by source').'

'; -echo graphic_incident_source2(); +echo graphic_incident_source(); echo '
'; ?> diff --git a/pandora_console/operation/integria_incidents/incident_statistics.php b/pandora_console/operation/integria_incidents/incident_statistics.php index b833786b70..985b345374 100755 --- a/pandora_console/operation/integria_incidents/incident_statistics.php +++ b/pandora_console/operation/integria_incidents/incident_statistics.php @@ -30,19 +30,19 @@ ui_print_page_header (__('Statistics'), "images/book_edit.png", false, "", false echo '

'.__('Incidents by status').'

'; -echo graph_incidents_status2 (); +echo graph_incidents_status (); echo '

'.__('Incidents by priority').'

'; -echo grafico_incidente_prioridad2 (); +echo grafico_incidente_prioridad (); echo '

'.__('Incidents by group').'

'; -echo graphic_incident_group2(); +echo graphic_incident_group(); echo '

'.__('Incidents by user').'

'; -echo graphic_incident_user2(); +echo graphic_incident_user(); echo '

'.__('Incidents by source').'

'; -echo graphic_incident_source2(); +echo graphic_incident_source(); echo '
'; ?> diff --git a/pandora_console/operation/reporting/reporting_xml.php b/pandora_console/operation/reporting/reporting_xml.php index aaedd574b8..543d5e61ae 100644 --- a/pandora_console/operation/reporting/reporting_xml.php +++ b/pandora_console/operation/reporting/reporting_xml.php @@ -192,7 +192,7 @@ foreach ($contents as $content) { case 'simple_graph': $data["title"] = __('Simple graph'); - $img = grafico_modulo_sparse2($content['id_agent_module'], + $img = grafico_modulo_sparse($content['id_agent_module'], $content['period'], 0, 720, 230, '', null, false, true, false, $datetime, '', 0, 0, true, true); preg_match("/src='(.*)'/", $img, $matches); @@ -204,7 +204,7 @@ foreach ($contents as $content) { case 'simple_baseline_graph': $data["title"] = __('Simple baseline graph'); - $img = grafico_modulo_sparse2($content['id_agent_module'], + $img = grafico_modulo_sparse($content['id_agent_module'], $content['period'], 0, 720, 230, '', null, false, true, false, ($datetime + $content['period']), '', true, 0, true, true); @@ -232,7 +232,7 @@ foreach ($contents as $content) { array_push ($weights, $content2["weight"]); } - $img = $data[0] = graphic_combined_module2( + $img = $data[0] = graphic_combined_module( $modules, $weights, $content['period'], diff --git a/pandora_console/operation/servers/view_server.php b/pandora_console/operation/servers/view_server.php index 4754814916..408c3ffa9e 100644 --- a/pandora_console/operation/servers/view_server.php +++ b/pandora_console/operation/servers/view_server.php @@ -80,7 +80,7 @@ foreach ($servers as $server) { // Load $data[3] = - progress_bar2($server["load"], 60, 20, $server["lag_txt"], 0); + progress_bar($server["load"], 60, 20, $server["lag_txt"], 0); $data[4] = $server["modules"] . " ".__('of')." ". $server["modules_total"]; $data[5] = ''.$server["lag_txt"].''; $data[6] = $server['threads'].' : '.$server['queued_modules']; diff --git a/pandora_console/operation/servers/view_server_detail.php b/pandora_console/operation/servers/view_server_detail.php index bca46d2796..a83a3b1000 100644 --- a/pandora_console/operation/servers/view_server_detail.php +++ b/pandora_console/operation/servers/view_server_detail.php @@ -140,7 +140,7 @@ foreach ($recon_tasks as $task) { $data[6] = "-"; } else { - $data[6] = progress_bar2($task['status'], 100, 20, __('Progress').':'.$task["status"].'%', 0); + $data[6] = progress_bar($task['status'], 100, 20, __('Progress').':'.$task["status"].'%', 0); } $data[7] = ui_print_timestamp ($task["utimestamp"], true);