Split out OSes where necessary

This commit is contained in:
Neil Lathwood
2016-09-23 21:28:02 +01:00
parent 96a3160ff4
commit 70c996d4b8
6 changed files with 43 additions and 9 deletions

View File

@@ -0,0 +1,15 @@
<?php
if (starts_with($sysDescr, 'SunOS')) {
list(,,$version) = explode(' ', $sysDescr);
if (version_compare($version, '5.10', '>')) {
if (str_contains($sysDescr, 'oi_')) {
$os = 'openindiana';
}
}
}
if (starts_with($sysObjectId, '.1.3.6.1.4.1.42.2.1.1')) {
$os = 'solaris';
}

View File

@@ -0,0 +1,11 @@
<?php
if (starts_with($sysDescr, 'SunOS')) {
list(,,$version) = explode(' ', $sysDescr);
if (version_compare($version, '5.10', '>')) {
if (!str_contains($sysDescr, 'oi_')) {
$os = 'opensolaris';
}
}
}

View File

@@ -8,9 +8,7 @@ if (starts_with($sysDescr, 'Sentry') && str_contains($sysDescr, array('Switched'
$version = intval($version[1]);
// It appears that version 8 and up is good for sentry4
if ($version >= 8) {
$os = 'sentry4';
} else {
if ($version < 8) {
$os = 'sentry3';
}
}

View File

@@ -0,0 +1,14 @@
<?php
if (starts_with($sysDescr, 'Sentry') && 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';
}
}

View File

@@ -5,11 +5,7 @@ if (starts_with($sysDescr, 'SunOS')) {
list(,,$version) = explode(' ', $sysDescr);
if (version_compare($version, '5.10', '>')) {
if (str_contains($sysDescr, 'oi_')) {
$os = 'openindiana';
} else {
$os = 'opensolaris';
}
unset($os);
}
}

View File

@@ -1271,7 +1271,7 @@ class DiscoveryTest extends \PHPUnit_Framework_TestCase
public function testSwos()
{
$mockSnmp = array(
'SNMPv2-MIB::sysName.0' => 'MicroTik'
'SNMPv2-MIB::sysName.0' => 'MikroTik'
);
$this->checkOS('swos', 'RB250GS', '', $mockSnmp);
$this->checkOS('swos', 'RB260GS', '', $mockSnmp);