fix some rewriting of interfaces. fix some other small things.

git-svn-id: http://www.observium.org/svn/observer/trunk@757 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
Adam Amstrong 2010-02-02 19:24:12 +00:00
parent 6ea25ad639
commit 2fc76a8a4d
7 changed files with 27 additions and 15 deletions

View File

@ -9,10 +9,10 @@
$interface['device_id'] = $device['device_id'];
$interface['hostname'] = $device['hostname'];
$interface = ifNameDescr($interface);
$if_id = $interface['interface_id'];
$interface = ifLabel($interface);
if(!is_integer($i/2)) { $row_colour = $list_colour_a; } else { $row_colour = $list_colour_b; }
if($interface['ifInErrors_delta'] > 0 || $interface['ifOutErrors_delta'] > 0) {
@ -27,7 +27,7 @@
<td valign=top width=300>");
echo(" <span class=list-large>
" . generateiflink($interface, $interface['ifIndex'] . ". ".fixifName($interface['label'])) . " $error_img $mac
" . generateiflink($interface, $interface['ifIndex'] . ". ".$interface['label']) . " $error_img $mac
</span><br /><span class=interface-desc>".$interface['ifAlias']."</span>");

View File

@ -123,8 +123,8 @@
while($acc = mysql_fetch_array($query)) {
if(!is_integer($i/2)) { $row_colour = $list_colour_a; } else { $row_colour = $list_colour_b; }
$addy = mysql_fetch_array(mysql_query("SELECT * FROM ipv4_mac where mac_address = '".$acc['mac']."'"));
#$name = gethostbyaddr($addy['ipv4_address']);
#if($name == $addy['ipv4_address']) { unset ($name); }
$name = gethostbyaddr($addy['ipv4_address']);
if($name == $addy['ipv4_address']) { unset ($name); }
if(mysql_result(mysql_query("SELECT count(*) FROM bgpPeers WHERE device_id = '".$acc['device_id']."' AND bgpPeerIdentifier = '".$addy['ipv4_address']."'"),0)) {
$peer_query = mysql_query("SELECT * FROM bgpPeers WHERE device_id = '".$acc['device_id']."' AND bgpPeerIdentifier = '".$addy['ipv4_address']."'");
$peer_info = mysql_fetch_array($peer_query);

View File

@ -163,7 +163,7 @@ function graph_multi_bits_trio ($interfaces, $graph, $from, $to, $width, $height
}
if($width <= "300") { $options .= " --font LEGEND:7:".$config['mono_font']." --font AXIS:6:".$config['mono_font']." --font-render-mode normal"; }
# echo($config['rrdtool'] . " graph $graph $options");
echo($config['rrdtool'] . " graph $graph $options");
$thing = shell_exec($config['rrdtool'] . " graph $graph $options");
return $graph;
}
@ -175,7 +175,7 @@ function graph_multi_bits_duo ($interfaces, $graph, $from, $to, $width, $height,
$options .= $config['rrdgraph_def_text'];
if($height < "99") { $options .= " --only-graph"; }
$i = 1;
foreach(explode(",", $interfaces[1]) as $ifid) {
foreach(explode(",", $interfaces[0]) as $ifid) {
$query = mysql_query("SELECT `ifIndex`, `hostname` FROM `interfaces` AS I, devices as D WHERE I.interface_id = '" . $ifid . "' AND I.device_id = D.device_id");
$int = mysql_fetch_row($query);
if(is_file($config['rrd_dir'] . "/" . $int[1] . "/" . $int[0] . ".rrd")) {
@ -190,7 +190,7 @@ function graph_multi_bits_duo ($interfaces, $graph, $from, $to, $width, $height,
}
}
unset($seperator); unset($plus);
foreach(explode(",", $interfaces[0]) as $ifid) {
foreach(explode(",", $interfaces[1]) as $ifid) {
$query = mysql_query("SELECT `ifIndex`, `hostname` FROM `interfaces` AS I, devices as D WHERE I.interface_id = '" . $ifid . "' AND I.device_id = D.device_id");
$int = mysql_fetch_row($query);
if(is_file($config['rrd_dir'] . "/" . $int[1] . "/" . $int[0] . ".rrd")) {

View File

@ -10,7 +10,7 @@ if($device['os_group'] == "ios") {
list($slotport, $ifIndex) = explode(" ", $entry);
$portifIndex[$ifIndex] = $slotport;
}
# print_r($portifIndex);
if($debug) { print_r($portifIndex); }
}
$interface_query = mysql_query("SELECT * FROM `interfaces` $where");

View File

@ -12,7 +12,7 @@
$stat_oids_db = array('ifInOctets', 'ifOutOctets', 'ifInErrors', 'ifOutErrors', 'ifInUcastPkts', 'ifOutUcastPkts'); // From above for DB
$etherlike_oids = array('dot3StatsAlignmentErrors', 'dot3StatsFCSErrors', 'dot3StatsSingleCollisionFrames', 'dot3StatsMultipleCollisionFrames',
$etherlike_oids = array('dot3StatsAlignmentErrors', 'dot3StatsFCSErrors', 'dot3StatsSingleCollisionFrames', 'dot3StatsMultipleCollisionFrames',
'dot3StatsSQETestErrors', 'dot3StatsDeferredTransmissions', 'dot3StatsLateCollisions', 'dot3StatsExcessiveCollisions',
'dot3StatsInternalMacTransmitErrors', 'dot3StatsCarrierSenseErrors', 'dot3StatsFrameTooLongs', 'dot3StatsInternalMacReceiveErrors',
'dot3StatsSymbolErrors');
@ -39,8 +39,9 @@
#foreach ($pagp_oids as $oid) { $array = snmp_cache_oid($oid, $device, $array, "CISCO-PAGP-MIB"); }
if($device['os_group'] == "ios") {
#$array = snmp_cache_portIfIndex ($device, $array);
#$array = snmp_cache_portName ($device, $array);
$array = snmp_cache_portIfIndex ($device, $array);
$array = snmp_cache_portName ($device, $array);
$data_oids[] = "portName";
#$array = snmp_cache_oid("vmVlan", $device, $array, "CISCO-VLAN-MEMBERSHIP-MIB");
#$array = snmp_cache_oid("vlanTrunkPortEncapsulationOperType", $device, $array, "CISCO-VTP-MIB");
#$array = snmp_cache_oid("vlanTrunkPortNativeVlan", $device, $array, "CISCO-VTP-MIB");

View File

@ -6,14 +6,22 @@ function formatMac($mac) {
}
function ifNameDescr ($interface, $device = NULL) {
function ifNameDescr($interface, $device = NULL) {
return ifLabel($interface, $device);
}
function ifLabel ($interface, $device = NULL) {
global $config;
if(!$device) { $device = device_array($interface['device_id']); }
$os = strtolower($device['os']);
if(isset($config['ifname'][$os])) {
$interface['label'] = $interface['ifDescr'];
} else {
$interface['label'] = $interface['ifName'];
} elseif(isset($config['ifAlias'][$os])) {
$interface['label'] = $interface['ifAlias'];
} else {
$interface['label'] = $interface['ifDescr'];
if(isset($config['appendifindex'][$os])) { $interface['label'] = $interface['label'] . " " . $interface['ifIndex']; }
}
return $interface;

View File

@ -6,6 +6,8 @@ $config['ifname']['catos'] = true;
$config['ifname']['windows'] = true;
$config['ifname']['speedtouch'] = true;
$config['ifname']['dell-laser'] = true;
$config['ifalias']['adva'] = true;
#$config['appendifindex']['adva'] = true;
## AFI / SAFI pairs for BGP (and other stuff, perhaps)
$config['afi']['ipv4']['unicast'] = "IPv4";
@ -49,6 +51,7 @@ $os_text['junos'] = "Juniper JunOS";
$os_text['procurve'] = "HP ProCurve";
$os_text['speedtouch'] = "Thomson Speedtouch";
$os_text['dell-laser'] = "Dell Laser Printer";
$os_text['adva'] = "Adva";
if(!$config['graph_colours']['greens']) {
$config['graph_colours']['greens'] = array('B6D14B','91B13C','6D912D','48721E','24520F','003300');