本文整理汇总了PHP中snmpwalk_cache_twopart_oid函数的典型用法代码示例。如果您正苦于以下问题:PHP snmpwalk_cache_twopart_oid函数的具体用法?PHP snmpwalk_cache_twopart_oid怎么用?PHP snmpwalk_cache_twopart_oid使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了snmpwalk_cache_twopart_oid函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: snmpwalk_cache_twopart_oid
/**
* Observium
*
* This file is part of Observium.
*
* @package observium
* @subpackage poller
* @copyright (C) 2006-2015 Adam Armstrong
*
*/
// Polling of AP and radios status for Juniper Wireless (ex Trapeze)
//
// TRAPEZE-NETWORKS-AP-STATUS-MIB
echo " TRAPEZE-NETWORKS-AP-STATUS-MIB ";
// getting APs and radios
$radios_snmp = snmpwalk_cache_twopart_oid($device, "trpzApStatRadioOpStatisticsTable", $radios_snmp, "TRAPEZE-NETWORKS-AP-STATUS-MIB", mib_dirs('trapeze'));
if (OBS_DEBUG > 1 && count($radios_snmp)) {
print_vars($radios_snmp);
}
// OIDs to graph
$oids_counter = array('TxUniPkt', 'TxUniOctet', 'TxMultiPkt', 'TxMultiOctet', 'RxPkt', 'RxOctet', 'UndcrptPkt', 'UndcrptOctet', 'PhyErr', 'ResetCount', 'AutoTuneChannelChangeCount', 'TxRetriesCount', 'ClientAssociations', 'ClientFailedAssociations', 'ClientReAssociations', 'SignalingPkt', 'ReTransmitOctet', 'RefusedConnectionCount', 'RxDataPkt', 'RxAuthPkt', 'RxAssocPkt', 'TxDataPkt', 'TxAuthRespPkt', 'TxAssocRespPkt');
$oids_gauge = array('UserSessions', 'NoiseFloor');
// Goes through the SNMP radio data
foreach ($radios_snmp as $ap_serial => $ap_radios) {
foreach ($ap_radios as $radio_number => $radio) {
$rrdupdate = "N";
$rrd_create = "";
if ($radio_number == "radio-1") {
$radio_number = 1;
} else {
if ($radio_number == "radio-2") {
示例2: print_debug
$entity_array[$index] = $entry;
}
}
print_debug('ENTITY-MIB already cached');
} else {
$oids = array('entPhysicalDescr', 'entPhysicalName', 'entPhysicalClass', 'entPhysicalContainedIn', 'entPhysicalParentRelPos');
if (is_device_mib($device, 'ARISTA-ENTITY-SENSOR-MIB')) {
$oids[] = 'entPhysicalAlias';
}
foreach ($oids as $oid) {
$entity_array = snmpwalk_cache_multi_oid($device, $oid, $entity_array, 'ENTITY-MIB:CISCO-ENTITY-VENDORTYPE-OID-MIB');
if (!$GLOBALS['snmp_status']) {
break;
}
}
$entity_array = snmpwalk_cache_twopart_oid($device, 'entAliasMappingIdentifier', $entity_array, 'ENTITY-MIB:IF-MIB');
}
if (is_device_mib($device, 'ARISTA-ENTITY-SENSOR-MIB')) {
$oids_arista = array('aristaEntSensorThresholdLowWarning', 'aristaEntSensorThresholdLowCritical', 'aristaEntSensorThresholdHighWarning', 'aristaEntSensorThresholdHighCritical');
foreach ($oids_arista as $oid) {
$entity_array = snmpwalk_cache_multi_oid($device, $oid, $entity_array, 'ARISTA-ENTITY-SENSOR-MIB');
if (!$GLOBALS['snmp_status']) {
break;
}
}
}
$entitysensor = array('voltsDC' => 'voltage', 'voltsAC' => 'voltage', 'amperes' => 'current', 'watts' => 'power', 'hertz' => 'frequency', 'percentRH' => 'humidity', 'rpm' => 'fanspeed', 'celsius' => 'temperature', 'dBm' => 'dbm');
foreach ($entity_array as $index => $entry) {
if ($entitysensor[$entry['entPhySensorType']] && is_numeric($entry['entPhySensorValue']) && is_numeric($index) && $entry['entPhySensorOperStatus'] != 'unavailable' && $entry['entPhySensorOperStatus'] != 'nonoperational') {
$ok = TRUE;
$options = array('entPhysicalIndex' => $index);
示例3: foreach
<?php
echo "Port Stacks: ";
$query = "SELECT * FROM `ports_stack` WHERE `device_id` = ?";
foreach (dbFetchRows($query, array($device['device_id'])) as $entry) {
$stack_db_array[$entry['port_id_high']][$entry['port_id_low']]['ifStackStatus'] = $entry['ifStackStatus'];
}
$stack_poll_array = snmpwalk_cache_twopart_oid($device, "ifStackStatus", array());
foreach ($stack_poll_array as $port_id_high => $entry_high) {
$port_high = get_port_by_index_cache($device, $port_id_high);
if ($port_high['ifType'] == 'propVirtual') {
continue;
}
//Skip stacking on Vlan ports (F.u. Cisco SB)
foreach ($entry_high as $port_id_low => $entry_low) {
$port_low = get_port_by_index_cache($device, $port_id_low);
if ($port_low['ifType'] == 'propVirtual') {
continue;
}
//Skip stacking on Vlan ports (F.u. Cisco SB)
$ifStackStatus = $entry_low['ifStackStatus'];
if (isset($stack_db_array[$port_id_high][$port_id_low])) {
if ($stack_db_array[$port_id_high][$port_id_low]['ifStackStatus'] == $ifStackStatus) {
echo ".";
} else {
$update_array = array('ifStackStatus' => $ifStackStatus);
dbUpdate($update_array, 'ports_stack', "`device_id` = ? AND `port_id_high` = ? AND `port_id_low` = ?", array($device['device_id'], $port_id_high, $port_id_low));
echo "U";
}
unset($stack_db_array[$port_id_high][$port_id_low]);
} else {
示例4: snmpwalk_cache_twopart_oid
<?php
/**
* Observium
*
* This file is part of Observium.
*
* @package observium
* @subpackage discovery
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2016 Observium Limited
*
*/
if (!isset($cache_discovery['timetra-chassis-mib'])) {
$cache_discovery['timetra-chassis-mib'] = snmpwalk_cache_twopart_oid($device, 'tmnxHwTable', NULL, 'TIMETRA-CHASSIS-MIB');
}
foreach ($cache_discovery['timetra-chassis-mib'] as $chassis => $entries) {
foreach ($entries as $index => $entry) {
$inventory[$index] = array('entPhysicalDescr' => $entry['tmnxHwName'], 'entPhysicalClass' => $entry['tmnxHwClass'], 'entPhysicalName' => $entry['tmnxHwName'], 'entPhysicalAlias' => $entry['tmnxHwAlias'], 'entPhysicalAssetID' => $entry['tmnxHwAssetID'], 'entPhysicalIsFRU' => $entry['tmnxHwIsFRU'], 'entPhysicalSerialNum' => $entry['tmnxHwSerialNumber'], 'entPhysicalContainedIn' => $entry['tmnxHwContainedIn'], 'entPhysicalParentRelPos' => $entry['tmnxHwParentRelPos'], 'entPhysicalMfgName' => $entry['tmnxHwMfgString']);
if ($entry['tmnxHwContainedIn'] === '0' && $entry['tmnxHwParentRelPos'] == '-1') {
$inventory[$index]['entPhysicalName'] .= ' ' . $chassis;
}
discover_inventory($valid['inventory'], $device, $index, $inventory[$index], 'timetra-chassis-mib');
}
}
// EOF
示例5: snmpwalk_cache_twopart_oid
* This file is part of Observium.
*
* @package observium
* @subpackage discovery
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2016 Observium Limited
*
*/
$ip_version = 'ipv6';
if ($check_ipv6_mib || !count($ip_data[$ip_version])) {
// Get IP addresses from IPV6-MIB
//ipv6AddrPfxLength.20.254.192.0.0.0.0.0.0.0.10.0.0.0.0.0.4 = 64
//ipv6AddrPfxLength.573.42.1.183.64.0.1.130.32.0.0.0.0.0.0.0.2 = 126
//ipv6AddrType.20.254.192.0.0.0.0.0.0.0.10.0.0.0.0.0.4 = stateful
//ipv6AddrType.573.42.1.183.64.0.1.130.32.0.0.0.0.0.0.0.2 = stateful
//ipv6AddrAnycastFlag.20.254.192.0.0.0.0.0.0.0.10.0.0.0.0.0.4 = false
//ipv6AddrAnycastFlag.573.42.1.183.64.0.1.130.32.0.0.0.0.0.0.0.2 = false
//ipv6AddrStatus.20.254.192.0.0.0.0.0.0.0.10.0.0.0.0.0.4 = preferred
//ipv6AddrStatus.573.42.1.183.64.0.1.130.32.0.0.0.0.0.0.0.2 = preferred
//Types: stateless(1), stateful(2), unknown(3)
$oid_data = snmpwalk_cache_twopart_oid($device, 'ipv6AddrEntry', array(), 'IPV6-MIB', NULL, OBS_SNMP_ALL_NUMERIC_INDEX);
//print_vars($oid_data);
// Rewrite IPV6-MIB array
foreach ($oid_data as $ifIndex => $entry1) {
foreach ($entry1 as $ip_snmp => $entry) {
$ip_address = snmp2ipv6($ip_snmp);
$ip_data[$ip_version][$ifIndex][$ip_address] = array('ifIndex' => $ifIndex, 'ip' => $ip_address, 'prefix' => $entry['ipv6AddrPfxLength'], 'origin' => $entry['ipv6AddrType']);
}
}
}
unset($ifIndex, $ip_address, $ip_snmp, $entry1, $oid_data);
// EOF
示例6: snmpwalk_cache_twopart_oid
/**
* Observium
*
* This file is part of Observium.
*
* @package observium
* @subpackage discovery
* @copyright (C) 2006-2014 Adam Armstrong
*
*/
// CLEANME rename code can go in r6000
echo " Sentry3-MIB ";
$scale = 0.01;
$scale_voltage = 0.1;
$sentry3_InfeedEntry = snmpwalk_cache_twopart_oid($device, 'InfeedEntry', array(), 'Sentry3-MIB');
$sentry3_OutletEntry = snmpwalk_cache_threepart_oid($device, 'OutletEntry', array(), 'Sentry3-MIB');
foreach ($sentry3_InfeedEntry as $tower => $feeds) {
foreach ($feeds as $feed => $entry) {
$descr = str_replace('_', ', ', $entry['infeedName']);
$index = "{$tower}.{$feed}";
//infeedLoadValue
$oid = '.1.3.6.1.4.1.1718.3.2.2.1.7.' . $index;
if (isset($entry['infeedLoadValue']) && $entry['infeedLoadValue'] >= 0) {
$limits = array('limit_high' => $entry['infeedCapacity'], 'limit_high_warn' => $entry['infeedLoadHighThresh']);
$value = $entry['infeedLoadValue'];
## Rename code for older revisions
$old_rrd = $config['rrd_dir'] . '/' . $device['hostname'] . '/' . safename("sensor-current-sentry3-{$tower}.rrd");
$new_rrd = $config['rrd_dir'] . '/' . $device['hostname'] . '/' . safename("sensor-current-sentry3-infeedLoad.{$index}.rrd");
if (is_file($old_rrd)) {
rename($old_rrd, $new_rrd);
示例7: snmp_cache_portIfIndex
// foreach ($pagp_oids as $oid) { $port_stats = snmpwalk_cache_oid($device, $oid, $port_stats, "CISCO-PAGP-MIB"); }
if ($device['os_group'] == 'cisco') {
$port_stats = snmp_cache_portIfIndex($device, $port_stats);
$port_stats = snmp_cache_portName($device, $port_stats);
foreach ($pagp_oids as $oid) {
$port_stats = snmpwalk_cache_oid($device, $oid, $port_stats, 'CISCO-PAGP-MIB');
}
$data_oids[] = 'portName';
// Grab data to put ports into vlans or make them trunks
// FIXME we probably shouldn't be doing this from the VTP MIB, right?
$port_stats = snmpwalk_cache_oid($device, 'vmVlan', $port_stats, 'CISCO-VLAN-MEMBERSHIP-MIB');
$port_stats = snmpwalk_cache_oid($device, 'vlanTrunkPortEncapsulationOperType', $port_stats, 'CISCO-VTP-MIB');
$port_stats = snmpwalk_cache_oid($device, 'vlanTrunkPortNativeVlan', $port_stats, 'CISCO-VTP-MIB');
} else {
$port_stats = snmpwalk_cache_oid($device, 'dot1qPortVlanTable', $port_stats, 'Q-BRIDGE-MIB');
$vlan_ports = snmpwalk_cache_twopart_oid($device, 'dot1qVlanCurrentEgressPorts', $vlan_stats, 'Q-BRIDGE-MIB');
$vlan_ifindex_map = snmpwalk_cache_oid($device, 'dot1dBasePortIfIndex', $vlan_stats, 'Q-BRIDGE-MIB');
foreach ($vlan_ports as $instance) {
foreach (array_keys($instance) as $vlan_id) {
$parts = explode(' ', $instance[$vlan_id]['dot1qVlanCurrentEgressPorts']);
$binary = '';
foreach ($parts as $part) {
$binary .= zeropad(decbin($part), 8);
}
for ($i = 0; $i < strlen($binary); $i++) {
if ($binary[$i]) {
$ifindex = $i;
// FIXME $vlan_ifindex_map[$i]
$q_bridge_mib[$ifindex][] = $vlan_id;
}
}
示例8: snmpwalk_cache_twopart_oid
<?php
/**
* Observium
*
* This file is part of Observium.
*
* @package observium
* @subpackage discovery
* @author Adam Armstrong <adama@memetic.org>
* @copyright (C) 2006-2015 Adam Armstrong
*
*/
echo " FOUNDRY-SN-SWITCH-GROUP-MIB ";
$fdp_array = snmpwalk_cache_twopart_oid($device, "snFdpCacheEntry", array(), "FOUNDRY-SN-SWITCH-GROUP-MIB", mib_dirs('foundry'));
if ($fdp_array) {
unset($fdp_links);
foreach (array_keys($fdp_array) as $key) {
$port = dbFetchRow("SELECT * FROM `ports` WHERE `device_id` = ? AND `ifIndex` = ?", array($device['device_id'], $key));
$fdp_if_array = $fdp_array[$key];
foreach (array_keys($fdp_if_array) as $entry_key) {
$fdp = $fdp_if_array[$entry_key];
$remote_device_id = FALSE;
if (is_valid_hostname($fdp['snFdpCacheDeviceId'])) {
if (isset($GLOBALS['cache']['discovery-protocols'][$fdp['snFdpCacheDeviceId']])) {
// This hostname already checked, skip discover
$remote_device_id = $GLOBALS['cache']['discovery-protocols'][$fdp['snFdpCacheDeviceId']];
} else {
$remote_device_id = dbFetchCell("SELECT `device_id` FROM `devices` WHERE `sysName` = ? OR `hostname` = ?", array($fdp['snFdpCacheDeviceId'], $fdp['snFdpCacheDeviceId']));
if (!$remote_device_id && !is_bad_xdp($fdp['snFdpCacheDeviceId'], $fdp['snFdpCachePlatform'])) {
$remote_device_id = discover_new_device($fdp['snFdpCacheDeviceId'], 'xdp', 'FDP', $device, $port);
示例9: snmpwalk_cache_oid
<?php
/**
* Observium
*
* This file is part of Observium.
*
* @package observium
* @subpackage discovery
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2016 Observium Limited
*
*/
// HWG-PWR-MIB
echo "HWG-PWR-MIB ";
$meters = snmpwalk_cache_oid($device, 'mtEntry', array(), 'HWG-PWR-MIB');
$oids = snmpwalk_cache_twopart_oid($device, 'mtvalEntry', array(), 'HWG-PWR-MIB');
if (OBS_DEBUG > 1 && count($oids)) {
print_vars($meters);
print_vars($oids);
}
foreach ($oids as $meter => $entry1) {
$name = $meters[$meter]['mtName'];
foreach ($entry1 as $idx => $entry) {
$index = "{$meter}.{$idx}";
$descr = $entry['mtvalName'];
if ($name) {
$descr .= ' - ' . $name;
}
$oid_name = 'mtvalMbusValue';
$oid_num = ".1.3.6.1.4.1.21796.4.6.1.3.1.6.{$index}";
$type = $mib . '-' . $oid_name;
示例10: dbFetchRows
$cefs_db[$cef_id] = $ceftmp['cef_switching_id'];
}
$cef_pfxs_query = dbFetchRows("SELECT * FROM `cef_prefix` WHERE `device_id` = ?", array($device['device_id']));
foreach ($cef_pfxs_query as $pfx) {
$cef_pfxs_db[$pfx['entPhysicalIndex']][$pfx['afi']] = $pfx['cef_pfx_id'];
}
unset($cefs_query, $cef_pfxs_query);
$device_context = $device;
if (!count($cefs_db)) {
// Set retries to 0 for speedup first walking, only if previously polling also empty (DB empty)
$device_context['snmp_retries'] = 0;
}
$cefs = snmpwalk_cache_threepart_oid($device_context, "cefSwitchingStatsEntry", array(), "CISCO-CEF-MIB", mib_dirs(array("cisco")));
unset($device_context);
if ($GLOBALS['snmp_status']) {
$cef_pfxs = snmpwalk_cache_twopart_oid($device, "cefFIBSummaryEntry", array(), "CISCO-CEF-MIB", mib_dirs(array("cisco")));
if (!is_array($entity_array)) {
echo "Caching OIDs: ";
$entity_array = array();
echo " entPhysicalDescr";
$entity_array = snmpwalk_cache_multi_oid($device, "entPhysicalDescr", $entity_array, "ENTITY-MIB");
echo " entPhysicalName";
$entity_array = snmpwalk_cache_multi_oid($device, "entPhysicalName", $entity_array, "ENTITY-MIB");
echo " entPhysicalModelName";
$entity_array = snmpwalk_cache_multi_oid($device, "entPhysicalModelName", $entity_array, "ENTITY-MIB");
}
$polled = time();
}
if (OBS_DEBUG > 1 && count($cefs)) {
print_vars($cefs);
}
示例11: snmpwalk_cache_oid
}
$service_policies = snmpwalk_cache_oid($device_context, "cbQosIfType", array(), "CISCO-CLASS-BASED-QOS-MIB");
unset($device_context);
if (count($service_policies)) {
// Continue populating service policies
$service_policies = snmpwalk_cache_oid($device, "cbQosPolicyDirection", $service_policies, "CISCO-CLASS-BASED-QOS-MIB");
$service_policies = snmpwalk_cache_oid($device, "cbQosIfIndex", $service_policies, "CISCO-CLASS-BASED-QOS-MIB");
# $policy_maps = snmpwalk_cache_oid($device, "cbQosPolicyMapCfgEntry", array(), "CISCO-CLASS-BASED-QOS-MIB");
# $class_maps = snmpwalk_cache_oid($device, "cbQosCMCfgEntry", array(), "CISCO-CLASS-BASED-QOS-MIB");
# $object_indexes = snmpwalk_cache_twopart_oid($device, "cbQosConfigIndex", array(), "CISCO-CLASS-BASED-QOS-MIB");
#print_r($policy_maps);
#print_r($class_maps);
#print_r($object_indexes);
$cm_stats = array();
foreach ($oids as $oid) {
$cm_stats = snmpwalk_cache_twopart_oid($device, $oid, $cm_stats, "CISCO-CLASS-BASED-QOS-MIB");
}
foreach ($cm_stats as $policy_index => $policy_entry) {
foreach ($policy_entry as $object_index => $object_entry) {
$port = get_port_by_ifIndex($device['device_id'], $service_policies[$policy_index]['cbQosIfIndex']);
$object_entry['port_id'] = $port['port_id'];
$object_entry['direction'] = $service_policies[$policy_index]['cbQosPolicyDirection'];
$object_entry['policy_index'] = $policy_index;
$object_entry['object_index'] = $object_index;
$object_entry['cm_cfg_index'] = $object_indexes[$policy_index][$object_index]['cbQosConfigIndex'];
$object_entry['pm_cfg_index'] = $object_indexes[$policy_index][$policy_index]['cbQosConfigIndex'];
if (!is_numeric($object_entry['pm_cfg_index'])) {
$object_entry['pm_cfg_index'] = $object_indexes[$policy_index]['1']['cbQosConfigIndex'];
}
$object_entry['policy_name'] = $policy_maps[$object_entry['pm_cfg_index']]['cbQosPolicyMapName'];
$object_entry['policy_desc'] = $policy_maps[$object_entry['pm_cfg_index']]['cbQosPolicyMapDesc'];
示例12: foreach
* Observium
*
* This file is part of Observium.
*
* @package observium
* @subpackage discovery
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2016 Observium Limited
*
*/
echo 'Port Stacks: ';
// FIXME. Add here discovery CISCO-STACK-MIB::portTable, CISCO-PAGP-MIB::pagpProtocolConfigTable
$query = 'SELECT * FROM `ports_stack` WHERE `device_id` = ?';
foreach (dbFetchRows($query, array($device['device_id'])) as $entry) {
$stack_db_array[$entry['port_id_high']][$entry['port_id_low']]['ifStackStatus'] = $entry['ifStackStatus'];
}
$stack_poll_array = snmpwalk_cache_twopart_oid($device, 'ifStackStatus', array(), 'IF-MIB');
foreach ($stack_poll_array as $port_id_high => $entry_high) {
if (is_numeric($port_id_high)) {
$port_high = get_port_by_index_cache($device, $port_id_high);
if ($device['os'] == 'ciscosb' && $port_high['ifType'] == 'propVirtual') {
continue;
}
//Skip stacking on Vlan ports (F.u. Cisco SB)
foreach ($entry_high as $port_id_low => $entry_low) {
if (is_numeric($port_id_low)) {
$port_low = get_port_by_index_cache($device, $port_id_low);
if ($device['os'] == 'ciscosb' && $port_low['ifType'] == 'propVirtual') {
continue;
}
//Skip stacking on Vlan ports (F.u. Cisco SB)
$ifStackStatus = $entry_low['ifStackStatus'];
示例13: snmpwalk_cache_twopart_oid
<?php
/**
* Observium
*
* This file is part of Observium.
*
* @package observium
* @subpackage poller
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2016 Observium Limited
*
*/
// Polling of AP and radios status for Juniper Wireless (ex Trapeze)
// getting APs and radios
$radios_snmp = snmpwalk_cache_twopart_oid($device, 'trpzApStatRadioOpStatisticsTable', $radios_snmp, 'TRAPEZE-NETWORKS-AP-STATUS-MIB');
if (OBS_DEBUG > 1 && count($radios_snmp)) {
print_vars($radios_snmp);
}
// OIDs to graph
$oids_counter = array('TxUniPkt', 'TxUniOctet', 'TxMultiPkt', 'TxMultiOctet', 'RxPkt', 'RxOctet', 'UndcrptPkt', 'UndcrptOctet', 'PhyErr', 'ResetCount', 'AutoTuneChannelChangeCount', 'TxRetriesCount', 'ClientAssociations', 'ClientFailedAssociations', 'ClientReAssociations', 'SignalingPkt', 'ReTransmitOctet', 'RefusedConnectionCount', 'RxDataPkt', 'RxAuthPkt', 'RxAssocPkt', 'TxDataPkt', 'TxAuthRespPkt', 'TxAssocRespPkt');
$oids_gauge = array('UserSessions', 'NoiseFloor');
// Goes through the SNMP radio data
foreach ($radios_snmp as $ap_serial => $ap_radios) {
foreach ($ap_radios as $radio_number => $radio) {
$rrdupdate = 'N';
$rrd_create = '';
if ($radio_number == 'radio-1') {
$radio_number = 1;
} else {
if ($radio_number == 'radio-2') {
$radio_number = 2;
示例14: array
* @package observium
* @subpackage discovery
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2016 Observium Limited
*
*/
$ip_version = 'ipv6';
if (!count($ip_data[$ip_version])) {
// Get IP addresses from CISCO-IETF-IP-MIB
//cIpAddressIfIndex.ipv6."20:01:04:70:00:15:00:bb:00:00:00:00:00:00:00:02" = 450
//cIpAddressPrefix.ipv6."20:01:04:70:00:15:00:bb:00:00:00:00:00:00:00:02" = cIpAddressPfxOrigin.450.ipv6."20:01:04:70:00:15:00:bb:00:00:00:00:00:00:00:00".64
//cIpAddressOrigin.ipv6."20:01:04:70:00:15:00:bb:00:00:00:00:00:00:00:02" = manual
//Origins: 1:other, 2:manual, 4:dhcp, 5:linklayer, 6:random
$flags = OBS_SNMP_ALL ^ OBS_QUOTES_STRIP;
$oid_data = array();
foreach (array('cIpAddressIfIndex', 'cIpAddressPrefix', 'cIpAddressType', 'cIpAddressOrigin') as $oid) {
$oid_data = snmpwalk_cache_twopart_oid($device, $oid . '.' . $ip_version, $oid_data, 'CISCO-IETF-IP-MIB', NULL, $flags);
if ($oid == 'cIpAddressIfIndex' && $GLOBALS['snmp_status'] === FALSE) {
break;
// Stop walk, not exist table
}
}
//print_vars($oid_data);
// Rewrite CISCO-IETF-IP-MIB array
foreach ($oid_data[$ip_version] as $ip_snmp => $entry) {
$ip_address = hex2ip($ip_snmp);
$ifIndex = $entry['cIpAddressIfIndex'];
$tmp_prefix = explode('.', $entry['cIpAddressPrefix']);
$entry['cIpAddressPrefix'] = end($tmp_prefix);
$ip_data[$ip_version][$ifIndex][$ip_address] = array('ifIndex' => $ifIndex, 'ip' => $ip_address, 'prefix' => $entry['cIpAddressPrefix'], 'type' => $entry['cIpAddressType'], 'origin' => $entry['cIpAddressOrigin']);
}
}
示例15: snmpwalk_cache_multi_oid
$oids = snmpwalk_cache_multi_oid($device, "entSensorType", $oids, "CISCO-ENTITY-SENSOR-MIB");
echo " entSensorScale";
$oids = snmpwalk_cache_multi_oid($device, "entSensorScale", $oids, "CISCO-ENTITY-SENSOR-MIB");
echo " entSensorValue";
$oids = snmpwalk_cache_multi_oid($device, "entSensorValue", $oids, "CISCO-ENTITY-SENSOR-MIB");
echo " entSensorMeasuredEntity";
$oids = snmpwalk_cache_multi_oid($device, "entSensorMeasuredEntity", $oids, "CISCO-ENTITY-SENSOR-MIB");
echo " entSensorPrecision";
$oids = snmpwalk_cache_multi_oid($device, "entSensorPrecision", $oids, "CISCO-ENTITY-SENSOR-MIB");
$t_oids = array();
echo " entSensorThresholdSeverity";
$t_oids = snmpwalk_cache_twopart_oid($device, "entSensorThresholdSeverity", $t_oids, "CISCO-ENTITY-SENSOR-MIB");
echo " entSensorThresholdRelation";
$t_oids = snmpwalk_cache_twopart_oid($device, "entSensorThresholdRelation", $t_oids, "CISCO-ENTITY-SENSOR-MIB");
echo " entSensorThresholdValue";
$t_oids = snmpwalk_cache_twopart_oid($device, "entSensorThresholdValue", $t_oids, "CISCO-ENTITY-SENSOR-MIB");
if ($debug) {
print_r($oids);
}
$entitysensor['voltsDC'] = "voltage";
$entitysensor['voltsAC'] = "voltage";
$entitysensor['amperes'] = "current";
$entitysensor['watt'] = "power";
$entitysensor['hertz'] = "freq";
$entitysensor['percentRH'] = "humidity";
$entitysensor['rpm'] = "fanspeed";
$entitysensor['celsius'] = "temperature";
$entitysensor['watts'] = "power";
$entitysensor['dBm'] = "dbm";
if (is_array($oids)) {
foreach ($oids as $index => $entry) {