refactor: move more discovery into yaml files including compound discovery and regex

This commit is contained in:
Tony Murray
2017-01-07 08:37:59 -06:00
committed by Neil Lathwood
parent d6e260fde6
commit 8936d9503b
63 changed files with 115 additions and 338 deletions

View File

@@ -1,5 +0,0 @@
<?php
if (starts_with($sysObjectId, '.1.3.6.1.4.1.8072.3.2.10') && str_contains($sysDescr, 'Acano')) {
$os = 'acano';
}

View File

@@ -1,7 +0,0 @@
<?php
if (str_contains($sysDescr, array('Application Control Engine', 'Cisco Application Control Software'))) {
$os = 'acsw';
} elseif (starts_with($sysObjectId, '.1.3.6.1.4.1.9.1.1291')) {
$os = 'acsw';
}

View File

@@ -1,18 +0,0 @@
<?php
/*
* LibreNMS ADTRAN AOS OS Discovery module
*
* Copyright (c) 2016 Chris A. Evans <thecityofguanyu@outlook.com>
*
* 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 (str_contains($sysDescr, 'NetVanta')) {
$os = 'adtran-aos';
} elseif (starts_with($sysObjectId, '.1.3.6.1.4.1.664')) {
$os = 'adtran-aos';
}

View File

@@ -1,5 +0,0 @@
<?php
if (preg_match('/AXIS .* (Network Camera|Video Server|Network Video Encoder)/', $sysDescr)) {
$os = 'axiscam';
}

View File

@@ -1,5 +0,0 @@
<?php
if (preg_match('/^AXIS .* Network Document Server/', $sysDescr)) {
$os = 'axisdocserver';
}

View File

@@ -1,15 +0,0 @@
<?php
/*
* LibreNMS Barracuda OS information module
*
* Copyright (c) 2015 Søren Friis Rosiak <sorenrosiak@gmail.com>
* 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 (str_contains($sysDescr, array('Barracuda Load Balancer', 'Barracuda Load Balancer ADC'), true)) {
$os = 'barracudaloadbalancer';
}

View File

@@ -1,5 +0,0 @@
<?php
if (preg_match('/Brother NC-.*(h|w),/', $sysDescr)) {
$os = 'brother';
}

View File

@@ -1,15 +0,0 @@
<?php
/*
* LibreNMS Cisco wireless controller OS detection module
*
* Copyright (c) 2016 Tuomas Riihimäki <tuomari@iudex.fi>
* 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 (str_contains($sysDescr, 'Cisco Controller')) {
$os = 'ciscowlc';
}

View File

@@ -1,9 +0,0 @@
<?php
if (str_contains($sysDescr, 'Comware')) {
$os = 'comware';
} elseif (preg_match('/HP [a-zA-Z0-9- ]+ Switch Software Version/', $sysDescr)) {
$os = 'comware';
} elseif (starts_with($sysObjectId, '.1.3.6.1.4.1.25506.11.1')) {
$os = 'comware';
}

View File

@@ -1,15 +0,0 @@
<?php
/*
* LibreNMS
*
* Copyright (c) 2016 Søren Friis Rosiak <sorenrosiak@gmail.com>
* 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 (str_contains($sysDescr, 'Deliberant')) {
$os = 'deliberant';
}

View File

@@ -1,7 +0,0 @@
<?php
if (str_contains($sysDescr, array('Dell Color Laser', 'Dell Laser Printer'))) {
$os = 'dell-laser';
} elseif (preg_match('/^Dell.*MFP/', $sysDescr)) {
$os = 'dell-laser';
}

View File

@@ -1,28 +0,0 @@
<?php
/**
* dell-rcs.inc.php
*
* LibreNMS os discovery module for Dell Remote Console
*
* 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 2016 Neil Lathwood
* @author Neil Lathwood <neil@lathwood.co.uk>
*/
if (starts_with($sysObjectId, '.1.3.6.1.4.1.10418.18.21.17')) {
$os = 'dell-rcs';
}

View File

@@ -1,7 +0,0 @@
<?php
if (preg_match('/D-Link .* AP/', $sysDescr)) {
$os = 'dlinkap';
} elseif (str_contains($sysDescr, array('D-Link DAP-', 'D-Link Access Point'))) {
$os = 'dlinkap';
}

View File

@@ -1,8 +0,0 @@
<?php
// DRAC5, iDRAC6 - 1.3.6.1.4.1.674.10892.2
// iDRAC7, iDRAC8 - 1.3.6.1.4.1.674.10892.5
if (str_contains($sysDescr, 'Dell Out-of-band SNMP Agent for Remote Access Controller') ||
starts_with($sysObjectId, array('.1.3.6.1.4.1.674.10892.2', '.1.3.6.1.4.1.674.10892.5'))) {
$os = 'drac';
}

View File

@@ -1,15 +0,0 @@
<?php
/*
* LibreNMS
*
* Copyright (c) 2016 Søren Friis Rosiak <sorenrosiak@gmail.com>
* 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.534.6.6.7')) {
$os = 'eatonpdu';
}

View File

@@ -1,5 +0,0 @@
<?php
// Eaton UPS
if (starts_with($sysDescr, 'Eaton 5P') || starts_with($sysObjectId, '.1.3.6.1.4.1.534.')) {
$os = 'eatonups';
}

View File

@@ -1,7 +0,0 @@
<?php
if (starts_with($sysDescr, 'Enterasys Networks')) {
$os = 'enterasys';
} elseif (starts_with($sysObjectId, '.1.3.6.1.4.1.5624.2.1')) {
$os = 'enterasys';
}

View File

@@ -1,10 +0,0 @@
<?php
/**
* Supported Devides List
* OLT AN5516-06
* OLT AN5516-01
*/
if (preg_match('/^AN5516-0[16]$/', $sysDescr)) {
$os = "fiberhome";
}

