mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
add duplex detection frmo dot3stats and display this for ports (and fix weird bug where speed wasn't shown for devices with no ifAlias!)
git-svn-id: http://www.observium.org/svn/observer/trunk@1504 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
@@ -77,10 +77,10 @@
|
||||
}
|
||||
|
||||
echo("</td><td width=75>");
|
||||
if($interface['ifSpeed'] && $interface['ifAlias'] != "") { echo("<span class=box-desc>".humanspeed($interface['ifSpeed'])."</span>"); }
|
||||
if($interface['ifSpeed']) { echo("<span class=box-desc>".humanspeed($interface['ifSpeed'])."</span>"); }
|
||||
echo("<br />");
|
||||
|
||||
# if($interface[ifDuplex] != unknown) { echo("<span class=box-desc>Duplex " . $interface['ifDuplex'] . "</span>"); } else { echo("-"); }
|
||||
if($interface[ifDuplex] != "unknown") { echo("<span class=box-desc>" . $interface['ifDuplex'] . "</span>"); } else { echo("-"); }
|
||||
|
||||
if($device['os'] == "ios" || $device['os'] == "iosxe") {
|
||||
if($interface['ifTrunk']) {
|
||||
@@ -92,8 +92,8 @@
|
||||
echo("<span style='color: green;'>" . $vrf['vrf_name'] . "</span>");
|
||||
}
|
||||
}
|
||||
if($port_adsl['adslLineCoding']) {
|
||||
|
||||
if($port_adsl['adslLineCoding']) {
|
||||
echo("</td><td width=150>");
|
||||
echo($port_adsl['adslLineCoding']."/".$port_adsl['adslLineType']);
|
||||
echo("<br />");
|
||||
@@ -104,8 +104,6 @@
|
||||
echo("Atten:".$port_adsl['adslAtucCurrAtn'] . "dB/". $port_adsl['adslAturCurrAtn'] . "dB");
|
||||
echo("<br />");
|
||||
echo("SNR:".$port_adsl['adslAtucCurrSnrMgn'] . "dB/". $port_adsl['adslAturCurrSnrMgn']. "dB");
|
||||
|
||||
|
||||
} else {
|
||||
echo("</td><td width=150>");
|
||||
if($interface['ifType'] && $interface['ifType'] != "") { echo("<span class=box-desc>" . fixiftype($interface['ifType']) . "</span>"); } else { echo("-"); }
|
||||
|
@@ -5,7 +5,7 @@
|
||||
|
||||
// Build SNMP Cache Array
|
||||
$data_oids = array('ifName','ifDescr','ifAlias', 'ifAdminStatus', 'ifOperStatus', 'ifMtu', 'ifSpeed', 'ifHighSpeed', 'ifType', 'ifPhysAddress',
|
||||
'ifPromiscuousMode','ifConnectorPresent');
|
||||
'ifPromiscuousMode','ifConnectorPresent','ifDuplex');
|
||||
$stat_oids = array('ifInErrors', 'ifOutErrors', 'ifInUcastPkts', 'ifOutUcastPkts', 'ifInNUcastPkts', 'ifOutNUcastPkts',
|
||||
'ifHCInMulticastPkts', 'ifHCInBroadcastPkts', 'ifHCOutMulticastPkts', 'ifHCOutBroadcastPkts',
|
||||
'ifInOctets', 'ifOutOctets', 'ifHCInOctets', 'ifHCOutOctets');
|
||||
@@ -30,7 +30,12 @@
|
||||
echo("Caching Oids: ");
|
||||
foreach ($ifmib_oids as $oid) { echo("$oid "); $port_stats = snmpwalk_cache_oid($device, $oid, $port_stats, "IF-MIB");}
|
||||
|
||||
if($config['enable_ports_etherlike']) { echo("dot3Stats "); $port_stats = snmpwalk_cache_oid($device, "dot3StatsEntry", $port_stats, "EtherLike-MIB"); }
|
||||
if($config['enable_ports_etherlike'])
|
||||
{
|
||||
echo("dot3Stats "); $port_stats = snmpwalk_cache_oid($device, "dot3StatsEntry", $port_stats, "EtherLike-MIB");
|
||||
} else {
|
||||
echo("dot3StatsDuplexStatus"); $port_stats = snmpwalk_cache_oid($device, "dot3StatsDuplexStatus", $port_stats, "EtherLike-MIB");
|
||||
}
|
||||
|
||||
if($config['enable_ports_adsl']) {
|
||||
$device['adsl_count'] = mysql_result(mysql_query("SELECT COUNT(*) FROM `ports` WHERE `device_id` = '".$device['device_id']."' AND `ifType` = 'adsl'"),0);
|
||||
@@ -102,19 +107,28 @@
|
||||
#echo("\n32bit - In: ".$this_port['ifInOctets']." Out: ".$this_port['ifOutOctets']);
|
||||
#echo("\n64bit - In: ".$this_port['ifHCInOctets']." Out: ".$this_port['ifHCOutOctets']."\n");
|
||||
|
||||
/// Copy ifHC[In|Out]Octets values to non-HC if they exist
|
||||
### Copy ifHC[In|Out]Octets values to non-HC if they exist
|
||||
if($this_port['ifHCInOctets'] > 0 && is_numeric($this_port['ifHCInOctets']) && $this_port['ifHCOutOctets'] > 0 && is_numeric($this_port['ifHCOutOctets'])) {
|
||||
echo("HC ");
|
||||
$this_port['ifInOctets'] = $this_port['ifHCInOctets'];
|
||||
$this_port['ifOutOctets'] = $this_port['ifHCOutOctets'];
|
||||
}
|
||||
|
||||
### Overwrite ifSpeed with ifHighSpeed if it's over 10G
|
||||
if(is_numeric($this_port['ifHighSpeed']) && $this_port['ifSpeed'] > "1000000000")
|
||||
{
|
||||
echo("HighSpeed ");
|
||||
$this_port['ifSpeed'] = $this_port['ifHighSpeed'] * 1000000;
|
||||
}
|
||||
|
||||
/// Update IF-MIB data
|
||||
### Overwrite ifDuplex with dot3StatsDuplexStatus if it exists
|
||||
if(isset($this_port['dot3StatsDuplexStatus']))
|
||||
{
|
||||
echo("dot3Duplex ");
|
||||
$this_port['ifDuplex'] = $this_port['dot3StatsDuplexStatus'];
|
||||
}
|
||||
|
||||
### Update IF-MIB data
|
||||
foreach ($data_oids as $oid) {
|
||||
if ( $port[$oid] != $this_port[$oid] && !isset($this_port[$oid])) {
|
||||
$update .= ", `$oid` = NULL";
|
||||
|
Reference in New Issue
Block a user