feature: Added generic hardware rewrite function

This commit is contained in:
rockyluke
2017-01-31 09:09:56 +01:00
committed by Neil Lathwood
parent 4390347508
commit e90875bee1
3 changed files with 16 additions and 3 deletions

View File

@@ -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']) {

View File

@@ -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.
*/

View File

@@ -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)
{