View File

@@ -1,5 +0,0 @@
<?php
if (str_contains($sysDescr, array('CS121', 'CS141')) && str_contains($sysObjectId, '.1.3.6.1.2.1.33')) {
$os = 'generex-ups';
}

View File

@@ -1,19 +0,0 @@
<?php
/*
* LibreNMS
*
* Copyright (c) 2015 Søren Friis Rosiak <sorenrosiak@gmail.com>
* 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.8744.1')) {
$split_oid = explode('.', $sysObjectId);
$model_oid = $split_oid[count($split_oid)-1];
if ($model_oid >= 40 && $model_oid < 60 || $model_oid = 67) {
$os = 'hpmsm';
}
}

View File

@@ -1,5 +0,0 @@
<?php
if (str_contains($sysDescr, 'IronWare')) {
$os = 'ironware';
}

View File

@@ -1,7 +0,0 @@
<?php
if (starts_with($sysObjectId, '.1.3.6.1.4.1.2636')) {
$os = 'junos';
} elseif (str_contains($sysDescr, 'kernel JUNOS', true)) {
$os = 'junos';
}

View File

@@ -1,5 +0,0 @@
<?php
if (starts_with($sysObjectId, '.1.3.6.1.4.1.8239.1.2.9')) {
$os = 'jwos';
}

View File

@@ -1,35 +0,0 @@
<?php
/**
* lcos.inc.php
*
* LibreNMS os discovery module for Lancom
*
* 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 2016 Neil Lathwood
* @author Neil Lathwood <neil@lathwood.co.uk>
*/
$lcos_oids = array(
'.1.3.6.1.4.1.2356.11.8.103',
'.1.3.6.1.4.1.2356.600.6.310',
);
if (starts_with($sysObjectId, $lcos_oids)) {
$os = 'lcos';
}
unset($lcos_oids);

View File

@@ -9,6 +9,7 @@ $skip_oids = array(
'.1.3.6.1.4.1.7779.', // nios
'.1.3.6.1.4.1.9.1.1348', // Cisco Unified Communications Manager
'.1.3.6.1.4.1.3375.2.1', // F5
'.1.3.6.1.4.1.534.', // Eaton
);
if (starts_with($sysDescr, 'Linux') && !starts_with($sysObjectId, $skip_oids)) {

View File

@@ -1,15 +0,0 @@
<?php
/*
* LibreNMS
*
* Copyright (c) 2015 Søren Friis Rosiak <sorenrosiak@gmail.com>
* 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.8072.3.2.16') || str_contains($sysDescr, array('Darwin Kernel Version 15', 'Darwin Kernel Version 16'))) {
$os = 'macosx';
}

View File

@@ -1,7 +0,0 @@
<?php
if (str_contains($sysDescr, 'ProSafe')) {
$os = 'netgear';
} elseif (starts_with($sysObjectId, '.1.3.6.1.4.1.4526')) {
$os = 'netgear';
}

View File

@@ -1,7 +0,0 @@
<?php
if (starts_with($sysDescr, 'NetMan') && str_contains($sysDescr, 'plus')) {
$os = 'netmanplus';
} elseif (starts_with($sysObjectId, '.1.3.6.1.4.1.5491.6')) {
$os = 'netmanplus';
}

View File

@@ -1,13 +0,0 @@
<?php
$nos_objectid = array(
'.1.3.6.1.4.1.1588.2.2.1.1',
);
if (str_contains($sysDescr, array('Brocade VDX', 'BR-VDX', 'VDX67'))) {
$os = 'nos';
} elseif (starts_with($sysObjectId, $nos_objectid)) {
$os = 'nos';
}
unset($nos_objectid);

View File

@@ -1,5 +0,0 @@
<?php
if (starts_with($sysObjectId, '.1.3.6.1.4.1.30155.23.1') || str_contains($sysDescr, 'OpenBSD')) {
$os = 'openbsd';
}

View File

@@ -1,11 +0,0 @@
<?php
if (str_contains($sysDescr, array('ProCurve', 'HP 1820'), true)) {
$os = 'procurve';
} elseif (preg_match('/eCos-[0-9.]+/', $sysDescr)) {
$os = 'procurve';
} elseif (preg_match('/HP(.+)2530(.+)/', $sysDescr)) {
$os = 'procurve';
} elseif (preg_match('/HP(.+)54[0-1][2-6]R(.+)/', $sysDescr)) {
$os = 'procurve';
}

View File

@@ -1,5 +0,0 @@
<?php
if (starts_with($sysObjectId, '.1.3.6.1.4.1.8886')) {
$os = 'raisecom';
}

View File

@@ -1,9 +0,0 @@
<?php
if (starts_with($sysObjectId, '.1.3.6.1.4.1.311.1.1.3')) {
$os = 'windows';
}
if (str_contains($sysDescr, array('Windows'))) {
$os = 'windows';
}