mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
fix: better Cisco hardware formatting (#5184)
This commit is contained in:
committed by
Neil Lathwood
parent
bcae14c7d9
commit
9fef312a20
@@ -759,18 +759,22 @@ function formatCiscoHardware(&$device, $short = false)
|
||||
{
|
||||
if ($device['os'] == "ios") {
|
||||
if ($device['hardware']) {
|
||||
if (preg_match("/^WS-C([A-Za-z0-9]+).*/", $device['hardware'], $matches)) {
|
||||
if (preg_match("/^WS-C([A-Za-z0-9]+)/", $device['hardware'], $matches)) {
|
||||
if (!$short) {
|
||||
$device['hardware'] = "Catalyst " . $matches[1] . " (" . $device['hardware'] . ")";
|
||||
} else {
|
||||
$device['hardware'] = "Catalyst " . $matches[1];
|
||||
}
|
||||
} elseif (preg_match("/^CISCO([0-9]+)(.*)/", $device['hardware'], $matches)) {
|
||||
if (!$short && $matches[2]) {
|
||||
$device['hardware'] = "Cisco " . $matches[1] . " (" . $device['hardware'] . ")";
|
||||
} else {
|
||||
$device['hardware'] = "Cisco " . $matches[1];
|
||||
}
|
||||
} elseif (preg_match("/^CISCO([0-9]+)$/", $device['hardware'], $matches)) {
|
||||
$device['hardware'] = "Cisco " . $matches[1];
|
||||
}
|
||||
} else {
|
||||
if (preg_match("/Cisco IOS Software, C([A-Za-z0-9]+) Software.*/", $device['sysDescr'], $matches)) {
|
||||
$device['hardware'] = "Cisco " . $matches[1];
|
||||
$device['hardware'] = "Catalyst " . $matches[1];
|
||||
} elseif (preg_match("/Cisco IOS Software, ([0-9]+) Software.*/", $device['sysDescr'], $matches)) {
|
||||
$device['hardware'] = "Cisco " . $matches[1];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user