mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
basics of customisable ifAlias parser. fixed "Processorss" to "Processors" in top menu
git-svn-id: http://www.observium.org/svn/observer/trunk@1088 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
@@ -106,6 +106,9 @@ $config['show_services'] = 1; # Enable Services on menu
|
||||
$config['ports_page_default'] = "details/";
|
||||
# Default devices ports page display type. "details/", "graphs/bits/", etc
|
||||
|
||||
#$config['port_descr_parser'] = "includes/port-descr-parser.inc.php";
|
||||
## Use parser to parse out ifAlias into type/descr/speed/circuit/notes
|
||||
|
||||
### Which additional features should we enable?
|
||||
|
||||
$config['enable_bgp'] = 1; # Enable BGP session collection and display
|
||||
|
||||
@@ -5,3 +5,5 @@ DROP TABLE `cempMemPool`;
|
||||
DROP TABLE `cpmCPU`;
|
||||
DROP TABLE `cmpMemPool`;
|
||||
ALTER TABLE `mempools` CHANGE `mempool_used` `mempool_used` BIGINT( 16 ) NOT NULL ,CHANGE `mempool_free` `mempool_free` BIGINT( 16 ) NOT NULL ,CHANGE `mempool_total` `mempool_total` BIGINT( 16 ) NOT NULL ,CHANGE `mempool_largestfree` `mempool_largestfree` BIGINT( 16 ) NULL DEFAULT NULL ,CHANGE `mempool_lowestfree` `mempool_lowestfree` BIGINT( 16 ) NULL DEFAULT NULL ;
|
||||
ALTER TABLE `ports` ADD `port_descr_type` VARCHAR( 32 ) NULL DEFAULT NULL AFTER `device_id` ,ADD `port_descr_descr` VARCHAR( 64 ) NULL DEFAULT NULL AFTER `port_descr_type` ,ADD `port_descr_circuit` VARCHAR( 64 ) NULL DEFAULT NULL AFTER `port_descr_descr` ,ADD `port_descr_speed` VARCHAR( 32 ) NULL DEFAULT NULL AFTER `port_descr_circuit` ,ADD `port_descr_notes` VARCHAR( 128 ) NULL DEFAULT NULL AFTER `port_descr_speed`;
|
||||
|
||||
|
||||
@@ -176,7 +176,7 @@ echo('<li><a href="ports/?status=0"><img src="images/16/link_error.png" border="
|
||||
<!--[if IE 7]><!--></a><!--<![endif]-->
|
||||
<table><tr><td>
|
||||
<ul>
|
||||
<li><a href="health/processors/"><img src="images/icons/overview/processors.png" border="0" align="absmiddle" /> Processorss</a></li>
|
||||
<li><a href="health/processors/"><img src="images/icons/overview/processors.png" border="0" align="absmiddle" /> Processors</a></li>
|
||||
<li><a href="health/memory/"><img src="images/icons/overview/mempools.png" border="0" align="absmiddle" /> Memory</a></li>
|
||||
<li><a href="health/storage/"><img src="images/icons/storage.png" border="0" align="absmiddle" /> Storage</a></li>
|
||||
<li><hr width=140 /></li>
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
|
||||
$ifclass = ifclass($interface['ifOperStatus'], $interface['ifAdminStatus']);
|
||||
|
||||
list(,$customer) = preg_split("/[\:\[\]\{\}\(\)]/", $interface['ifAlias']);
|
||||
list($type,$customer) = preg_split("/[\:\[\]\{\}\(\)]/", $interface['ifAlias']);
|
||||
list(,$circuit) = preg_split("/[\{\}]/", $interface['ifAlias']);
|
||||
list(,$notes) = preg_split("/[\(\)]/", $interface['ifAlias']);
|
||||
list(,$speed) = preg_split("/[\[\]]/", $interface['ifAlias']);
|
||||
|
||||
@@ -1,4 +1,13 @@
|
||||
<?php
|
||||
<?php print_optionbar_start();
|
||||
|
||||
if(!$_GET['opta']) { $_GET['opta'] = "basic"; }
|
||||
|
||||
echo("<a href='".$config['base_url']."/services/basic/'>Basic</a> | ");
|
||||
echo("<a href='".$config['base_url']."/services/details/'>Details</a>");
|
||||
|
||||
print_optionbar_end();
|
||||
|
||||
print_r($_GET);
|
||||
|
||||
if($_GET['status'] == '0') { $where = " AND service_status = '0'"; } else { unset ($where); }
|
||||
|
||||
@@ -15,9 +24,30 @@ if ($_SESSION['userlevel'] >= '5') {
|
||||
$device_id = $host_data['device_id'];
|
||||
$device_hostname = $host_data['hostname'];
|
||||
$service_query = mysql_query("SELECT * FROM `services` WHERE `device_id` = '" . $host_data['device_id'] . "' $where");
|
||||
while($service = mysql_fetch_array($service_query)) {
|
||||
while($service = mysql_fetch_array($service_query))
|
||||
{
|
||||
include("includes/print-service.inc");
|
||||
$samehost = 1;
|
||||
# $samehost = 1;
|
||||
if($_GET['opta'] == "details")
|
||||
{
|
||||
|
||||
$graph_array['height'] = "100";
|
||||
$graph_array['width'] = "215";
|
||||
$graph_array['to'] = $now;
|
||||
$graph_array['id'] = $service['service_id'];
|
||||
$graph_array['type'] = "service";
|
||||
|
||||
$periods = array('day', 'week', 'month', 'year');
|
||||
|
||||
echo('<tr style="background-color: $bg; padding: 5px;"><td colspan=6>');
|
||||
|
||||
foreach($periods as $period) {
|
||||
$graph_array['from'] = $$period;
|
||||
$graph_array_zoom = $graph_array; $graph_array_zoom['height'] = "150"; $graph_array_zoom['width'] = "400";
|
||||
echo(overlib_link($_SERVER['REQUEST_URI'], generate_graph_tag($graph_array), generate_graph_tag($graph_array_zoom), NULL));
|
||||
}
|
||||
echo("</td></tr>");
|
||||
}
|
||||
}
|
||||
unset ($samehost);
|
||||
}
|
||||
|
||||
@@ -92,6 +92,28 @@
|
||||
}
|
||||
}
|
||||
|
||||
/// Parse description (usually ifAlias) if config option set
|
||||
|
||||
if(isset($config['port_descr_parser']))
|
||||
{
|
||||
$port_attribs = array('type','descr','circuit','speed','notes');
|
||||
include($config['port_descr_parser']);
|
||||
|
||||
foreach ($port_attribs as $attrib) {
|
||||
$attrib_key = "port_descr_".$attrib;
|
||||
if($port_ifAlias[$attrib])
|
||||
{
|
||||
if($port_ifAlias[$attrib] != $port[$attrib_key])
|
||||
{
|
||||
$update .= ", `".$attrib_key."` = '".$port_ifAlias[$attrib]."'";
|
||||
eventlog($attrib . ": ".$port[$attrib_key]." -> " . $port_ifAlias[$attrib], $device['device_id'], $port['interface_id']);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Ende parse ifAlias
|
||||
|
||||
/// Update IF-MIB metrics
|
||||
foreach ($stat_oids_db as $oid) {
|
||||
$update .= ", `$oid` = '".$this_port[$oid]."'";
|
||||
|
||||
Reference in New Issue
Block a user