mirror of
https://github.com/stylersnico/librenms.git
synced 2026-07-12 16:06:25 +02:00
change interfaces table to ports (to match GUI conventions)
git-svn-id: http://www.observium.org/svn/observer/trunk@889 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
$sql = "SELECT * FROM ipv4_mac AS M, interfaces AS I WHERE I.interface_id = M.interface_id AND I.device_id = '".$device['device_id']."'";
|
||||
$sql = "SELECT * FROM ipv4_mac AS M, ports AS I WHERE I.interface_id = M.interface_id AND I.device_id = '".$device['device_id']."'";
|
||||
$query = mysql_query($sql);
|
||||
|
||||
echo("<table border=0 cellspacing=0 cellpadding=5 width=100%>");
|
||||
@@ -8,7 +8,7 @@ $i = "1";
|
||||
|
||||
while($arp = mysql_fetch_array($query)) {
|
||||
if(!is_integer($i/2)) { $bg_colour = $list_colour_a; } else { $bg_colour = $list_colour_b; }
|
||||
$arp_host = mysql_fetch_array(mysql_query("SELECT * FROM ipv4_addresses AS A, interfaces AS I, devices AS D WHERE A.ipv4_address = '".$arp['ipv4_address']."' AND I.interface_id = A.interface_id AND D.device_id = I.device_id"));
|
||||
$arp_host = mysql_fetch_array(mysql_query("SELECT * FROM ipv4_addresses AS A, ports AS I, devices AS D WHERE A.ipv4_address = '".$arp['ipv4_address']."' AND I.interface_id = A.interface_id AND D.device_id = I.device_id"));
|
||||
|
||||
if($arp_host) { $arp_name = generatedevicelink($arp_host); } else { unset($arp_name); }
|
||||
if($arp_host) { $arp_if = generateiflink($arp_host); } else { unset($arp_if); }
|
||||
|
||||
@@ -32,12 +32,12 @@ print_optionbar_end();
|
||||
|
||||
if($peer['bgpPeerRemoteAs'] == $device['bgpLocalAs']) { $peer_type = "<span style='color: #00f;'>iBGP</span>"; } else { $peer_type = "<span style='color: #0a0;'>eBGP</span>"; }
|
||||
|
||||
$query = "SELECT * FROM ipv4_addresses AS A, interfaces AS I, devices AS D WHERE ";
|
||||
$query = "SELECT * FROM ipv4_addresses AS A, ports AS I, devices AS D WHERE ";
|
||||
$query .= "(A.ipv4_address = '".$peer['bgpPeerIdentifier']."' AND I.interface_id = A.interface_id)";
|
||||
$query .= " AND D.device_id = I.device_id";
|
||||
$ipv4_host = mysql_fetch_array(mysql_query($query));
|
||||
|
||||
$query = "SELECT * FROM ipv6_addresses AS A, interfaces AS I, devices AS D WHERE ";
|
||||
$query = "SELECT * FROM ipv6_addresses AS A, ports AS I, devices AS D WHERE ";
|
||||
$query .= "(A.ipv6_address = '".$peer['bgpPeerIdentifier']."' AND I.interface_id = A.interface_id)";
|
||||
$query .= " AND D.device_id = I.device_id";
|
||||
$ipv6_host = mysql_fetch_array(mysql_query($query));
|
||||
@@ -105,7 +105,7 @@ print_optionbar_end();
|
||||
}
|
||||
if ($_GET['opta'] == "macaccounting") {
|
||||
if(mysql_result(mysql_query("SELECT COUNT(*) FROM `ipv4_mac` AS I, mac_accounting AS M WHERE I.ipv4_address = '".$peer['bgpPeerIdentifier']."' AND M.mac = I.mac_address"),0)) {
|
||||
$acc = mysql_fetch_array(mysql_query("SELECT * FROM `ipv4_mac` AS I, mac_accounting AS M, interfaces AS P WHERE I.ipv4_address = '".$peer['bgpPeerIdentifier']."' AND M.mac = I.mac_address AND P.interface_id = M.interface_id"));
|
||||
$acc = mysql_fetch_array(mysql_query("SELECT * FROM `ipv4_mac` AS I, mac_accounting AS M, ports AS P WHERE I.ipv4_address = '".$peer['bgpPeerIdentifier']."' AND M.mac = I.mac_address AND P.interface_id = M.interface_id"));
|
||||
$graph_type = "mac_acc_bits";
|
||||
$database = $config['rrd_dir'] . "/" . $device['hostname'] . "/cip-" . $acc['ifIndex'] . "-" . $acc['mac'] . ".rrd";
|
||||
if ( is_file($database) ) {
|
||||
|
||||
@@ -23,7 +23,7 @@ function printEntPhysical($ent, $level, $class) {
|
||||
if($link) {echo("<a $link>");}
|
||||
|
||||
if($ent['ifIndex']) {
|
||||
$interface = mysql_fetch_array(mysql_query("SELECT * FROM `interfaces` WHERE ifIndex = '".$ent['ifIndex']."' AND device_id = '".$device['device_id']."'"));
|
||||
$interface = mysql_fetch_array(mysql_query("SELECT * FROM `ports` WHERE ifIndex = '".$ent['ifIndex']."' AND device_id = '".$device['device_id']."'"));
|
||||
$ent['entPhysicalName'] = generateiflink($interface);
|
||||
}
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ if($hrdevice['hrDeviceType'] == "hrDeviceProcessor") {
|
||||
echo("<td><a href='#' $proc_popup>".$hrdevice['hrDeviceDescr']."</a></td>");
|
||||
} elseif ($hrdevice['hrDeviceType'] == "hrDeviceNetwork") {
|
||||
$int = str_replace("network interface ", "", $hrdevice['hrDeviceDescr']);
|
||||
$interface = mysql_fetch_array(mysql_query("SELECT * FROM interfaces WHERE device_id = '".$device['device_id']."' AND ifDescr = '".$int."'"));
|
||||
$interface = mysql_fetch_array(mysql_query("SELECT * FROM ports WHERE device_id = '".$device['device_id']."' AND ifDescr = '".$int."'"));
|
||||
if($interface['ifIndex']) {
|
||||
echo("<td>".generateiflink($interface)."</td>");
|
||||
} else {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
$interface_query = mysql_query("select * from interfaces WHERE interface_id = '".$_GET['opta']."'");
|
||||
$interface_query = mysql_query("select * from ports WHERE interface_id = '".$_GET['opta']."'");
|
||||
$interface = mysql_fetch_array($interface_query);
|
||||
|
||||
$port_details = 1;
|
||||
@@ -42,7 +42,7 @@ $interface = mysql_fetch_array($interface_query);
|
||||
$broke = yes;
|
||||
}
|
||||
|
||||
if(mysql_result(mysql_query("SELECT COUNT(*) FROM `interfaces` WHERE `pagpGroupIfIndex` = '".$interface['ifIndex']."' and `device_id` = '".$device['device_id']."'"),0)) {
|
||||
if(mysql_result(mysql_query("SELECT COUNT(*) FROM `ports` WHERE `pagpGroupIfIndex` = '".$interface['ifIndex']."' and `device_id` = '".$device['device_id']."'"),0)) {
|
||||
$pagp = " | <a href='".$config['base_url']."/device/" . $device['device_id'] . "/interface/".$interface['interface_id']."/pagp/'>PAgP</a>";
|
||||
}
|
||||
|
||||
|
||||
@@ -6,10 +6,10 @@ $overview = 1;
|
||||
|
||||
#$device = mysql_fetch_array(mysql_query("SELECT * FROM `devices` WHERE `device_id` = '$_GET[id]'"));
|
||||
|
||||
$interfaces['total'] = mysql_result(mysql_query("SELECT count(*) FROM interfaces WHERE device_id = '" . $device['device_id'] . "'"),0);
|
||||
$interfaces['up'] = mysql_result(mysql_query("SELECT count(*) FROM interfaces WHERE device_id = '" . $device['device_id'] . "' AND ifOperStatus = 'up'"),0);
|
||||
$interfaces['down'] = mysql_result(mysql_query("SELECT count(*) FROM interfaces WHERE device_id = '" . $device['device_id'] . "' AND ifOperStatus = 'down' AND ifAdminStatus = 'up'"),0);
|
||||
$interfaces['disabled'] = mysql_result(mysql_query("SELECT count(*) FROM interfaces WHERE device_id = '" . $device['device_id'] . "' AND ifAdminStatus = 'down'"),0);
|
||||
$ports['total'] = mysql_result(mysql_query("SELECT count(*) FROM ports WHERE device_id = '" . $device['device_id'] . "'"),0);
|
||||
$ports['up'] = mysql_result(mysql_query("SELECT count(*) FROM ports WHERE device_id = '" . $device['device_id'] . "' AND ifOperStatus = 'up'"),0);
|
||||
$ports['down'] = mysql_result(mysql_query("SELECT count(*) FROM ports WHERE device_id = '" . $device['device_id'] . "' AND ifOperStatus = 'down' AND ifAdminStatus = 'up'"),0);
|
||||
$ports['disabled'] = mysql_result(mysql_query("SELECT count(*) FROM ports WHERE device_id = '" . $device['device_id'] . "' AND ifAdminStatus = 'down'"),0);
|
||||
|
||||
$services['total'] = mysql_result(mysql_query("SELECT count(service_id) FROM services WHERE service_host = '" . $device['device_id'] . "'"),0);
|
||||
$services['up'] = mysql_result(mysql_query("SELECT count(service_id) FROM services WHERE service_host = '" . $device['device_id'] . "' AND service_status = '1' AND service_ignore ='0'"),0);
|
||||
@@ -17,7 +17,7 @@ $services['down'] = mysql_result(mysql_query("SELECT count(service_id) FROM serv
|
||||
$services['disabled'] = mysql_result(mysql_query("SELECT count(service_id) FROM services WHERE service_host = '" . $device['device_id'] . "' AND service_ignore = '1'"),0);
|
||||
|
||||
if($services['down']) { $services_colour = $warn_colour_a; } else { $services_colour = $list_colour_a; }
|
||||
if($interfaces['down']) { $interfaces_colour = $warn_colour_a; } else { $interfaces_colour = $list_colour_a; }
|
||||
if($ports['down']) { $ports_colour = $warn_colour_a; } else { $ports_colour = $list_colour_a; }
|
||||
|
||||
echo("<div style='width: 50%; float: left;'>");
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
if($interfaces['total']) {
|
||||
if($ports['total']) {
|
||||
echo("<div style='background-color: #eeeeee; margin: 5px; padding: 5px;'>
|
||||
" . device_traffic_image($device['device_id'], 490, 100, $day, '-300s') . "");
|
||||
|
||||
@@ -8,16 +8,16 @@ if($interfaces['total']) {
|
||||
|
||||
echo("
|
||||
<table class=tablehead cellpadding=2 cellspacing=0 width=100%>
|
||||
<tr bgcolor=$interfaces_colour align=center><td></td>
|
||||
<td width=25%><img src='images/16/connect.png' align=absmiddle> $interfaces[total]</td>
|
||||
<td width=25% class=green><img src='images/16/if-connect.png' align=absmiddle> $interfaces[up]</td>
|
||||
<td width=25% class=red><img src='images/16/if-disconnect.png' align=absmiddle> $interfaces[down]</td>
|
||||
<td width=25% class=grey><img src='images/16/if-disable.png' align=absmiddle> $interfaces[disabled]</td></tr>
|
||||
<tr bgcolor=$ports_colour align=center><td></td>
|
||||
<td width=25%><img src='images/16/connect.png' align=absmiddle> $ports[total]</td>
|
||||
<td width=25% class=green><img src='images/16/if-connect.png' align=absmiddle> $ports[up]</td>
|
||||
<td width=25% class=red><img src='images/16/if-disconnect.png' align=absmiddle> $ports[down]</td>
|
||||
<td width=25% class=grey><img src='images/16/if-disable.png' align=absmiddle> $ports[disabled]</td></tr>
|
||||
</table>");
|
||||
|
||||
echo("<div style='margin: 8px; font-size: 11px; font-weight: bold;'>");
|
||||
|
||||
$sql = "SELECT * FROM interfaces WHERE `device_id` = '" . $device['device_id'] . "' AND deleted != '1'";
|
||||
$sql = "SELECT * FROM ports WHERE `device_id` = '" . $device['device_id'] . "' AND deleted != '1'";
|
||||
$query = mysql_query($sql);
|
||||
while($data = mysql_fetch_array($query)) {
|
||||
$data = ifNameDescr($data);
|
||||
|
||||
@@ -8,7 +8,7 @@ $i = "1";
|
||||
|
||||
while($arp = mysql_fetch_array($query)) {
|
||||
if(!is_integer($i/2)) { $bg_colour = $list_colour_a; } else { $bg_colour = $list_colour_b; }
|
||||
$arp_host = mysql_fetch_array(mysql_query("SELECT * FROM ipv4_addresses AS A, interfaces AS I, devices AS D WHERE A.ipv4_address = '".$arp['ipv4_address']."' AND I.interface_id = A.interface_id AND D.device_id = I.device_id"));
|
||||
$arp_host = mysql_fetch_array(mysql_query("SELECT * FROM ipv4_addresses AS A, ports AS I, devices AS D WHERE A.ipv4_address = '".$arp['ipv4_address']."' AND I.interface_id = A.interface_id AND D.device_id = I.device_id"));
|
||||
|
||||
if($arp_host) { $arp_name = generatedevicelink($arp_host); } else { unset($arp_name); }
|
||||
if($arp_host) { $arp_if = generateiflink($arp_host); } else { unset($arp_if); }
|
||||
|
||||
@@ -117,7 +117,7 @@
|
||||
} else {
|
||||
|
||||
$query = mysql_query("SELECT *, (M.cipMacHCSwitchedBytes_input_rate + M.cipMacHCSwitchedBytes_output_rate) as bps FROM `mac_accounting` AS M,
|
||||
`interfaces` AS I, `devices` AS D WHERE M.interface_id = '".$interface['interface_id']."' AND I.interface_id = M.interface_id
|
||||
`ports` AS I, `devices` AS D WHERE M.interface_id = '".$interface['interface_id']."' AND I.interface_id = M.interface_id
|
||||
AND I.device_id = D.device_id ORDER BY bps DESC");
|
||||
|
||||
while($acc = mysql_fetch_array($query)) {
|
||||
@@ -125,7 +125,7 @@
|
||||
$addy = mysql_fetch_array(mysql_query("SELECT * FROM ipv4_mac where mac_address = '".$acc['mac']."'"));
|
||||
$name = gethostbyaddr($addy['ipv4_address']);
|
||||
|
||||
$arp_host = mysql_fetch_array(mysql_query("SELECT * FROM ipv4_addresses AS A, interfaces AS I, devices AS D WHERE A.ipv4_address = '".$addy['ipv4_address']."' AND I.interface_id = A.interface_id AND D.device_id = I.device_id"));
|
||||
$arp_host = mysql_fetch_array(mysql_query("SELECT * FROM ipv4_addresses AS A, ports AS I, devices AS D WHERE A.ipv4_address = '".$addy['ipv4_address']."' AND I.interface_id = A.interface_id AND D.device_id = I.device_id"));
|
||||
if($arp_host) { $arp_name = generatedevicelink($arp_host); $arp_name .= " ".generateiflink($arp_host); } else { unset($arp_if); }
|
||||
|
||||
if($name == $addy['ipv4_address']) { unset ($name); }
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
|
||||
|
||||
|
||||
$members = mysql_query("SELECT * FROM `interfaces` WHERE `pagpGroupIfIndex` = '".$interface['ifIndex']."' and `device_id` = '".$device['device_id']."'");
|
||||
$members = mysql_query("SELECT * FROM `ports` WHERE `pagpGroupIfIndex` = '".$interface['ifIndex']."' and `device_id` = '".$device['device_id']."'");
|
||||
while($member = mysql_fetch_array($members)) {
|
||||
echo("$br<img src='images/16/brick_link.png' align=absmiddle> <strong>" . generateiflink($member) . " (PAgP)</strong>");
|
||||
$br = "<br />";
|
||||
|
||||
@@ -31,7 +31,7 @@ if($_GET['optc'] == thumbs) {
|
||||
$timeperiods = array('-1day','-1week','-1month','-1year');
|
||||
$from = '-1day';
|
||||
echo("<div style='display: block; clear: both; margin: auto;'>");
|
||||
$sql = "select * from interfaces WHERE device_id = '".$device['device_id']."' ORDER BY ifIndex";
|
||||
$sql = "select * from ports WHERE device_id = '".$device['device_id']."' ORDER BY ifIndex";
|
||||
$query = mysql_query($sql);
|
||||
unset ($seperator);
|
||||
while($interface = mysql_fetch_array($query)) {
|
||||
@@ -55,7 +55,7 @@ if($_GET['optc'] == thumbs) {
|
||||
if($_GET['opta'] == "details" ) { $port_details = 1; }
|
||||
echo("<div style='margin: 5px;'><table border=0 cellspacing=0 cellpadding=5 width=100%>");
|
||||
$i = "1";
|
||||
$interface_query = mysql_query("select * from interfaces WHERE device_id = '".$device['device_id']."' AND deleted = '0' ORDER BY `ifIndex` ASC");
|
||||
$interface_query = mysql_query("select * from ports WHERE device_id = '".$device['device_id']."' AND deleted = '0' ORDER BY `ifIndex` ASC");
|
||||
while($interface = mysql_fetch_array($interface_query)) {
|
||||
include("includes/print-interface.inc.php");
|
||||
$i++;
|
||||
|
||||
Reference in New Issue
Block a user