Merge pull request #2558 from vizay/brocade-vdx-support

Added full discovery and polling support for brocade VDX devices.
This commit is contained in:
Neil Lathwood
2015-12-18 15:57:27 +00:00
9 changed files with 55 additions and 9 deletions

View File

@@ -38,9 +38,18 @@ else {
echo "<tr style=\"background-color: $row_colour;\" valign=top onmouseover=\"this.style.backgroundColor='$list_highlight';\" onmouseout=\"this.style.backgroundColor='$row_colour';\" style='cursor: pointer;'>
<td valign=top width=350 onclick=\"location.href='".generate_port_url($port)."'\">";
echo ' <span class=list-large>
// Don't echo out ports ifIndex if it's a NOS device since their ifIndex is, for lack of better words....different
if ($device['os'] == 'nos') {
echo ' <span class=list-large>
'.generate_port_link($port, $port['label'])." $error_img $mac
</span><br /><span class=interface-desc>".$port['ifAlias'].'</span>';
}
else {
echo ' <span class=list-large>
'.generate_port_link($port, $port['ifIndex'].'. '.$port['label'])." $error_img $mac
</span><br /><span class=interface-desc>".$port['ifAlias'].'</span>';
}
if ($port['ifAlias']) {
echo '<br />';

View File

@@ -453,7 +453,6 @@ $os = 'nos';
$config['os'][$os]['text'] = 'Brocade NOS';
$config['os'][$os]['type'] = 'network';
$config['os'][$os]['ifname'] = 1;
$config['os'][$os]['descr_to_alias'] = 1;
$config['os'][$os]['over'][0]['graph'] = 'device_bits';
$config['os'][$os]['over'][0]['text'] = 'Device Traffic';
$config['os'][$os]['over'][1]['graph'] = 'device_processor';

View File

@@ -0,0 +1,15 @@
<?php
if ($device['os'] == "nos") {
echo("nos: ");
$used = snmp_get($device, "1.3.6.1.4.1.1588.2.1.1.1.26.6.0", "-Ovq");
$total = "100";
$free = ($total - $used);
$percent = $used;
if (is_numeric($used)) {
discover_mempool($valid_mempool, $device, 0, "nos", "Memory", "1", NULL, NULL);
}
}

View File

@@ -1,7 +1,7 @@
<?php
if (!$os) {
if (strstr($sysObjectId, '.1.3.6.1.4.1.1588.2.2.1.1.1.5') || stristr($sysDescr, 'Brocade Communications Systems')) {
$os = 'nos';
if (strstr($sysDescr, "Brocade VDX") || strstr($sysObjectId, '.1.3.6.1.4.1.1588.2.2.1.1.1.5') || stristr($sysDescr, 'Brocade Communications Systems')) {
$os = "nos";
}
}

View File

@@ -0,0 +1,14 @@
<?php
if ($device['os'] == "nos") {
echo("nos : ");
$descr = "CPU";
$usage = snmp_get($device, "1.3.6.1.4.1.1588.2.1.1.1.26.1.0", "-Ovq");
if (is_numeric($usage)) {
discover_processor($valid['processor'], $device, "1.3.6.1.4.1.1588.2.1.1.1.26.1", "0", "nos", $descr, "1", $usage, NULL, NULL);
}
}
unset ($processors_array);

View File

@@ -0,0 +1,7 @@
<?php
// Somewhat of an uggly hack since NOS doesn't support fetching total memory of the device over SNMP
// Given OID returns usage in percent so we set total to 100 in order to get a proper graph
$mempool['total'] = "100";
$mempool['used'] = snmp_get($device, "1.3.6.1.4.1.1588.2.1.1.1.26.6.0", "-Ovq");
$mempool['free'] = ($mempool['total'] - $mempool['used']);

View File

@@ -1,6 +1,5 @@
<?php
// SNMPv2-MIB::sysDescr.0 Brocade VDX Switch.
if (preg_match('/Brocade ([\s\d\w]+)/', $poll_device['sysDescr'], $hardware)) {
$hardware = $hardware[1];
}
$version = trim(snmp_get($device, "1.3.6.1.4.1.1588.2.1.1.1.1.6.0", "-Ovq"),'"');
$hardware = trim(snmp_get($device, "ENTITY-MIB::entPhysicalDescr.1", "-Ovq"),'"');
$serial = trim(snmp_get($device, "1.3.6.1.2.1.47.1.1.1.1.11.1", "-Ovq"),'"');

View File

@@ -354,7 +354,7 @@ foreach ($ports as $port) {
echo 'VLAN == '.$this_port['ifVlan'];
// When devices do not provide ifAlias data, populate with ifDescr data if configured
if (($this_port['ifAlias'] == '' || $this_port['ifAlias'] == NULL) || $config['os'][$device['os']]['descr_to_alias'] == 1) {
if ($this_port['ifAlias'] == '' || $this_port['ifAlias'] == NULL) {
$this_port['ifAlias'] = $this_port['ifDescr'];
d_echo('Using ifDescr as ifAlias');
}

View File

@@ -0,0 +1,3 @@
<?php
$proc = trim(snmp_get($device, "1.3.6.1.4.1.1588.2.1.1.1.26.1.0", "-Ovq"),'"');