. * * @link https://www.librenms.org * * @copyright 2022 Nick Peelman * @author Nick Peelman */ namespace LibreNMS\OS; use App\Models\Device; use LibreNMS\Interfaces\Discovery\OSDiscovery; use LibreNMS\OS; class Axos extends OS implements OSDiscovery { public function discoverOS(Device $device): void { parent::discoverOS($device); $cards = explode("\n", snmp_walk($this->getDeviceArray(), 'axosCardActualType', '-OQv', 'Axos-Card-MIB')); $card_count = []; foreach ($cards as $card) { $card_count[$card] = ($card_count[$card] ?? 0) + 1; } $device->features = implode(', ', array_map(function ($card) use ($card_count) { return ($card_count[$card] > 1 ? $card_count[$card] . 'x ' : '') . $card; }, array_keys($card_count))); } }