refactor: move some os from linux and freebsd discovery files to yaml (#5429)

This commit is contained in:
Tony Murray
2017-01-14 08:54:16 -06:00
committed by Neil Lathwood
parent 34084af803
commit 0ab2f18f7d
20 changed files with 63 additions and 67 deletions

View File

@@ -1,16 +0,0 @@
<?php
/*
* LibreNMS
*
* 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. Please see LICENSE.txt at the top level of
* the source code distribution for details.
*/
if (starts_with($sysDescr, array('Cambium PTP 50650', 'PTP250', 'Cambium'))) {
$os = 'cambium';
} elseif (starts_with($sysObjectId, '.1.3.6.1.4.1.17713.21')) {
$os = 'cambium';
}

View File

@@ -1,9 +0,0 @@
<?php
if (str_contains($sysDescr, 'Cisco Small Business WAP')) {
$os = 'ciscowap';
}
if (starts_with($sysObjectId, '.1.3.6.1.4.1.9.6.1.32.321.1')) {
$os = 'ciscowap';
}

View File

@@ -1,12 +1,6 @@
<?php
// FreeBSD variants, check for specialized distros first
if (str_contains($sysDescr, 'pfSense')) {
$os = 'pfsense';
} elseif (str_contains($sysDescr, 'Voswall')) {
$os = 'voswall';
} elseif (str_contains($sysDescr, 'm0n0wall')) {
$os = 'monowall';
} elseif (str_contains($sysDescr, 'FreeBSD')) {
// do not move to yaml, this check needs to happen last
if (starts_with($sysDescr, 'FreeBSD')) {
$os = 'freebsd';
}

View File

@@ -5,16 +5,8 @@ if (starts_with($sysDescr, 'Linux')) {
$os = 'linux';
// Specific Linux-derivatives
if (starts_with($sysObjectId, array('.1.3.6.1.4.1.5528.100.20.10.2014', '.1.3.6.1.4.1.5528.100.20.10.2016'))) {
$os = 'netbotz';
} elseif (str_contains($sysDescr, 'endian')) {
$os = 'endian';
} elseif (str_contains($sysDescr, 'Cisco Small Business')) {
$os = 'ciscosmblinux';
} elseif (str_contains(snmp_get($device, 'ENTITY-MIB::entPhysicalMfgName.1', '-Osqnv'), 'QNAP')) {
if (str_contains(snmp_get($device, 'ENTITY-MIB::entPhysicalMfgName.1', '-Osqnv'), 'QNAP')) {
$os = 'qnap';
} elseif (starts_with($sysObjectId, '.1.3.6.1.4.1.15397.2')) {
$os = 'procera';
} elseif (starts_with($sysObjectId, array('.1.3.6.1.4.1.10002.1', '.1.3.6.1.4.1.41112.1.4')) || str_contains(snmp_get($device, 'dot11manufacturerName.5', '-Osqnv', 'IEEE802dot11-MIB'), 'Ubiquiti')) {
$os = 'airos';
if (str_contains(snmp_walk($device, 'dot11manufacturerProductName', '-Osqnv', 'IEEE802dot11-MIB'), 'UAP')) {
@@ -24,14 +16,10 @@ if (starts_with($sysDescr, 'Linux')) {
}
} elseif (snmp_get($device, 'GANDI-MIB::rxCounter.0', '-Osqnv', 'GANDI-MIB') !== false) {
$os = 'pktj';
} elseif (starts_with($sysObjectId, '.1.3.6.1.4.1.40310')) {
$os = 'cumulus';
} elseif (snmp_get($device, 'SFA-INFO::systemName.0', '-Osqnv', 'SFA-INFO') !== false) {
$os = 'ddnos';
} elseif (is_numeric(trim(snmp_get($device, 'roomTemp.0', '-OqvU', 'CAREL-ug40cdz-MIB', 'carel')))) {
$os = 'pcoweb'; // Carel PCOweb
} elseif (starts_with($sysDescr, 'Linux mirthtemplate')) {
$os = 'mirth';
} elseif ($wrt = snmp_get($device, '.1.3.6.1.4.1.2021.7890.1.101.1', '-Osqnv')) {
$wrt = trim($wrt, '"');
if (starts_with($wrt, 'ASUSWRT-Merlin')) {

View File

@@ -1,15 +0,0 @@
<?php
/*
* LibreNMS
*
* Copyright (c) 2016 Neil Lathwood <neil@lathwood.co.uk>
* 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. Please see LICENSE.txt at the top level of
* the source code distribution for details.
*/
if (starts_with($sysObjectId, '.1.3.6.1.4.1.935.10') || starts_with($sysDescr, 'Network Management Card for UPS')) {
$os = 'powerwalker';
}

View File

@@ -1,5 +0,0 @@
<?php
if (str_contains($sysDescr, array('TG585v7', 'SpeedTouch ')) || starts_with($sysDescr, 'ST')) {
$os = 'speedtouch';
}