refactor os discovery s to w

This commit is contained in:
crcro
2016-09-22 02:34:17 +03:00
parent 52d6d0d9df
commit cfeb7258b5
24 changed files with 79 additions and 146 deletions
+2 -4
View File
@@ -1,7 +1,5 @@
<?php
if (!$os) {
if (strstr($sysObjectId, '.1.3.6.1.4.1.7571.100.1.1.5')) {
$os = 'saf';
}
if (str_contains('.1.3.6.1.4.1.7571.100.1.1.5', $sysObjectId)) {
$os = 'saf';
}
+3 -7
View File
@@ -1,9 +1,5 @@
<?php
if (!$os) {
if (strstr($sysDescr, 'Samsung CLX') ||
strstr($sysDescr, 'Samsung SCX') ||
strstr($sysDescr, 'Samsung C') ||
strstr($sysDescr, 'Samsung S')) {
$os = 'samsungprinter';
}
if (str_contains($sysDescr, array('Samsung CLX', 'Samsung SCX', 'Samsung C', 'Samsung S'))) {
$os = 'samsungprinter';
}
+2 -4
View File
@@ -1,7 +1,5 @@
<?php
if (!$os) {
if (strstr($sysDescr, 'SAN-OS')) {
$os = 'sanos';
}
if (str_contains('SAN-OS', $sysDescr)) {
$os = 'sanos';
}
+2 -8
View File
@@ -1,11 +1,5 @@
<?php
if (!$os) {
if (strstr($sysObjectId, '.1.3.6.1.4.1.674.3224.1')) {
$os = 'screenos';
}
if (strstr($sysObjectId, '.1.3.6.1.4.1.3224')) {
$os = 'screenos';
}
if (str_contains($sysObjectId, array('.1.3.6.1.4.1.674.3224.1', '.1.3.6.1.4.1.3224'))) {
$os = 'screenos';
}
+11 -13
View File
@@ -1,18 +1,16 @@
<?php
if (!$os) {
if (preg_match('/^Sentry\ (Switched|Smart) /', $sysDescr)) {
// ServerTech doesn't have a way to distinguish between sentry3 and sentry4 devices
// Hopefully, we can use the version string to figure it out
$version = trim(snmp_get($device, 'Sentry3-MIB::serverTech.4.1.1.1.3.0', '-Osqnv'));
$version = explode(" ", $version);
$version = intval($version[1]);
if (starts_with('Sentry', $sysDescr) && str_contains($sysDescr, array('Switched', 'Smart'))) {
// ServerTech doesn't have a way to distinguish between sentry3 and sentry4 devices
// Hopefully, we can use the version string to figure it out
$version = trim(snmp_get($device, 'Sentry3-MIB::serverTech.4.1.1.1.3.0', '-Osqnv'));
$version = explode(" ", $version);
$version = intval($version[1]);
// It appears that version 8 and up is good for sentry4
if ($version >= 8) {
$os = 'sentry4';
} else {
$os = 'sentry3';
}
// It appears that version 8 and up is good for sentry4
if ($version >= 8) {
$os = 'sentry4';
} else {
$os = 'sentry3';
}
}
+12 -14
View File
@@ -1,18 +1,16 @@
<?php
if (!$os) {
if (preg_match('/ServerIron/', $sysDescr)) {
$os = 'serveriron';
$serviron_mibs = array (
"snL4slbTotalConnections" => "FOUNDRY-SN-SW-L4-SWITCH-GROUP-MIB", // Total connections in this device
"snL4slbLimitExceeds" => "FOUNDRY-SN-SW-L4-SWITCH-GROUP-MIB", // exceeds snL4TCPSynLimit (numbers of connection per second)
"snL4slbForwardTraffic" => "FOUNDRY-SN-SW-L4-SWITCH-GROUP-MIB", // Client->Server
"snL4slbReverseTraffic" => "FOUNDRY-SN-SW-L4-SWITCH-GROUP-MIB", // Server->Client
"snL4slbFinished" => "FOUNDRY-SN-SW-L4-SWITCH-GROUP-MIB", // FIN_or_RST
"snL4FreeSessionCount" => "FOUNDRY-SN-SW-L4-SWITCH-GROUP-MIB", // Maximum sessions - used sessions
"snL4unsuccessfulConn" => "FOUNDRY-SN-SW-L4-SWITCH-GROUP-MIB", // Unsuccessfull connection
);
if (str_contains('ServerIron', $sysDescr)) {
$os = 'serveriron';
$serviron_mibs = array (
"snL4slbTotalConnections" => "FOUNDRY-SN-SW-L4-SWITCH-GROUP-MIB", // Total connections in this device
"snL4slbLimitExceeds" => "FOUNDRY-SN-SW-L4-SWITCH-GROUP-MIB", // exceeds snL4TCPSynLimit (numbers of connection per second)
"snL4slbForwardTraffic" => "FOUNDRY-SN-SW-L4-SWITCH-GROUP-MIB", // Client->Server
"snL4slbReverseTraffic" => "FOUNDRY-SN-SW-L4-SWITCH-GROUP-MIB", // Server->Client
"snL4slbFinished" => "FOUNDRY-SN-SW-L4-SWITCH-GROUP-MIB", // FIN_or_RST
"snL4FreeSessionCount" => "FOUNDRY-SN-SW-L4-SWITCH-GROUP-MIB", // Maximum sessions - used sessions
"snL4unsuccessfulConn" => "FOUNDRY-SN-SW-L4-SWITCH-GROUP-MIB", // Unsuccessfull connection
);
register_mibs($device, $serviron_mibs, "includes/discovery/os/serveriron.inc.php");
}
register_mibs($device, $serviron_mibs, "includes/discovery/os/serveriron.inc.php");
}
+3 -4
View File
@@ -1,6 +1,5 @@
<?php
if (!$os) {
if (strstr($sysDescr, 'SHARP MX-')) {
$os = 'sharp';
}
if (str_contains('SHARP MX-', $sysDescr)) {
$os = 'sharp';
}
+2 -4
View File
@@ -23,8 +23,6 @@
* @author Tony Murray <[email protected]>
*/
if (!$os) {
if (strpos($sysDescr, 'Huawei Integrated Access Software') !== false) {
$os = 'smartax';
}
if (str_contains('Huawei Integrated Access Software', $sysDescr)) {
$os = 'smartax';
}
+12 -15
View File
@@ -1,21 +1,18 @@
<?php
if (!$os) {
if (preg_match('/^SunOS/', $sysDescr)) {
$os = 'solaris';
list(,,$version) = explode(' ', $sysDescr);
if ($version > '5.10') {
if (starts_with('SunOS', $sysDescr)) {
$os = 'solaris';
list(,,$version) = explode(' ', $sysDescr);
if(version_compare($version, '5.10', '>')) {
if (str_contains('oi_', $sysDescr)) {
$os = 'openindiana';
} else {
$os = 'opensolaris';
}
if ($version > '5.10') {
if (preg_match('/oi_/', $sysDescr)) {
$os = 'openindiana';
}
}
}
if (strstr($sysObjectId, '.1.3.6.1.4.1.42.2.1.1')) {
$os = 'solaris';
}
}
if (str_contains('.1.3.6.1.4.1.42.2.1.1', $sysObjectId)) {
$os = 'solaris';
}
+2 -4
View File
@@ -1,7 +1,5 @@
<?php
if (!$os) {
if (strstr($sysDescr, 'SonicWALL')) {
$os = 'sonicwall';
}
if (str_contains('SonicWALL', $sysDescr)) {
$os = 'sonicwall';
}
+2 -4
View File
@@ -10,8 +10,6 @@
* the source code distribution for details.
*/
if (!$os) {
if (strstr($sysObjectId, '.1.3.6.1.4.1.2879.1.1.2')) {
$os = 'sonus-gsx';
}
if (strstr($sysObjectId, '.1.3.6.1.4.1.2879.1.1.2')) {
$os = 'sonus-gsx';
}
+2 -4
View File
@@ -10,8 +10,6 @@
* the source code distribution for details.
*/
if (!$os) {
if (starts_with($sysObjectId, array('.1.3.6.1.4.1.2879.1.9.2','.1.3.6.1.4.1.177.15.1.1.1'))) {
$os = 'sonus-sbc';
}
if (starts_with($sysObjectId, array('.1.3.6.1.4.1.2879.1.9.2', '.1.3.6.1.4.1.177.15.1.1.1'))) {
$os = 'sonus-sbc';
}
+2 -8
View File
@@ -1,11 +1,5 @@
<?php
if (!$os) {
if (strstr($sysDescr, 'TG585v7')) {
$os = 'speedtouch';
} elseif (strstr($sysDescr, 'SpeedTouch ')) {
$os = 'speedtouch';
} elseif (preg_match('/^ST\d/', $sysDescr)) {
$os = 'speedtouch';
}
if (str_contains($sysDescr, array('TG585v7', 'SpeedTouch ')) || starts_with('ST', $sysDescr)) {
$os = 'speedtouch';
}
+2 -4
View File
@@ -3,8 +3,6 @@
* LibreNMS Sub10 OS information module
*/
if (!$os) {
if (strstr($sysObjectId, '.1.3.6.1.4.1.39003')) {
$os = 'sub10';
}
if (str_contains('.1.3.6.1.4.1.39003', $sysObjectId)) {
$os = 'sub10';
}
@@ -1,13 +1,5 @@
<?php
if (!$os) {
if (preg_match('/^Supermicro Switch/', $sysDescr)) {
$os = 'supermicro-switch';
}
if (preg_match('/^SSE-/', $sysDescr)) {
$os = 'supermicro-switch';
}
if (preg_match('/^SBM-/', $sysDescr)) {
$os = 'supermicro-switch';
}
if (starts_with($sysDescr, array('Supermicro Switch', 'SSE-', 'SBM-'))) {
$os = 'supermicro-switch';
}
+2 -4
View File
@@ -1,7 +1,5 @@
<?php
if (!$os) {
if (strstr($sysObjectId, '.1.3.6.1.4.1.388')) {
$os = 'symbol';
}
if (str_contains('.1.3.6.1.4.1.388', $sysObjectId)) {
$os = 'symbol';
}
+2 -4
View File
@@ -1,7 +1,5 @@
<?php
if (!$os) {
if (strstr($sysObjectId, '.1.3.6.1.4.1.5596.180.6.4.1')) {
$os = 'tpconductor';
}
if (str_contains('.1.3.6.1.4.1.5596.180.6.4.1', $sysObjectId)) {
$os = 'tpconductor';
}
+2 -4
View File
@@ -1,7 +1,5 @@
<?php
if (!$os) {
if (strstr($sysObjectId, '.1.3.6.1.4.1.11863.1.1')) {
$os = 'tplink';
}
if (str_contains('.1.3.6.1.4.1.11863.1.1', $sysObjectId)) {
$os = 'tplink';
}
+2 -4
View File
@@ -1,7 +1,5 @@
<?php
if (!$os) {
if (preg_match('/^Tranzeo/', $sysDescr)) {
$os = 'tranzeo';
}
if (starts_with('Tranzeo', $sysDescr)) {
$os = 'tranzeo';
}
+2 -4
View File
@@ -1,7 +1,5 @@
<?php
if (!$os) {
if (strstr($sysObjectId, '.1.3.6.1.4.1.5596.150.6.4.1')) {
$os = 'vccodec';
}
if (str_contains('.1.3.6.1.4.1.5596.150.6.4.1', $sysObjectId)) {
$os = 'vccodec';
}
+2 -4
View File
@@ -1,7 +1,5 @@
<?php
if (!$os) {
if (strstr($sysObjectId, '.1.3.6.1.4.1.5596.130.6.4.1')) {
$os = 'vcs';
}
if (str_contains('.1.3.6.1.4.1.5596.130.6.4.1', $sysObjectId)) {
$os = 'vcs';
}
+2 -4
View File
@@ -1,7 +1,5 @@
<?php
if (!$os) {
if (strstr($sysDescr, 'Viprinet VPN Router')) {
$os = 'viprinux';
}
if (str_contains('Viprinet VPN Router', $sysDescr)) {
$os = 'viprinux';
}
+2 -7
View File
@@ -1,10 +1,5 @@
<?php
if (!$os) {
if (preg_match('/^VMware ESX/', $sysDescr)) {
$os = 'vmware';
}
if (preg_match('/^VMware-vCenter-Server-Appliance/', $sysDescr)) {
$os = 'vmware';
}
if (starts_with($sysDescr, array('VMware ESX', 'VMware-vCenter-Server-Appliance'))) {
$os = 'vmware';
}
+2 -4
View File
@@ -1,7 +1,5 @@
<?php
if (!$os) {
if (stristr($sysDescr, 'VRP (R) Software') || stristr($sysDescr, 'VRP Software Version') || stristr($sysDescr, 'Software Version VRP') || stristr($sysDescr, 'Versatile Routing Platform Software')) {
$os = 'vrp';
}
if (str_contains($sysDescr, array('VRP (R) Software', 'VRP Software Version', 'Software Version VRP', 'Versatile Routing Platform Software'))) {
$os = 'vrp';
}