// 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 require_once ('../include/config.php'); if (!isset($_SESSION["id_user"])){ session_start(); session_write_close(); } require_once ('../include/functions.php'); require_once ('../include/functions_db.php'); require_once ('../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 $refresh = get_parameter ("refresh", -1); if ($refresh != -1) header( 'refresh: ' . $_GET['refresh'] ); echo ' Pandora FMS Graph '; echo ""; echo ""; // Get input parameters $label = get_parameter ("label",""); if (!isset($_GET["period"]) OR (!isset($_GET["id"]))) { echo "

".$lang_label["graf_error"]."

"; exit; } $period = get_parameter ( "period", 3600); 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); } $draw_alerts = get_parameter("draw_alerts", 0); $avg_only = get_parameter ("avg_only", 0); $period = get_parameter ("period", 86400); $id = get_parameter ("id", 0); $width = get_parameter ("width", 555); $height = get_parameter ("height", 245); $label = get_parameter ("label", ""); $start_date = get_parameter ("start_date", date("Y-m-d")); $draw_events = get_parameter ("draw_events", 0); $graph_type = get_parameter ("type", "sparse"); $zoom = get_parameter ("zoom", 1); if ($zoom > 1){ $height=$height*($zoom/2.1); $width=$width*($zoom/1.4); } if ($zoom > 1) { echo " "; } $current = date("Y-m-d"); if ($start_date != $current){ $utime = strtotime ($start_date); echo ""; } else echo ""; echo ""; echo ""; echo "
"; echo $lang_label["max_value"]." : ". format_for_graph(get_agent_module_value_max ($id, $period)); echo ""; echo $lang_label["avg_value"]." : ". format_for_graph(get_agent_module_value_average ($id, $period)); echo ""; echo $lang_label["min_value"]." : ". format_for_graph(get_agent_module_value_min ($id, $period)); echo "
"; ?>