* Copyright (c) 2004-2006 Jonathan Watt * All rights reserved. * * originally based on m0n0wall (http://m0n0.ch/wall) * Copyright (c) 2003-2004 Manuel Kasper . * All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ ##|+PRIV ##|*IDENT=page-diagnostics-interfacetraffic ##|*NAME=Diagnostics: Interface Traffic ##|*DESCR=Allow access to the 'Diagnostics: Interface Traffic' page. ##|*MATCH=graph.php* ##|-PRIV require_once("globals.inc"); require_once("guiconfig.inc"); header("Last-Modified: " . gmdate("D, j M Y H:i:s") . " GMT"); header("Expires: " . gmdate("D, j M Y H:i:s", time()) . " GMT"); header("Cache-Control: no-cache, no-store, must-revalidate"); // HTTP/1.1 header("Pragma: no-cache"); // HTTP/1.0 header("Content-type: image/svg+xml"); /********** HTTP GET Based Conf ***********/ $ifnum = @$_GET["ifnum"]; // BSD / SNMP interface name / number $ifnum = get_real_interface($ifnum); $ifname = @$_GET["ifname"]?$_GET["ifname"]:"Interface $ifnum"; //Interface name that will be showed on top right of graph /********* Other conf *******/ if (isset($config["widgets"]["trafficgraphs"]["scale_type"])) { $scale_type = $config["widgets"]["trafficgraphs"]["scale_type"]; } else { $scale_type = "up"; } $nb_plot=120; //NB plot in graph if ($_GET["timeint"]) { $time_interval = $_GET["timeint"]; //Refresh time Interval } else { $time_interval = 3; } if ($_GET["initdelay"]) { $init_delay = $_GET["initdelay"]; //Initial Delay } else { $init_delay = 3; } //SVG attributes $attribs['axis']='fill="black" stroke="black"'; $attribs['in']='fill="#FF0000" font-family="Tahoma, Verdana, Arial, Helvetica, sans-serif" font-size="7"'; $attribs['out']='fill="#000000" font-family="Tahoma, Verdana, Arial, Helvetica, sans-serif" font-size="7"'; $attribs['graph_in']='fill="none" stroke="#FF0000" stroke-opacity="0.8"'; $attribs['graph_out']='fill="none" stroke="#000000" stroke-opacity="0.8"'; $attribs['legend']='fill="black" font-family="Tahoma, Verdana, Arial, Helvetica, sans-serif" font-size="4"'; $attribs['graphname']='fill="#FF0000" font-family="Tahoma, Verdana, Arial, Helvetica, sans-serif" font-size="8"'; $attribs['grid_txt']='fill="gray" font-family="Tahoma, Verdana, Arial, Helvetica, sans-serif" font-size="6"'; $attribs['grid']='stroke="gray" stroke-opacity="0.5"'; $attribs['switch_unit']='fill="#FF0000" font-family="Tahoma, Verdana, Arial, Helvetica, sans-serif" font-size="4" text-decoration="underline"'; $attribs['switch_scale']='fill="#FF0000" font-family="Tahoma, Verdana, Arial, Helvetica, sans-serif" font-size="4" text-decoration="underline"'; $attribs['error']='fill="blue" font-family="Arial" font-size="4"'; $attribs['collect_initial']='fill="gray" font-family="Tahoma, Verdana, Arial, Helvetica, sans-serif" font-size="4"'; //Error text if we cannot fetch data : depends on which method is used $error_text = sprintf(gettext("Cannot get data about interface %s"), htmlspecialchars($ifnum)); $height=100; //SVG internal height : do not modify $width=200; //SVG internal width : do not modify $fetch_link = "ifstats.php?if=" . htmlspecialchars($ifnum); /********* Graph DATA **************/ print('' . "\n");?> /> /> /> /> /> text-anchor="end"> text-anchor="end"> text-anchor="end"> > > > > text-anchor="end"> > > () > > > points=" "/> text-anchor="middle"> text-anchor="middle">...