1 | <?php |
||
2 | /** |
||
3 | * ifotec.inc.php |
||
4 | * |
||
5 | * LibreNMS os poller module for Ifotec devices |
||
6 | * |
||
7 | * This program is free software: you can redistribute it and/or modify |
||
8 | * it under the terms of the GNU General Public License as published by |
||
9 | * the Free Software Foundation, either version 3 of the License, or |
||
10 | * (at your option) any later version. |
||
11 | * |
||
12 | * This program is distributed in the hope that it will be useful, |
||
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
||
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the |
||
15 | * GNU General Public License for more details. |
||
16 | * |
||
17 | * You should have received a copy of the GNU General Public License |
||
18 | * along with this program. If not, see <https://www.gnu.org/licenses/>. |
||
19 | * |
||
20 | * @link https://www.librenms.org |
||
21 | * |
||
22 | * @copyright LibreNMS contributors |
||
23 | * @author Cedric MARMONIER |
||
24 | */ |
||
25 | |||
26 | namespace LibreNMS\OS; |
||
27 | |||
28 | use App\Models\Device; |
||
29 | use Illuminate\Support\Str; |
||
30 | use LibreNMS\Interfaces\Discovery\OSDiscovery; |
||
31 | use LibreNMS\OS; |
||
32 | |||
33 | class Ifotec extends OS implements OSDiscovery |
||
34 | { |
||
35 | public function discoverOS(Device $device): void |
||
36 | { |
||
37 | if (Str::startsWith($device->sysObjectID, '.1.3.6.1.4.1.21362.100.')) { |
||
38 | $ifoSysProductIndex = snmp_get($this->getDeviceArray(), 'ifoSysProductIndex.0', '-Oqv', 'IFOTEC-SMI'); |
||
39 | |||
40 | if ($ifoSysProductIndex !== null) { |
||
41 | $oids = [ |
||
42 | 'ifoSysSerialNumber.' . $ifoSysProductIndex, |
||
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||
43 | 'ifoSysFirmware.' . $ifoSysProductIndex, |
||
44 | 'ifoSysBootloader.' . $ifoSysProductIndex, |
||
45 | ]; |
||
46 | $data = snmp_get_multi($this->getDeviceArray(), $oids, ['-OQUs'], 'IFOTEC-SMI'); |
||
47 | |||
48 | $device->version = $data[1]['ifoSysFirmware'] . ' (Bootloader ' . $data[1]['ifoSysBootloader'] . ')'; |
||
49 | $device->serial = $data[1]['ifoSysSerialNumber']; |
||
50 | } |
||
51 | } |
||
52 | |||
53 | // sysDecr struct = (<product_reference> . ' : ' . <product_description>) OR (<product_reference>) |
||
54 | [$device->hardware] = explode(' : ', $device->sysDescr, 2); |
||
55 | } |
||
56 | } |
||
57 |