mirror of
https://github.com/stylersnico/librenms.git
synced 2026-07-12 16:06:25 +02:00
Basic QNAP Turbo NAS support. (versions and hardware).
git-svn-id: http://www.observium.org/svn/observer/trunk@1989 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
@@ -3,6 +3,19 @@
|
||||
if (!$os)
|
||||
{
|
||||
if (preg_match("/^Linux/", $sysDescr)) { $os = "linux"; }
|
||||
|
||||
|
||||
## Specific Linux-derivatives
|
||||
|
||||
if($os == "linux") {
|
||||
|
||||
## Check for QNAP Systems TurboNAS
|
||||
$entPhysicalMfgName = snmp_get($device, "ENTITY-MIB::entPhysicalMfgName.1", "-Osqnv");
|
||||
|
||||
if(strpos($entPhysicalMfgName, "QNAP") !== FALSE) { $os = "qnap";}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
?>
|
||||
|
||||
@@ -1,6 +1,34 @@
|
||||
<?php
|
||||
|
||||
if ($device['os'] == "freebsd")
|
||||
if ($device['os'] == "linux")
|
||||
{
|
||||
list(,,$version) = explode (" ", $sysDescr);
|
||||
if (strstr($sysDescr, "386")|| strstr($sysDescr, "486")||strstr($sysDescr, "586")||strstr($sysDescr, "686")) { $hardware = "Generic x86"; }
|
||||
else if (strstr($sysDescr, "x86_64")) { $hardware = "Generic x86 64-bit"; }
|
||||
else if (strstr($sysDescr, "sparc32")) { $hardware = "Generic SPARC 32-bit"; }
|
||||
else if (strstr($sysDescr, "sparc64")) { $hardware = "Generic SPARC 64-bit"; }
|
||||
else if (strstr($sysDescr, "armv5")) { $hardware = "Generic ARMv5"; }
|
||||
else if (strstr($sysDescr, "armv6")) { $hardware = "Generic ARMv6"; }
|
||||
else if (strstr($sysDescr, "armv7")) { $hardware = "Generic ARMv7"; }
|
||||
else if (strstr($sysDescr, "armv")) { $hardware = "Generic ARM"; }
|
||||
|
||||
# Distro "extend" support
|
||||
$features = snmp_get($device, ".1.3.6.1.4.1.2021.7890.1.3.1.1.6.100.105.115.116.114.111", "-Oqv", "UCD-SNMP-MIB");
|
||||
$features = str_replace("\"", "", $features);
|
||||
|
||||
if (!$features) // No "extend" support, try "exec" support
|
||||
{
|
||||
$features = snmp_get($device, ".1.3.6.1.4.1.2021.7890.1.101.1", "-Oqv", "UCD-SNMP-MIB");
|
||||
$features = str_replace("\"", "", $features);
|
||||
}
|
||||
|
||||
// Detect Dell hardware via OpenManage SNMP
|
||||
$hw = snmp_get($device, ".1.3.6.1.4.1.674.10892.1.300.10.1.9.1", "-Oqv", "MIB-Dell-10892");
|
||||
$hw = trim(str_replace("\"", "", $hw));
|
||||
if ($hw) { $hardware = "Dell " . $hw; }
|
||||
|
||||
}
|
||||
elseif ($device['os'] == "freebsd")
|
||||
{
|
||||
$sysDescr = str_replace(" 0 ", " ", $sysDescr);
|
||||
list(,,$version) = explode (" ", $sysDescr);
|
||||
@@ -33,32 +61,14 @@ elseif ($device['os'] == "monowall" || $device['os'] == "Voswall")
|
||||
$hardware = "$hardware ($arch)";
|
||||
$hardware = str_replace("\"", "", $hardware);
|
||||
}
|
||||
elseif ($device['os'] == "linux")
|
||||
elseif ($device['os'] == "qnap")
|
||||
{
|
||||
list(,,$version) = explode (" ", $sysDescr);
|
||||
if (strstr($sysDescr, "386")|| strstr($sysDescr, "486")||strstr($sysDescr, "586")||strstr($sysDescr, "686")) { $hardware = "Generic x86"; }
|
||||
else if (strstr($sysDescr, "x86_64")) { $hardware = "Generic x86 64-bit"; }
|
||||
else if (strstr($sysDescr, "sparc32")) { $hardware = "Generic SPARC 32-bit"; }
|
||||
else if (strstr($sysDescr, "sparc64")) { $hardware = "Generic SPARC 64-bit"; }
|
||||
else if (strstr($sysDescr, "armv5")) { $hardware = "Generic ARMv5"; }
|
||||
else if (strstr($sysDescr, "armv6")) { $hardware = "Generic ARMv6"; }
|
||||
else if (strstr($sysDescr, "armv7")) { $hardware = "Generic ARMv7"; }
|
||||
else if (strstr($sysDescr, "armv")) { $hardware = "Generic ARM"; }
|
||||
|
||||
# Distro "extend" support
|
||||
$features = snmp_get($device, ".1.3.6.1.4.1.2021.7890.1.3.1.1.6.100.105.115.116.114.111", "-Oqv", "UCD-SNMP-MIB");
|
||||
$features = str_replace("\"", "", $features);
|
||||
$hardware = snmp_get($device, "ENTITY-MIB::entPhysicalName.1", "-Osqnv");
|
||||
$version = snmp_get($device, "ENTITY-MIB::entPhysicalFirmwareRev.1", "-Osqnv");
|
||||
$serial = snmp_get($device, "ENTITY-MIB::entPhysicalSerial.1", "-Osqnv");
|
||||
|
||||
if (!$features) // No "extend" support, try "exec" support
|
||||
{
|
||||
$features = snmp_get($device, ".1.3.6.1.4.1.2021.7890.1.101.1", "-Oqv", "UCD-SNMP-MIB");
|
||||
$features = str_replace("\"", "", $features);
|
||||
}
|
||||
|
||||
// Detect Dell hardware via OpenManage SNMP
|
||||
$hw = snmp_get($device, ".1.3.6.1.4.1.674.10892.1.300.10.1.9.1", "-Oqv", "MIB-Dell-10892");
|
||||
$hw = trim(str_replace("\"", "", $hw));
|
||||
if ($hw) { $hardware = "Dell " . $hw; }
|
||||
}
|
||||
|
||||
?>
|
||||
?>
|
||||
|
||||
@@ -20,12 +20,22 @@ $config['os'][$os]['text'] = "Vyatta";
|
||||
$config['os'][$os]['type'] = "network";
|
||||
$config['os'][$os]['ifname'] = 1;
|
||||
|
||||
### Linux-based OSes here please.
|
||||
|
||||
$os = "linux";
|
||||
$config['os'][$os]['type'] = "server";
|
||||
$config['os'][$os]['group'] = "unix";
|
||||
$config['os'][$os]['text'] = "Linux";
|
||||
$config['os'][$os]['ifXmcbc'] = 1;
|
||||
|
||||
$os = "qnap";
|
||||
$config['os'][$os]['type'] = "server";
|
||||
$config['os'][$os]['group'] = "unix";
|
||||
$config['os'][$os]['text'] = "QNAP TurboNAS";
|
||||
$config['os'][$os]['ifXmcbc'] = 1;
|
||||
|
||||
### Othre Unix-based OSes here please.
|
||||
|
||||
$os = "freebsd";
|
||||
$config['os'][$os]['type'] = "server";
|
||||
$config['os'][$os]['group'] = "unix";
|
||||
|
||||
Reference in New Issue
Block a user