// Additions to Pandora FMS 1.2 graph code and new XML reporting template management // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License // as published by the Free Software Foundation; version 2 // of the License, or (at your option) any later version. // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. // Global & session management include ('../include/config.php'); session_start(); include ('../include/functions.php'); include ('../include/functions_db.php'); include ('../include/languages/language_'.$config['language'].'.php'); // Access control if (comprueba_login() != 0) { $REMOTE_ADDR = getenv ("REMOTE_ADDR"); audit_db("Unknown",$REMOTE_ADDR, "ACL Violation","Trying to access graph window without auth"); require ("../general/noaccess.php"); exit; } // Parsing the refresh before sending any header if (isset($_GET['refresh']) and is_numeric($_GET['refresh']) and $_GET['refresh']>0) { header( 'refresh: ' . $_GET['refresh'] ); } echo ' Pandora FMS Graph '; ; // Get input parameters if (isset($_GET["label"])) $label = entrada_limpia($_GET["label"]); if (!isset($_GET["period"]) OR (!isset($_GET["id"]))) { echo "

".$lang_label["graf_error"]."

"; exit; } if (isset($_GET["draw_events"])) $draw_events = entrada_limpia($_GET["draw_events"]); else $draw_events = 0; if (isset($_GET["period"])) $period = entrada_limpia($_GET["period"]); else $period = 3600; // 1 hour (the most fast query possible) switch ($period) { case 3600: $period_label = $lang_label["hour"]; break; case 7200: $period_label = $lang_label["2_hours"]; break; case 21600: $period_label = $lang_label["6_hours"]; break; case 43200: $period_label = $lang_label["12_hours"]; break; case 86400: $period_label = $lang_label["last_day"]; break; case 172800: $period_label = $lang_label["two_days"]; break; case 432000: $period_label = $lang_label["five_days"]; break; case 604800: $period_label = $lang_label["last_week"]; break; case 1296000: $period_label = $lang_label["15_days"]; break; case 2592000: $period_label = $lang_label["last_month"]; break; case 5184000: $period_label = $lang_label["two_month"]; break; case 15552000: $period_label = $lang_label["six_months"]; break; default: $period_label = human_time_description_raw ($period); } if (isset($_GET["draw_alerts"])) $draw_alerts = entrada_limpia($_GET["draw_alerts"]); else $draw_alerts = 0; if (isset($_GET["avg_only"])) $avg_only = entrada_limpia($_GET["avg_only"]); else $avg_only = 0; if (isset($_GET["refresh"])) $refresh = entrada_limpia($_GET["refresh"]); else $refresh = 0; if (isset($_GET["period"])) $period = entrada_limpia($_GET["period"]); else $period = 86400; // 1 day default period if (isset($_GET["id"])) $id = entrada_limpia($_GET["id"]); else $id = 0; if (isset($_GET["width"])) $width = entrada_limpia($_GET["width"]); else $width = 525; if (isset($_GET["height"])) $height = entrada_limpia ($_GET["height"]); else $height = 220; if (isset($_GET["label"])) $label = entrada_limpia ($_GET["label"]); else $label = ""; if (isset($_GET["zoom"])){ $zoom = entrada_limpia ($_GET["zoom"]); if ($zoom > 1){ $height=$height*($zoom/2.1); $width=$width*($zoom/1.4); } } else $zoom = "1"; if ($zoom > 1) { echo " "; } $graph_type = "sparse"; if (isset($_GET["type"])) $graph_type = entrada_limpia($_GET["type"]); echo ""; echo ""; echo ""; echo "
"; echo $lang_label["max_value"]." : ". format_for_graph(return_moduledata_max_value ($id, $period)); echo ""; echo $lang_label["avg_value"]." : ". format_for_graph(return_moduledata_avg_value ($id, $period)); echo ""; echo $lang_label["min_value"]." : ". format_for_graph(return_moduledata_min_value ($id, $period)); echo "
"; ?>