accesspoint support (probably) from ethan sommer (#50)

git-svn-id: http://www.observium.org/svn/observer/trunk@3223 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
Adam Amstrong
2012-05-21 18:17:23 +00:00
parent fcef689504
commit d3796004ae
21 changed files with 596 additions and 2 deletions

View File

@@ -121,6 +121,9 @@ function snmp_get($device, $oid, $options = NULL, $mib = NULL, $mibdir = NULL)
else { return false; }
}
function snmp_walk($device, $oid, $options = NULL, $mib = NULL, $mibdir = NULL)
{
global $debug,$config,$runtime_stats;
@@ -331,6 +334,29 @@ function snmpwalk_cache_oid($device, $oid, $array, $mib = NULL, $mibdir = NULL)
return $array;
}
// just like snmpwalk_cache_oid except that it returns the numerical oid as the index
// this is useful when the oid is indexed by the mac address and snmpwalk would
// return periods (.) for non-printable numbers, thus making many different indexes appear
// to be the same.
function snmpwalk_cache_oid_num($device, $oid, $array, $mib = NULL, $mibdir = NULL)
{
$data = snmp_walk($device, $oid, "-OQUn", $mib, $mibdir);
foreach (explode("\n", $data) as $entry)
{
list($oid,$value) = explode("=", $entry);
$oid = trim($oid); $value = trim($value);
list($oid, $index) = explode(".", $oid, 2);
if (!strstr($value, "at this OID") && isset($oid) && isset($index))
{
$array[$index][$oid] = $value;
}
}
return $array;
}
function snmpwalk_cache_multi_oid($device, $oid, $array, $mib = NULL, $mibdir = NULL)
{
global $cache;