Fix: NIOS detection #4420

This commit is contained in:
Tony Murray
2016-09-13 16:16:02 -05:00
committed by Neil Lathwood
parent a8efda8f30
commit 7f7e3d22bc
4 changed files with 6 additions and 5 deletions

View File

@@ -6,10 +6,10 @@ if (!$os) {
'.1.3.6.1.4.1.17163.1.1',
'.1.3.6.1.4.1.17713.21',
'.1.3.6.1.4.1.2.3.51.3',
'.1.3.6.1.4.1.7779.1', // nios
'.1.3.6.1.4.1.7779.', // nios
);
if (starts_with($sysDescr, 'Linux') && !in_array($sysObjectId, $skip_oids)) {
if (starts_with($sysDescr, 'Linux') && !starts_with($sysObjectId, $skip_oids)) {
$os = 'linux';
// Specific Linux-derivatives

View File

@@ -1,6 +1,6 @@
<?php
if (!$os) {
if (str_contains($sysObjectId, ".1.3.6.1.4.1.7779.1")) {
if (starts_with($sysObjectId, '.1.3.6.1.4.1.7779.')) {
$os = 'nios';
}
}

View File

@@ -114,7 +114,7 @@ function getHostOS($device)
$sysDescr = snmp_get($device, "SNMPv2-MIB::sysDescr.0", "-Ovq");
$sysObjectId = snmp_get($device, "SNMPv2-MIB::sysObjectID.0", "-Ovqn");
d_echo("| $sysDescr | $sysObjectId | ");
d_echo("| $sysDescr | $sysObjectId | \n");
$pattern = $config['install_dir'] . '/includes/discovery/os/*.inc.php';
foreach (glob($pattern) as $file) {

View File

@@ -131,7 +131,8 @@ class DiscoveryTest extends \PHPUnit_Framework_TestCase
public function testNios()
{
$this->checkOS('nios', 'Linux 3.14.25 #1 SMP Thu Jun 16 18:19:37 EDT 2016 x86_64', '.1.3.6.1.4.1.7779.1');
$this->checkOS('nios', 'Linux 3.14.25 #1 SMP Thu Jun 16 18:19:37 EDT 2016 x86_64', '.1.3.6.1.4.1.7779.1.1402');
$this->checkOS('nios', 'IPAM', '.1.3.6.1.4.1.7779.1.1004');
}
public function testPcoweb()