commit version 22.12.12447

This commit is contained in:
2023-01-01 22:36:12 -05:00
parent af1b03d79f
commit b948283a96
744 changed files with 620715 additions and 27381 deletions

View File

@ -6,7 +6,7 @@
*
* @package observium
* @subpackage discovery
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2021 Observium Limited
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2022 Observium Limited
*
*/
@ -51,26 +51,35 @@ if (is_device_mib($device, 'ELTEX-MES-PHYSICAL-DESCRIPTION-MIB')) {
$vendor_oids = snmpwalk_cache_oid($device, "swL2PortSfpInfoTable", $vendor_oids, $vendor_mib, NULL, $snmp_flags);
//print_vars($entity_array);
//print_debug_vars($vendor_oids);
} elseif (is_device_mib($device, 'DGS-3420-28SC-L2MGMT-MIB')) {
$vendor_mib = 'DGS-3420-28SC-L2MGMT-MIB';
$vendor_oids = snmpwalk_cache_oid($device, "swL2PortSfpInfoTable", $vendor_oids, $vendor_mib, NULL, $snmp_flags);
//print_vars($entity_array);
//print_debug_vars($vendor_oids);
} elseif (is_device_mib($device, 'DGS-3420-26SC-L2MGMT-MIB')) {
$vendor_mib = 'DGS-3420-26SC-L2MGMT-MIB';
$vendor_oids = snmpwalk_cache_oid($device, "swL2PortSfpInfoTable", $vendor_oids, $vendor_mib, NULL, $snmp_flags);
//print_vars($entity_array);
//print_debug_vars($vendor_oids);
} elseif (is_device_mib($device, 'DGS-3620-28SC-L2MGMT-MIB')) {
$vendor_mib = 'DGS-3620-28SC-L2MGMT-MIB';
$vendor_oids = snmpwalk_cache_oid($device, "swL2PortSfpInfoTable", $vendor_oids, $vendor_mib, NULL, $snmp_flags);
//print_vars($entity_array);
//print_debug_vars($vendor_oids);
} elseif (is_device_mib($device, 'DGS-3620-26SC-L2MGMT-MIB')) {
$vendor_mib = 'DGS-3620-26SC-L2MGMT-MIB';
$vendor_oids = snmpwalk_cache_oid($device, "swL2PortSfpInfoTable", $vendor_oids, $vendor_mib, NULL, $snmp_flags);
//print_vars($entity_array);
//print_debug_vars($vendor_oids);
} elseif (is_device_mib($device, 'DGS-3420-28SC-L2MGMT-MIB')) {
$vendor_mib = 'DGS-3420-28SC-L2MGMT-MIB';
$vendor_oids = snmpwalk_cache_oid($device, "swL2PortSfpInfoTable", $vendor_oids, $vendor_mib, NULL, $snmp_flags);
//print_vars($entity_array);
//print_debug_vars($vendor_oids);
} elseif (is_device_mib($device, 'DGS-3420-26SC-L2MGMT-MIB')) {
$vendor_mib = 'DGS-3420-26SC-L2MGMT-MIB';
$vendor_oids = snmpwalk_cache_oid($device, "swL2PortSfpInfoTable", $vendor_oids, $vendor_mib, NULL, $snmp_flags);
//print_vars($entity_array);
//print_debug_vars($vendor_oids);
} elseif (is_device_mib($device, 'DGS-3620-28SC-L2MGMT-MIB')) {
$vendor_mib = 'DGS-3620-28SC-L2MGMT-MIB';
$vendor_oids = snmpwalk_cache_oid($device, "swL2PortSfpInfoTable", $vendor_oids, $vendor_mib, NULL, $snmp_flags);
//print_vars($entity_array);
//print_debug_vars($vendor_oids);
} elseif (is_device_mib($device, 'DGS-3620-26SC-L2MGMT-MIB')) {
$vendor_mib = 'DGS-3620-26SC-L2MGMT-MIB';
$vendor_oids = snmpwalk_cache_oid($device, "swL2PortSfpInfoTable", $vendor_oids, $vendor_mib, NULL, $snmp_flags);
//print_vars($entity_array);
//print_debug_vars($vendor_oids);
} elseif (is_device_mib($device, 'HUAWEI-ENTITY-EXTENT-MIB') &&
$vendor_oids = snmpwalk_cache_oid($device, "hwEntityOpticalVendorSn", $vendor_oids, 'HUAWEI-ENTITY-EXTENT-MIB', NULL, $snmp_flags)) {
$vendor_mib = 'HUAWEI-ENTITY-EXTENT-MIB';
$vendor_oids = snmpwalk_cache_oid($device, "hwEntityOpticalType", $vendor_oids, $vendor_mib, NULL, $snmp_flags);
$vendor_oids = snmpwalk_cache_oid($device, "hwEntityOpticalVenderName", $vendor_oids, $vendor_mib, NULL, $snmp_flags);
$vendor_oids = snmpwalk_cache_oid($device, "hwEntityOpticalVenderPn", $vendor_oids, $vendor_mib, NULL, $snmp_flags);
$vendor_oids = snmpwalk_cache_oid($device, "hwEntityOpticalTransType", $vendor_oids, $vendor_mib, NULL, $snmp_flags);
//print_vars($entity_array);
//print_debug_vars($vendor_oids);
}
foreach ($entity_array as $entPhysicalIndex => $entry) {
@ -198,6 +207,27 @@ foreach ($entity_array as $entPhysicalIndex => $entry) {
$entry['entPhysicalSerialNum'] = trim($vendor_oids[$entry['entPhysicalParentRelPos']]['swL2PortSfpInfoVendorSN']);
$entry['entPhysicalMfgName'] = trim($vendor_oids[$entry['entPhysicalParentRelPos']]['swL2PortSfpInfoVendorName']);
$entry['entPhysicalModelName'] = trim($vendor_oids[$entry['entPhysicalParentRelPos']]['swL2PortSfpInfoFiberType']);
} elseif ($vendor_mib === 'HUAWEI-ENTITY-EXTENT-MIB' && isset($vendor_oids[$entPhysicalIndex]) &&
$vendor_oids[$entPhysicalIndex]['hwEntityOpticalType'] !== 'unknown') {
//$entry = array_merge($entry, $vendor_oids[$entry['ifIndex']]);
print_debug_vars($vendor_oids[$entPhysicalIndex]);
// entPhysicalVendorType -> hwEntityOpticalType
// entPhysicalHardwareRev -> ??
// entPhysicalFirmwareRev -> ??
// entPhysicalSoftwareRev -> ??
// entPhysicalSerialNum -> hwEntityOpticalVendorSn
// entPhysicalMfgName -> hwEntityOpticalVenderName
// entPhysicalModelName -> hwEntityOpticalVenderPn
// entPhysicalAlias -> hwEntityOpticalTransType
// entPhysicalAssetID -> ??
$entry['entPhysicalVendorType'] = trim($vendor_oids[$entPhysicalIndex]['hwEntityOpticalType']);
//$entry['entPhysicalHardwareRev'] = trim($vendor_oids[$entPhysicalIndex]['']);
//$entry['entPhysicalFirmwareRev'] = trim($vendor_oids[$entPhysicalIndex]['']);
$entry['entPhysicalSerialNum'] = trim($vendor_oids[$entPhysicalIndex]['hwEntityOpticalVendorSn']);
$entry['entPhysicalMfgName'] = trim($vendor_oids[$entPhysicalIndex]['hwEntityOpticalVenderName']);
$entry['entPhysicalModelName'] = trim($vendor_oids[$entPhysicalIndex]['hwEntityOpticalVenderPn']);
$entry['entPhysicalAlias'] = trim($vendor_oids[$entPhysicalIndex]['hwEntityOpticalTransType']);
}
if ($entry['entPhysicalDescr'] || $entry['entPhysicalName']) {

View File

@ -33,21 +33,23 @@ if (is_array($hrDevices)) {
print_debug_vars($hrDevice, 1);
continue;
}
if (!is_numeric($hrDevice['hrDeviceErrors'])) {
$hrDevice['hrDeviceErrors'] = 0;
}
//if (dbFetchCell("SELECT COUNT(*) FROM `hrDevice` WHERE device_id = ? AND hrDeviceIndex = ?",array($device['device_id'], $hrDevice['hrDeviceIndex'])))
if (dbExist('hrDevice', '`device_id` = ? AND `hrDeviceIndex` = ?', array($device['device_id'], $hrDevice['hrDeviceIndex'])))
{
if (($hrDevice['hrDeviceType'] === "hrDeviceProcessor") && empty($hrDevice['hrDeviceDescr']))
{
if (dbExist('hrDevice', '`device_id` = ? AND `hrDeviceIndex` = ?', array($device['device_id'], $hrDevice['hrDeviceIndex']))) {
if (($hrDevice['hrDeviceType'] === "hrDeviceProcessor") && empty($hrDevice['hrDeviceDescr'])) {
$hrDevice['hrDeviceDescr'] = "Processor";
}
$update_array = array('hrDeviceType' => $hrDevice['hrDeviceType'],
'hrDeviceDescr' => $hrDevice['hrDeviceDescr'],
'hrDeviceStatus' => $hrDevice['hrDeviceStatus'],
'hrDeviceErrors' => $hrDevice['hrDeviceErrors']);
$update_array = [
'hrDeviceType' => $hrDevice['hrDeviceType'],
'hrDeviceDescr' => $hrDevice['hrDeviceDescr'],
'hrDeviceStatus' => $hrDevice['hrDeviceStatus'],
'hrDeviceErrors' => $hrDevice['hrDeviceErrors']
];
if ($hrDevice['hrDeviceType'] === "hrDeviceProcessor")
{
if ($hrDevice['hrDeviceType'] === "hrDeviceProcessor") {
$update_array['hrProcessorLoad'] = $hrDevice['hrProcessorLoad'];
} else {
$update_array['hrProcessorLoad'] = array('NULL');