mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
ISIS-adjacency polling support (#12461)
* init
* Add adjacency polling support
* Format messages
* Fix prints
* Apply fixes from StyleCI
* Fix schema
* Schema fix
* Alert rule example
* Remove display format
* Change option order
* Add test data
* Add test data
* Test data
* Review fixes
* Remove duplicate MIB-file
* Add cleanup
* Fix
* Print fix
* Remove extra cleanup
* Revert "Remove duplicate MIB-file"
This reverts commit 4b3cf8127c.
* Remove unneeded MIB-files
* Add check for empty array
* Apply fixes from StyleCI
* Review fixes
* StyleCI
* StyleCI
* Apply fixes from StyleCI
* typo
* Update function calls on pages
* Linting fixes
* Apply fixes from StyleCI
* Discovery module
* Add discovery module
* Apply fixes from StyleCI
* Update example alert rule
Co-authored-by: ottorei <ottorei@users.noreply.github.com>
Co-authored-by: PipoCanaja <38363551+PipoCanaja@users.noreply.github.com>
This commit is contained in:
@@ -19,6 +19,7 @@ $type_text['netscaler_vsvr'] = 'VServers';
|
||||
$type_text['bgp'] = 'BGP';
|
||||
$type_text['cef'] = 'CEF';
|
||||
$type_text['ospf'] = 'OSPF';
|
||||
$type_text['isis'] = 'ISIS';
|
||||
$type_text['vrf'] = 'VRFs';
|
||||
$type_text['routes'] = 'Routing Table';
|
||||
$type_text['cisco-otv'] = 'OTV';
|
||||
|
||||
55
includes/html/pages/device/routing/isis.inc.php
Normal file
55
includes/html/pages/device/routing/isis.inc.php
Normal file
@@ -0,0 +1,55 @@
|
||||
<?php
|
||||
|
||||
use App\Models\IsisAdjacency;
|
||||
|
||||
echo '
|
||||
<div>
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-body">
|
||||
<table class="table table-condensed table-hover" style="border-collapse:collapse;">
|
||||
<thead>
|
||||
<tr>
|
||||
<th> </th>
|
||||
<th>Local device</th>
|
||||
<th>Local interface</th>
|
||||
<th>Adjacent</th>
|
||||
<th>System ID</th>
|
||||
<th>Area</th>
|
||||
<th>System type</th>
|
||||
<th>State</th>
|
||||
<th>Last uptime</th>
|
||||
</tr>
|
||||
</thead>';
|
||||
|
||||
foreach (IsisAdjacency::where('device_id', $device['device_id'])->with('port')->get() as $adj) {
|
||||
if ($adj->isisISAdjState == 'up') {
|
||||
$color = 'green';
|
||||
} else {
|
||||
$color = 'red';
|
||||
}
|
||||
$interface_name = $adj->port->ifName;
|
||||
|
||||
echo '
|
||||
<tbody>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td>' . generate_device_link($device, 0, ['tab' => 'routing', 'proto' => 'isis']) . '</td>
|
||||
<td><a href="' . \LibreNMS\Util\Url::generate([
|
||||
'page'=>'device',
|
||||
'device'=>$adj->device_id,
|
||||
'tab'=>'port',
|
||||
'port'=>$adj->port_id,
|
||||
]) . '">' . $interface_name . '</a></td>
|
||||
<td>' . $adj->isisISAdjIPAddrAddress . '</td>
|
||||
<td>' . $adj->isisISAdjNeighSysID . '</td>
|
||||
<td>' . $adj->isisISAdjAreaAddress . '</td>
|
||||
<td>' . $adj->isisISAdjNeighSysType . '</td>
|
||||
<td><strong><span style="color: ' . $color . ';">' . $adj->isisISAdjState . '</span></strong></td>
|
||||
<td>' . \LibreNMS\Util\Time::formatInterval($adj->isisISAdjLastUpTime) . '</td>
|
||||
</tr>
|
||||
</tbody>';
|
||||
}
|
||||
echo '</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>';
|
||||
@@ -17,6 +17,7 @@ $type_text['bgp'] = 'BGP';
|
||||
$type_text['cef'] = 'CEF';
|
||||
$type_text['mpls'] = 'MPLS';
|
||||
$type_text['ospf'] = 'OSPF';
|
||||
$type_text['isis'] = 'ISIS';
|
||||
$type_text['vrf'] = 'VRFs';
|
||||
$type_text['cisco-otv'] = 'OTV';
|
||||
|
||||
@@ -58,6 +59,7 @@ switch ($vars['protocol']) {
|
||||
case 'cef':
|
||||
case 'mpls':
|
||||
case 'ospf':
|
||||
case 'isis':
|
||||
case 'cisco-otv':
|
||||
include 'includes/html/pages/routing/' . $vars['protocol'] . '.inc.php';
|
||||
break;
|
||||
|
||||
111
includes/html/pages/routing/isis.inc.php
Normal file
111
includes/html/pages/routing/isis.inc.php
Normal file
@@ -0,0 +1,111 @@
|
||||
<?php
|
||||
|
||||
use App\Models\IsisAdjacency;
|
||||
|
||||
if (! Auth::user()->hasGlobalRead()) {
|
||||
include 'includes/html/error-no-perm.inc.php';
|
||||
} else {
|
||||
$link_array = [
|
||||
'page' => 'routing',
|
||||
'protocol' => 'isis',
|
||||
];
|
||||
|
||||
print_optionbar_start('', '');
|
||||
|
||||
echo '<span style="font-weight: bold;">Adjacencies</span> » ';
|
||||
|
||||
if (! $vars['state']) {
|
||||
$vars['state'] = 'all';
|
||||
}
|
||||
|
||||
if ($vars['state'] == 'all') {
|
||||
$filter = ['up', 'down'];
|
||||
echo "<span class='pagemenu-selected'>";
|
||||
}
|
||||
|
||||
echo generate_link('All', $vars, ['state' => 'all']);
|
||||
if ($vars['state'] == 'all') {
|
||||
echo '</span>';
|
||||
}
|
||||
|
||||
echo ' | ';
|
||||
|
||||
if ($vars['state'] == 'up') {
|
||||
$filter = ['up'];
|
||||
echo "<span class='pagemenu-selected'>";
|
||||
}
|
||||
|
||||
echo generate_link('Up', $vars, ['state' => 'up']);
|
||||
if ($vars['state'] == 'up') {
|
||||
$filter = ['up'];
|
||||
echo '</span>';
|
||||
}
|
||||
|
||||
echo ' | ';
|
||||
|
||||
if ($vars['state'] == 'down') {
|
||||
echo "<span class='pagemenu-selected'>";
|
||||
}
|
||||
|
||||
echo generate_link('Down', $vars, ['state' => 'down']);
|
||||
if ($vars['state'] == 'down') {
|
||||
$filter = ['down'];
|
||||
echo '</span>';
|
||||
}
|
||||
|
||||
print_optionbar_end();
|
||||
|
||||
echo '
|
||||
<div>
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-body">
|
||||
<table class="table table-condensed table-hover" style="border-collapse:collapse;">
|
||||
<thead>
|
||||
<tr>
|
||||
<th> </th>
|
||||
<th>Local device</th>
|
||||
<th>Local interface</th>
|
||||
<th>Adjacent</th>
|
||||
<th>System ID</th>
|
||||
<th>Area</th>
|
||||
<th>System type</th>
|
||||
<th>State</th>
|
||||
<th>Last uptime</th>
|
||||
</tr>
|
||||
</thead>';
|
||||
|
||||
foreach (IsisAdjacency::whereIn('isisISAdjState', $filter)->with('port')->get() as $adj) {
|
||||
$device = device_by_id_cache($adj->device_id);
|
||||
if ($adj->isisISAdjState == 'up') {
|
||||
$color = 'green';
|
||||
} else {
|
||||
$color = 'red';
|
||||
}
|
||||
|
||||
$interface_name = $adj->port->ifName;
|
||||
|
||||
echo '
|
||||
<tbody>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td>' . generate_device_link($device, 0, ['tab' => 'routing', 'proto' => 'isis']) . '</td>
|
||||
<td><a href="' . \LibreNMS\Util\Url::generate([
|
||||
'page'=>'device',
|
||||
'device'=>$adj->device_id,
|
||||
'tab'=>'port',
|
||||
'port'=>$adj->port_id,
|
||||
]) . '">' . $interface_name . '</a></td>
|
||||
<td>' . $adj->isisISAdjIPAddrAddress . '</td>
|
||||
<td>' . $adj->isisISAdjNeighSysID . '</td>
|
||||
<td>' . $adj->isisISAdjAreaAddress . '</td>
|
||||
<td>' . $adj->isisISAdjNeighSysType . '</td>
|
||||
<td><strong><span style="color: ' . $color . ';">' . $adj->isisISAdjState . '</span></strong></td>
|
||||
<td>' . \LibreNMS\Util\Time::formatInterval($adj->isisISAdjLastUpTime) . '</td>
|
||||
</tr>
|
||||
</tbody>';
|
||||
}
|
||||
echo '</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>';
|
||||
}
|
||||
Reference in New Issue
Block a user