* * @author T. Lechat , Manuel Kasper , Jonathan Watt * @copyright 2004-2006 T. Lechat , Manuel Kasper , Jonathan Watt * @license BSD */ $init_modules = ['web', 'auth']; require realpath(__DIR__ . '/..') . '/includes/init.php'; if (is_numeric($_GET['id']) && (Config::get('allow_unauth_graphs') || port_permitted($_GET['id']))) { $port = cleanPort(get_port_by_id($_GET['id'])); $device = device_by_id_cache($port['device_id']); $title = generate_device_link($device); $title .= ' :: Port ' . generate_port_link($port); $auth = true; } else { echo 'Unauthenticated'; exit; } header('Content-type: image/svg+xml'); /********** HTTP GET Based Conf ***********/ $ifnum = @$port['ifIndex']; // BSD / SNMP interface name / number $ifname = $port['label']; //Interface name that will be showed on top right of graph $hostname = shorthost($device['hostname']); if (isset($_GET['title'])) { $ifname = \LibreNMS\Util\Clean::html($_GET['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 if (is_numeric($_GET['interval'])) { $time_interval = $_GET['interval']; } else { $time_interval = 1; //Refresh time Interval } $fetch_link = 'data.php?id=' . $_GET['id']; //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['cachewarning'] = 'fill="darkorange" 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 = "Cannot get data about interface $ifnum"; $height = 125; //SVG internal height : do not modify $width = 300; //SVG internal width : do not modify /********* Graph DATA **************/ echo '' . "\n"; ?> " preserveAspectRatio="none" xml:space="preserve" xmlns="http://www.w3.org/2000/svg" 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 visibility="hidden">Caching may be in effect (?s) points=" "/> text-anchor="middle"> text-anchor="middle">Collecting initial data, please wait...