move from port_id to interface_id. make ports discovery only discover. add some cleaner functions. add a tiny bit of alerting infrastructure.

git-svn-id: http://www.observium.org/svn/observer/trunk@3195 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
Adam Amstrong
2012-05-16 13:25:50 +00:00
parent 2e2379a8a1
commit 4db1454e92
100 changed files with 525 additions and 928 deletions
+3 -3
View File
@@ -76,12 +76,12 @@ foreach (dbFetchRows("SELECT * FROM `bgpPeers` WHERE `device_id` = ? ORDER BY `b
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, ports AS I, devices AS D WHERE ";
$query .= "(A.ipv4_address = ? AND I.interface_id = A.interface_id)";
$query .= "(A.ipv4_address = ? AND I.port_id = A.port_id)";
$query .= " AND D.device_id = I.device_id";
$ipv4_host = dbFetchRow($query,array($peer['bgpPeerIdentifier']));
$query = "SELECT * FROM ipv6_addresses AS A, ports AS I, devices AS D WHERE ";
$query .= "(A.ipv6_address = ? AND I.interface_id = A.interface_id)";
$query .= "(A.ipv6_address = ? AND I.port_id = A.port_id)";
$query .= " AND D.device_id = I.device_id";
$ipv6_host = dbFetchRow($query,array($peer['bgpPeerIdentifier']));
@@ -167,7 +167,7 @@ foreach (dbFetchRows("SELECT * FROM `bgpPeers` WHERE `device_id` = ? ORDER BY `b
{
case 'macaccounting_bits':
case 'macaccounting_pkts':
$acc = dbFetchRow("SELECT * FROM `ipv4_mac` AS I, `mac_accounting` AS M, `ports` AS P, `devices` AS D WHERE I.ipv4_address = ? AND M.mac = I.mac_address AND P.interface_id = M.interface_id AND D.device_id = P.device_id", array($peer['bgpPeerIdentifier']));
$acc = dbFetchRow("SELECT * FROM `ipv4_mac` AS I, `mac_accounting` AS M, `ports` AS P, `devices` AS D WHERE I.ipv4_address = ? AND M.mac = I.mac_address AND P.port_id = M.port_id AND D.device_id = P.device_id", array($peer['bgpPeerIdentifier']));
$database = $config['rrd_dir'] . "/" . $device['hostname'] . "/cip-" . $acc['ifIndex'] . "-" . $acc['mac'] . ".rrd";
if (is_array($acc) && is_file($database))
{
+3 -3
View File
@@ -16,7 +16,7 @@ foreach (dbFetchRows("SELECT * FROM `ospf_instances` WHERE `device_id` = ?", arr
$nbr_count = dbFetchCell("SELECT COUNT(*) FROM `ospf_nbrs` WHERE `device_id` = ?", array($device['device_id']));
$query = "SELECT * FROM ipv4_addresses AS A, ports AS I WHERE ";
$query .= "(A.ipv4_address = ? AND I.interface_id = A.interface_id)";
$query .= "(A.ipv4_address = ? AND I.port_id = A.port_id)";
$query .= " AND I.device_id = ?";
$ipv4_host = dbFetchRow($query, array($peer['bgpPeerIdentifier'], $device['device_id']));
@@ -63,7 +63,7 @@ foreach (dbFetchRows("SELECT * FROM `ospf_instances` WHERE `device_id` = ?", arr
##### Loop Ports
$i_p = $i_a + 1;
$p_sql = "SELECT * FROM `ospf_ports` AS O, `ports` AS P WHERE O.`ospfIfAdminStat` = 'enabled' AND O.`device_id` = ? AND O.`ospfIfAreaId` = ? AND P.interface_id = O.interface_id";
$p_sql = "SELECT * FROM `ospf_ports` AS O, `ports` AS P WHERE O.`ospfIfAdminStat` = 'enabled' AND O.`device_id` = ? AND O.`ospfIfAreaId` = ? AND P.port_id = O.port_id";
foreach (dbFetchRows($p_sql, array($device['device_id'], $area['ospfAreaId'])) as $ospfport)
{
if (!is_integer($i_a/2))
@@ -107,7 +107,7 @@ foreach (dbFetchRows("SELECT * FROM `ospf_instances` WHERE `device_id` = ?", arr
if (!is_integer($i_n/2)) { $nbr_bg = $list_colour_b_a; } else { $nbr_bg = $list_colour_b_b; }
$host = @dbFetchRow("SELECT * FROM ipv4_addresses AS A, ports AS I, devices AS D WHERE A.ipv4_address = ?
AND I.interface_id = A.interface_id AND D.device_id = I.device_id", array($nbr['ospfNbrRtrId']));
AND I.port_id = A.port_id AND D.device_id = I.device_id", array($nbr['ospfNbrRtrId']));
if (is_array($host)) { $rtr_id = generate_device_link($host); } else { $rtr_id = "unknown"; }