mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Merge pull request #1125 from laf/issue-1033
Added ability to customise ports transit/peering/core/custom descr
This commit is contained in:
@@ -126,6 +126,10 @@ $config['show_locations_dropdown'] = 1; # Enable Locations dropdown on menu
|
|||||||
$config['show_services'] = 0; # Enable Services on menu
|
$config['show_services'] = 0; # Enable Services on menu
|
||||||
$config['int_customers'] = 1; # Enable Customer Port Parsing
|
$config['int_customers'] = 1; # Enable Customer Port Parsing
|
||||||
$config['customers_descr'] = 'cust'; // The description to look for in ifDescr. Can be an array as well array('cust','cid');
|
$config['customers_descr'] = 'cust'; // The description to look for in ifDescr. Can be an array as well array('cust','cid');
|
||||||
|
$config['transit_descr'] = ""; // Add custom transit descriptions (can be an array)
|
||||||
|
$config['peering_descr'] = ""; // Add custom peering descriptions (can be an array)
|
||||||
|
$config['core_descr'] = ""; // Add custom core descriptions (can be an array)
|
||||||
|
$config['custom_descr'] = ""; // Add custom interface descriptions (can be an array)
|
||||||
$config['int_transit'] = 1; # Enable Transit Types
|
$config['int_transit'] = 1; # Enable Transit Types
|
||||||
$config['int_peering'] = 1; # Enable Peering Types
|
$config['int_peering'] = 1; # Enable Peering Types
|
||||||
$config['int_core'] = 1; # Enable Core Port Types
|
$config['int_core'] = 1; # Enable Core Port Types
|
||||||
|
@@ -235,6 +235,15 @@ if ($_SESSION['userlevel'] >= '5')
|
|||||||
if ($config['int_peering']) { echo(' <li><a href="iftype/type=peering/"><i class="fa fa-user-plus fa-fw fa-lg"></i> Peering</a></li>'); $ifbreak = 1; }
|
if ($config['int_peering']) { echo(' <li><a href="iftype/type=peering/"><i class="fa fa-user-plus fa-fw fa-lg"></i> Peering</a></li>'); $ifbreak = 1; }
|
||||||
if ($config['int_peering'] && $config['int_transit']) { echo(' <li><a href="iftype/type=peering,transit/"><i class="fa fa-user-secret fa-fw fa-lg"></i> Peering + Transit</a></li>'); $ifbreak = 1; }
|
if ($config['int_peering'] && $config['int_transit']) { echo(' <li><a href="iftype/type=peering,transit/"><i class="fa fa-user-secret fa-fw fa-lg"></i> Peering + Transit</a></li>'); $ifbreak = 1; }
|
||||||
if ($config['int_core']) { echo(' <li><a href="iftype/type=core/"><i class="fa fa-anchor fa-fw fa-lg"></i> Core</a></li>'); $ifbreak = 1; }
|
if ($config['int_core']) { echo(' <li><a href="iftype/type=core/"><i class="fa fa-anchor fa-fw fa-lg"></i> Core</a></li>'); $ifbreak = 1; }
|
||||||
|
if (is_array($config['custom_descr']) === FALSE) {
|
||||||
|
$config['custom_descr'] = array($config['custom_descr']);
|
||||||
|
}
|
||||||
|
foreach ($config['custom_descr'] as $custom_type) {
|
||||||
|
if (!empty($custom_type)) {
|
||||||
|
echo ' <li><a href="iftype/type=' . strtolower($custom_type) . '"><i class="fa fa-connectdevelop fa-fw fa-lg"></i> ' . ucfirst($custom_type) . '</a></li>';
|
||||||
|
$ifbreak = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($ifbreak) {
|
if ($ifbreak) {
|
||||||
|
@@ -7,6 +7,16 @@ if ($bg == "#ffffff") { $bg = "#e5e5e5"; } else { $bg = "#ffffff"; }
|
|||||||
$type_where = " (";
|
$type_where = " (";
|
||||||
foreach (explode(",", $vars['type']) as $type)
|
foreach (explode(",", $vars['type']) as $type)
|
||||||
{
|
{
|
||||||
|
if (is_array($config[$type."_descr"]) === FALSE) {
|
||||||
|
$config[$type."_descr"] = array($config[$type."_descr"]);
|
||||||
|
}
|
||||||
|
foreach ($config[$type."_descr"] as $additional_type) {
|
||||||
|
if(!empty($additional_type)) {
|
||||||
|
$type_where .= " $or `port_descr_type` = ?";
|
||||||
|
$or = "OR";
|
||||||
|
$type_param[] = $additional_type;
|
||||||
|
}
|
||||||
|
}
|
||||||
$type_where .= " $or `port_descr_type` = ?";
|
$type_where .= " $or `port_descr_type` = ?";
|
||||||
$or = "OR";
|
$or = "OR";
|
||||||
$type_param[] = $type;
|
$type_param[] = $type;
|
||||||
|
@@ -129,6 +129,10 @@ $config['old_graphs'] = 1; // RRDfiles from before the great rra r
|
|||||||
|
|
||||||
$config['int_customers'] = 1; # Enable Customer Port Parsing
|
$config['int_customers'] = 1; # Enable Customer Port Parsing
|
||||||
$config['customers_descr'] = 'cust';
|
$config['customers_descr'] = 'cust';
|
||||||
|
$config['transit_descr'] = ""; // Add custom transit descriptions (can be an array)
|
||||||
|
$config['peering_descr'] = ""; // Add custom peering descriptions (can be an array)
|
||||||
|
$config['core_descr'] = ""; // Add custom core descriptions (can be an array)
|
||||||
|
$config['custom_descr'] = ""; // Add custom interface descriptions (can be an array)
|
||||||
$config['int_transit'] = 1; # Enable Transit Types
|
$config['int_transit'] = 1; # Enable Transit Types
|
||||||
$config['int_peering'] = 1; # Enable Peering Types
|
$config['int_peering'] = 1; # Enable Peering Types
|
||||||
$config['int_core'] = 1; # Enable Core Port Types
|
$config['int_core'] = 1; # Enable Core Port Types
|
||||||
|
Reference in New Issue
Block a user