* * @package observium * @subpackage graphing * @author T. Lechat , Manuel Kasper , Jonathan Watt * @copyright 2004-2006 T. Lechat , Manuel Kasper , Jonathan Watt * @license BSD * */ include_once("../includes/observium.inc.php"); if (!$config['web_iframe'] && is_iframe() && !http_match_referer('!/device/device=\d+/tab=port/.*?/view=realtime/!')) { //bdump($_SERVER['HTTP_SEC_FETCH_DEST']); //bdump($_SERVER['HTTP_REFERER']); //'HTTP_SEC_FETCH_SITE' => 'same-origin' print_error_permission("Not allowed to run in a iframe!"); die(); } include($config['html_dir'] . "/includes/authenticate.inc.php"); // Push $_GET into $vars to be compatible with web interface naming $vars = get_vars('GET'); if (is_numeric($vars['id']) && ($config['allow_unauth_graphs'] || port_permitted($vars['id']))) { $port = get_port_by_id_cache($vars['id']); $device = device_by_id_cache($port['device_id']); $title = generate_device_link($device); $title .= " :: Port " . generate_port_link($port); $auth = TRUE; } else { // not authenticated die("Unauthenticated"); } header("Content-type: image/svg+xml"); /********** HTTP GET Based Conf ***********/ $ifnum = $port['ifIndex']; // BSD / SNMP interface name / number $ifname = escape_html($port['port_label']); //Interface name that will be showed on top right of graph //$hostname = short_hostname($device['hostname']); $hostname = escape_html(device_name($device, TRUE)); if ($vars['title']) { $ifname = escape_html($vars['title']); } /********* Other conf *******/ $scale_type = "follow"; // Autoscale default setup : "up" = only increase scale; "follow" = increase and decrease scale according to current graphed datas $nb_plot = 240; // NB plot in graph // Refresh time Interval $time_interval = is_numeric($vars['interval']) ? $vars['interval'] : 1; $fetch_link = "data.php?id=" . $vars['id']; if (OBS_DEBUG) { $fetch_link .= '&debug=yes'; } // SVG attributes $attribs['axis'] = 'fill="black" stroke="black"'; $attribs['in'] = 'fill="green" font-family="Tahoma, Verdana, Arial, Helvetica, sans-serif" font-size="7"'; $attribs['out'] = 'fill="blue" font-family="Tahoma, Verdana, Arial, Helvetica, sans-serif" font-size="7"'; $attribs['graph_in'] = 'fill="none" stroke="green" stroke-opacity="0.8"'; $attribs['graph_out'] = 'fill="none" stroke="blue" stroke-opacity="0.8"'; $attribs['legend'] = 'fill="black" font-family="Tahoma, Verdana, Arial, Helvetica, sans-serif" font-size="4"'; $attribs['graphname'] = 'fill="#435370" font-family="Tahoma, Verdana, Arial, Helvetica, sans-serif" font-size="9"'; $attribs['hostname'] = 'fill="#435370" font-family="Tahoma, Verdana, Arial, Helvetica, sans-serif" font-size="6"'; $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="#435370" font-family="Tahoma, Verdana, Arial, Helvetica, sans-serif" font-size="4" text-decoration="underline"'; $attribs['switch_scale'] = 'fill="#435370" 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 = "Can't get data about port $ifnum"; $height = 125; // SVG internal height : do not modify $width = 300; // SVG internal width : do not modify /********* Graph DATA **************/ print('' . PHP_EOL); ?> " preserveAspectRatio="none" xml:space="preserve" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" onload="init(evt)"> /> /> /> /> /> text-anchor="end"> text-anchor="end"> text-anchor="end"> >In >Out > > text-anchor="end"> text-anchor="end"> >Switch to bytes/s >AutoScale () > >Graph shows last seconds points=" "/> text-anchor="middle"> text-anchor="middle">Collecting initial data, please wait...