This commit is contained in:
HenocKA
2016-02-02 12:58:05 +01:00
107 changed files with 4982 additions and 480 deletions
+22 -47
View File
@@ -168,10 +168,10 @@ if ($config['enable_bgp']) {
$peerrrd = $config['rrd_dir'].'/'.$device['hostname'].'/'.safename('bgp-'.$peer['bgpPeerIdentifier'].'.rrd');
if (!is_file($peerrrd)) {
$create_rrd = 'DS:bgpPeerOutUpdates:COUNTER:600:U:100000000000
DS:bgpPeerInUpdates:COUNTER:600:U:100000000000
DS:bgpPeerOutTotal:COUNTER:600:U:100000000000
DS:bgpPeerInTotal:COUNTER:600:U:100000000000
$create_rrd = 'DS:bgpPeerOutUpdates:COUNTER:600:U:100000000000
DS:bgpPeerInUpdates:COUNTER:600:U:100000000000
DS:bgpPeerOutTotal:COUNTER:600:U:100000000000
DS:bgpPeerInTotal:COUNTER:600:U:100000000000
DS:bgpPeerEstablished:GAUGE:600:0:U '.$config['rrd_rra'];
rrdtool_create($peerrrd, $create_rrd);
@@ -294,45 +294,6 @@ if ($config['enable_bgp']) {
unset($cbgp_data);
}//end if
if ($device['os'] == 'junos') {
// Missing: cbgpPeerAdminLimit cbgpPeerPrefixThreshold cbgpPeerPrefixClearThreshold cbgpPeerSuppressedPrefixes cbgpPeerWithdrawnPrefixes
$safis['unicast'] = 1;
$safis['multicast'] = 2;
if (!isset($peerIndexes)) {
$j_bgp = snmpwalk_cache_multi_oid($device, 'jnxBgpM2PeerTable', $jbgp, 'BGP4-V2-MIB-JUNIPER', $config['install_dir'].'/mibs/junos');
foreach ($j_bgp as $index => $entry) {
switch ($entry['jnxBgpM2PeerRemoteAddrType']) {
case 'ipv4':
$ip = long2ip(hexdec($entry['jnxBgpM2PeerRemoteAddr']));
$j_peerIndexes[$ip] = $entry['jnxBgpM2PeerIndex'];
break;
case 'ipv6':
$ip6 = trim(str_replace(' ', '', $entry['jnxBgpM2PeerRemoteAddr']), '"');
$ip6 = substr($ip6, 0, 4).':'.substr($ip6, 4, 4).':'.substr($ip6, 8, 4).':'.substr($ip6, 12, 4).':'.substr($ip6, 16, 4).':'.substr($ip6, 20, 4).':'.substr($ip6, 24, 4).':'.substr($ip6, 28, 4);
$ip6 = Net_IPv6::compress($ip6);
$j_peerIndexes[$ip6] = $entry['jnxBgpM2PeerIndex'];
break;
default:
echo "PANIC: Don't know RemoteAddrType ".$entry['jnxBgpM2PeerRemoteAddrType']."!\n";
break;
}
}
}//end if
$j_prefixes = snmpwalk_cache_multi_oid($device, 'jnxBgpM2PrefixCountersTable', $jbgp, 'BGP4-V2-MIB-JUNIPER', $config['install_dir'].'/mibs/junos');
$cbgpPeerAcceptedPrefixes = $j_prefixes[$j_peerIndexes[$peer['bgpPeerIdentifier']].".$afi.".$safis[$safi]]['jnxBgpM2PrefixInPrefixesAccepted'];
$cbgpPeerDeniedPrefixes = $j_prefixes[$j_peerIndexes[$peer['bgpPeerIdentifier']].".$afi.".$safis[$safi]]['jnxBgpM2PrefixInPrefixesRejected'];
$cbgpPeerAdvertisedPrefixes = $j_prefixes[$j_peerIndexes[$peer['bgpPeerIdentifier']].".$afi.".$safis[$safi]]['jnxBgpM2PrefixOutPrefixes'];
unset($j_prefixes);
unset($j_bgp);
unset($j_peerIndexes);
}//end if
// FIXME THESE FIELDS DO NOT EXIST IN THE DATABASE!
$update = 'UPDATE bgpPeers_cbgp SET';
$peer['c_update']['AcceptedPrefixes'] = $cbgpPeerAcceptedPrefixes;
@@ -344,14 +305,28 @@ if ($config['enable_bgp']) {
$peer['c_update']['SuppressedPrefixes'] = $cbgpPeerSuppressedPrefixes;
$peer['c_update']['WithdrawnPrefixes'] = $cbgpPeerWithdrawnPrefixes;
$oids = array(
'AcceptedPrefixes',
'DeniedPrefixes',
'AdvertisedPrefixes',
'SuppressedPrefixes',
'WithdrawnPrefixes',
);
foreach ($oids as $oid) {
$peer['c_update'][$oid.'_delta'] = $peer['c_update'][$oid] - $peer_afi[$oid];
$peer['c_update'][$oid.'_prev'] = $peer_afi[$oid];
}
dbUpdate($peer['c_update'], 'bgpPeers_cbgp', '`device_id` = ? AND bgpPeerIdentifier = ? AND afi = ? AND safi = ?', array($device['device_id'], $peer['bgpPeerIdentifier'], $afi, $safi));
$cbgp_rrd = $config['rrd_dir'].'/'.$device['hostname'].'/'.safename('cbgp-'.$peer['bgpPeerIdentifier'].".$afi.$safi.rrd");
if (!is_file($cbgp_rrd)) {
$rrd_create = 'DS:AcceptedPrefixes:GAUGE:600:U:100000000000
DS:DeniedPrefixes:GAUGE:600:U:100000000000
DS:AdvertisedPrefixes:GAUGE:600:U:100000000000
DS:SuppressedPrefixes:GAUGE:600:U:100000000000
$rrd_create = 'DS:AcceptedPrefixes:GAUGE:600:U:100000000000
DS:DeniedPrefixes:GAUGE:600:U:100000000000
DS:AdvertisedPrefixes:GAUGE:600:U:100000000000
DS:SuppressedPrefixes:GAUGE:600:U:100000000000
DS:WithdrawnPrefixes:GAUGE:600:U:100000000000 '.$config['rrd_rra'];
rrdtool_create($cbgp_rrd, $rrd_create);
}
+72
View File
@@ -0,0 +1,72 @@
<?php
/*
* LibreNMS module to capture Cisco Class-Based QoS Details
*
* Copyright (c) 2015 Aaron Daniels <aaron@daniels.id.au>
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation, either version 3 of the License, or (at your
* option) any later version. Please see LICENSE.txt at the top level of
* the source code distribution for details.
*/
if ($device['os_group'] == "cisco") {
$module = 'Cisco-CBQOS';
require_once 'includes/component.php';
$component = new component();
$options['filter']['type'] = array('=',$module);
$options['filter']['disabled'] = array('=',0);
$options['filter']['ignore'] = array('=',0);
$components = $component->getComponents($device['device_id'],$options);
// We only care about our device id.
$components = $components[$device['device_id']];
// Only collect SNMP data if we have enabled components
if (count($components > 0)) {
// Let's gather the stats..
$tblcbQosClassMapStats = snmpwalk_array_num($device, '.1.3.6.1.4.1.9.9.166.1.15.1.1', 2);
// Loop through the components and extract the data.
foreach ($components as $key => $array) {
$type = $array['qos-type'];
// Get data from the class table.
if ($type == 2) {
// Let's make sure the rrd is setup for this class.
$filename = "port-".$array['ifindex']."-cbqos-".$array['sp-id']."-".$array['sp-obj'].".rrd";
$rrd_filename = $config['rrd_dir'] . "/" . $device['hostname'] . "/" . safename ($filename);
if (!file_exists ($rrd_filename)) {
rrdtool_create ($rrd_filename, " DS:postbits:COUNTER:600:0:U DS:bufferdrops:COUNTER:600:0:U DS:qosdrops:COUNTER:600:0:U" . $config['rrd_rra']);
}
// Let's print some debugging info.
d_echo("\n\nComponent: ".$key."\n");
d_echo(" Class-Map: ".$array['label']."\n");
d_echo(" SPID.SPOBJ: ".$array['sp-id'].".".$array['sp-obj']."\n");
d_echo(" PostBytes: 1.3.6.1.4.1.9.9.166.1.15.1.1.10.".$array['sp-id'].".".$array['sp-obj']." = ".$tblcbQosClassMapStats['1.3.6.1.4.1.9.9.166.1.15.1.1.10'][$array['sp-id']][$array['sp-obj']]."\n");
d_echo(" BufferDrops: 1.3.6.1.4.1.9.9.166.1.15.1.1.21.".$array['sp-id'].".".$array['sp-obj']." = ".$tblcbQosClassMapStats['1.3.6.1.4.1.9.9.166.1.15.1.1.21'][$array['sp-id']][$array['sp-obj']]."\n");
d_echo(" QOSDrops: 1.3.6.1.4.1.9.9.166.1.15.1.1.17.".$array['sp-id'].".".$array['sp-obj']." = ".$tblcbQosClassMapStats['1.3.6.1.4.1.9.9.166.1.15.1.1.17'][$array['sp-id']][$array['sp-obj']]."\n");
$rrd['postbytes'] = $tblcbQosClassMapStats['1.3.6.1.4.1.9.9.166.1.15.1.1.10'][$array['sp-id']][$array['sp-obj']];
$rrd['bufferdrops'] = $tblcbQosClassMapStats['1.3.6.1.4.1.9.9.166.1.15.1.1.21'][$array['sp-id']][$array['sp-obj']];
$rrd['qosdrops'] = $tblcbQosClassMapStats['1.3.6.1.4.1.9.9.166.1.15.1.1.17'][$array['sp-id']][$array['sp-obj']];
// Update rrd
rrdtool_update ($rrd_filename, $rrd);
// Clean-up after yourself!
unset($filename, $rrd_filename);
}
} // End foreach components
echo $module." ";
} // end if count components
// Clean-up after yourself!
unset($type, $components, $component, $options, $module);
}
+15
View File
@@ -0,0 +1,15 @@
<?php
/*
* LibreNMS
*
* Copyright (c) 2016 Søren Friis Rosiak <sorenrosiak@gmail.com>
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation, either version 3 of the License, or (at your
* option) any later version. Please see LICENSE.txt at the top level of
* the source code distribution for details.
*/
$hardware = trim(snmp_get($device, 'partNumber.0', '-Ovq', 'EATON-EPDU-MIB'), '"');
$version = trim(snmp_get($device, 'firmwareVersion.0', '-Ovq', 'EATON-EPDU-MIB'), '"');
$serial = trim(snmp_get($device, 'serialNumber.0', '-Ovq', 'EATON-EPDU-MIB'), '"');
+6 -6
View File
@@ -39,11 +39,11 @@
// adslAturPerfESs.1 = 0 seconds
// adslAturPerfValidIntervals.1 = 0
// adslAturPerfInvalidIntervals.1 = 0
if (isset($port_stats[$port['ifIndex']]['adslLineCoding'])) {
if (isset($port_stats[$port_id]['adslLineCoding'])) {
// Check to make sure Port data is cached.
$this_port = &$port_stats[$port['ifIndex']];
$this_port = &$port_stats[$port_id];
$rrdfile = $config['rrd_dir'].'/'.$device['hostname'].'/'.safename('port-'.$port['ifIndex'].'-adsl.rrd');
$rrdfile = get_port_rrdfile_path ($device['hostname'], $port_id, 'adsl');
$rrd_create = ' --step 300';
$rrd_create .= ' DS:AtucCurrSnrMgn:GAUGE:600:0:635';
@@ -130,8 +130,8 @@ if (isset($port_stats[$port['ifIndex']]['adslLineCoding'])) {
$this_port[$oid] = ($this_port[$oid] / 10);
}
if (dbFetchCell('SELECT COUNT(*) FROM `ports_adsl` WHERE `port_id` = ?', array($port['port_id'])) == '0') {
dbInsert(array('port_id' => $port['port_id']), 'ports_adsl');
if (dbFetchCell('SELECT COUNT(*) FROM `ports_adsl` WHERE `port_id` = ?', array($port_id)) == '0') {
dbInsert(array('port_id' => $port_id), 'ports_adsl');
}
$port['adsl_update'] = array('port_adsl_updated' => array('NOW()'));
@@ -141,7 +141,7 @@ if (isset($port_stats[$port['ifIndex']]['adslLineCoding'])) {
$port['adsl_update'][$oid] = $data;
}
dbUpdate($port['adsl_update'], 'ports_adsl', '`port_id` = ?', array($port['port_id']));
dbUpdate($port['adsl_update'], 'ports_adsl', '`port_id` = ?', array($port_id));
if ($this_port['adslAtucCurrSnrMgn'] > '1280') {
$this_port['adslAtucCurrSnrMgn'] = 'U';
+5 -4
View File
@@ -1,13 +1,14 @@
<?php
if ($port_stats[$port['ifIndex']] &&
if ($port_stats[$port_id] &&
$port['ifType'] == 'ethernetCsmacd' &&
isset($port_stats[$port['ifIndex']]['dot3StatsIndex'])) {
isset($port_stats[$port_id]['dot3StatsIndex'])) {
// Check to make sure Port data is cached.
$this_port = &$port_stats[$port[ifIndex]];
$this_port = &$port_stats[$port_id];
// TODO: remove legacy check?
$old_rrdfile = $config['rrd_dir'].'/'.$device['hostname'].'/'.safename('etherlike-'.$port['ifIndex'].'.rrd');
$rrdfile = $config['rrd_dir'].'/'.$device['hostname'].'/'.safename('port-'.$port['ifIndex'].'-dot3.rrd');
$rrd_file = get_port_rrdfile_path ($device['hostname'], $port_id, 'dot3');
$rrd_create = $config['rrd_rra'];
+4 -5
View File
@@ -35,14 +35,13 @@ $peth_oids = array(
'pethMainPseConsumptionPower',
);
if ($port_stats[$port['ifIndex']]
if ($port_stats[$port_id]
&& $port['ifType'] == 'ethernetCsmacd'
&& isset($port_stats[$port['ifIndex']]['dot3StatsIndex'])) {
&& isset($port_stats[$port_id]['dot3StatsIndex'])) {
// Check to make sure Port data is cached.
$this_port = &$port_stats[$port['ifIndex']];
$rrdfile = $config['rrd_dir'].'/'.$device['hostname'].'/'.safename('port-'.$port['ifIndex'].'-poe.rrd');
$this_port = &$port_stats[$port_id];
$rrdfile = get_port_rrdfile_path ($device['hostname'], $port_id, 'poe');
if (!file_exists($rrdfile)) {
$rrd_create .= $config['rrd_rra'];
+76 -35
View File
@@ -191,50 +191,91 @@ $polled = time();
// End Building SNMP Cache Array
d_echo($port_stats);
// Build array of ports in the database
// FIXME -- this stuff is a little messy, looping the array to make an array just seems wrong. :>
// -- i can make it a function, so that you don't know what it's doing.
// -- $ports = adamasMagicFunction($ports_db); ?
// select * doesn't do what we want if multiple tables have the same column name -- last one wins :/
$ports_db = dbFetchRows('SELECT *, `ports_statistics`.`port_id` AS `ports_statistics_port_id`, `ports`.`port_id` AS `port_id` FROM `ports` LEFT OUTER JOIN `ports_statistics` ON `ports`.`port_id` = `ports_statistics`.`port_id` WHERE `ports`.`device_id` = ?', array($device['device_id']));
// By default libreNMS uses the ifIndex to associate ports on devices with ports discoverd/polled
// before and stored in the database. On Linux boxes this is a problem as ifIndexes may be
// unstable between reboots or (re)configuration of tunnel interfaces (think: GRE/OpenVPN/Tinc/...)
// The port association configuration allows to choose between association via ifIndex, ifName,
// or maybe other means in the future. The default port association mode still is ifIndex for
// compatibility reasons.
$port_association_mode = $config['default_port_association_mode'];
if ($device['port_association_mode'])
$port_association_mode = get_port_assoc_mode_name ($device['port_association_mode']);
foreach ($ports_db as $port) {
$ports[$port['ifIndex']] = $port;
// Query known ports and mapping table in order of discovery to make sure
// the latest discoverd/polled port is in the mapping tables.
$ports_mapped = get_ports_mapped ($device['device_id'], true);
$ports = $ports_mapped['ports'];
//
// Rename any old RRD files still named after the previous ifIndex based naming schema.
foreach ($ports_mapped['maps']['ifIndex'] as $ifIndex => $port_id) {
foreach (array ('', 'adsl', 'dot3') as $suffix) {
$suffix_tmp = '';
if ($suffix)
$suffix_tmp = "-$suffix";
$old_rrd_path = trim ($config['rrd_dir']) . '/' . $device['hostname'] . "/port-$ifIndex$suffix_tmp.rrd";
$new_rrd_path = get_port_rrdfile_path ($device['hostname'], $port_id, $suffix);
if (is_file ($old_rrd_path)) {
rename ($old_rrd_path, $new_rrd_path);
}
}
}
// New interface detection
foreach ($port_stats as $ifIndex => $port) {
// Store ifIndex in port entry and prefetch ifName as we'll need it multiple times
$port['ifIndex'] = $ifIndex;
$ifName = $port['ifName'];
// Get port_id according to port_association_mode used for this device
$port_id = get_port_id ($ports_mapped, $port, $port_association_mode);
if (is_port_valid($port, $device)) {
echo 'valid';
if (!is_array($ports[$port['ifIndex']])) {
$port_id = dbInsert(array('device_id' => $device['device_id'], 'ifIndex' => $ifIndex), 'ports');
// Port newly discovered?
if (! $ports[$port_id]) {
$port_id = dbInsert(array('device_id' => $device['device_id'], 'ifIndex' => $ifIndex, 'ifName' => $ifName), 'ports');
dbInsert(array('port_id' => $port_id), 'ports_statistics');
$ports[$port['ifIndex']] = dbFetchRow('SELECT * FROM `ports` WHERE `port_id` = ?', array($port_id));
echo 'Adding: '.$port['ifName'].'('.$ifIndex.')('.$ports[$port['ifIndex']]['port_id'].')';
$ports[$port_id] = dbFetchRow('SELECT * FROM `ports` WHERE `port_id` = ?', array($port_id));
echo 'Adding: '.$ifName.'('.$ifIndex.')('.$port_id.')';
// print_r($ports);
}
else if ($ports[$ifIndex]['deleted'] == '1') {
dbUpdate(array('deleted' => '0'), 'ports', '`port_id` = ?', array($ports[$ifIndex]['port_id']));
$ports[$ifIndex]['deleted'] = '0';
}
if ($ports[$ifIndex]['ports_statistics_port_id'] === null) {
// in case the port was created before we created the table
dbInsert(array('port_id' => $ports[$ifIndex]['port_id']), 'ports_statistics');
}
}
else {
if ($ports[$port['ifIndex']]['deleted'] != '1') {
dbUpdate(array('deleted' => '1'), 'ports', '`port_id` = ?', array($ports[$ifIndex]['port_id']));
$ports[$ifIndex]['deleted'] = '1';
}
}
}
// End New interface detection
// Port re-discovered after previous deletion?
else if ($ports[$port_id]['deleted'] == 1) {
dbUpdate(array('deleted' => '0'), 'ports', '`port_id` = ?', array($port_id));
$ports[$port_id]['deleted'] = '0';
}
if ($ports[$port_id]['ports_statistics_port_id'] === null) {
// in case the port was created before we created the table
dbInsert(array('port_id' => $port_id), 'ports_statistics');
}
// Assure stable mapping
$port_stats[$ifIndex]['port_id'] = $port_id;
$ports[$port_id]['ifIndex'] = $ifIndex;
}
// Port vanished (mark as deleted)
else {
if ($ports[$port_id]['deleted'] != '1') {
dbUpdate(array('deleted' => '1'), 'ports', '`port_id` = ?', array($port_id));
$ports[$port_id]['deleted'] = '1';
}
}
} // End new interface detection
echo "\n";
// Loop ports in the DB and update where necessary
foreach ($ports as $port) {
echo 'Port '.$port['ifDescr'].'('.$port['ifIndex'].') ';
$port_id = $port['port_id'];
echo 'Port ' . $port['ifName'] . ': ' . $port['ifDescr'] . '(' . $port['ifIndex'] . ') ';
if ($port_stats[$port['ifIndex']] && $port['disabled'] != '1') {
// Check to make sure Port data is cached.
$this_port = &$port_stats[$port['ifIndex']];
@@ -477,7 +518,7 @@ foreach ($ports as $port) {
}
// Update RRDs
$rrdfile = $host_rrd.'/port-'.safename($port['ifIndex'].'.rrd');
$rrdfile = get_port_rrdfile_path ($device['hostname'], $port_id);
if (!is_file($rrdfile)) {
rrdtool_create(
$rrdfile,
@@ -576,9 +617,9 @@ foreach ($ports as $port) {
// Update Database
if (count($port['update'])) {
$updated = dbUpdate($port['update'], 'ports', '`port_id` = ?', array($port['port_id']));
$updated = dbUpdate($port['update'], 'ports', '`port_id` = ?', array($port_id));
// do we want to do something else with this?
$updated += dbUpdate($port['update_extended'], 'ports_statistics', '`port_id` = ?', array($port['port_id']));
$updated += dbUpdate($port['update_extended'], 'ports_statistics', '`port_id` = ?', array($port_id));
d_echo("$updated updated");
}
@@ -588,7 +629,7 @@ foreach ($ports as $port) {
echo 'Port Deleted';
// Port missing from SNMP cache.
if ($port['deleted'] != '1') {
dbUpdate(array('deleted' => '1'), 'ports', '`device_id` = ? AND `ifIndex` = ?', array($device['device_id'], $port['ifIndex']));
dbUpdate(array('deleted' => '1'), 'ports', '`device_id` = ? AND `port_id` = ?', array($device['device_id'], $port_id));
}
}
else {
@@ -599,7 +640,7 @@ foreach ($ports as $port) {
// Clear Per-Port Variables Here
unset($this_port);
}//end foreach
} //end port update
// Clear Variables Here
unset($port_stats);
+54 -1
View File
@@ -39,6 +39,7 @@ if ($stpprotocol == 'ieee8021d' || $stpprotocol == 'unknown') {
// read the 802.1D subtree
$stp_raw = snmpwalk_cache_oid($device, 'dot1dStp', array(), 'RSTP-MIB');
d_echo($stp_raw);
$stp = array(
'protocolSpecification' => $stp_raw[0]['dot1dStpProtocolSpecification'],
'priority' => $stp_raw[0]['dot1dStpPriority'],
@@ -121,7 +122,59 @@ if ($stpprotocol == 'ieee8021d' || $stpprotocol == 'unknown') {
dbUpdate($stp,'stp','device_id = ?', array($device['device_id']));
echo '.';
}
// STP port related stuff
foreach ($stp_raw as $port => $value){
if ($port) { // $stp_raw[0] ist not port related so we skip this one
$stp_port = array(
'priority' => $stp_raw[$port]['dot1dStpPortPriority'],
'state' => $stp_raw[$port]['dot1dStpPortState'],
'enable' => $stp_raw[$port]['dot1dStpPortEnable'],
'pathCost' => $stp_raw[$port]['dot1dStpPortPathCost'],
'designatedCost' => $stp_raw[$port]['dot1dStpPortDesignatedCost'],
'designatedPort' => $stp_raw[$port]['dot1dStpPortDesignatedPort'],
'forwardTransitions' => $stp_raw[$port]['dot1dStpPortForwardTransitions']
);
// set device binding
$stp_port['device_id'] = $device['device_id'];
// set port binding
$stp_port['port_id'] = dbFetchCell('SELECT port_id FROM `ports` WHERE `device_id` = ? AND `ifIndex` = ?', array($device['device_id'], $stp_raw[$port]['dot1dStpPort']));
$dr = str_replace(array(' ', ':', '-'), '', strtolower($stp_raw[$port]['dot1dStpPortDesignatedRoot']));
$dr = substr($dr, -12); //remove first two octets
$stp_port['designatedRoot'] = $dr;
$db = str_replace(array(' ', ':', '-'), '', strtolower($stp_raw[$port]['dot1dStpPortDesignatedBridge']));
$db = substr($db, -12); //remove first two octets
$stp_port['designatedBridge'] = $db;
if ($device['os'] == 'pbn') {
// It seems that PBN guys don't care about ieee 802.1d :-(
// So try to find the right port with some crazy conversations
$dp_value = dechex($stp_port['priority']);
$dp_value = $dp_value.'00';
$dp_value = hexdec($dp_value);
if ($stp_raw[$port]['dot1dStpPortDesignatedPort']) {
$dp = $stp_raw[$port]['dot1dStpPortDesignatedPort'] - $dp_value;
$stp_port['designatedPort'] = $dp;
}
}
else {
// Port saved in format priority+port (ieee 802.1d-1998: clause 8.5.5.1)
$dp = substr($stp_raw[$port]['dot1dStpPortDesignatedPort'], -2); //discard the first octet (priority part)
$stp_port['designatedPort'] = hexdec($dp);
}
//d_echo($stp_port);
// Update db
dbUpdate($stp_port,'ports_stp','`device_id` = ? AND `port_id` = ?', array($device['device_id'], $stp_port['port_id']));
echo '.';
}
}
}
unset($stp_raw, $stp, $stp_db);
unset($stp_raw, $stp, $stp_db, $stp_port);
echo "\n";