$entry) { [$hw_class, $hw_item, $hw_index] = explode('.', $named_index, 3); // Convert to numeric index $index = '.' . snmp_string_to_oid($hw_item) . '.' . $hw_index; // SYNTAX INTEGER {temperatureSensors(0),fans(1),pEM(2),pIM(3),uSB(4),lED(5),nIM(6)} switch ($hw_class) { case 'temperatureSensors': $index = '0' . $index; $descr = $hw_item; if ($descr === 'Board') { $descr .= ' ' . $hw_index; } $oid_name = 'hardwareEnvironmentMeasurement'; $oid_num = '.1.3.6.1.4.1.41916.3.1.2.1.5.' . $index; $scale = 1; $value = $entry[$oid_name]; // Detect limits $hw_index = strtolower(str_replace(' ', '-', $hw_item)) . '.' . $hw_index; $limits = []; foreach ($oids_limits as $limit_index => $limit_entry) { $limit_index = strtolower($limit_index); if ($hw_index == $limit_index) { $limits['limit_high'] = $limit_entry['hardwareTemperatureThresholdsRedAlarmNormal']; $limits['limit_high_warn'] = $limit_entry['hardwareTemperatureThresholdsYellowAlarmNormal']; break; } } discover_sensor_ng($device, 'temperature', $mib, $oid_name, $oid_num, $index, $descr, $scale, $value, $limits); break; case 'fans': $index = '1' . $index; $descr = $hw_item . ' ' . $hw_index; $oid_name = 'hardwareEnvironmentMeasurement'; $oid_num = '.1.3.6.1.4.1.41916.3.1.2.1.5.' . $index; $scale = 1; $value = $entry[$oid_name]; discover_sensor_ng($device, 'fanspeed', $mib, $oid_name, $oid_num, $index, $descr, $scale, $value); break; case 'pEM': $index = '2' . $index; $descr = $hw_item . ' ' . $hw_index; $oid_name = 'hardwareEnvironmentStatus'; $oid_num = '.1.3.6.1.4.1.41916.3.1.2.1.4.' . $index; $type = 'hardwareEnvironmentStatus'; $value = $entry[$oid_name]; discover_status_ng($device, $mib, $oid_name, $oid_num, $index, $type, $descr, $value, ['entPhysicalClass' => 'powerSupply']); break; case 'pIM': $index = '3' . $index; $descr = $hw_item; $oid_name = 'hardwareEnvironmentStatus'; $oid_num = '.1.3.6.1.4.1.41916.3.1.2.1.4.' . $index; $type = 'hardwareEnvironmentStatus'; $value = $entry[$oid_name]; discover_status_ng($device, $mib, $oid_name, $oid_num, $index, $type, $descr, $value, ['entPhysicalClass' => 'other']); break; case 'uSB': $index = '4' . $index; break; case 'lED': $index = '5' . $index; $descr = $hw_item; $oid_name = 'hardwareEnvironmentStatus'; $oid_num = '.1.3.6.1.4.1.41916.3.1.2.1.4.' . $index; $type = 'hardwareEnvironmentStatus'; $value = $entry[$oid_name]; discover_status_ng($device, $mib, $oid_name, $oid_num, $index, $type, $descr, $value, ['entPhysicalClass' => 'device']); break; case 'nIM': $index = '6' . $index; break; } } unset($oids, $oids_limits, $index); // EOF