mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
- Added a utility function formatCiscoHardware()
Params: - A reference to the $device array. - An optional (true) if you want the platform only (and not the part number) - In device overview place Hardware before Operating System (makes more sence) - Added virtual $device['hardware'] for Cisco platforms without an hardware tag (like Cisco 3750) git-svn-id: http://www.observium.org/svn/observer/trunk@925 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
@@ -835,5 +835,25 @@ function notify($device,$title,$message)
|
||||
if ($device['sysContact']) { $email = $device['sysContact']; } else { $email = $config['email_default']; }
|
||||
mail($email, $title, $message, $config['email_headers']);
|
||||
}
|
||||
|
||||
|
||||
|
||||
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 (!$short) {
|
||||
$device['hardware'] = "Cisco " . $matches[1] . " (" . $device['hardware'] . ")";
|
||||
} else {
|
||||
$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];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
Reference in New Issue
Block a user