mirror of
https://github.com/stylersnico/librenms.git
synced 2026-07-28 08:02:41 +02:00
add basic STP/RSTP support
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
$stp_raw = dbFetchRow('SELECT * FROM `stp` WHERE `device_id` = ?', array($device['device_id']));
|
||||
$stp = array (
|
||||
'Root bridge' => ($stp_raw['rootBridge'] == 1) ? 'Yes' : 'No',
|
||||
'Bridge address (MAC)' => $stp_raw['bridgeAddress'],
|
||||
'Protocol specification' => $stp_raw['protocolSpecification'],
|
||||
'Priority (0-61440)' => $stp_raw['priority'],
|
||||
'Time since topology change' => formatUptime($stp_raw['timeSinceTopologyChange']),
|
||||
'Topology changes' => $stp_raw['topChanges'],
|
||||
'Designated root (MAC)' => $stp_raw['designatedRoot'],
|
||||
'Root cost' => $stp_raw['rootCost'],
|
||||
'Root port' => $stp_raw['rootPort'],
|
||||
'Max age (s)' => $stp_raw['maxAge'],
|
||||
'Hello time (s)' => $stp_raw['helloTime'],
|
||||
'Hold time (s)' => $stp_raw['holdTime'],
|
||||
'Forward delay (s)' => $stp_raw['forwardDelay'],
|
||||
'Bridge max age (s)' => $stp_raw['bridgeMaxAge'],
|
||||
'Bridge hello time (s)' => $stp_raw['bridgeHelloTime'],
|
||||
'Bridge forward delay (s)' => $stp_raw['bridgeForwardDelay']
|
||||
);
|
||||
foreach (array_keys($stp) as $key) {
|
||||
echo "
|
||||
<tr>
|
||||
<td width=280 class=list-large>$key</td>
|
||||
<td class=box-desc>$stp[$key]</td>
|
||||
</tr>
|
||||
";
|
||||
}
|
||||
@@ -229,6 +229,14 @@ if (device_permitted($vars['device']) || $check_device == $vars['device']) {
|
||||
</a>
|
||||
</li>');
|
||||
|
||||
if (@dbFetchCell("SELECT COUNT(stp_id) FROM stp WHERE device_id = '".$device['device_id']."'") > '0') {
|
||||
echo '<li class="'.$select['stp'].'">
|
||||
<a href="'.generate_device_url($device, array('tab' => 'stp')).'">
|
||||
<img src="images/16/chart_organisation.png" align="absmiddle" border="0" /> STP
|
||||
</a>
|
||||
</li>';
|
||||
}
|
||||
|
||||
if (@dbFetchCell("SELECT COUNT(*) FROM `packages` WHERE device_id = '".$device['device_id']."'") > '0') {
|
||||
echo '<li class="'.$select['packages'].'">
|
||||
<a href="'.generate_device_url($device, array('tab' => 'packages')).'">
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
$link_array = array(
|
||||
'page' => 'device',
|
||||
'device' => $device['device_id'],
|
||||
'tab' => 'stp',
|
||||
);
|
||||
|
||||
print_optionbar_start();
|
||||
|
||||
echo "<span style='font-weight: bold;'>STP</span> » ";
|
||||
|
||||
if (!$vars['view']) {
|
||||
$vars['view'] = 'basic';
|
||||
}
|
||||
|
||||
$menu_options['basic'] = 'Basic';
|
||||
// $menu_options['details'] = 'Details';
|
||||
$sep = '';
|
||||
foreach ($menu_options as $option => $text) {
|
||||
echo $sep;
|
||||
if ($vars['view'] == $option) {
|
||||
echo "<span class='pagemenu-selected'>";
|
||||
}
|
||||
|
||||
echo generate_link($text, $link_array, array('view' => $option));
|
||||
if ($vars['view'] == $option) {
|
||||
echo '</span>';
|
||||
}
|
||||
|
||||
$sep = ' | ';
|
||||
}
|
||||
|
||||
unset($sep);
|
||||
|
||||
print_optionbar_end();
|
||||
|
||||
echo '<table border="0" cellspacing="0" cellpadding="5" width="100%">';
|
||||
|
||||
$i = '1';
|
||||
|
||||
foreach (dbFetchRows("SELECT * FROM `stp` WHERE `device_id` = ? ORDER BY 'stp_id'", array($device['device_id'])) as $stp) {
|
||||
include 'includes/print-stp.inc.php';
|
||||
|
||||
$i++;
|
||||
}
|
||||
|
||||
echo '</table>';
|
||||
|
||||
$pagetitle[] = 'STP';
|
||||
Reference in New Issue
Block a user