mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
feature: Added generic hardware rewrite function
This commit is contained in:
@@ -51,9 +51,8 @@ if ($device['os'] == "linux" || $device['os'] == "endian") {
|
||||
if ($agent_data['dmi']['system-product-name']) {
|
||||
$hardware = ($agent_data['dmi']['system-manufacturer'] ? $agent_data['dmi']['system-manufacturer'] . ' ' : '') . $agent_data['dmi']['system-product-name'];
|
||||
|
||||
# Clean up "Dell Computer Corporation" and "Intel Corporation"
|
||||
$hardware = str_replace(" Computer Corporation", "", $hardware);
|
||||
$hardware = str_replace(" Corporation", "", $hardware);
|
||||
# Clean up Generic hardware descriptions
|
||||
$hardware = rewrite_generic_hardware($hardware);
|
||||
}
|
||||
|
||||
if ($agent_data['dmi']['system-serial-number']) {
|
||||
|
@@ -17,6 +17,9 @@ $features = 'build-'.$data[0]['vmwProdBuild'];
|
||||
$hardware = snmp_get($device, 'entPhysicalDescr.1', '-OsvQU', 'ENTITY-MIB');
|
||||
$serial = snmp_get($device, 'entPhysicalSerialNum.1', '-OsvQU', 'ENTITY-MIB');
|
||||
|
||||
# Clean up Generic hardware descriptions
|
||||
$hardware = rewrite_generic_hardware($hardware);
|
||||
|
||||
/*
|
||||
* CONSOLE: Start the VMware discovery process.
|
||||
*/
|
||||
|
@@ -969,6 +969,12 @@ $rewrite_hrDevice = array(
|
||||
' ' => ' ',
|
||||
);
|
||||
|
||||
$rewrite_GenericHW = array(
|
||||
' Computer Corporation' => '',
|
||||
' Corporation' => '',
|
||||
' Inc.' => '',
|
||||
);
|
||||
|
||||
// Specific rewrite functions
|
||||
|
||||
|
||||
@@ -1053,6 +1059,11 @@ function rewrite_junos_hardware($hardware)
|
||||
return ($hardware);
|
||||
}
|
||||
|
||||
function rewrite_generic_hardware($hardware)
|
||||
{
|
||||
global $rewrite_GenericHW;
|
||||
return array_str_replace($rewrite_GenericHW, $hardware);
|
||||
}
|
||||
|
||||
function fixiftype($type)
|
||||
{
|
||||
|
Reference in New Issue
Block a user