From 5d5bce6c203a1abb1360bcafab6810774589cf9c Mon Sep 17 00:00:00 2001 From: slerena Date: Thu, 7 Jun 2007 17:46:38 +0000 Subject: [PATCH] 2007-06-07 Sancho Lerena * include/styles/god.css: Added god51 (reporting). * include/styles/pandora.css: Added h4 (for reporting). * include/functions_db.php: * include/functions_reporting.php: Reporting functions should be here. Now is SLA, tomorrow will be more ;) * include/functions.php: Added generic POST/GET parameter management, and a few functions to mangle dates. * pandoradb.sql: A few changes on treport_content table. * operation/agentes/datos_agente.php: Added option to delete individual data from here. Useful to purge bad data. * operation/reporting/reporting_viewer.php: New report viewer on HTML. * operation/reporting/custom_reporting.php: Moved. * operation/reporting/graph_builder.php: Moved to godmode directory. * operation/menu.php: Added few options and removed other (Reporting) * reporting/fgraph.php: Few changes to use graphs in reports without titles. * godmode/reporting: Added. * godmode/reporting/reporting_builder.php: The Pandora FMS report editor :-) * godmode/reporting/graph_builder.php: Graph builder almost done, only a few bugs to finish. * godmode/menu.php: New reporting options in godmode menu. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@494 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_console/ChangeLog | 44 ++ pandora_console/godmode/menu.php | 44 +- .../reporting/graph_builder.php | 8 +- .../godmode/reporting/reporting_builder.php | 420 ++++++++++++++++++ pandora_console/include/config.inc.php | 2 +- pandora_console/include/functions.php | 66 ++- pandora_console/include/functions_db.php | 6 +- .../include/functions_reporting.php | 44 ++ .../include/languages/language_en.php | 26 ++ pandora_console/include/styles/god.css | 12 +- pandora_console/include/styles/pandora.css | 14 +- .../operation/agentes/datos_agente.php | 18 +- pandora_console/operation/menu.php | 13 +- .../operation/reporting/custom_reporting.php | 100 +---- .../operation/reporting/reporting_viewer.php | 239 ++++++++++ pandora_console/pandoradb.sql | 21 + pandora_console/reporting/fgraph.php | 117 +++-- 17 files changed, 1018 insertions(+), 176 deletions(-) rename pandora_console/{operation => godmode}/reporting/graph_builder.php (96%) create mode 100644 pandora_console/godmode/reporting/reporting_builder.php create mode 100644 pandora_console/include/functions_reporting.php create mode 100644 pandora_console/operation/reporting/reporting_viewer.php diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index 3d6e7c709f..9c7eeb4545 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,47 @@ +2007-06-07 Sancho Lerena + + * include/styles/god.css: Added god51 (reporting). + + * include/styles/pandora.css: Added h4 (for reporting). + + * include/functions_db.php: + + * include/functions_reporting.php: Reporting functions should be + here. Now is SLA, tomorrow will be more ;) + + * include/functions.php: Added generic POST/GET parameter + management, and a few functions to mangle dates. + + * pandoradb.sql: A few changes on treport_content table. + + * operation/agentes/datos_agente.php: Added option to delete + individual data from here. Useful to purge bad data. + + * operation/reporting/reporting_viewer.php: New report viewer on + HTML. + + * operation/reporting/custom_reporting.php: Moved. + + * operation/reporting/graph_builder.php: Moved to godmode + directory. + + * operation/menu.php: Added few options and removed other + (Reporting) + + * reporting/fgraph.php: Few changes to use graphs in reports + without titles. + + * godmode/reporting: Added. + + * godmode/reporting/reporting_builder.php: The Pandora FMS report + editor :-) + + * godmode/reporting/graph_builder.php: Graph builder almost done, + only a few bugs to finish. + + * godmode/menu.php: New reporting options in godmode menu. + + 2007-06-06 Raul Mateos * godmode/*.php: Closed a lot of unclosed html tags. Updated near all of diff --git a/pandora_console/godmode/menu.php b/pandora_console/godmode/menu.php index d61867b99d..74ab86601c 100644 --- a/pandora_console/godmode/menu.php +++ b/pandora_console/godmode/menu.php @@ -102,20 +102,55 @@ if (comprueba_login() == 0){ else echo ''; } + // Reporting + // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + if ((give_acl($id_user, 0, "AW")==1)){ + + echo ''; + + // Custom report builder + if (isset($_GET["sec"]) && $_GET["sec"] == "greporting"){ + if (isset($_GET["sec2"]) && $_GET["sec2"] == "godmode/reporting/reporting_builder"){ + echo "
"; + } else { + echo ""; + } + + // Custom graph builder + if (isset($_GET["sec"]) && $_GET["sec"] == "greporting"){ + if (isset($_GET["sec2"]) && $_GET["sec2"] == "godmode/reporting/graph_builder"){ + echo "
"; + } else { + echo ""; + } + } + + // Manage profiles + // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + if ( (give_acl($id_user, 0, "PM")==1)){ if (isset($_GET["sec2"]) && $_GET["sec2"] == "godmode/profiles/profile_list"){ echo '
'; } else echo ''; - + + // SERVERS + // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + if (isset($_GET["sec2"]) && $_GET["sec2"] == "godmode/servers/modificar_server"){ echo '
'; } else echo ''; - + if (isset($_GET["sec"]) && $_GET["sec"] == "gservers"){ if (isset($_GET["sec2"]) && $_GET["sec2"] == "godmode/servers/manage_recontask"|| $_GET["sec2"] == "godmode/servers/manage_recontask_form"){ echo "
"; @@ -123,13 +158,16 @@ if (comprueba_login() == 0){ echo ""; } - + // AUDIT + // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ if (isset($_GET["sec2"]) && $_GET["sec2"] == "godmode/admin_access_logs"){ echo '
'; } else echo ''; + // Main SETUP + // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ if (isset($_GET["sec2"]) && $_GET["sec2"] == "godmode/setup/setup"){ echo '
'; } diff --git a/pandora_console/operation/reporting/graph_builder.php b/pandora_console/godmode/reporting/graph_builder.php similarity index 96% rename from pandora_console/operation/reporting/graph_builder.php rename to pandora_console/godmode/reporting/graph_builder.php index 57ddbc918c..c659b52752 100644 --- a/pandora_console/operation/reporting/graph_builder.php +++ b/pandora_console/godmode/reporting/graph_builder.php @@ -193,7 +193,7 @@ if (! isset($_GET["delete_module"])){ echo "

".$lang_label["reporting"]." > "; if (isset($chunk1)) { echo $lang_label["graph_builder_modulelist"]."

"; - echo "
"; + echo ""; if (isset($chunkdata)) echo ""; if (isset($id_agent)) @@ -247,7 +247,7 @@ if (($render == 1) && (isset($modules))) { // ----------------------- echo $lang_label["graph_builder"].""; echo ""; -echo ""; +echo ""; if (isset($period)) echo ""; @@ -276,7 +276,7 @@ echo ""; // ----------------------- // SOURCE MODULE FORM // ----------------------- -echo ""; +echo ""; if (isset($chunkdata)) echo ""; @@ -423,7 +423,7 @@ echo "
"; if (isset($module_array)){ echo "

".$lang_label["graph_store"]."

"; echo ""; - echo ""; + echo ""; // hidden fields with data begin echo ""; diff --git a/pandora_console/godmode/reporting/reporting_builder.php b/pandora_console/godmode/reporting/reporting_builder.php new file mode 100644 index 0000000000..b8348f52e2 --- /dev/null +++ b/pandora_console/godmode/reporting/reporting_builder.php @@ -0,0 +1,420 @@ +".$lang_label["delete_ok"].""; + else + $result = "

".$lang_label["delete_no"]."

"; + echo $result; +} + +// Delete module SQL code +if (isset($_GET["delete_report"])){ + $id = $_GET["delete_report"]; + $sql = "DELETE FROM treport_content WHERE id_report = $id"; + $sql2 = "DELETE FROM treport WHERE id_report = $id"; + $res=mysql_query($sql); + $res2=mysql_query($sql2); + if ($res AND $res2) + $result = "

".$lang_label["delete_ok"]."

"; + else + $result = "

".$lang_label["delete_no"]."

"; + echo $result; +} + +// Create new report. First step +if (isset($_GET["create_report"])){ + $createmode = 2; +} + +// Add module SQL code +if (isset($_GET["add_module"])){ + if (isset($_POST["id_report"])) + $id_report = $_POST["id_report"]; + else { + audit_db($id_user,$REMOTE_ADDR, "Hack attempt","Parameter trash in report builder"); + include ("general/noaccess.php"); + exit; + } + $my_id_agent = entrada_limpia($_POST["id_agent"]); + $my_id_module = entrada_limpia($_POST["id_module"]); + $my_period = entrada_limpia($_POST["period"]); + $my_type = entrada_limpia($_POST["type"]); + $my_cg = entrada_limpia($_POST["id_custom_graph"]); + $my_slamax = entrada_limpia($_POST["sla_max"]); + $my_slamin = entrada_limpia($_POST["sla_min"]); + $my_slalimit = entrada_limpia($_POST["sla_limit"]); + + $sql = "INSERT INTO treport_content (id_report, id_gs, id_agent_module, type, sla_max, sla_min, sla_limit, period) VALUES ('$id_report', '$my_cg', '$my_id_module', '$my_type', '$my_slamax', '$my_slamin', '$my_slalimit', '$my_period')"; + if ($res=mysql_query($sql)) + $result = "

".$lang_label["create_ok"]."

"; + else + $result = "

".$lang_label["create_no"]."

"; + echo $result; +} + +// Create item SQL code +if (isset($_POST["createmode"])){ + $createmode = $_POST["createmode"]; + $form_report_name = entrada_limpia($_POST["report_name"]); + $form_report_description = entrada_limpia($_POST["report_description"]); + if (isset($_POST["report_private"])) + $form_report_private = entrada_limpia($_POST["report_private"]); + else + $form_report_private = 0; + + // INSERT REPORT DATA + if ($createmode == 1){ + $form_id_user = $id_user; + $sql = "INSERT INTO treport (name, description, id_user, private) VALUES ('$form_report_name', '$form_report_description', '$form_id_user', '$form_report_private')"; + if ($res=mysql_query($sql)) + $result = "

".$lang_label["create_ok"]."

"; + else + $result = "

".$lang_label["create_no"]."

"; + $id_report = mysql_insert_id(); + // UPDATE REPORT DATA + } else { + $form_id_report = entrada_limpia($_POST["id_report"]); + $id_report = $form_id_report; + $sql = "UPDATE treport SET name = '$form_report_name', description = '$form_report_description', private = '$form_report_private' WHERE id_report = $form_id_report"; + if ($res=mysql_query($sql)) + $result = "

".$lang_label["modify_ok"]."

"; + else + $result = "

".$lang_label["modify_no"]."

"; + } + echo $result; + if ($id_report != ""){ + $_GET["id"]=$id_report; + $createmode=0; + } +} + +// GET DATA OF REPORT +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +if ($createmode==2 OR isset($_GET["id"]) OR (isset($_POST["id_report"]))) { + if (isset($_GET["id"])) + $id_report = $_GET["id"]; + elseif (isset($_POST["id_report"])) + $id_report = $_POST["id_report"]; + else + $id_report = -1; + + if (isset($_POST["id_agent"])) + $id_agent = $_POST["id_agent"]; + else + $id_agent = 0; + if ($createmode != 2){ + $createmode = 0; + $sql = "SELECT * FROM treport WHERE id_report = $id_report"; + $res=mysql_query($sql); + if ($row = mysql_fetch_array($res)){ + $form_report_name = $row["name"]; + $form_report_description = $row["description"]; + $form_report_private = $row["private"]; + $form_id_user = $row["id_user"]; + } + } else { + $form_report_name = ""; + $form_report_description = ""; + $form_report_private = 0; + $form_id_user = $id_user; + $createmode = 1; + } + + echo "

".$lang_label["custom_reporting_builder"]."

"; + echo ""; + echo ""; + if ($createmode == 0){ + echo ""; + } + echo "
"; + + echo "
"; + echo $lang_label["report_name"]; + echo ""; + echo ""; + + echo "
"; + echo $lang_label["private"]; + echo ""; + if ($form_report_private == 1) + echo ""; + else + echo ""; + + echo "
"; + echo $lang_label["description"]; + echo ""; + echo ""; + + + // Button + echo "
"; + echo ""; + echo "
"; + if ($createmode == 0) + echo ""; + else + echo ""; + echo "
"; + echo ""; + + if ($createmode == 0){ + // Part 2 - Add new items to report + // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + echo "

".$lang_label["reporting_item_add"]."

"; + + // Show combo with agents + // ---------------------- + + echo ""; + echo ""; + echo ""; + + echo ""; + echo "
".$lang_label["source_agent"]; + echo ""; + echo "'; + + + echo ""; + echo ""; + + // Modules combo + // ----------------------- + echo "
"; + echo ""; + if (isset($id_agent)) + echo ""; + + echo "
"; + echo "".$lang_label["modules"].""; + echo ""; + echo ""; + + // Component type + echo "
"; + echo "".$lang_label["reporting_type"].""; + echo ""; + echo ""; + + // Custom graph + // ----------------------- + echo "
"; + echo "".$lang_name["custom_graph_name"].""; + echo ""; + echo ""; + + + // Period + echo "
"; + echo "".$lang_label["period"].""; + echo ""; + echo ""; + + // SLA Max + echo "
"; + echo "".$lang_label["sla_max"].""; + echo ""; + echo ""; + // SLA Min + echo ""; + echo "".$lang_label["sla_min"].""; + echo ""; + echo ""; + + // SLA limit + echo "
"; + echo "".$lang_label["sla_limit"].""; + echo ""; + echo ""; + echo "
"; + + echo ""; + echo "
"; + echo ""; + echo "
"; + echo ""; + + + // Part 3 - List of already assigned report items + // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + echo "

".$lang_label["report_items"]."

"; + echo ""; + echo ""; + echo "
".$lang_label["type"]."".$lang_label["agent_name"]."".$lang_label["module_name"]."".$lang_label["period"]."".$lang_label["delete"]; + $sql = "SELECT * FROM treport_content WHERE id_report = $id_report"; + $res=mysql_query($sql); + $color = 0; + while ($row = mysql_fetch_array($res)){ + // Calculate table line color + if ($color == 1){ + $tdcolor = "datos"; + $color = 0; + } + else { + $tdcolor = "datos2"; + $color = 1; + } + $id_rc = $row["id_rc"]; + $type = $row["type"]; + switch ($type){ + case "0": $type_desc = "Graph"; break; + case "1": $type_desc = "User graph"; break; + case "2": $type_desc = "SLA"; break; + case "3": $type_desc = "Event report"; break; + case "4": $type_desc = "Alert report"; break; + case "5": $type_desc = "Monitor report"; break; + case "6": $type_desc = "Avg.Value"; break; + case "7": $type_desc = "Max.Value"; break; + case "8": $type_desc = "Min.Value"; break; + } + $period = $row["period"]; + $id_am = $row["id_agent_module"]; + $name = "N/A"; + $agent_name = "N/A"; + if ($id_am != ""){ + $agent_name = dame_nombre_agente_agentemodulo ($id_am); + $module_name = dame_nombre_modulo_agentemodulo ($id_am); + } + echo "
".$type_desc; + echo "".$agent_name; + echo "".$module_name; + echo "".$period; + echo ""; + if ($form_id_user == $id_user){ + echo ""; + } + } + echo "
"; + } +} else { + // Report item editor / add + + // Report LIST + // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + echo "

".$lang_label["custom_reporting"]."

"; + echo ""; + echo ""; + echo "
".$lang_label["report_name"]."".$lang_label["description"]."".$lang_label["Manage"]."".$lang_label["delete"]; + $color=1; + $sql="SELECT * FROM treport"; + $res=mysql_query($sql); + while ($row = mysql_fetch_array($res)){ + if (($row["private"]==0) || ($row["id_user"] == $id_user)){ + // Calculate table line color + if ($color == 1){ + $tdcolor = "datos"; + $color = 0; + } + else { + $tdcolor = "datos2"; + $color = 1; + } + echo "
".$row["name"]; + echo "".$row["description"]; + $id_report = $row["id_report"]; + echo ""; + echo ""; + } + } + echo "
"; + echo ""; + echo ""; + echo "
"; + echo ""; + echo ""; + echo "
"; +} +?> \ No newline at end of file diff --git a/pandora_console/include/config.inc.php b/pandora_console/include/config.inc.php index 2f78f5f168..8996b951ed 100644 --- a/pandora_console/include/config.inc.php +++ b/pandora_console/include/config.inc.php @@ -96,7 +96,7 @@ if($result2=mysql_query("SELECT * FROM tconfig")){ case "bgimage": $config_bgimage=$row2["value"]; break; case "style": $config_style=$row2["value"]; - break; + break; } } } else { diff --git a/pandora_console/include/functions.php b/pandora_console/include/functions.php index 78572cc6e1..22aedabb5e 100644 --- a/pandora_console/include/functions.php +++ b/pandora_console/include/functions.php @@ -397,5 +397,69 @@ function format_for_graph ( $number , $decimals=2, $dec_point=".", $thousands_se return number_format ($number, 0, $dec_point, $thousands_sep); } +function give_parameter_get ( $name, $default = "" ){ + $output = $default; + if (isset ($_GET[$name])){ + $output = $_GET[$name]; + } + return $output; +} -?> +function give_parameter_post ( $name, $default = "" ){ + $output = $default; + if (isset ($_POST[$name])){ + $output = $_POST[$name]; + } + return $output; +} + +function human_time_comparation ( $timestamp ){ + global $config; + require ("include/languages/language_".$config["language_code"].".php"); + $ahora=date("Y/m/d H:i:s"); + $seconds = strtotime($ahora) - strtotime($timestamp); + if ($seconds < 3600) + $render = format_numeric($seconds/60,2)." ".$lang_label["minutes"]; + elseif (($seconds >= 3600) and ($seconds < 86400)) + $render = format_numeric ($seconds/3600,2)." ".$lang_label["hours"]; + elseif ($seconds >= 86400) + $render = format_numeric ($seconds/86400,2)." ".$lang_label["days"]; + return $render; +} + +function human_time_description ($period){ + switch ($period) { + case 3600: $period_label = "Hour"; + break; + case 7200: $period_label = "2 Hours"; + break; + case 10800: $period_label = "3 Hours"; + break; + case 21600: $period_label = "6 Hours"; + break; + case 43200: $period_label = "12 Hours"; + break; + case 86400: $period_label = "Day"; + break; + case 172800: $period_label = "Two days"; + break; + case 345600: $period_label = "Four days"; + break; + case 604800: $period_label = "Last Week"; + break; + case 1296000: $period_label = "15 Days"; + break; + case 2592000: $period_label = "Last Month"; + break; + case 5184000: $period_label = "Two Month"; + break; + case 15552000: $period_label = "Six Months"; + break; + case 31104000: $period_label = "One year"; + break; + default: $period_label = "Day"; + } + return $period_label; +} + +?> \ No newline at end of file diff --git a/pandora_console/include/functions_db.php b/pandora_console/include/functions_db.php index b8da24e094..2bb7ff8a0f 100644 --- a/pandora_console/include/functions_db.php +++ b/pandora_console/include/functions_db.php @@ -6,10 +6,8 @@ // Main PHP/SQL code development and project architecture and management // Copyright (c) 2004-2007 Raul Mateos Martin, raulofpandora@gmail.com // CSS and some PHP additions -// Copyright (c) 2006-2007 Jonathan Barajas, jonathan.barajas[AT]gmail[DOT]com -// Javascript Active Console code. // Copyright (c) 2006 Jose Navarro -// Additions to Pandora FMS 1.2 graph code and new XML reporting template management +// Additions to Pandora FMS 1.2 graph code // Copyright (c) 2005-2007 Artica Soluciones Tecnologicas, info@artica.es // // This program is free software; you can redistribute it and/or @@ -1191,4 +1189,6 @@ function return_moduledata_min_value ($id_agent_module, $period){ } + + ?> diff --git a/pandora_console/include/functions_reporting.php b/pandora_console/include/functions_reporting.php new file mode 100644 index 0000000000..2c2d74c44e --- /dev/null +++ b/pandora_console/include/functions_reporting.php @@ -0,0 +1,44 @@ + $datelimit"; + $resq1=mysql_query($query1); + $last_data = ""; + + $total_badtime = 0; + $interval_begin = 0; + $interval_last = 0; + + if ($resq1 != 0){ + while ($row=mysql_fetch_array($resq1)){ + if ( ($row["datos"] > $max_value) OR ($row["datos"] < $min_value)){ + if ($interval_begin == 0){ + $interval_begin = $row["utimestamp"]; + } + } elseif ($interval_begin != 0){ + // Here ends interval with data outside valid values, + // Need to add this time to counter + $interval_last = $row["utimestamp"]; + $temp_time = $interval_last - $interval_begin; + $total_badtime = $total_badtime + $temp_time; + $interval_begin = 0; + $interval_last = 0; + } + } + } else + return 100; + $result = 100 - ($total_badtime / $period ) * 100; + return $result; +} + + +?> diff --git a/pandora_console/include/languages/language_en.php b/pandora_console/include/languages/language_en.php index 967c506b43..f481d74761 100644 --- a/pandora_console/include/languages/language_en.php +++ b/pandora_console/include/languages/language_en.php @@ -792,9 +792,35 @@ $lang_label["min_valid_value_help"]="Min. possible value to consider 'valid' val $lang_label["max_valid_value_help"]="Max. possible value to consider 'valid' values, above this limit, Pandora FMS will fire the alert"; $lang_label["alert_time_threshold_help"]="This value must be al least Module Interval * (Min.Number of Alerts + 1)"; $lang_label["style_template"]="Style template"; + +$lang_label["report_name"]="Report name"; +$lang_label["custom_reporting_builder"]="Custom reporting builder"; +$lang_label["report_builder"]="Report builder"; +$lang_label["manage_reporting"]="Manage reports"; +$lang_label["report_items"]="Report items"; +$lang_label["period"]="Period"; +$lang_label["reporting_item_add"]="Add item to report"; + $lang_label["template"]="Template"; $lang_label["add_mod_ok"]="Modules added successfully"; + +$lang_label["simple_graph"] = "Simple graph"; +$lang_label["custom_graph"] = "Custom graph"; +$lang_label["SLA"] = "S.L.A"; +$lang_label["event_report"] = "Event report"; +$lang_label["alert_report"] = "Alert report"; +$lang_label["monitor_report"] = "Monitor report"; +$lang_label["avg_value"]="Avg. Value"; +$lang_label["max_value"]="Max. Value"; +$lang_label["min_value"]="Min. Value"; +$lang_label["reporting_type"]="Reporting type"; + +$lang_label["sla_max"] = "SLA Max. (value)"; +$lang_label["sla_min"] = "SLA Min. (value)"; +$lang_label["sla_limit"] = "SLA Limit (%)"; +$lang_label["up"]="Up"; +$lang_label["down"]="Down"; global $lang_label; global $help_label; ?> diff --git a/pandora_console/include/styles/god.css b/pandora_console/include/styles/god.css index 665b970170..b966408605 100644 --- a/pandora_console/include/styles/god.css +++ b/pandora_console/include/styles/god.css @@ -15,13 +15,10 @@ div.menug { width: 155px; margin-bottom: 5px; } -#god1 li, #god2 li, #god3 li, #god4 li, #god5 li, #god6 li, #god7 li, #god8 li, #god1s li, -#god2s li, #god3s li, #god4s li, #god5s li, #god6s li, #god7s li, #god8s li, #god_module li, #god_module_sel li { +#god1 li, #god2 li, #god3 li, #god4 li, #god5 li, #god51 li, #god6 li, #god7 li, #god8 li, #god1s li, #god2s li, #god3s li, #god4s li, #god5s li, #god51s li, #god6s li, #god7s li, #god8s li, #god_module li, #god_module_sel li { padding: 0px 0px 0px 30px; } -div#god1>ul, div#god2>ul, div#god3>ul, div#god4>ul, div#god5>ul, div#god6>ul, -div#god7>ul, div#god8>ul, div#god1s>ul, div#god2s>ul, div#god3s>ul, div#god4s>ul, -div#god5s>ul, div#god6s>ul, div#god7s>ul, div#god8s>ul, div#god_module>ul, div#god_module_sel>ul { +div#god1>ul, div#god2>ul, div#god3>ul, div#god4>ul, div#god5>ul, div#god51>ul, div#god6>ul, div#god7>ul, div#god8>ul, div#god1s>ul, div#god2s>ul, div#god3s>ul, div#god4s>ul, div#god5s>ul, div#god51s>ul, div#god6s>ul, div#god7s>ul, div#god8s>ul, div#god_module>ul, div#god_module_sel>ul { width: 124px; } #god1 li, #god1 li:hover, #god1s li { @@ -39,6 +36,9 @@ div#god5s>ul, div#god6s>ul, div#god7s>ul, div#god8s>ul, div#god_module>ul, div#g #god5 li, #god5 li:hover, #god5s li { background: url(../../images/god5.gif) no-repeat 3px 3px; } +#god51 li, #god51 li:hover, #god51s li { + background: url(../../images/reporting.png) no-repeat 4px 4px; +} #god6 li, #god6 li:hover, #god6s li { background: url(../../images/god6.gif) no-repeat 4px 3px; } @@ -62,7 +62,7 @@ div.arrowg>ul, div.arrowgs>ul { #god a:hover, #god1 li:hover, #god1s li, #god2 li:hover, #god2s li, #god3 li:hover, #god3s li, #god4 li:hover, #god4s li, #god5 li:hover, #god5s li, #god6 li:hover, #god6s li, -#god7 li:hover, #god7s li, #god8 li:hover, #god8s li, #god_module li:hover, #god_module_sel li, +#god7 li:hover, #god7s li, #god8 li:hover, #god8s li, #god_module li:hover, #god_module_sel li, #god51 li:hover, #god51s li, .arrowg li:hover, .arrowgs li { background-color: #efefbd; diff --git a/pandora_console/include/styles/pandora.css b/pandora_console/include/styles/pandora.css index c3fa470c95..608dcc55ca 100644 --- a/pandora_console/include/styles/pandora.css +++ b/pandora_console/include/styles/pandora.css @@ -66,11 +66,11 @@ checkbox { padding: 4px; border:1px solid #eee; } -h1, h2, h3 { +h1, h2, h3, h4 { font: bold 1em Arial, Sans-serif; text-transform: uppercase; color: #786; - padding-bottom: 5px; + padding-bottom: 4px; padding-top: 7px; } h1 { @@ -80,8 +80,16 @@ h2 { font-size: 15px; } h3 { - font-size: 13px; + font-size: 14px; } +h4 { + margin-bottom: 2px; + padding-bottom: 0px; + padding-top: 5px; + font-size: 13px; + color: #000; +} + a { color: #486787; text-decoration: none; diff --git a/pandora_console/operation/agentes/datos_agente.php b/pandora_console/operation/agentes/datos_agente.php index f6f5c6cf4e..999e46a049 100644 --- a/pandora_console/operation/agentes/datos_agente.php +++ b/pandora_console/operation/agentes/datos_agente.php @@ -23,6 +23,8 @@ require("include/config.php"); function datos_raw($id_agente_modulo, $periodo){ require("include/config.php"); require("include/languages/language_".$language_code.".php"); + $id_user = $_SESSION["id_usuario"]; + $periodo_label = $periodo; switch ($periodo) { case "mes": $periodo = 86400*30; @@ -39,6 +41,7 @@ function datos_raw($id_agente_modulo, $periodo){ } $periodo = time() - $periodo; $id_agent = give_agent_id_from_module_id ($id_agente_modulo); + $id_group = give_db_value ("id_grupo", "tagente", "id_agente", $id_agent); // Different query for string data type $id_tipo_modulo = dame_id_tipo_modulo_agentemodulo($id_agente_modulo); if ( (dame_nombre_tipo_modulo($id_tipo_modulo) == "generic_data_string" ) OR @@ -65,6 +68,7 @@ function datos_raw($id_agente_modulo, $periodo){ if (mysql_num_rows($result)){ echo ""; $color=1; + echo ""; echo ""; while ($row=mysql_fetch_array($result)){ @@ -76,7 +80,13 @@ function datos_raw($id_agente_modulo, $periodo){ $tdcolor = "datos2"; $color = 1; } - echo ""; + echo ""; + if (give_acl($id_user, $id_group, "AW") ==1) { + echo "
"; echo "".$lang_label["timestamp"]."".$lang_label["data"]."
"; + echo ""; + } else { + echo ""; + } echo "".$row["timestamp"]; echo ""; if (is_numeric($row["datos"])) { @@ -119,6 +129,12 @@ if (isset($_GET["tipo"]) AND isset($_GET["id"])) { exit; } +if (isset($_GET["delete"])) { + $delete =$_GET["delete"]; + $sql = "DELETE FROM tagente_datos WHERE id_agente_datos = $delete"; + $result=mysql_query($sql); +} + datos_raw($id,$tipo); ?> diff --git a/pandora_console/operation/menu.php b/pandora_console/operation/menu.php index b6beeb0421..ee96806b70 100644 --- a/pandora_console/operation/menu.php +++ b/pandora_console/operation/menu.php @@ -227,7 +227,7 @@ if (give_acl($_SESSION["id_usuario"], 0, "AR")==1) { } else { echo ''; + echo ''; // Custom reporting if (isset($_GET["sec"]) && $_GET["sec"] == "reporting"){ @@ -248,16 +248,7 @@ if (give_acl($_SESSION["id_usuario"], 0, "AR")==1) { } echo ""; } - - // Custom graph builder - if (isset($_GET["sec"]) && $_GET["sec"] == "reporting"){ - if (isset($_GET["sec2"]) && $_GET["sec2"] == "operation/reporting/graph_builder"){ - echo "
"; - } else { - echo ""; - } + } ?> diff --git a/pandora_console/operation/reporting/custom_reporting.php b/pandora_console/operation/reporting/custom_reporting.php index d2563d7bc7..3dc51e6eea 100644 --- a/pandora_console/operation/reporting/custom_reporting.php +++ b/pandora_console/operation/reporting/custom_reporting.php @@ -27,97 +27,10 @@ if (comprueba_login() != 0) { exit; } -if (isset($_GET["view_report"])){ - $id_report = $_GET["view_report"]; - $sql="SELECT * FROM treport WHERE id_report = $id_report"; - $res=mysql_query($sql); - if ($row = mysql_fetch_array($res)){ - $id_user = $row["id_user"]; - $private = $row["private"]; - $description = $row["description"]; - $name = $row["name"]; - if (($row["private"]==1) && ($row["id_user"] != $id_user)){ - audit_db($id_usuario,$REMOTE_ADDR, "ACL Violation","Trying to access to a custom graph not allowed"); - include ("general/noaccess.php"); - exit; - } +//echo "SLA for Tato: %".return_module_SLA (50, 604800, 1, 1); - - $sql2="SELECT * FROM tgraph_source WHERE id_graph = $id_graph"; - $res2=mysql_query($sql2); - while ( $row2 = mysql_fetch_array($res2)){ - $weight = $row2["weight"]; - $id_agent_module = $row2["id_agent_module"]; - if (!isset($modules)){ - $modules = $id_agent_module; - $weights = $weight; - } else { - $modules = $modules.",".$id_agent_module; - $weights = $weights.",".$weight; - } - } - - echo "

".$lang_label["combined_image"]."

"; - echo ""; - echo "
"; - echo ""; - echo "
"; - - - switch ($period) { - case 3600: $period_label = "Hour"; - break; - case 21600: $period_label = "6 Hours"; - break; - case 43200: $period_label = "12 Hours"; - break; - case 86400: $period_label = "Day"; - break; - case 172800: $period_label = "Two days"; - break; - case 604800: $period_label = "Last Week"; - break; - case 1296000: $period_label = "15 Days"; - break; - case 2592000: $period_label = "Last Month"; - break; - case 5184000: $period_label = "Two Month"; - break; - case 15552000: $period_label = "Six Months"; - break; - default: $period_label = "Day"; - } - echo "
"; - echo ""; - echo "
"; - echo "Period"; - echo ""; - echo ""; - - echo ""; - echo ""; - echo "
"; - echo "
"; - } -} - -echo "

".$lang_label["custom_report_builder"]."

"; -echo ""; +echo "

".$lang_label["custom_reporting"]."

"; +echo "
"; echo ""; echo "
".$lang_label["report_name"]."".$lang_label["description"]."".$lang_label["view"]; $color=1; $sql="SELECT * FROM treport"; @@ -136,14 +49,11 @@ while ($row = mysql_fetch_array($res)){ echo "
".$row["name"]; echo "".$row["description"]; - $id_graph = $row["id_graph"]; - echo ""; + $id_report = $row["id_report"]; + echo ""; } } echo "
"; - - - ?> diff --git a/pandora_console/operation/reporting/reporting_viewer.php b/pandora_console/operation/reporting/reporting_viewer.php new file mode 100644 index 0000000000..e97121a671 --- /dev/null +++ b/pandora_console/operation/reporting/reporting_viewer.php @@ -0,0 +1,239 @@ +".$lang_label["custom_reporting"]." - ".$report_name.""; + +echo ""; +echo ""; +echo ""; +echo "
"; +echo "".$report_description."
"; + +echo ""; +$sql = "SELECT * FROM treport_content WHERE id_report = $id_report ORDER by type desc"; +$res=mysql_query($sql); +while ($row = mysql_fetch_array($res)){ + $type = $row["type"]; + $sla_max = $row["sla_max"]; + $sla_min = $row["sla_min"]; + $sla_limit = $row["sla_limit"]; + $id_agent_module = $row["id_agent_module"]; + $period = $row["period"]; + $id_gs = $row["id_gs"]; + + switch($type){ + case 2: // SLA + $module_name = give_db_value ("nombre", "tagente_modulo", "id_agente_modulo", $id_agent_module); + $agent_name = dame_nombre_agente_agentemodulo ($id_agent_module); + $sla_result = format_numeric(return_module_SLA ($id_agent_module, $period, $sla_max, $sla_min), 2); + + echo ""; + echo ""; + break; + case 0: // Simple graph + $module_name = give_db_value ("nombre", "tagente_modulo", "id_agente_modulo", $id_agent_module); + $agent_name = dame_nombre_agente_agentemodulo ($id_agent_module); + echo ""; + break; + case 1: // Custom/Combined graph + $module_name = give_db_value ("nombre", "tagente_modulo", "id_agente_modulo", $id_agent_module); + $agent_name = dame_nombre_agente_agentemodulo ($id_agent_module); + $graph_name = give_db_value ("name", "tgraph", "id_graph", $id_gs); + $sql2="SELECT * FROM tgraph_source WHERE id_graph = $id_gs"; + $res2=mysql_query($sql2); + while ( $row2 = mysql_fetch_array($res2)){ + $weight = $row2["weight"]; + $id_agent_module = $row2["id_agent_module"]; + if (!isset($modules)){ + $modules = $id_agent_module; + $weights = $weight; + } else { + $modules = $modules.",".$id_agent_module; + $weights = $weights.",".$weight; + } + } + echo ""; + break; + case 6: // AVG value + $module_name = give_db_value ("nombre", "tagente_modulo", "id_agente_modulo", $id_agent_module); + $agent_name = dame_nombre_agente_agentemodulo ($id_agent_module); + $avg_value = format_for_graph(return_moduledata_avg_value ($id_agent_module, $period),2); + echo ""; + echo ""; + break; + case 7: // MAX value + $module_name = give_db_value ("nombre", "tagente_modulo", "id_agente_modulo", $id_agent_module); + $agent_name = dame_nombre_agente_agentemodulo ($id_agent_module); + $max_value = format_for_graph(return_moduledata_max_value ($id_agent_module, $period),2); + echo ""; + echo ""; + break; + case 8: // MIN value + $module_name = give_db_value ("nombre", "tagente_modulo", "id_agente_modulo", $id_agent_module); + $agent_name = dame_nombre_agente_agentemodulo ($id_agent_module); + $min_value = format_for_graph(return_moduledata_min_value ($id_agent_module, $period),2); + echo ""; + echo ""; + break; + case 5: // Monitor report + $module_name = give_db_value ("nombre", "tagente_modulo", "id_agente_modulo", $id_agent_module); + $agent_name = dame_nombre_agente_agentemodulo ($id_agent_module); + $monitor_value = $sla_result = format_numeric(return_module_SLA ($id_agent_module, $period, 1, 1), 2); + echo ""; + echo ""; + break; + case 3: // Event report + $module_name = give_db_value ("nombre", "tagente_modulo", "id_agente_modulo", $id_agent_module); + $agent_name = dame_nombre_agente_agentemodulo ($id_agent_module); + + echo ""; + echo ""; + break; + case 4: // Alert report + $module_name = give_db_value ("nombre", "tagente_modulo", "id_agente_modulo", $id_agent_module); + $agent_name = dame_nombre_agente_agentemodulo ($id_agent_module); + echo ""; + echo ""; + break; + } +} +echo "
"; + echo "

".$lang_label["SLA"]."

"; + echo "
"; + echo "

$agent_name - $module_name

"; + echo "
"; + echo "

".human_time_description($period)."

"; + echo "
"; + echo ""; + echo $lang_label["sla_max"]. " : ".$sla_max. "
"; + echo $lang_label["sla_min"]. " : ".$sla_min. "
"; + echo $lang_label["sla_limit"]. " : ".$sla_limit. "
"; + echo "
"; + echo "
"; + if ($sla_result >= $sla_limit) + echo "

"; + else + echo "

"; + echo $sla_result. " %"; + echo "

"; + echo "
"; + echo "

".$lang_label["simple_graph"]."

"; + echo "
"; + echo "

$agent_name - $module_name

"; + echo "
"; + echo "

".human_time_description($period)."

"; + echo "
"; + echo ""; + echo "
"; + echo "

".$lang_label["custom_graph"]."

"; + echo "
"; + echo "

$graph_name

"; + echo "
"; + echo "

".human_time_description($period)."

"; + echo "
"; + echo ""; + echo "
"; + echo "

".$lang_label["avg_value"]."

"; + echo "
"; + echo "

$agent_name - $module_name

"; + echo "
"; + echo "

".human_time_description($period)."

"; + echo "
"; + echo ""; + echo "

"; + echo $avg_value; + echo "

"; + echo "
"; + echo "

".$lang_label["max_value"]."

"; + echo "
"; + echo "

$agent_name - $module_name

"; + echo "
"; + echo "

".human_time_description($period)."

"; + echo "
"; + echo ""; + echo "

"; + echo $max_value; + echo "

"; + echo "
"; + echo "

".$lang_label["min_value"]."

"; + echo "
"; + echo "

$agent_name - $module_name

"; + echo "
"; + echo "

".human_time_description($period)."

"; + echo "
"; + echo ""; + echo "

"; + echo $min_value; + echo "

"; + echo "
"; + echo "

".$lang_label["monitor_report"]."

"; + echo "
"; + echo "

$agent_name - $module_name

"; + echo "
"; + echo "

".human_time_description($period)."

"; + echo "
"; + echo ""; + echo "

"; + echo $monitor_value." %".""; + echo "

"; + $monitor_value2 = 100 - $monitor_value ; + echo "

"; + echo $monitor_value2." %".""; + echo "

"; + echo "
"; + echo "

".$lang_label["event_report"]."

"; + echo "
"; + echo "

$agent_name - $module_name

"; + echo "
"; + echo "

".human_time_description($period)."

"; + echo "
"; + echo ""; + echo "Not ready yet ;-)"; + echo "
"; + echo "

".$lang_label["alert_report"]."

"; + echo "
"; + echo "

$agent_name - $module_name

"; + echo "
"; + echo "

".human_time_description($period)."

"; + echo "
"; + echo ""; + echo "Not ready yet ;-)"; + echo "
"; +?> diff --git a/pandora_console/pandoradb.sql b/pandora_console/pandoradb.sql index 4d713c1a0a..8d718ecb7d 100644 --- a/pandora_console/pandoradb.sql +++ b/pandora_console/pandoradb.sql @@ -516,9 +516,30 @@ CREATE TABLE `treport_content` ( `id_agent_module` int(11) NOT NULL default 0, `type` tinyint(1) UNSIGNED NOT NULL default 0, `period` int(11) NOT NULL default 0, + `sla_max` int(11) NOT NULL default 0, + `sla_min` int(11) NOT NULL default 0, + `sla_limit` int(11) NOT NULL default 0, PRIMARY KEY(`id_rc`) ) ENGINE = InnoDB; +/* + +treport_content descripcion +type valid values + 0 - Simple graph + 1 - User/Combined graph + 2 - SLA + 3 - Event report + 4 - Alert report + 5 - Monitor report + 6 - Avg. value + 7 - Max. value + 8 - Min. value + +id_gs is for combined graph pprimary key id + +*/ + CREATE TABLE `tlayout` ( `id` INTEGER UNSIGNED NOT NULL AUTO_INCREMENT, `name` varchar(50) NOT NULL, diff --git a/pandora_console/reporting/fgraph.php b/pandora_console/reporting/fgraph.php index d19360a73f..14a72f839b 100644 --- a/pandora_console/reporting/fgraph.php +++ b/pandora_console/reporting/fgraph.php @@ -6,10 +6,8 @@ // Main PHP/SQL code development and project architecture and management // Copyright (c) 2004-2007 Raul Mateos Martin, raulofpandora@gmail.com // CSS and some PHP additions -// Copyright (c) 2006-2007 Jonathan Barajas, jonathan.barajas[AT]gmail[DOT]com -// Javascript Active Console code. // Copyright (c) 2006 Jose Navarro -// Additions to Pandora FMS 1.2 graph code and new XML reporting template management +// Additions to Pandora FMS 1.2 graph code // Copyright (c) 2005-2007 Artica Soluciones Tecnologicas, info@artica.es // // This program is free software; you can redistribute it and/or @@ -72,7 +70,7 @@ function dame_fecha_grafico_timestamp ($timestamp) { return date('d/m H:i', $timestamp); } -function graphic_combined_module ($module_list, $weight_list, $periodo, $width, $height, $title, $unit_name, $show_event=0, $show_alert=0 ) { +function graphic_combined_module ($module_list, $weight_list, $periodo, $width, $height, $title, $unit_name, $show_event=0, $show_alert=0, $pure =0 ) { include ("../include/config.php"); require ("../include/languages/language_".$language_code.".php"); require_once 'Image/Graph.php'; @@ -159,7 +157,7 @@ function graphic_combined_module ($module_list, $weight_list, $periodo, $width, while ($row=mysql_fetch_array($result)){ $datos = $row[0]; $utimestamp = $row[1]; - if ($datos > 0) { + if ($datos >= 0) { for ($i=0; $i <= $resolution; $i++) { if ( ($utimestamp <= $valores[$i][3]) && ($utimestamp >= $valores[$i][2]) ){ $valores[$i][0]=$valores[$i][0]+$datos; @@ -219,9 +217,7 @@ function graphic_combined_module ($module_list, $weight_list, $periodo, $width, // ************* $Graph =& Image_Graph::factory('graph', array($width, $height)); // add a TrueType font - $Font =& $Graph->addNew('font', $config_fontpath); - $Font->setSize(6); - $Graph->setFont($Font); + if ($periodo == 86400) $title_period = "Last day"; @@ -233,24 +229,40 @@ function graphic_combined_module ($module_list, $weight_list, $periodo, $width, $title_period = "Last month"; else $title_period = "Last ".format_numeric(($periodo / (3600*24)),2)." days"; - - $Graph->add( - Image_Graph::vertical( + if ($pure == 0){ + $Font =& $Graph->addNew('font', $config_fontpath); + $Font->setSize(6); + $Graph->setFont($Font); + $Graph->add( Image_Graph::vertical( - $Title = Image_Graph::factory('title', array(' Pandora FMS Graph - '. $title_period, 10)), - $Subtitle = Image_Graph::factory('title', array(' '.$title, 7)), - 90 - ), - Image_Graph::vertical( - $Plotarea = Image_Graph::factory('plotarea'), - $Legend = Image_Graph::factory('legend'), - 80 - ), - 20) - ); - $Legend->setPlotarea($Plotarea); - $Title->setAlignment(IMAGE_GRAPH_ALIGN_LEFT); - $Subtitle->setAlignment(IMAGE_GRAPH_ALIGN_LEFT); + Image_Graph::vertical( + $Title = Image_Graph::factory('title', array(' Pandora FMS Graph - '. $title_period, 10)), + $Subtitle = Image_Graph::factory('title', array(' '.$title, 7)), + 90 + ), + Image_Graph::vertical( + $Plotarea = Image_Graph::factory('plotarea'), + $Legend = Image_Graph::factory('legend'), + 80 + ), + 20) + ); + $Legend->setPlotarea($Plotarea); + $Title->setAlignment(IMAGE_GRAPH_ALIGN_LEFT); + $Subtitle->setAlignment(IMAGE_GRAPH_ALIGN_LEFT); + } else { + $Font =& $Graph->addNew('font', $config_fontpath); + $Font->setSize(6); + $Graph->setFont($Font); + $Graph->add( + Image_Graph::vertical( + $Plotarea = Image_Graph::factory('plotarea'), + $Legend = Image_Graph::factory('legend'), + 85 + ) + ); + $Legend->setPlotarea($Plotarea); + } // Create the dataset // Merge data into a dataset object (sancho) // $Dataset =& Image_Graph::factory('dataset'); @@ -331,7 +343,7 @@ function graphic_combined_module ($module_list, $weight_list, $periodo, $width, } function grafico_modulo_sparse ( $id_agente_modulo, $periodo, $show_event, - $width, $height , $title, $unit_name, $show_alert, $avg_only = 0 ) { + $width, $height , $title, $unit_name, $show_alert, $avg_only = 0, $pure=0 ) { include ("../include/config.php"); require ("../include/languages/language_".$language_code.".php"); @@ -420,7 +432,7 @@ function grafico_modulo_sparse ( $id_agente_modulo, $periodo, $show_event, while ($row=mysql_fetch_array($result)){ $datos = $row[0]; $utimestamp = $row[1]; - if ($datos > 0) { + if ($datos >= 0) { for ($i=0; $i <= $resolution; $i++) { if ( ($utimestamp <= $valores[$i][3]) && ($utimestamp >= $valores[$i][2]) ){ $valores[$i][0]=$valores[$i][0]+$datos; @@ -478,24 +490,27 @@ function grafico_modulo_sparse ( $id_agente_modulo, $periodo, $show_event, $title_period = "Last month"; else $title_period = "Last ".format_numeric(($periodo / (3600*24)),2)." days"; - - $Graph->add( - Image_Graph::vertical( + if ($pure == 0){ + $Graph->add( 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 - ), - Image_Graph::horizontal( - $Plotarea = Image_Graph::factory('plotarea'), - $Legend = Image_Graph::factory('legend'), - 85 - ), - 15) - ); - $Legend->setPlotarea($Plotarea); - $Title->setAlignment(IMAGE_GRAPH_ALIGN_LEFT); - $Subtitle->setAlignment(IMAGE_GRAPH_ALIGN_LEFT); + 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 + ), + Image_Graph::horizontal( + $Plotarea = Image_Graph::factory('plotarea'), + $Legend = Image_Graph::factory('legend'), + 85 + ), + 15) + ); + $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')); + } // Create the dataset // Merge data into a dataset object (sancho) // $Dataset =& Image_Graph::factory('dataset'); @@ -542,9 +557,9 @@ function grafico_modulo_sparse ( $id_agente_modulo, $periodo, $show_event, // create the 1st plot as smoothed area chart using the 1st dataset $Plot =& $Plotarea->addNew('area', array(&$dataset)); if ($avg_only == 1){ - $Plot->setLineColor('gray@0.4'); + $Plot->setLineColor('black@0.1'); } else { - $Plot->setLineColor('yellow@0.1'); + $Plot->setLineColor('yellow@0.2'); } $AxisX =& $Plotarea->getAxis(IMAGE_GRAPH_AXIS_X); @@ -1731,6 +1746,12 @@ if (isset($_GET["tipo"])) else $tipo = ""; // 1 day default period +// Pure (Without title and legend) +if ( isset($_GET["pure"])) + $pure = $_GET["pure"]; +else + $pure = 0; + if (isset($_GET["period"])) $period = entrada_limpia($_GET["period"]); @@ -1816,7 +1837,7 @@ else if (isset($_GET["tipo"])){ if ($_GET["tipo"] == "sparse"){ - grafico_modulo_sparse($id, $period, $draw_events, $width, $height , $label, $unit_name, $draw_alerts, $avg_only); + grafico_modulo_sparse ($id, $period, $draw_events, $width, $height , $label, $unit_name, $draw_alerts, $avg_only, $pure); } elseif ($_GET["tipo"] =="estado_incidente") grafico_incidente_estados(); @@ -1858,7 +1879,7 @@ if (isset($_GET["tipo"])){ $module_list = split ( ",", $id); $weight_list = array(); $weight_list = split ( ",", $weight_l); - graphic_combined_module ($module_list, $weight_list, $period, $width, $height , $label, $unit_name ); + graphic_combined_module ($module_list, $weight_list, $period, $width, $height , $label, $unit_name, $draw_events, $draw_alerts, $pure); } else graphic_error ();