mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Fix regression on HW discovery for Cisco Catalyst chassis (#10877)
* Catalyst fix for HW * Try to avoid issue with stacks, chassis or standalone boxes * formatCiscoHardware iosxe for humans * codeclimate
This commit is contained in:
@ -193,6 +193,18 @@ class Rewrite
|
||||
}
|
||||
}
|
||||
|
||||
if ($device['os'] == "iosxe") {
|
||||
if ($device['hardware']) {
|
||||
if (preg_match('/CAT9K/', $device['sysDescr'], $matches) && preg_match("/^C(9[A-Za-z0-9]+)/", $device['hardware'], $matches2)) {
|
||||
if (!$short) {
|
||||
$device['hardware'] = "Catalyst " . $matches2[1] . " (" . $device['hardware'] . ")";
|
||||
} else {
|
||||
$device['hardware'] = "Catalyst " . $matches2[1];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $device['hardware'];
|
||||
}
|
||||
|
||||
|
@ -26,7 +26,7 @@ echo '<script src="js/L.Control.Locate.min.js"></script>';
|
||||
$uptime = (Time::formatInterval($device['status'] ? $device['uptime'] : time() - strtotime($device['last_polled'])));
|
||||
$uptime_text = ($device['status'] ? 'Uptime' : 'Downtime');
|
||||
|
||||
if ($device['os'] == 'ios') {
|
||||
if ($device['os'] == 'ios' || $device['os'] == 'iosxe') {
|
||||
formatCiscoHardware($device);
|
||||
}
|
||||
|
||||
|
@ -28,23 +28,21 @@ if ($data[1]['entPhysicalContainedIn'] == '0') {
|
||||
if (!empty($data[1]['entPhysicalSoftwareRev'])) {
|
||||
$version = $data[1]['entPhysicalSoftwareRev'];
|
||||
}
|
||||
|
||||
if (!empty($data[1]['entPhysicalName'])) {
|
||||
$hardware = $data[1]['entPhysicalName'];
|
||||
}
|
||||
|
||||
if (!empty($data[1]['entPhysicalModelName'])) {
|
||||
$hardware = $data[1]['entPhysicalModelName'];
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($data[1000]['entPhysicalModelName'])) {
|
||||
if (empty($hardware) && !empty($data[1000]['entPhysicalModelName'])) {
|
||||
$hardware = $data[1000]['entPhysicalModelName'];
|
||||
} elseif (!empty($data[1000]['entPhysicalContainedIn'])) {
|
||||
} elseif (empty($hardware) && !empty($data[1000]['entPhysicalContainedIn'])) {
|
||||
$hardware = $data[$data[1000]['entPhysicalContainedIn']]['entPhysicalName'];
|
||||
} elseif (!empty($data[1001]['entPhysicalModelName'])) {
|
||||
} elseif ((preg_match('/stack/i', $hardware) || empty($hardware)) && !empty($data[1001]['entPhysicalModelName'])) {
|
||||
$hardware = $data[1001]['entPhysicalModelName'];
|
||||
} elseif (!empty($data[1001]['entPhysicalContainedIn'])) {
|
||||
} elseif (empty($hardware) && !empty($data[1001]['entPhysicalContainedIn'])) {
|
||||
$hardware = $data[$data[1001]['entPhysicalContainedIn']]['entPhysicalName'];
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user