mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
a million fixes. half way to 0.6.0! :D
git-svn-id: http://www.observium.org/svn/observer/trunk@407 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
@@ -1,16 +1,24 @@
|
||||
<?php
|
||||
|
||||
$daily_traffic = "graph.php?host=" . $device['device_id'] . "&type=$graph_type&from=$day&to=$now&width=215&height=100";
|
||||
$daily_traffic .= $args;
|
||||
$daily_url = "graph.php?host=" . $device['device_id'] . "&type=$graph_type&from=$day&to=$now&width=400&height=150";
|
||||
$daily_url .= $args;
|
||||
|
||||
$weekly_traffic = "graph.php?host=" . $device['device_id'] . "&type=$graph_type&from=$week&to=$now&width=215&height=100";
|
||||
$weekly_traffic .= $args;
|
||||
$weekly_url = "graph.php?host=" . $device['device_id'] . "&type=$graph_type&from=$week&to=$now&width=400&height=150";
|
||||
$weekly_url .= $args;
|
||||
|
||||
$monthly_traffic = "graph.php?host=" . $device['device_id'] . "&type=$graph_type&from=$month&to=$now&width=215&height=100";
|
||||
$monthly_traffic .= $args;
|
||||
$monthly_url = "graph.php?host=" . $device['device_id'] . "&type=$graph_type&from=$month&to=$now&width=400&height=150";
|
||||
$monthly_url .= $args;
|
||||
|
||||
$yearly_traffic = "graph.php?host=" . $device['device_id'] . "&type=$graph_type&from=$year&to=$now&width=215&height=100";
|
||||
$yearly_url = "graph.php?host=" . $device['device_id'] . "&type=$graph_type&from=$year&to=$now&width=400&height=150";
|
||||
$yearly_traffic .= $args;
|
||||
$yearly_url = "graph.php?host=" . $device['device_id'] . "&type=$graph_type&from=$year&to=$now&width=400&height=150";
|
||||
$yearly_url .= $args;
|
||||
|
||||
echo("<a onmouseover=\"return overlib('<img src=\'$daily_url\'>', LEFT".$config['overlib_defaults'].");\" onmouseout=\"return nd();\">
|
||||
<img src='$daily_traffic' border=0></a> ");
|
||||
|
@@ -5,41 +5,31 @@
|
||||
$interface['device_id'] = $device['device_id'];
|
||||
$interface['hostname'] = $device['hostname'];
|
||||
|
||||
if(!$graph_type) { $graph_type = "bits"; }
|
||||
|
||||
$if_id = $interface['interface_id'];
|
||||
|
||||
|
||||
$ifDescr = fixifName($interface['ifDescr']);
|
||||
$ifIndex = $interface['ifIndex'];
|
||||
$ifAlias = $interface['ifAlias'];
|
||||
$ifSpeed = humanspeed($interface['ifSpeed']);
|
||||
$ifPhysAddress = $interface['ifPhysAddress'];
|
||||
$ifType = fixiftype($interface['ifType']);
|
||||
$ifHardType = $interface['ifHardType'];
|
||||
# $ifType = fixiftype($interface['ifType']);
|
||||
# $ifHardType = $interface['ifHardType'];
|
||||
|
||||
# if($ifAlias) {$ifAlias = $ifAlias . ;}
|
||||
#if($bg == "#ffffff") { $bg = "#e5e5e5"; } else { $bg="#ffffff"; }
|
||||
if($bg == "#e5e5e5") { $bg = "#ffffff"; } else { $bg="#e5e5e5"; }
|
||||
|
||||
if($interface['in_errors'] > 0 || $interface['out_errors'] > 0) {
|
||||
$error_img = generateiflink($interface,"<img src='images/16/chart_curve_error.png' alt='Interface Errors' border=0>",errors);
|
||||
} else { $error_img = ""; }
|
||||
|
||||
# $graph_url = "graph.php?if=$if_id&from=$twoday&to=$now&width=400&height=120&type=bits";
|
||||
|
||||
echo("<tr style=\"background-color: $bg; padding: 5px;\" valign=top onmouseover=\"this.style.backgroundColor='#fdd';\" onmouseout=\"this.style.backgroundColor='$bg';\" onclick=\"location.href='/device/".$device['device_id']."/interface/".$interface['interface_id']."/'\" style='cursor: hand;'>
|
||||
<td valign=top width=300>");
|
||||
|
||||
echo(" <span class=list-large>
|
||||
" . generateiflink($interface, "$i. $ifDescr") . " $error_img
|
||||
" . generateiflink($interface, "$i. ".fixifName($interface['ifDescr'])) . " $error_img
|
||||
|
||||
</span><br /><span class=interface-desc>$ifAlias</span>");
|
||||
</span><br /><span class=interface-desc>".$interface['ifAlias']."</span>");
|
||||
|
||||
if($ifAlias) { echo("<br />"); }
|
||||
if($interface['ifAlias']) { echo("<br />"); }
|
||||
|
||||
unset ($break);
|
||||
if(!$dographs) {
|
||||
if($port_details) {
|
||||
$ipdata = mysql_query("SELECT * FROM `ipv4_addresses` WHERE `interface_id` = '" . $interface['interface_id'] . "'");
|
||||
while($ip = mysql_fetch_Array($ipdata)) {
|
||||
echo("$break <a class=interface-desc href=\"javascript:popUp('/netcmd.php?cmd=whois&query=$ip[ipv4_address]')\">$ip[ipv4_address]/$ip[ipv4_prefixlen]</a>");
|
||||
@@ -50,7 +40,8 @@
|
||||
echo("$break <a class=interface-desc href=\"javascript:popUp('/netcmd.php?cmd=whois&query=".$ip6['ipv6_address']."')\">".Net_IPv6::compress($ip6['ipv6_address'])."/".$ip6['ipv6_prefixlen']."</a>");
|
||||
$break = "<br />";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
echo("</span>");
|
||||
|
||||
echo("</td><td width=100>");
|
||||
@@ -61,23 +52,21 @@
|
||||
|
||||
echo("</td><td width=120>");
|
||||
if($interface['ifOperStatus'] == "up") {
|
||||
|
||||
$in_perc = @round($interface['in_rate']/$interface['ifSpeed']*100);
|
||||
$out_perc = @round($interface['in_rate']/$interface['ifSpeed']*100);
|
||||
|
||||
echo("<img src='images/16/arrow_left.png' align=absmiddle> <span style='color: " . percent_colour($in_perc) . "'>" .
|
||||
formatRates($interface['in_rate']) . "</span><br />");
|
||||
echo("<img align=absmiddle src='images/16/arrow_out.png'> <span style='color: " . percent_colour($out_perc) . "'>" .
|
||||
formatRates($interface['out_rate']) . "</span>");
|
||||
|
||||
formatRates($interface['out_rate']) . "</span>");
|
||||
}
|
||||
echo("</td><td width=75Barbuda>");
|
||||
if($ifSpeed && $ifSpeed != "") { echo("<span class=box-desc>$ifSpeed</span>"); }
|
||||
|
||||
echo("</td><td width=75>");
|
||||
if($interface['ifSpeed'] && $interface['ifAlias'] != "") { echo("<span class=box-desc>".humanspeed($interface['ifSpeed'])."</span>"); }
|
||||
echo("<br />");
|
||||
|
||||
# if($interface[ifDuplex] != unknown) { echo("<span class=box-desc>Duplex " . $interface['ifDuplex'] . "</span>"); } else { echo("-"); }
|
||||
|
||||
if($device['os'] == "IOS" || $device['os'] == "IOS XE") {
|
||||
|
||||
if($interface['ifTrunk']) {
|
||||
echo("<span class=box-desc><span class=red>" . $interface['ifTrunk'] . "</span></span>");
|
||||
} elseif ($interface['ifVlan']) {
|
||||
@@ -86,22 +75,22 @@
|
||||
$vrf = mysql_fetch_array(mysql_query("SELECT * FROM vrfs WHERE vrf_id = '".$interface['ifVrf']."'"));
|
||||
echo("<span style='color: green;'>" . $vrf['vrf_name'] . "</span>");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
echo("</td><td width=150>");
|
||||
if($ifType && $ifType != "") { echo("<span class=box-desc>" . $ifType . "</span>"); } else { echo("-"); }
|
||||
if($interface['ifType'] && $interface['ifType'] != "") { echo("<span class=box-desc>" . fixiftype($interface['ifType']) . "</span>"); } else { echo("-"); }
|
||||
echo("<br />");
|
||||
if($ifHardType && $ifHardType != "") { echo("<span class=box-desc>" . $ifHardType . "</span>"); } else { echo("-"); }
|
||||
echo("</td><td width=150>");
|
||||
if($interface['ifPhysAddress'] && $interface['ifPhysAddress'] != "") { echo("<span class=box-desc>" . $interface['ifPhysAddress'] . "</span>"); } else { echo("-"); }
|
||||
echo("<br />");
|
||||
if($interface['ifMtu'] && $interface['ifMtu'] != "") { echo("<span class=box-desc>MTU " . $interface['ifMtu'] . "</span>"); } else { echo("-"); }
|
||||
}
|
||||
|
||||
#}
|
||||
|
||||
echo("</td>");
|
||||
echo("<td width=375 valign=top class=interface-desc>");
|
||||
if ( strpos($ifDescr, "oopback") === false && !$dographs) {
|
||||
if ( strpos($interface['ifDescr'], "oopback") === false && !$graph_type) {
|
||||
$link_query = mysql_query("select * from links AS L, interfaces AS I, devices AS D WHERE L.src_if = '$if_id' AND L.dst_if = I.interface_id AND I.device_id = D.device_id");
|
||||
while($link = mysql_fetch_array($link_query)) {
|
||||
# echo("<img src='images/16/connect.png' align=absmiddle alt='Directly Connected' /> " . generateiflink($link, makeshortif($link['ifDescr'])) . " on " . generatedevicelink($link, shorthost($link['hostname'])) . "</a><br />");
|
||||
@@ -112,6 +101,8 @@ echo("</td>");
|
||||
|
||||
unset($br);
|
||||
|
||||
if($port_details) { ## Show which other devices are on the same subnet as this interface
|
||||
|
||||
$sql = "SELECT `ipv4_network_id` FROM `ipv4_addresses` WHERE `interface_id` = '".$interface['interface_id']."' AND `ipv4_address` NOT LIKE '127.%'";
|
||||
$nets_query = mysql_query($sql);
|
||||
while($net = mysql_fetch_array($nets_query)) {
|
||||
@@ -129,7 +120,6 @@ echo("</td>");
|
||||
$this_ifname = fixifName($new['ifDescr']);
|
||||
$int_links[$this_ifid] = $this_ifid;
|
||||
$int_links_v4[$this_ifid] = 1;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -152,6 +142,7 @@ echo("</td>");
|
||||
$int_links_v6[$this_ifid] = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach($int_links as $int_link) {
|
||||
|
||||
@@ -187,7 +178,7 @@ echo("</td>");
|
||||
echo("</td></tr>");
|
||||
|
||||
// If we're showing graphs, generate the graph and print the img tags
|
||||
if($dographs && is_file($config['rrd_dir'] . "/" . $hostname . "/". $ifIndex . ".rrd")) {
|
||||
if($graph_type && is_file($config['rrd_dir'] . "/" . $hostname . "/". $interface['ifIndex'] . ".rrd")) {
|
||||
|
||||
$type = $graph_type;
|
||||
|
||||
@@ -203,7 +194,7 @@ echo("</td>");
|
||||
$yearly_traffic = "graph.php?if=$if_id&type=" . $graph_type . "&from=$year&to=$now&width=210&height=100";
|
||||
$yearly_url = "graph.php?if=$if_id&type=" . $graph_type . "&from=$year&to=$now&width=500&height=150";
|
||||
|
||||
echo("<tr style='background-color: $bg; padding: 5px;'><td colspan=3>");
|
||||
echo("<tr style='background-color: $bg; padding: 5px;'><td colspan=7>");
|
||||
|
||||
echo("<a href='?page=interface&id=" . $interface['interface_id'] . "' onmouseover=\"return overlib('<img src=\'$daily_url\'>', LEFT".$config['overlib_defaults'].");\"
|
||||
onmouseout=\"return nd();\"> <img src='$daily_traffic' border=0></a>");
|
||||
|
Reference in New Issue
Block a user