mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
* IFOTEC new product integration * change source code indentation * change source code for code climate checking * change source code for code climate checking * deletion of an unnecessary line * add ifotec.php and test units * forgetting about the previous commit * modifications of test units * add a test units * optimization and add test units * change SMNP mode request * source code cleanup and and file for test units * update .snmprec file * update json test file * update json test file * IFOTEC mib integration * add IFOTEC mib files * IFOTEC mib integration for sensors * cancel $oid2 unset * delete useless line
58 lines
2.0 KiB
PHP
58 lines
2.0 KiB
PHP
<?php
|
|
/**
|
|
* ifotec.inc.php
|
|
*
|
|
* LibreNMS os poller module for Ifotec devices
|
|
*
|
|
* This program is free software: you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License as published by
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
* (at your option) any later version.
|
|
*
|
|
* This program is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
|
|
* GNU General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
*
|
|
* @package LibreNMS
|
|
* @link http://librenms.org
|
|
* @copyright LibreNMS contributors
|
|
* @author Cedric MARMONIER
|
|
*/
|
|
|
|
namespace LibreNMS\OS;
|
|
|
|
use Illuminate\Support\Str;
|
|
use LibreNMS\Interfaces\Discovery\OSDiscovery;
|
|
use LibreNMS\OS;
|
|
|
|
class Ifotec extends OS implements OSDiscovery
|
|
{
|
|
public function discoverOS(): void
|
|
{
|
|
$device = $this->getDeviceModel();
|
|
|
|
if (Str::startsWith($device->sysObjectID, '.1.3.6.1.4.1.21362.100.')) {
|
|
$ifoSysProductIndex = snmp_get($this->getDevice(), 'ifoSysProductIndex.0', '-Oqv', 'IFOTEC-SMI');
|
|
|
|
if ($ifoSysProductIndex !== null) {
|
|
$oids = [
|
|
'ifoSysSerialNumber.' . $ifoSysProductIndex,
|
|
'ifoSysFirmware.' . $ifoSysProductIndex,
|
|
'ifoSysBootloader.' . $ifoSysProductIndex
|
|
];
|
|
$data = snmp_get_multi($this->getDevice(), $oids, ['-OQUs'], 'IFOTEC-SMI');
|
|
|
|
$device->version = $data[1]['ifoSysFirmware'] . " (Bootloader " . $data[1]['ifoSysBootloader'] . ")";
|
|
$device->serial = $data[1]['ifoSysSerialNumber'];
|
|
}
|
|
}
|
|
|
|
// sysDecr struct = (<product_reference> . ' : ' . <product_description>) OR (<product_reference>)
|
|
list($device->hardware) = explode(' : ', $device->sysDescr, 2);
|
|
}
|
|
}
|