initial commit; version 22.5.12042
This commit is contained in:
254
html/pages/routing/bgp.inc.php
Normal file
254
html/pages/routing/bgp.inc.php
Normal file
@ -0,0 +1,254 @@
|
||||
<?php
|
||||
/**
|
||||
* Observium
|
||||
*
|
||||
* This file is part of Observium.
|
||||
*
|
||||
* @package observium
|
||||
* @subpackage web
|
||||
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2022 Observium Limited
|
||||
*
|
||||
*/
|
||||
|
||||
//if ($_SESSION['permissions'] < '5')
|
||||
if ($_SESSION['userlevel'] < '5') {
|
||||
print_error_permission();
|
||||
return;
|
||||
}
|
||||
|
||||
$form_items = [];
|
||||
$form_limit = 250; // Limit count for multiselect (use input instead)
|
||||
|
||||
$form_devices = dbFetchColumn('SELECT DISTINCT `device_id` FROM `bgpPeers`;');
|
||||
$form_items['devices'] = generate_form_values('device', $form_devices);
|
||||
//r($form_items['devices']);
|
||||
|
||||
$param = 'peer_as';
|
||||
$column = 'bgpPeerRemoteAs';
|
||||
// fast query 0.0015, 0.0020, 0.0017
|
||||
$query = 'SELECT COUNT(DISTINCT `' . $column . '`) FROM `bgpPeers` WHERE 1 ' . $cache['where']['devices_permitted'];
|
||||
$count = dbFetchCell($query);
|
||||
if ($count < $form_limit) {
|
||||
$form_items[$param] = []; // Set
|
||||
// slow query: 0.0093, 0.0125, 0.0063
|
||||
$query = 'SELECT DISTINCT `' . $column . '`, `astext` FROM `bgpPeers` WHERE 1 ' . $cache['where']['devices_permitted'] . ' ORDER BY `' . $column . '`';
|
||||
foreach (dbFetchRows($query) as $entry) {
|
||||
if (safe_empty($entry[$column])) { continue; }
|
||||
|
||||
$form_items[$param][$entry[$column]]['name'] = 'AS'.$entry[$column];
|
||||
$form_items[$param][$entry[$column]]['subtext'] = $entry['astext'];
|
||||
}
|
||||
}
|
||||
|
||||
$form_params = [
|
||||
'local_ip' => 'bgpPeerLocalAddr',
|
||||
'peer_ip' => 'bgpPeerRemoteAddr',
|
||||
//'peer_as' => 'bgpPeerRemoteAs',
|
||||
];
|
||||
|
||||
foreach ($form_params as $param => $column) {
|
||||
$query = 'SELECT COUNT(DISTINCT `' . $column . '`) FROM `bgpPeers` WHERE 1 ' . $cache['where']['devices_permitted'];
|
||||
$count = dbFetchCell($query);
|
||||
if ($count < $form_limit) {
|
||||
$query = 'SELECT DISTINCT `' . $column . '` FROM `bgpPeers` WHERE 1 ' . $cache['where']['devices_permitted'] . ' ORDER BY `' . $column . '`';
|
||||
foreach (dbFetchColumn($query) as $entry) {
|
||||
if (safe_empty($entry)) { continue; }
|
||||
|
||||
if (str_contains($entry, ':')) {
|
||||
$form_items[$param][$entry]['group'] = 'IPv6';
|
||||
$form_items[$param][$entry]['name'] = ip_compress($entry);
|
||||
} else {
|
||||
$form_items[$param][$entry]['group'] = 'IPv4';
|
||||
$form_items[$param][$entry]['name'] = escape_html($entry);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$form = [
|
||||
'type' => 'rows',
|
||||
'space' => '5px',
|
||||
'submit_by_key' => TRUE,
|
||||
'url' => generate_url($vars)
|
||||
];
|
||||
$form['row'][0]['device'] = [
|
||||
'type' => 'multiselect',
|
||||
'name' => 'Local Device',
|
||||
'width' => '100%',
|
||||
'value' => $vars['device'],
|
||||
'values' => $form_items['devices']
|
||||
];
|
||||
$param = 'local_ip';
|
||||
$param_name = 'Local address';
|
||||
foreach ([ 'local_ip' => 'Local address',
|
||||
'peer_ip' => 'Peer address',
|
||||
'peer_as' => 'Remote AS' ] as $param => $param_name) {
|
||||
if (isset($form_items[$param])) {
|
||||
// If not so much item values, use multiselect
|
||||
$form['row'][0][$param] = [
|
||||
'type' => 'multiselect',
|
||||
'name' => $param_name,
|
||||
'width' => '100%',
|
||||
'value' => $vars[$param],
|
||||
'values' => $form_items[$param]
|
||||
];
|
||||
} else {
|
||||
// Instead, use input with autocomplete
|
||||
$form['row'][0][$param] = [
|
||||
'type' => 'text',
|
||||
'name' => $param_name,
|
||||
'width' => '100%',
|
||||
'placeholder' => TRUE,
|
||||
'ajax' => TRUE,
|
||||
'ajax_vars' => [ 'field' => 'bgp_'.$param ],
|
||||
'value' => $vars[$param]
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
$form['row'][0]['type'] = [
|
||||
'type' => 'select',
|
||||
'name' => 'Type',
|
||||
'width' => '100%',
|
||||
'value' => $vars['type'],
|
||||
'values' => [ '' => 'All', 'internal' => 'iBGP', 'external' => 'eBGP' ]
|
||||
];
|
||||
|
||||
// search button
|
||||
$form['row'][0]['search'] = [
|
||||
'type' => 'submit',
|
||||
//'name' => 'Search',
|
||||
//'icon' => 'icon-search',
|
||||
'right' => TRUE
|
||||
];
|
||||
|
||||
$panel_form = [
|
||||
'type' => 'rows',
|
||||
'title' => 'Search BGP',
|
||||
'space' => '10px',
|
||||
'submit_by_key' => TRUE,
|
||||
'url' => generate_url($vars)
|
||||
];
|
||||
|
||||
$panel_form['row'][0]['device'] = $form['row'][0]['device'];
|
||||
//$panel_form['row'][0]['device']['grid'] = 6;
|
||||
$panel_form['row'][0]['local_ip'] = $form['row'][0]['local_ip'];
|
||||
|
||||
$panel_form['row'][1]['peer_as'] = $form['row'][0]['peer_as'];
|
||||
$panel_form['row'][1]['peer_ip'] = $form['row'][0]['peer_ip'];
|
||||
|
||||
$panel_form['row'][2]['type'] = $form['row'][0]['type'];
|
||||
$panel_form['row'][2]['search'] = $form['row'][0]['search'];
|
||||
|
||||
// Register custom panel
|
||||
register_html_panel(generate_form($panel_form));
|
||||
|
||||
echo '<div class="hidden-xl">';
|
||||
print_form($form);
|
||||
echo '</div>';
|
||||
|
||||
unset($form, $panel_form, $form_items, $navbar);
|
||||
|
||||
if (!isset($vars['view'])) { $vars['view'] = 'details'; }
|
||||
|
||||
$link_array = [ 'page' => 'routing', 'protocol' => 'bgp' ];
|
||||
|
||||
$types = [
|
||||
'all' => 'All',
|
||||
'internal' => 'iBGP',
|
||||
'external' => 'eBGP'
|
||||
];
|
||||
foreach ($types as $option => $text) {
|
||||
$navbar['options'][$option]['text'] = $text;
|
||||
if ($vars['type'] == $option || (empty($vars['type']) && $option === 'all')) {
|
||||
$navbar['options'][$option]['class'] .= " active";
|
||||
}
|
||||
$bgp_options = [ 'type' => $option ];
|
||||
if ($vars['adminstatus']) {
|
||||
$bgp_options['adminstatus'] = $vars['adminstatus'];
|
||||
} elseif ($vars['state']) {
|
||||
$bgp_options['state'] = $vars['state'];
|
||||
}
|
||||
$navbar['options'][$option]['url'] = generate_url($link_array, $bgp_options);
|
||||
}
|
||||
|
||||
$statuses = [
|
||||
'stop' => 'Shutdown',
|
||||
'start' => 'Enabled',
|
||||
'down' => 'Down'
|
||||
];
|
||||
foreach ($statuses as $option => $text) {
|
||||
$status = ($option === 'down') ? 'state' : 'adminstatus';
|
||||
$navbar['options'][$option]['text'] = $text;
|
||||
if ($vars[$status] == $option) {
|
||||
$navbar['options'][$option]['class'] .= " active";
|
||||
$bgp_options = array($status => NULL);
|
||||
} else {
|
||||
$bgp_options = array($status => $option);
|
||||
}
|
||||
if ($vars['type']) { $bgp_options['type'] = $vars['type']; }
|
||||
$navbar['options'][$option]['url'] = generate_url($link_array, $bgp_options);
|
||||
}
|
||||
|
||||
$navbar['options_right']['details']['text'] = 'No Graphs';
|
||||
if ($vars['view'] === 'details') { $navbar['options_right']['details']['class'] .= ' active'; }
|
||||
$navbar['options_right']['details']['url'] = generate_url($vars, array('view' => 'details', 'graph' => 'NULL'));
|
||||
|
||||
$navbar['options_right']['updates']['text'] = 'Updates';
|
||||
if ($vars['graph'] === 'updates') { $navbar['options_right']['updates']['class'] .= ' active'; }
|
||||
$navbar['options_right']['updates']['url'] = generate_url($vars, array('view' => 'graphs', 'graph' => 'updates'));
|
||||
|
||||
/*
|
||||
$bgp_graphs = array();
|
||||
foreach ($cache['graphs'] as $entry)
|
||||
{
|
||||
if (preg_match('/^bgp_(?<subtype>prefixes)_(?<afi>ipv[46])(?<safi>[a-z]+)/', $entry, $matches))
|
||||
{
|
||||
if (!isset($bgp_graphs[$matches['safi']]))
|
||||
{
|
||||
$bgp_graphs[$matches['safi']] = array('text' => nicecase($matches['safi']));
|
||||
}
|
||||
$bgp_graphs[$matches['safi']]['types'][$matches['subtype'].'_'.$matches['afi'].$matches['safi']] = nicecase($matches['afi']) . ' ' . nicecase($matches['safi']) . ' ' . nicecase($matches['subtype']);
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
$bgp_graphs = array('unicast' => array('text' => 'Unicast'),
|
||||
'multicast' => array('text' => 'Multicast'),
|
||||
'mac' => array('text' => 'MAC Accounting'));
|
||||
$bgp_graphs['unicast']['types'] = array('prefixes_ipv4unicast' => 'IPv4 Ucast Prefixes',
|
||||
'prefixes_ipv6unicast' => 'IPv6 Ucast Prefixes',
|
||||
'prefixes_ipv4vpn' => 'VPNv4 Prefixes');
|
||||
$bgp_graphs['multicast']['types'] = array('prefixes_ipv4multicast' => 'IPv4 Mcast Prefixes',
|
||||
'prefixes_ipv6multicast' => 'IPv6 Mcast Prefixes');
|
||||
|
||||
$bgp_graphs['mac'] = array('text' => 'MAC Accounting');
|
||||
$bgp_graphs['mac']['types'] = array('macaccounting_bits' => 'MAC Bits',
|
||||
'macaccounting_pkts' => 'MAC Pkts');
|
||||
foreach ($bgp_graphs as $bgp_graph => $bgp_options)
|
||||
{
|
||||
$navbar['options_right'][$bgp_graph]['text'] = $bgp_options['text'];
|
||||
foreach ($bgp_options['types'] as $option => $text)
|
||||
{
|
||||
if ($vars['graph'] == $option)
|
||||
{
|
||||
$navbar['options_right'][$bgp_graph]['class'] .= ' active';
|
||||
$navbar['options_right'][$bgp_graph]['suboptions'][$option]['class'] = 'active';
|
||||
}
|
||||
$navbar['options_right'][$bgp_graph]['suboptions'][$option]['text'] = $text;
|
||||
$navbar['options_right'][$bgp_graph]['suboptions'][$option]['url'] = generate_url($vars, array('view' => 'graphs', 'graph' => $option));
|
||||
}
|
||||
}
|
||||
|
||||
$navbar['class'] = "navbar-narrow";
|
||||
$navbar['brand'] = "BGP";
|
||||
print_navbar($navbar);
|
||||
unset($navbar);
|
||||
|
||||
// Pagination
|
||||
$vars['pagination'] = TRUE;
|
||||
|
||||
//r($cache['bgp']);
|
||||
print_bgp_peer_table($vars);
|
||||
|
||||
// EOF
|
63
html/pages/routing/cef.inc.php
Normal file
63
html/pages/routing/cef.inc.php
Normal file
@ -0,0 +1,63 @@
|
||||
<?php
|
||||
/**
|
||||
* Observium
|
||||
*
|
||||
* This file is part of Observium.
|
||||
*
|
||||
* @package observium
|
||||
* @subpackage web
|
||||
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2022 Observium Limited
|
||||
*
|
||||
*/
|
||||
|
||||
echo generate_box_open();
|
||||
|
||||
echo('<table width=100% border=0 cellpadding=10 class="table table-hover table-striped table-condensed">');
|
||||
echo('<thead><tr><th>Device</th>
|
||||
<th>AFI</th>
|
||||
<th>Prefixes</th>
|
||||
<th><a title="CEF Switching Paths">Paths</a></th>
|
||||
<th><a title="Number of packets dropped.">Drop</a></th>
|
||||
<th><a title="Number of packets that could not be switched in the normal path and were punted to the next-fastest switching vector.">Punt</a></th>
|
||||
<th><a title="Number of packets that could not be switched in the normal path and were punted to the host.<br />For switch paths other than a centralized turbo switch path, punt and punt2host function the same way. With punt2host from a centralized turbo switch path (PAS and RSP), punt will punt the packet to LES, but punt2host will bypass LES and punt directly to process switching.">Punt2Host</a></th>
|
||||
</tr></thead>');
|
||||
|
||||
// Loop Instances
|
||||
|
||||
$cef_query = 'SELECT `cef_switching`.`device_id`, `cef_switching`.`afi`, `cef_switching`.`entPhysicalIndex`,
|
||||
COUNT(`cef_index`) AS `paths`, SUM(`drop`) AS `drops`, SUM(`punt`) AS `punts`, SUM(`punt2host`) AS `punt2host`, `cef_pfx`
|
||||
FROM `cef_switching`
|
||||
LEFT JOIN `cef_prefix` ON `cef_switching`.`device_id` = `cef_switching`.`device_id`
|
||||
AND `cef_switching`.`entPhysicalIndex` = `cef_prefix`.`entPhysicalIndex`
|
||||
AND `cef_switching`.`afi` = `cef_prefix`.`afi`
|
||||
WHERE 1'.generate_query_permitted([ 'device' ], [ 'device_table' => 'cef_switching' ]).'
|
||||
GROUP BY `cef_switching`.`device_id`, `cef_switching`.`afi`';
|
||||
|
||||
foreach (dbFetchRows($cef_query) as $instance) {
|
||||
$device = device_by_id_cache($instance['device_id']);
|
||||
|
||||
echo('<tr>');
|
||||
echo(' <td class="entity-title">'.generate_device_link($device, NULL, [ 'tab' => 'routing', 'proto' => 'cef' ]). '</td>');
|
||||
echo ' <td>';
|
||||
if ($instance['afi'] === "ipv4") {
|
||||
echo '<span class="label label-success">IPv4</span>';
|
||||
} elseif ($instance['afi'] === "ipv6") {
|
||||
echo '<span class="label label-info">IPv6</span>';
|
||||
} else {
|
||||
echo $instance['afi'];
|
||||
}
|
||||
echo '</td>';
|
||||
echo(' <td>'.$instance['cef_pfx'] . '</td>');
|
||||
echo(' <td>'.$instance['paths'] . '</td>');
|
||||
echo(' <td>'.$instance['drops'] . '</td>');
|
||||
echo(' <td>'.$instance['punts'] . '</td>');
|
||||
echo(' <td>'.$instance['punt2host'] . '</td>');
|
||||
echo('</tr>');
|
||||
|
||||
} // End loop instances
|
||||
|
||||
echo('</table>');
|
||||
|
||||
echo generate_box_close();
|
||||
|
||||
// EOF
|
42
html/pages/routing/eigrp.inc.php
Normal file
42
html/pages/routing/eigrp.inc.php
Normal file
@ -0,0 +1,42 @@
|
||||
<?php
|
||||
/**
|
||||
* Observium
|
||||
*
|
||||
* This file is part of Observium.
|
||||
*
|
||||
* @package observium
|
||||
* @subpackage web
|
||||
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2022 Observium Limited
|
||||
*
|
||||
*/
|
||||
|
||||
echo generate_box_open();
|
||||
|
||||
echo('<table class="table table-hover table-striped table-condensed">');
|
||||
echo('<thead><tr><th>Device</th><th>VPN</th><th>ASN</th><th>Router ID</th><th width="80">Ports</th></th><th width="80">Neighbours</th><th width="80">Routes</th></tr></thead>');
|
||||
|
||||
foreach (dbFetchRows("SELECT * FROM `eigrp_ases` LEFT JOIN `eigrp_vpns` USING (`device_id`, `eigrp_vpn`) WHERE 1 ".$GLOBALS['cache']['where']['devices_permitted']) as $as) {
|
||||
|
||||
$device = device_by_id_cache($as['device_id']);
|
||||
|
||||
$port_count = dbFetchCell("SELECT COUNT(*) FROM `eigrp_ports` WHERE device_id = ? AND `eigrp_vpn` = ? AND `eigrp_as` = ?", array($as['device_id'], $as['eigrp_vpn'], $as['eigrp_as']));
|
||||
//$peer_count = dbFetchCell("SELECT COUNT(*) FROM `eigrp_peers` WHERE device_id = ? AND `eigrp_vpn` = ? AND `eigrp_as` = ?", array($as['device_id'], $as['eigrp_vpn'], $as['eigrp_as']));
|
||||
|
||||
echo('<tr class="'.$row_class.'">');
|
||||
echo(' <td class="entity-title">'.generate_device_link($device, NULL, [ 'tab' => 'routing', 'proto' => 'eigrp' ]). '</td>');
|
||||
echo(' <td class="entity-title">'.$as['eigrp_vpn_name'] . '</td>');
|
||||
echo(' <td>' . $as['eigrp_as'] . '</td>');
|
||||
echo(' <td>' . $as['cEigrpAsRouterId'] . '</td>');
|
||||
echo(' <td>' . $port_count . '</td>');
|
||||
echo(' <td>' . $as['cEigrpNbrCount'] . '</td>');
|
||||
echo(' <td>' . $as['cEigrpTopoRoutes'] . '</td>');
|
||||
//echo(' <td>' . $peer_count . '</td>');
|
||||
echo('</tr>');
|
||||
|
||||
}
|
||||
|
||||
echo('</table>');
|
||||
|
||||
echo generate_box_close();
|
||||
|
||||
// EOF
|
99
html/pages/routing/ospf.inc.php
Normal file
99
html/pages/routing/ospf.inc.php
Normal file
@ -0,0 +1,99 @@
|
||||
<?php
|
||||
/**
|
||||
* Observium
|
||||
*
|
||||
* This file is part of Observium.
|
||||
*
|
||||
* @package observium
|
||||
* @subpackage web
|
||||
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2022 Observium Limited
|
||||
*
|
||||
*/
|
||||
|
||||
echo generate_box_open();
|
||||
|
||||
echo('<table class="table table-hover table-striped table-condensed">');
|
||||
echo('<thead><tr><th>Device</th><th>Router Id</th><th>Status</th><th>ABR</th><th>ASBR</th><th>Areas</th><th>Ports</th><th>Neighbours</th></tr></thead>');
|
||||
|
||||
// Counts
|
||||
$area_counts = [];
|
||||
foreach (dbFetchRows('SELECT `device_id`, COUNT(*) AS `count` FROM `ospf_areas` WHERE 1'.$GLOBALS['cache']['where']['devices_permitted'].' GROUP BY `device_id`') as $entry) {
|
||||
$area_counts[$entry['device_id']] = $entry['count'];
|
||||
}
|
||||
$port_counts = [];
|
||||
foreach (dbFetchRows('SELECT `device_id`, COUNT(*) AS `count` FROM `ospf_ports` WHERE 1'.$GLOBALS['cache']['where']['devices_permitted'].' GROUP BY `device_id`') as $entry) {
|
||||
$port_counts[$entry['device_id']] = $entry['count'];
|
||||
}
|
||||
$port_counts_enabled = [];
|
||||
foreach (dbFetchRows("SELECT `device_id`, COUNT(*) AS `count` FROM `ospf_ports` WHERE `ospfIfAdminStat` = 'enabled'".$GLOBALS['cache']['where']['devices_permitted'].' GROUP BY `device_id`') as $entry) {
|
||||
$port_counts_enabled[$entry['device_id']] = $entry['count'];
|
||||
}
|
||||
$neighbour_counts = [];
|
||||
foreach (dbFetchRows('SELECT `device_id`, COUNT(*) AS `count` FROM `ospf_nbrs` WHERE 1'.$GLOBALS['cache']['where']['devices_permitted'].' GROUP BY `device_id`') as $entry) {
|
||||
$neighbour_counts[$entry['device_id']] = $entry['count'];
|
||||
}
|
||||
|
||||
// Loop Instances
|
||||
foreach (dbFetchRows("SELECT * FROM `ospf_instances` WHERE `ospfAdminStat` IN ('enabled', 'disabled')".$GLOBALS['cache']['where']['devices_permitted']) as $instance) {
|
||||
$device = device_by_id_cache($instance['device_id']);
|
||||
|
||||
$row_class = '';
|
||||
if ($instance['ospfAdminStat'] === "enabled") {
|
||||
$enabled = '<span style="color: #00aa00">enabled</span>';
|
||||
|
||||
//$area_count = dbFetchCell('SELECT COUNT(*) FROM `ospf_areas` WHERE `device_id` = ?', array($device['device_id']));
|
||||
//$port_count = dbFetchCell('SELECT COUNT(*) FROM `ospf_ports` WHERE `device_id` = ?', array($device['device_id']));
|
||||
//$port_count_enabled = dbFetchCell("SELECT COUNT(*) FROM `ospf_ports` WHERE `ospfIfAdminStat` = 'enabled' AND `device_id` = ?", array($device['device_id']));
|
||||
//$neighbour_count = dbFetchCell('SELECT COUNT(*) FROM `ospf_nbrs` WHERE `device_id` = ?', array($device['device_id']));
|
||||
} else {
|
||||
|
||||
// Skip disabled OSPF processes
|
||||
if(!isset($vars['show_disabled']) && !$vars['show_disabled']) { continue; }
|
||||
|
||||
$enabled = '<span style="color: #aaaaaa">disabled</span>';
|
||||
$row_class = 'error';
|
||||
}
|
||||
$area_count = isset($area_counts[$device['device_id']]) ? $area_counts[$device['device_id']] : 0;
|
||||
$port_count = isset($port_counts[$device['device_id']]) ? $port_counts[$device['device_id']] : 0;
|
||||
$port_count_enabled = isset($port_counts_enabled[$device['device_id']]) ? $port_counts_enabled[$device['device_id']] : 0;
|
||||
$neighbour_count = isset($neighbour_counts[$device['device_id']]) ? $neighbour_counts[$device['device_id']] : 0;
|
||||
if ((!$port_count_enabled || !$neighbour_count) && safe_empty($row_class)) {
|
||||
$row_class = 'warning';
|
||||
}
|
||||
|
||||
/*
|
||||
$ip_query = "SELECT * FROM ipv4_addresses AS A, ports AS I WHERE ";
|
||||
$ip_query .= "(A.ipv4_address = ? AND I.port_id = A.port_id)";
|
||||
$ip_query .= " AND I.device_id = ?";
|
||||
$ipv4_host = dbFetchRow($ip_query, array($peer['bgpPeerIdentifier'], $device['device_id']));
|
||||
*/
|
||||
|
||||
if ($instance['ospfAreaBdrRtrStatus'] === "true") {
|
||||
$abr = '<span style="color: #00aa00">yes</span>';
|
||||
} else {
|
||||
$abr = '<span style="color: #aaaaaa">no</span>';
|
||||
}
|
||||
if ($instance['ospfASBdrRtrStatus'] === "true") {
|
||||
$asbr = '<span style="color: #00aa00">yes</span>';
|
||||
} else {
|
||||
$asbr = '<span style="color: #aaaaaa">no</span>';
|
||||
}
|
||||
|
||||
echo('<tr class="'.$row_class.'">');
|
||||
echo(' <td class="entity-title">'.generate_device_link($device, NULL, [ 'tab' => 'routing', 'proto' => 'ospf' ]). '</td>');
|
||||
echo(' <td class="entity-title">'.$instance['ospfRouterId'] . '</td>');
|
||||
echo(' <td>' . $enabled . '</td>');
|
||||
echo(' <td>' . $abr . '</td>');
|
||||
echo(' <td>' . $asbr . '</td>');
|
||||
echo(' <td>' . $area_count . '</td>');
|
||||
echo(' <td>' . $port_count . '('.$port_count_enabled.')</td>');
|
||||
echo(' <td>' . $neighbour_count . '</td>');
|
||||
echo('</tr>');
|
||||
|
||||
} // End loop instances
|
||||
|
||||
echo('</table>');
|
||||
|
||||
echo generate_box_close();
|
||||
|
||||
// EOF
|
40
html/pages/routing/overview.inc.php
Normal file
40
html/pages/routing/overview.inc.php
Normal file
@ -0,0 +1,40 @@
|
||||
<?php
|
||||
/**
|
||||
* Observium
|
||||
*
|
||||
* This file is part of Observium.
|
||||
*
|
||||
* @package observium
|
||||
* @subpackage web
|
||||
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2020 Observium Limited
|
||||
*
|
||||
*/
|
||||
|
||||
$g_i = 0;
|
||||
foreach ($datas as $type)
|
||||
{
|
||||
if ($type != "overview")
|
||||
{
|
||||
$filename = $config['html_dir'] . '/pages/routing/overview/'.$type.'.inc.php';
|
||||
if (is_file($filename))
|
||||
{
|
||||
$g_i++;
|
||||
$row_colour = !is_intnum($g_i / 2) ? OBS_COLOUR_LIST_A : OBS_COLOUR_LIST_B;
|
||||
|
||||
echo('<div style="background-color: '.$row_colour.';">');
|
||||
echo('<div style="padding:4px 0px 0px 8px;"><span class=graphhead>'.$type_text[$type].'</span>');
|
||||
|
||||
include($filename);
|
||||
|
||||
echo('</div>');
|
||||
echo('</div>');
|
||||
} else {
|
||||
$graph_title = $type_text[$type];
|
||||
$graph_type = "device_".$type;
|
||||
|
||||
include($config['html_dir'] . "/includes/print-device-graph.php");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// EOF
|
201
html/pages/routing/vrf.inc.php
Normal file
201
html/pages/routing/vrf.inc.php
Normal file
@ -0,0 +1,201 @@
|
||||
<?php
|
||||
/**
|
||||
* Observium
|
||||
*
|
||||
* This file is part of Observium.
|
||||
*
|
||||
* @package observium
|
||||
* @subpackage web
|
||||
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2021 Observium Limited
|
||||
*
|
||||
*/
|
||||
|
||||
if ($_SESSION['userlevel'] < 5) {
|
||||
print_error_permission();
|
||||
return;
|
||||
} elseif (!$config['enable_vrfs']) {
|
||||
print_error("VRFs disabled globally.");
|
||||
return;
|
||||
}
|
||||
|
||||
$link_array = array('page' => 'routing',
|
||||
'protocol' => 'vrf');
|
||||
|
||||
$navbar = array('brand' => "VRFs", 'class' => "navbar-narrow");
|
||||
|
||||
$navbar['options']['vrf']['text'] = 'All VRFs';
|
||||
if (!isset($vars['vrf'])) { $navbar['options']['vrf']['class'] .= " active"; }
|
||||
$navbar['options']['vrf']['url'] = generate_url($link_array,array('vrf' => NULL));
|
||||
|
||||
$options['basic']['text'] = 'Basic';
|
||||
// $navbar['options']['details']['text'] = 'Details';
|
||||
$options['graphs'] = array('text' => 'Graphs', 'class' => 'pull-right', 'icon' => $config['icon']['graphs']);
|
||||
|
||||
if (!isset($vars['view'])) { $vars['view'] = 'basic'; }
|
||||
|
||||
foreach ($options as $option => $array)
|
||||
{
|
||||
$navbar['options'][$option] = $array;
|
||||
if ($vars['view'] == $option) { $navbar['options'][$option]['class'] .= " active"; }
|
||||
$navbar['options'][$option]['url'] = generate_url($link_array,array('view' => $option));
|
||||
}
|
||||
|
||||
foreach (array('graphs') as $type)
|
||||
{
|
||||
foreach ($config['graph_types']['port'] as $option => $data)
|
||||
{
|
||||
if ($vars['view'] == $type && $vars['view'] == $option)
|
||||
{
|
||||
$navbar['options'][$type]['suboptions'][$option]['class'] = 'active';
|
||||
$navbar['options'][$type]['text'] .= ' ('.$data['name'].')';
|
||||
}
|
||||
$navbar['options'][$type]['suboptions'][$option]['text'] = $data['name'];
|
||||
$navbar['options'][$type]['suboptions'][$option]['url'] = generate_url($link_array, array('view' => $type, 'graph' => $option));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
print_navbar($navbar);
|
||||
unset($navbar);
|
||||
|
||||
if (!$vars['vrf'])
|
||||
{
|
||||
// Pre-Cache in arrays
|
||||
// That's heavier on RAM, but much faster on CPU (1:40)
|
||||
|
||||
// Specifying the fields reduces a lot the RAM used (1:4) .
|
||||
$vrf_fields = "`vrf_id`, `vrf_rd`, `vrf_descr`, `vrf_name`";
|
||||
$dev_fields = "`device_id`, `hostname`, `os`, `hardware`, `version`, `features`, `location`, `status`, `ignore`, `disabled`";
|
||||
$port_fields = "`port_id`, `ifVrf`, `device_id`, `ifDescr`, `ifAlias`, `ifName`";
|
||||
|
||||
foreach (dbFetchRows("SELECT $vrf_fields, $dev_fields FROM `vrfs` LEFT JOIN `devices` USING (`device_id`) WHERE 1 ".$GLOBALS['cache']['where']['devices_permitted']) as $vrf_device)
|
||||
{
|
||||
if (empty($vrf_devices[$vrf_device['vrf_rd']]))
|
||||
{
|
||||
$vrf_devices[$vrf_device['vrf_rd']][0] = $vrf_device;
|
||||
} else {
|
||||
array_push($vrf_devices[$vrf_device['vrf_rd']], $vrf_device);
|
||||
}
|
||||
}
|
||||
|
||||
foreach (dbFetchRows("SELECT $port_fields FROM `ports` WHERE `ifVrf` IS NOT NULL ".$GLOBALS['cache']['where']['ports_permitted']) as $port)
|
||||
{
|
||||
if (empty($vrf_ports[$port['ifVrf']][$port['device_id']]))
|
||||
{
|
||||
$vrf_ports[$port['ifVrf']][$port['device_id']][0] = $port;
|
||||
} else {
|
||||
array_push($vrf_ports[$port['ifVrf']][$port['device_id']], $port);
|
||||
}
|
||||
}
|
||||
|
||||
echo generate_box_open();
|
||||
|
||||
echo('<table class="table table-striped">');
|
||||
foreach (dbFetchRows("SELECT * FROM `vrfs` WHERE 1".$GLOBALS['cache']['where']['devices_permitted']." GROUP BY `vrf_rd`") as $vrf)
|
||||
{
|
||||
echo('<tr>');
|
||||
echo('<td style="width: 240px;"><a class="entity" href="'.generate_url($link_array,array('vrf' => $vrf['vrf_rd'])).'">' . $vrf['vrf_name'] . '</a><br />
|
||||
<span class="small">' . $vrf['vrf_descr'] . '</span></td>');
|
||||
echo('<td style="width: 75px;"><span class="label label-primary">' . $vrf['vrf_rd'] . '</span></td>');
|
||||
echo('<td>');
|
||||
|
||||
echo generate_box_open();
|
||||
|
||||
echo('<table class="table table-striped table-condensed">');
|
||||
$x=1;
|
||||
foreach ($vrf_devices[$vrf['vrf_rd']] as $device)
|
||||
{
|
||||
echo('<tr><td style="width: 150px;"><span class="entity">'.generate_device_link_short($device) .'</span>');
|
||||
|
||||
if ($device['vrf_name'] != $vrf['vrf_name']) {
|
||||
echo(generate_tooltip_link(NULL, ' '.get_icon('exclamation'), "Expected Name : ".$vrf['vrf_name']."<br />Configured : ".$device['vrf_name']));
|
||||
}
|
||||
echo("</td><td>");
|
||||
unset($seperator);
|
||||
|
||||
foreach ($vrf_ports[$device['vrf_id']][$device['device_id']] as $port)
|
||||
{
|
||||
$port = array_merge($device, $port);
|
||||
|
||||
switch ($vars['graph'])
|
||||
{
|
||||
case 'bits':
|
||||
case 'upkts':
|
||||
case 'nupkts':
|
||||
case 'errors':
|
||||
$port['width'] = "130";
|
||||
$port['height'] = "30";
|
||||
$port['from'] = $config['time']['day'];
|
||||
$port['to'] = $config['time']['now'];
|
||||
$port['bg'] = "#".$bg;
|
||||
$port['graph_type'] = "port_".$vars['graph'];
|
||||
echo '<div class="box box-solid" style="display: block; padding: 3px; margin: 3px; min-width: 135px; max-width:135px; min-height:75px; max-height:75px;
|
||||
text-align: center; float: left;"">
|
||||
<div style="font-weight: bold;">'.short_ifname($port['ifDescr']).'</div>';
|
||||
generate_port_thumbnail($port);
|
||||
echo("<div style='font-size: 9px;'>".short_port_descr($port['ifAlias'])."</div>
|
||||
</div>");
|
||||
break;
|
||||
|
||||
default:
|
||||
echo($seperator.generate_port_link_short($port));
|
||||
$seperator = ", ";
|
||||
break;
|
||||
}
|
||||
}
|
||||
echo("</td></tr>");
|
||||
$x++;
|
||||
} // End While
|
||||
|
||||
echo '</table>';
|
||||
echo generate_box_close();
|
||||
echo '</td>';
|
||||
|
||||
$i++;
|
||||
}
|
||||
echo("</table>");
|
||||
|
||||
echo generate_box_close();
|
||||
|
||||
} else {
|
||||
|
||||
// Print single VRF
|
||||
|
||||
echo generate_box_open();
|
||||
echo('<table class="table table-striped">');
|
||||
$vrf = dbFetchRow("SELECT * FROM `vrfs` WHERE `vrf_rd` = ? ".$GLOBALS['cache']['where']['devices_permitted'], array($vars['vrf']));
|
||||
echo('<tr>');
|
||||
echo('<td style="width: 200px;" class="entity-title"><a href="'.generate_url($link_array,array('vrf' => $vrf['vrf_rd'])).'">' . $vrf['vrf_name'] . '</a></td>');
|
||||
echo('<td style="width: 100px;" class="small">' . $vrf['vrf_rd'] . '</td>');
|
||||
echo('<td style="width: 200px;" class="small">' . $vrf['vrf_descr'] . '</td>');
|
||||
echo('</table>');
|
||||
echo generate_box_close();
|
||||
|
||||
$vrf_devices = dbFetchRows("SELECT * FROM `vrfs` LEFT JOIN `devices` USING (`device_id`) WHERE `vrf_rd` = ? ".$GLOBALS['cache']['where']['devices_permitted'], array($vrf['vrf_rd']));
|
||||
foreach ($vrf_devices as $device)
|
||||
{
|
||||
$hostname = $device['hostname'];
|
||||
echo generate_box_open();
|
||||
echo('<table cellpadding="10" cellspacing="0" class="table table-striped" width="100%">');
|
||||
|
||||
print_device_row($device);
|
||||
|
||||
echo('</table>');
|
||||
echo generate_box_close();
|
||||
unset($seperator);
|
||||
echo('<div style="margin: 10px;"><table class="table table-striped">');
|
||||
$i=1;
|
||||
foreach (dbFetchRows("SELECT * FROM `ports` WHERE `ifVrf` = ? AND `device_id` = ?".$GLOBALS['cache']['where']['ports_permitted'], array($device['vrf_id'], $device['device_id'])) as $port)
|
||||
{
|
||||
print_port_row($port);
|
||||
|
||||
$i++;
|
||||
}
|
||||
|
||||
$x++;
|
||||
echo('</table></div>');
|
||||
echo('<div style="height: 10px;"></div>');
|
||||
}
|
||||
}
|
||||
|
||||
// EOF
|
Reference in New Issue
Block a user