mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
fix permissions on device_port_* graphs (woo, we now have some graph security!) and fix some bugs with graph naming
git-svn-id: http://www.observium.org/svn/observer/trunk@1596 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
@@ -238,7 +238,7 @@ function generate_if_link($args, $text = NULL)
|
||||
$graph_array['height'] = "100";
|
||||
$graph_array['width'] = "340";
|
||||
$graph_array['from'] = $config['day'];
|
||||
$graph_array['port'] = $args['interface_id'];
|
||||
$graph_array['id'] = $args['interface_id'];
|
||||
$content .= generate_graph_tag($graph_array);
|
||||
$graph_array['from'] = $config['week'];
|
||||
$content .= generate_graph_tag($graph_array);
|
||||
@@ -261,7 +261,7 @@ function generate_if_link($args, $text = NULL)
|
||||
function generate_port_thumbnail($args)
|
||||
{
|
||||
if(!$args['bg']) { $args['bg'] = "FFFFF"; }
|
||||
$args['content'] = "<img src='graph.php?type=".$args['graph_type']."&subtype=".$args['graph_subtype']."&id=".$args['interface_id']."&from=".$args['from']."&to=".$args['to']."&width=".$args['width']."&height=".$args['height']."&legend=no&bg=".$args['bg']."'>";
|
||||
$args['content'] = "<img src='graph.php?type=".$args['graph_type']."&id=".$args['interface_id']."&from=".$args['from']."&to=".$args['to']."&width=".$args['width']."&height=".$args['height']."&legend=no&bg=".$args['bg']."'>";
|
||||
$output = generate_if_link($args, $args['content']);
|
||||
echo $output;
|
||||
}
|
||||
|
@@ -1,17 +1,6 @@
|
||||
<?php
|
||||
|
||||
if($_GET['id']) { $interface = $_GET['id'];
|
||||
} elseif($_GET['port']) { $interface = $_GET['port'];
|
||||
} elseif($_GET['if']) { $interface = $_GET['if'];
|
||||
} elseif($_GET['interface']) { $interface = $_GET['interface']; }
|
||||
|
||||
$query = mysql_query("SELECT * FROM `ports` AS I, `devices` AS D WHERE I.interface_id = '".$interface."'
|
||||
AND I.device_id = D.device_id");
|
||||
|
||||
$port = mysql_fetch_array($query);
|
||||
#if(is_file($config['rrd_dir'] . "/" . $port['hostname'] . "/" . safename($port['ifIndex'] . ".rrd"))) {
|
||||
$rrd_filename = $config['rrd_dir'] . "/" . $port['hostname'] . "/port-" . safename($port['ifIndex'] . "-adsl.rrd");
|
||||
#}
|
||||
$rrd_filename = $config['rrd_dir'] . "/" . $device['hostname'] . "/port-" . safename($port['ifIndex'] . "-adsl.rrd");
|
||||
|
||||
$rrd_list[0]['filename'] = $rrd_filename;
|
||||
$rrd_list[0]['descr'] = "Downstream";
|
||||
@@ -21,7 +10,6 @@ $rrd_list[1]['filename'] = $rrd_filename;
|
||||
$rrd_list[1]['descr'] = "Upstream";
|
||||
$rrd_list[1]['rra'] = "AtucCurrAttainableR";
|
||||
|
||||
|
||||
$unit_text = "Bits/sec";
|
||||
|
||||
$units='';
|
||||
|
@@ -1,17 +1,6 @@
|
||||
<?php
|
||||
|
||||
if($_GET['id']) { $interface = $_GET['id'];
|
||||
} elseif($_GET['port']) { $interface = $_GET['port'];
|
||||
} elseif($_GET['if']) { $interface = $_GET['if'];
|
||||
} elseif($_GET['interface']) { $interface = $_GET['interface']; }
|
||||
|
||||
$query = mysql_query("SELECT * FROM `ports` AS I, `devices` AS D WHERE I.interface_id = '".$interface."'
|
||||
AND I.device_id = D.device_id");
|
||||
|
||||
$port = mysql_fetch_array($query);
|
||||
#if(is_file($config['rrd_dir'] . "/" . $port['hostname'] . "/" . safename($port['ifIndex'] . ".rrd"))) {
|
||||
$rrd_filename = $config['rrd_dir'] . "/" . $port['hostname'] . "/port-" . safename($port['ifIndex'] . "-adsl.rrd");
|
||||
#}
|
||||
$rrd_filename = $config['rrd_dir'] . "/" . $device['hostname'] . "/port-" . safename($port['ifIndex'] . "-adsl.rrd");
|
||||
|
||||
$rrd_list[0]['filename'] = $rrd_filename;
|
||||
$rrd_list[0]['descr'] = "Downstream";
|
||||
|
@@ -1,17 +1,6 @@
|
||||
<?php
|
||||
|
||||
if($_GET['id']) { $interface = $_GET['id'];
|
||||
} elseif($_GET['port']) { $interface = $_GET['port'];
|
||||
} elseif($_GET['if']) { $interface = $_GET['if'];
|
||||
} elseif($_GET['interface']) { $interface = $_GET['interface']; }
|
||||
|
||||
$query = mysql_query("SELECT * FROM `ports` AS I, `devices` AS D WHERE I.interface_id = '".$interface."'
|
||||
AND I.device_id = D.device_id");
|
||||
|
||||
$port = mysql_fetch_array($query);
|
||||
#if(is_file($config['rrd_dir'] . "/" . $port['hostname'] . "/" . safename($port['ifIndex'] . ".rrd"))) {
|
||||
$rrd_filename = $config['rrd_dir'] . "/" . $port['hostname'] . "/port-" . safename($port['ifIndex'] . "-adsl.rrd");
|
||||
#}
|
||||
$rrd_filename = $config['rrd_dir'] . "/" . $device['hostname'] . "/port-" . safename($port['ifIndex'] . "-adsl.rrd");
|
||||
|
||||
$rrd_list[0]['filename'] = $rrd_filename;
|
||||
$rrd_list[0]['descr'] = "Downstream";
|
||||
|
@@ -1,17 +1,6 @@
|
||||
<?php
|
||||
|
||||
if($_GET['id']) { $interface = $_GET['id'];
|
||||
} elseif($_GET['port']) { $interface = $_GET['port'];
|
||||
} elseif($_GET['if']) { $interface = $_GET['if'];
|
||||
} elseif($_GET['interface']) { $interface = $_GET['interface']; }
|
||||
|
||||
$query = mysql_query("SELECT * FROM `ports` AS I, `devices` AS D WHERE I.interface_id = '".$interface."'
|
||||
AND I.device_id = D.device_id");
|
||||
|
||||
$port = mysql_fetch_array($query);
|
||||
#if(is_file($config['rrd_dir'] . "/" . $port['hostname'] . "/" . safename($port['ifIndex'] . ".rrd"))) {
|
||||
$rrd_filename = $config['rrd_dir'] . "/" . $port['hostname'] . "/port-" . safename($port['ifIndex'] . "-adsl.rrd");
|
||||
#}
|
||||
$rrd_filename = $config['rrd_dir'] . "/" . $device['hostname'] . "/port-" . safename($port['ifIndex'] . "-adsl.rrd");
|
||||
|
||||
$rrd_list[0]['filename'] = $rrd_filename;
|
||||
$rrd_list[0]['descr'] = "Downstream";
|
||||
|
@@ -1,17 +1,6 @@
|
||||
<?php
|
||||
|
||||
if($_GET['id']) { $interface = $_GET['id'];
|
||||
} elseif($_GET['port']) { $interface = $_GET['port'];
|
||||
} elseif($_GET['if']) { $interface = $_GET['if'];
|
||||
} elseif($_GET['interface']) { $interface = $_GET['interface']; }
|
||||
|
||||
$query = mysql_query("SELECT * FROM `ports` AS I, `devices` AS D WHERE I.interface_id = '".$interface."'
|
||||
AND I.device_id = D.device_id");
|
||||
|
||||
$port = mysql_fetch_array($query);
|
||||
#if(is_file($config['rrd_dir'] . "/" . $port['hostname'] . "/" . safename($port['ifIndex'] . ".rrd"))) {
|
||||
$rrd_filename = $config['rrd_dir'] . "/" . $port['hostname'] . "/port-" . safename($port['ifIndex'] . "-adsl.rrd");
|
||||
#}
|
||||
$rrd_filename = $config['rrd_dir'] . "/" . $device['hostname'] . "/port-" . safename($port['ifIndex'] . "-adsl.rrd");
|
||||
|
||||
$rrd_list[0]['filename'] = $rrd_filename;
|
||||
$rrd_list[0]['descr'] = "Downstream";
|
||||
|
@@ -1,12 +1,14 @@
|
||||
<?
|
||||
|
||||
if(is_numeric($id)) {
|
||||
$port = get_port_by_id($id);
|
||||
if(is_numeric($_GET['id']) && interfacepermitted($_GET['id'])) {
|
||||
$port = get_port_by_id($_GET['id']);
|
||||
$device = device_by_id_cache($port['device_id']);
|
||||
|
||||
$title = generatedevicelink($device);
|
||||
$title .= " :: Port ".generateiflink($port);
|
||||
|
||||
$auth = TRUE;
|
||||
|
||||
}
|
||||
|
||||
$title = generatedevicelink($device);
|
||||
$title .= " :: Port ".generateiflink($port);
|
||||
|
||||
|
||||
?>
|
||||
|
@@ -1,17 +1,6 @@
|
||||
<?php
|
||||
|
||||
if($_GET['id']) { $interface = $_GET['id'];
|
||||
} elseif($_GET['port']) { $interface = $_GET['port'];
|
||||
} elseif($_GET['if']) { $interface = $_GET['if'];
|
||||
} elseif($_GET['interface']) { $interface = $_GET['interface']; }
|
||||
|
||||
$query = mysql_query("SELECT * FROM `ports` AS I, `devices` AS D WHERE I.interface_id = '".$interface."'
|
||||
AND I.device_id = D.device_id");
|
||||
|
||||
$port = mysql_fetch_array($query);
|
||||
if(is_file($config['rrd_dir'] . "/" . $port['hostname'] . "/" . safename($port['ifIndex'] . ".rrd"))) {
|
||||
$rrd_filename = $config['rrd_dir'] . "/" . $port['hostname'] . "/" . safename($port['ifIndex'] . ".rrd");
|
||||
}
|
||||
$rrd_filename = $config['rrd_dir'] . "/" . $device['hostname'] . "/" . safename($port['ifIndex'] . ".rrd");
|
||||
|
||||
$rra_in = "INOCTETS";
|
||||
$rra_out = "OUTOCTETS";
|
||||
|
@@ -1,17 +1,6 @@
|
||||
<?php
|
||||
|
||||
if($_GET['id']) { $interface = $_GET['id'];
|
||||
} elseif($_GET['port']) { $interface = $_GET['port'];
|
||||
} elseif($_GET['if']) { $interface = $_GET['if'];
|
||||
} elseif($_GET['interface']) { $interface = $_GET['interface']; }
|
||||
|
||||
$query = mysql_query("SELECT * FROM `ports` AS I, `devices` AS D WHERE I.interface_id = '".$interface."'
|
||||
AND I.device_id = D.device_id");
|
||||
|
||||
$port = mysql_fetch_array($query);
|
||||
if(is_file($config['rrd_dir'] . "/" . $port['hostname'] . "/" . safename($port['ifIndex'] . ".rrd"))) {
|
||||
$rrd_filename = $config['rrd_dir'] . "/" . $port['hostname'] . "/" . safename($port['ifIndex'] . ".rrd");
|
||||
}
|
||||
$rrd_filename = $config['rrd_dir'] . "/" . $device['hostname'] . "/" . safename($port['ifIndex'] . ".rrd");
|
||||
|
||||
$rra_in = "INERRORS";
|
||||
$rra_out = "OUTERRORS";
|
||||
|
@@ -1,9 +1,6 @@
|
||||
<?php
|
||||
|
||||
## Generate a list of ports and then call the multi_bits grapher to generate from the list
|
||||
|
||||
$query = mysql_query("SELECT * FROM `ports` AS I, `devices` AS D WHERE I.interface_id = '".mres($_GET['id'])."' AND I.device_id = D.device_id");
|
||||
$port = mysql_fetch_array($query);
|
||||
## Cycle through dot3stats OIDs and build list of RRAs to pass to multi simplex grapher
|
||||
|
||||
$oids = array('dot3StatsAlignmentErrors', 'dot3StatsFCSErrors', 'dot3StatsSingleCollisionFrames', 'dot3StatsMultipleCollisionFrames',
|
||||
'dot3StatsSQETestErrors', 'dot3StatsDeferredTransmissions', 'dot3StatsLateCollisions', 'dot3StatsExcessiveCollisions',
|
||||
@@ -11,20 +8,18 @@ $oids = array('dot3StatsAlignmentErrors', 'dot3StatsFCSErrors', 'dot3StatsSingle
|
||||
'dot3StatsSymbolErrors');
|
||||
|
||||
$i=0;
|
||||
$file = $config['rrd_dir'] . "/" . $port['hostname'] . "/" . safename("etherlike-" . $port['ifIndex'] . ".rrd");
|
||||
if(is_file($file)) {
|
||||
$rrd_filename = $config['rrd_dir'] . "/" . $device['hostname'] . "/" . safename("etherlike-" . $port['ifIndex'] . ".rrd");
|
||||
if(is_file($rrd_filename)) {
|
||||
foreach($oids as $oid){
|
||||
$oid = str_replace("dot3Stats", "", $oid);
|
||||
$oid_rra = truncate($oid, 19, '');
|
||||
$rrd_list[$i]['filename'] = $file;
|
||||
$rrd_list[$i]['filename'] = $rrd_filename;
|
||||
$rrd_list[$i]['descr'] = $oid;
|
||||
$rrd_list[$i]['rra'] = $oid_rra;
|
||||
$i++;
|
||||
}
|
||||
} else {echo("file missing: $file"); }
|
||||
|
||||
if ($_GET['debug']) { print_r($rrd_list); }
|
||||
|
||||
$colours = "mixed";
|
||||
$nototal = 1;
|
||||
$unit_text = "Errors";
|
||||
|
@@ -1,19 +1,10 @@
|
||||
<?php
|
||||
|
||||
if($_GET['id']) { $interface = $_GET['id'];
|
||||
} elseif($_GET['port']) { $interface = $_GET['port'];
|
||||
} elseif($_GET['if']) { $interface = $_GET['if'];
|
||||
} elseif($_GET['interface']) { $interface = $_GET['interface']; }
|
||||
|
||||
$query = mysql_query("SELECT * FROM `ports` AS I, `devices` AS D WHERE I.interface_id = '".$interface."'
|
||||
AND I.device_id = D.device_id");
|
||||
$port = mysql_fetch_array($query);
|
||||
|
||||
if(is_file($config['rrd_dir'] . "/" . $port['hostname'] . "/ifx-" . safename($port['ifIndex'] . ".rrd")))
|
||||
if(is_file($config['rrd_dir'] . "/" . $device['hostname'] . "/ifx-" . safename($port['ifIndex'] . ".rrd")))
|
||||
{
|
||||
$rrd_filename = $config['rrd_dir'] . "/" . $port['hostname'] . "/ifx-" . safename($port['ifIndex'] . ".rrd");
|
||||
$rrd_filename = $config['rrd_dir'] . "/" . $device['hostname'] . "/ifx-" . safename($port['ifIndex'] . ".rrd");
|
||||
|
||||
$rrd_list[1]['filename'] = $config['rrd_dir'] . "/" . $port['hostname'] . "/ifx-" . safename($port['ifIndex'] . ".rrd");
|
||||
$rrd_list[1]['filename'] = $config['rrd_dir'] . "/" . $device['hostname'] . "/ifx-" . safename($port['ifIndex'] . ".rrd");
|
||||
$rrd_list[1]['descr'] = $int['ifDescr'];
|
||||
$rrd_list[1]['rra_in'] = "InBroadcastPkts";
|
||||
$rrd_list[1]['rra_out'] = "OutBroadcastPkts";
|
||||
@@ -21,7 +12,7 @@ if(is_file($config['rrd_dir'] . "/" . $port['hostname'] . "/ifx-" . safename($po
|
||||
$rrd_list[1]['colour_area_in'] = "BB77BB";
|
||||
$rrd_list[1]['colour_area_out'] = "FFDD88";
|
||||
|
||||
$rrd_list[4]['filename'] = $config['rrd_dir'] . "/" . $port['hostname'] . "/ifx-" . safename($port['ifIndex'] . ".rrd");
|
||||
$rrd_list[4]['filename'] = $config['rrd_dir'] . "/" . $device['hostname'] . "/ifx-" . safename($port['ifIndex'] . ".rrd");
|
||||
$rrd_list[4]['descr'] = $int['ifDescr'];
|
||||
$rrd_list[4]['rra_in'] = "InMulticastPkts";
|
||||
$rrd_list[4]['rra_out'] = "OutMulticastPkts";
|
||||
@@ -41,9 +32,9 @@ if(is_file($config['rrd_dir'] . "/" . $port['hostname'] . "/ifx-" . safename($po
|
||||
include ("includes/graphs/generic_multi_seperated.inc.php");
|
||||
|
||||
}
|
||||
elseif(is_file($config['rrd_dir'] . "/" . $port['hostname'] . "/" . safename($port['ifIndex'] . ".rrd")))
|
||||
elseif(is_file($config['rrd_dir'] . "/" . $device['hostname'] . "/" . safename($port['ifIndex'] . ".rrd")))
|
||||
{
|
||||
$rrd_filename = $config['rrd_dir'] . "/" . $port['hostname'] . "/" . safename($port['ifIndex'] . ".rrd");
|
||||
$rrd_filename = $config['rrd_dir'] . "/" . $device['hostname'] . "/" . safename($port['ifIndex'] . ".rrd");
|
||||
|
||||
$rra_in = "INNUCASTPKTS";
|
||||
$rra_out = "OUTNUCASTPKTS";
|
||||
|
@@ -2,9 +2,7 @@
|
||||
|
||||
## Generate a list of ports and then call the multi_bits grapher to generate from the list
|
||||
|
||||
$parent = mysql_fetch_array(mysql_query("SELECT * FROM `ports` WHERE interface_id = '".mres($_GET['port'])."'"));
|
||||
|
||||
$query = mysql_query("SELECT * FROM `ports` WHERE `device_id` = '".$parent['device_id']."' AND `pagpGroupIfIndex` = '".$parent['ifIndex']."'");
|
||||
$query = mysql_query("SELECT * FROM `ports` WHERE `device_id` = '".$port['device_id']."' AND `pagpGroupIfIndex` = '".$port['ifIndex']."'");
|
||||
|
||||
$i=0;
|
||||
while($int = mysql_fetch_array($query)) {
|
||||
|
@@ -1,17 +1,6 @@
|
||||
<?php
|
||||
|
||||
if($_GET['id']) { $interface = $_GET['id'];
|
||||
} elseif($_GET['port']) { $interface = $_GET['port'];
|
||||
} elseif($_GET['if']) { $interface = $_GET['if'];
|
||||
} elseif($_GET['interface']) { $interface = $_GET['interface']; }
|
||||
|
||||
$query = mysql_query("SELECT * FROM `ports` AS I, `devices` AS D WHERE I.interface_id = '".$interface."'
|
||||
AND I.device_id = D.device_id");
|
||||
|
||||
$port = mysql_fetch_array($query);
|
||||
if(is_file($config['rrd_dir'] . "/" . $port['hostname'] . "/" . safename($port['ifIndex'] . ".rrd"))) {
|
||||
$rrd_filename = $config['rrd_dir'] . "/" . $port['hostname'] . "/" . safename($port['ifIndex'] . ".rrd");
|
||||
}
|
||||
$rrd_filename = $config['rrd_dir'] . "/" . $device['hostname'] . "/" . safename($port['ifIndex'] . ".rrd");
|
||||
|
||||
$rra_in = "INUCASTPKTS";
|
||||
$rra_out = "OUTUCASTPKTS";
|
||||
|
@@ -57,11 +57,11 @@
|
||||
|
||||
if($port_details) {
|
||||
$interface['graph_type'] = "port_bits";
|
||||
echo(generateiflink($interface, "<img src='graph.php?type=port_bits&port=".$interface['interface_id']."&from=".$day."&to=".$now."&width=100&height=20&legend=no&bg=".str_replace("#","", $row_colour)."'>", $interface['graph_type']));
|
||||
echo(generateiflink($interface, "<img src='graph.php?type=port_bits&id=".$interface['interface_id']."&from=".$day."&to=".$now."&width=100&height=20&legend=no&bg=".str_replace("#","", $row_colour)."'>", $interface['graph_type']));
|
||||
$interface['graph_type'] = "port_upkts";
|
||||
echo(generateiflink($interface, "<img src='graph.php?type=port_upkts&port=".$interface['interface_id']."&from=".$day."&to=".$now."&width=100&height=20&legend=no&bg=".str_replace("#","", $row_colour)."'>",$interface['graph_type']));
|
||||
echo(generateiflink($interface, "<img src='graph.php?type=port_upkts&id=".$interface['interface_id']."&from=".$day."&to=".$now."&width=100&height=20&legend=no&bg=".str_replace("#","", $row_colour)."'>",$interface['graph_type']));
|
||||
$interface['graph_type'] = "port_errors";
|
||||
echo(generateiflink($interface, "<img src='graph.php?type=port_errors&port=".$interface['interface_id']."&from=".$day."&to=".$now."&width=100&height=20&legend=no&bg=".str_replace("#","", $row_colour)."'>",$interface['graph_type']));
|
||||
echo(generateiflink($interface, "<img src='graph.php?type=port_errors&id=".$interface['interface_id']."&from=".$day."&to=".$now."&width=100&height=20&legend=no&bg=".str_replace("#","", $row_colour)."'>",$interface['graph_type']));
|
||||
}
|
||||
|
||||
echo("</td><td width=120>");
|
||||
|
@@ -42,9 +42,9 @@ if($_GET['optc'] == thumbs) {
|
||||
<a href='device/".$device['device_id']."/interface/".$interface['interface_id']."/' onmouseover=\"return overlib('\
|
||||
<div style=\'font-size: 16px; padding:5px; font-weight: bold; color: #e5e5e5;\'>".$device['hostname']." - ".$interface['ifDescr']."</div>\
|
||||
".$interface['ifAlias']." \
|
||||
<img src=\'graph.php?type=$graph_type&if=".$interface['interface_id']."&from=".$from."&to=".$now."&width=450&height=150\'>\
|
||||
<img src=\'graph.php?type=$graph_type&id=".$interface['interface_id']."&from=".$from."&to=".$now."&width=450&height=150\'>\
|
||||
', CENTER, LEFT, FGCOLOR, '#e5e5e5', BGCOLOR, '#e5e5e5', WIDTH, 400, HEIGHT, 150);\" onmouseout=\"return nd();\" >".
|
||||
"<img src='graph.php?type=$graph_type&if=".$interface['interface_id']."&from=".$from."&to=".$now."&width=180&height=45&legend=no'>
|
||||
"<img src='graph.php?type=$graph_type&id=".$interface['interface_id']."&from=".$from."&to=".$now."&width=180&height=45&legend=no'>
|
||||
</a>
|
||||
<div style='font-size: 9px;'>".truncate(short_port_descr($interface['ifAlias']), 32, '')."</div>
|
||||
</div>");
|
||||
|
Reference in New Issue
Block a user