mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
* fix: Updated qnap sensor code to be more generic #5910 * small change to check for valid data * small code change
This commit is contained in:
@@ -355,6 +355,22 @@ function snmpwalk_cache_oid($device, $oid, $array, $mib = null, $mibdir = null,
|
||||
return $array;
|
||||
}//end snmpwalk_cache_oid()
|
||||
|
||||
function snmpwalk_cache_numerical_oid($device, $oid, $array, $mib = null, $mibdir = null, $snmpflags = '-OQUsn')
|
||||
{
|
||||
$data = snmp_walk($device, $oid, $snmpflags, $mib, $mibdir);
|
||||
foreach (explode("\n", $data) as $entry) {
|
||||
list($oid,$value) = explode('=', $entry, 2);
|
||||
$oid = trim($oid);
|
||||
$value = trim($value);
|
||||
list($index,) = explode('.', strrev($oid), 2);
|
||||
if (!strstr($value, 'at this OID') && isset($oid) && isset($index)) {
|
||||
$array[$index][$oid] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
return $array;
|
||||
}//end snmpwalk_cache_oid()
|
||||
|
||||
function snmpwalk_cache_long_oid($device, $oid, $noid, $array, $mib = null, $mibdir = null, $snmpflags = '-OQnU')
|
||||
{
|
||||
$data = snmp_walk($device, $oid, $snmpflags, $mib, $mibdir);
|
||||
|
Reference in New Issue
Block a user