本文整理汇总了PHP中snmpwalk_cache_threepart_oid函数的典型用法代码示例。如果您正苦于以下问题:PHP snmpwalk_cache_threepart_oid函数的具体用法?PHP snmpwalk_cache_threepart_oid怎么用?PHP snmpwalk_cache_threepart_oid使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了snmpwalk_cache_threepart_oid函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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);
print_message('Moved RRD');
示例2: array
<?php
if ($device['os_group'] == "cisco") {
echo "Cisco CEF Switching Path: ";
$cefs = array();
$cefs = snmpwalk_cache_threepart_oid($device, "CISCO-CEF-MIB::cefSwitchingStatsEntry", $cefs, "CISCO-CEF-MIB");
$polled = time();
$cefs_query = dbFetchRows("SELECT * FROM `cef_switching` WHERE `device_id` = ?", array($device['device_id']));
foreach ($cefs_query as $ceftmp) {
$cef_id = $device['device_id'] . "-" . $ceftmp['entPhysicalIndex'] . "-" . $ceftmp['afi'] . "-" . $ceftmp['cef_index'];
$cefs_db[$cef_id] = $ceftmp['cef_switching_id'];
}
if ($debug) {
print_r($cefs);
}
if (is_array($cefs)) {
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");
}
foreach ($cefs as $entity => $afis) {
$entity_name = $entity_array[$entity]['entPhysicalName'] . " - " . $entity_array[$entity]['entPhysicalModelName'];
echo "\n{$entity} {$entity_name}\n";
foreach ($afis as $afi => $paths) {
echo " |- {$afi}\n";
示例3: snmpwalk_cache_threepart_oid
<?php
/**
* Observium
*
* This file is part of Observium.
*
* @package observium
* @subpackage discovery
* @author Adam Armstrong <adama@observium.org>
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2016 Observium Limited
*
*/
$amap_array = snmpwalk_cache_threepart_oid($device, "aipAMAPportConnectionTable", array(), "ALCATEL-IND1-INTERSWITCH-PROTOCOL-MIB", NULL, OBS_SNMP_ALL_NUMERIC_INDEX);
if ($amap_array) {
foreach (array_keys($amap_array) as $key) {
$amap = array_shift(array_shift($amap_array[$key]));
$port = dbFetchRow("SELECT * FROM `ports` WHERE `device_id` = ? AND `ifIndex` = ?", array($device['device_id'], $amap['aipAMAPLocalIfindex']));
$remote_device_id = FALSE;
if (is_valid_hostname($amap['aipAMAPRemHostname'])) {
if (isset($GLOBALS['cache']['discovery-protocols'][$amap['aipAMAPRemHostname']])) {
// This hostname already checked, skip discover
$remote_device_id = $GLOBALS['cache']['discovery-protocols'][$amap['aipAMAPRemHostname']];
} else {
$remote_device = dbFetchRow("SELECT `device_id`, `hostname` FROM `devices` WHERE `sysName` = ? OR `hostname` = ?", array($amap['aipAMAPRemHostname'], $amap['aipAMAPRemHostname']));
$remote_device_id = $remote_device['device_id'];
if (!$remote_device_id && !is_bad_xdp($amap['aipAMAPRemHostname'], $amap['aipAMAPRemDeviceType'])) {
$remote_device_id = discover_new_device($amap['aipAMAPRemHostname'], 'xdp', 'AMAP', $device, $port);
}
// Cache remote device ID for other protocols
$GLOBALS['cache']['discovery-protocols'][$amap['aipAMAPRemHostname']] = $remote_device_id;
示例4: array
<?php
echo 'Cisco CEF Switching Path: ';
$cefs = array();
$cefs = snmpwalk_cache_threepart_oid($device, 'CISCO-CEF-MIB::cefSwitchingPath', $cefs);
if ($debug) {
print_r($cefs);
}
if (is_array($cefs)) {
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');
}
foreach ($cefs as $entity => $afis) {
$entity_name = $entity_array[$entity]['entPhysicalName'] . ' - ' . $entity_array[$entity]['entPhysicalModelName'];
echo "\n{$entity} {$entity_name}\n";
foreach ($afis as $afi => $paths) {
echo " |- {$afi}\n";
foreach ($paths as $path => $path_name) {
echo ' | |-' . $path . ': ' . $path_name['cefSwitchingPath'] . "\n";
$cef_exists[$device['device_id']][$entity][$afi][$path] = 1;
if (dbFetchCell('SELECT COUNT(*) from `cef` WHERE device_id = ? AND entPhysicalIndex = ?, AND afi=? AND cef_index=?', array($device['device_id'], $entity, $afi, $path)) != '1') {
dbInsert(array('device_id' => $device['device_id'], 'entPhysicalIndex' => $entity, 'afi' => $afi, 'cef_path' => $path), 'cef');
echo '+';
}
示例5: array
<?php
if ($device['os_group'] == 'cisco') {
echo 'Cisco CEF Switching Path: ';
$cefs = array();
$cefs = snmpwalk_cache_threepart_oid($device, 'CISCO-CEF-MIB::cefSwitchingStatsEntry', $cefs, 'CISCO-CEF-MIB');
$polled = time();
$cefs_query = dbFetchRows('SELECT * FROM `cef_switching` WHERE `device_id` = ?', array($device['device_id']));
foreach ($cefs_query as $ceftmp) {
$cef_id = $device['device_id'] . '-' . $ceftmp['entPhysicalIndex'] . '-' . $ceftmp['afi'] . '-' . $ceftmp['cef_index'];
$cefs_db[$cef_id] = $ceftmp['cef_switching_id'];
}
d_echo($cefs);
if (is_array($cefs)) {
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');
}
foreach ($cefs as $entity => $afis) {
$entity_name = $entity_array[$entity]['entPhysicalName'] . ' - ' . $entity_array[$entity]['entPhysicalModelName'];
echo "\n{$entity} {$entity_name}\n";
foreach ($afis as $afi => $paths) {
echo " |- {$afi}\n";
foreach ($paths as $path => $cef_stat) {
echo ' | |-' . $path . ': ' . $cef_stat['cefSwitchingPath'];
示例6: snmpwalk_cache_threepart_oid
<?php
/**
* Observium
*
* This file is part of Observium.
*
* @package observium
* @subpackage discovery
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2016 Observium Limited
*
*/
// DELL-NETWORKING-CHASSIS-MIB
//DELL-NETWORKING-CHASSIS-MIB::dellNetCpuUtil5Min.stack.1.1 = Gauge32: 14 percent
$processors_array = snmpwalk_cache_threepart_oid($device, 'dellNetCpuUtil5Min', array(), $mib, NULL, OBS_SNMP_ALL_NUMERIC_INDEX);
//print_vars($processors_array);
foreach ($processors_array as $type => $entry1) {
// Hrm, this is possible for multiple types?
$first_unit = array_shift(array_keys($entry1));
foreach ($entry1 as $unit => $entry2) {
$processors_count = count($entry2);
foreach ($entry2 as $processor => $entry) {
$dot_index = ".{$type}.{$unit}.{$processor}";
$descr = 'Unit ' . strval($unit - $first_unit);
if ($processors_count > 1) {
$descr .= " Processor {$processor}";
}
$oid_table = 'dellNetCpuUtilTable';
$oid_name = 'dellNetCpuUtil5Min';
$oid_num = ".1.3.6.1.4.1.6027.3.26.1.4.4.1.5{$dot_index}";
$usage = $entry[$oid_name];
示例7: snmpwalk_cache_twopart_oid
/**
* Observium
*
* This file is part of Observium.
*
* @package observium
* @subpackage discovery
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2016 Observium Limited
*
*/
/// Collect data about inputs :
$inputs = snmpwalk_cache_twopart_oid($device, 'inputTable', array(), 'EATON-EPDU-MIB');
$inputs = snmpwalk_cache_twopart_oid($device, 'inputTotal', $inputs, 'EATON-EPDU-MIB');
$inputs_o = snmpwalk_cache_threepart_oid($device, 'inputVoltageTable', array(), 'EATON-EPDU-MIB');
$inputs_o = snmpwalk_cache_threepart_oid($device, 'inputCurrentTable', $inputs_o, 'EATON-EPDU-MIB');
$inputs_o = snmpwalk_cache_threepart_oid($device, 'inputPowerTable', $inputs_o, 'EATON-EPDU-MIB');
foreach ($inputs as $unit_id => $unit_data) {
//echo "Unit $unit_id".PHP_EOL;
foreach ($unit_data as $input_id => $input_data) {
//echo " Input $input_id".PHP_EOL;
$input_oid = $unit_id . "." . $input_id;
if (isset($input_data['inputFrequency'])) {
discover_sensor($valid['sensor'], 'frequency', $device, ".1.3.6.1.4.1.534.6.6.7.3.1.1.3." . $input_oid, "inputFrequency.{$input_oid}", 'eaton-epdu-mib', "Unit {$unit_id} Input {$input_id} Frequency", "0.1", $input_data['inputFrequency']);
}
if (isset($input_data['inputFrequencyStatus'])) {
discover_status($device, ".1.3.6.1.4.1.534.6.6.7.3.1.1.4." . $input_oid, "inputFrequencyStatus." . $input_oid, 'inputFrequencyStatus', "Unit {$unit_id} Input {$input_id} Frequency Status", $input_data['inputFrequencyStatus'], array('entPhysicalClass' => 'input'));
}
if (isset($input_data['inputTotalVA']) && is_numeric($input_data['inputTotalVA'])) {
$descr = "Unit {$unit_id} Input {$input_id}";
$oid = ".1.3.6.1.4.1.534.6.6.7.3.5.1.3." . $input_oid;
$value = $input_data['inputTotalVA'];
示例8: WHERE
if ($remote_device_id) {
$if = $cdp['cdpCacheDevicePort'];
$remote_interface_id = @mysql_result(mysql_query("SELECT interface_id FROM `ports` WHERE (`ifDescr` = '{$if}' OR `ifName`='{$if}') AND `device_id` = '" . $remote_device_id . "'"), 0);
} else {
$remote_interface_id = "0";
}
if ($interface['interface_id'] && $cdp['cdpCacheDeviceId'] && $cdp['cdpCacheDevicePort']) {
discover_link($interface['interface_id'], 'cdp', $remote_interface_id, $cdp['cdpCacheDeviceId'], $cdp['cdpCacheDevicePort'], $cdp['cdpCachePlatform'], $cdp['cdpCacheVersion']);
}
}
}
}
}
echo " LLDP-MIB: ";
unset($lldp_array);
$lldp_array = snmpwalk_cache_threepart_oid("lldpRemoteSystemsData", $device, array(), "LLDP-MIB");
$lldp_array = $lldp_array[$device['device_id']];
if ($lldp_array) {
$lldp_links = "";
foreach (array_keys($lldp_array) as $key) {
$lldp_if_array = $lldp_array[$key];
foreach (array_keys($lldp_if_array) as $entry_key) {
$interface = mysql_fetch_array(mysql_query("SELECT * FROM `ports` WHERE device_id = '" . $device['device_id'] . "' AND `ifIndex` = '" . $entry_key . "'"));
$lldp_instance = $lldp_if_array[$entry_key];
foreach (array_keys($lldp_instance) as $entry_instance) {
$lldp = $lldp_instance[$entry_instance];
$remote_device_id = @mysql_result(mysql_query("SELECT `device_id` FROM `devices` WHERE `sysName` = '" . $lldp['lldpRemSysName'] . "' OR `hostname`='" . $lldp['lldpRemSysName'] . "'"), 0);
if ($remote_device_id) {
$if = $lldp['lldpRemPortDesc'];
$remote_interface_id = @mysql_result(mysql_query("SELECT interface_id FROM `ports` WHERE (`ifDescr` = '{$if}' OR `ifName`='{$if}') AND `device_id` = '" . $remote_device_id . "'"), 0);
} else {
示例9: array
<?php
if ($device['os_group'] == "cisco") {
echo "Cisco CEF Switching Path: ";
$cefs = array();
$cefs = snmpwalk_cache_threepart_oid($device, "CISCO-CEF-MIB::cefSwitchingStatsEntry", $cefs, "CISCO-CEF-MIB", mib_dirs(array("cisco")));
$polled = time();
$cefs_query = dbFetchRows("SELECT * FROM `cef_switching` WHERE `device_id` = ?", array($device['device_id']));
foreach ($cefs_query as $ceftmp) {
$cef_id = $device['device_id'] . "-" . $ceftmp['entPhysicalIndex'] . "-" . $ceftmp['afi'] . "-" . $ceftmp['cef_index'];
$cefs_db[$cef_id] = $ceftmp['cef_switching_id'];
}
if ($debug) {
print_r($cefs);
}
if (is_array($cefs)) {
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");
}
foreach ($cefs as $entity => $afis) {
$entity_name = $entity_array[$entity]['entPhysicalName'] . " - " . $entity_array[$entity]['entPhysicalModelName'];
echo "\n{$entity} {$entity_name}\n";
foreach ($afis as $afi => $paths) {
echo " |- {$afi}\n";
示例10: snmpwalk_cache_threepart_oid
<?php
/**
* Observium
*
* This file is part of Observium.
*
* @package observium
* @subpackage discovery
* @author Adam Armstrong <adama@memetic.org>
* @copyright (C) 2006-2014 Adam Armstrong
*
*/
echo " LLDP-MIB ";
$lldp_array = snmpwalk_cache_threepart_oid($device, "lldpRemoteSystemsData", array(), "LLDP-MIB", mib_dirs());
if ($lldp_array) {
$dot1d_array = snmpwalk_cache_oid($device, "dot1dBasePortIfIndex", array(), "BRIDGE-MIB", mib_dirs());
foreach (array_keys($lldp_array) as $key) {
$lldp_if_array = $lldp_array[$key];
foreach (array_keys($lldp_if_array) as $entry_key) {
if (is_numeric($dot1d_array[$entry_key]['dot1dBasePortIfIndex']) && $device['os'] != "junos") {
$ifIndex = $dot1d_array[$entry_key]['dot1dBasePortIfIndex'];
} else {
$ifIndex = $entry_key;
}
$port = dbFetchRow("SELECT * FROM `ports` WHERE `device_id` = ? AND `ifIndex` = ?", array($device['device_id'], $ifIndex));
$lldp_instance = $lldp_if_array[$entry_key];
foreach (array_keys($lldp_instance) as $entry_instance) {
$lldp = $lldp_instance[$entry_instance];
$remote_device_id = FALSE;
if (is_valid_hostname($lldp['lldpRemSysName'])) {
示例11: state_string_to_numeric
if ($value != '') {
$oid = ".1.3.6.1.4.1.318.1.1.1.4.1.1.0";
$descr = "Output Status";
$value = state_string_to_numeric('powernet-upsbasicoutput-state', $value);
discover_sensor($valid['sensor'], 'state', $device, $oid, "upsBasicOutputStatus.0", 'powernet-upsbasicoutput-state', $descr, NULL, $value, array('entPhysicalClass' => 'power'));
}
#### ATS #############################################################################################
$inputs = snmp_get($device, "atsNumInputs.0", "-Ovq", "PowerNet-MIB", mib_dirs('apc'));
$outputs = snmp_get($device, "atsNumOutputs.0", "-Ovq", "PowerNet-MIB", mib_dirs('apc'));
// Check if we have values for these, if not, try other code paths below.
if ($inputs || $outputs) {
echo " ";
$cache['apc'] = array();
foreach (array("atsInputTable", "atsOutputTable", "atsInputPhaseTable", "atsOutputPhaseTable") as $table) {
echo "{$table} ";
$cache['apc'] = snmpwalk_cache_threepart_oid($device, $table, $cache['apc'], "PowerNet-MIB", mib_dirs('apc'), TRUE);
}
foreach (array("atsInputTable", "atsOutputTable") as $table) {
echo "{$table} ";
$cache['apc'] = snmpwalk_cache_multi_oid($device, $table, $cache['apc'], "PowerNet-MIB", mib_dirs('apc'), TRUE);
}
// Not tested with threephase, but I don't see any on the APC product list anyway, so...
// FIXME - Not monitored:
// [atsOutputLoad] => 364 (VA)
// [atsOutputPercentLoad] => 9 (%)
// [atsOutputPercentPower] => 9 (%)
foreach ($cache['apc'] as $index => $entry) {
$descr = $entry['atsInputName'];
$oid = ".1.3.6.1.4.1.318.1.1.8.5.3.3.1.3.{$index}.1.1";
$value = $entry[1][1]['atsInputVoltage'];
if ($value != '' && $value != -1) {
示例12: array
<?php
/**
* Observium
*
* This file is part of Observium.
*
* @package observium
* @subpackage discovery
* @copyright (C) 2006-2014 Adam Armstrong
*
*/
echo "Cisco CEF Switching Path: ";
$cefs = array();
$cefs = snmpwalk_cache_threepart_oid($device, "CISCO-CEF-MIB::cefSwitchingPath", $cefs, NULL, mib_dirs(array("cisco")));
if ($debug) {
print_vars($cefs);
}
if (is_array($cefs)) {
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");
}
foreach ($cefs as $entity => $afis) {
$entity_name = $entity_array[$entity]['entPhysicalName'] . " - " . $entity_array[$entity]['entPhysicalModelName'];
示例13: dbFetchRows
$cefs_query = dbFetchRows('SELECT * FROM `cef_switching` WHERE `device_id` = ?', array($device['device_id']));
foreach ($cefs_query as $ceftmp) {
$cef_id = $device['device_id'] . '-' . $ceftmp['entPhysicalIndex'] . '-' . $ceftmp['afi'] . '-' . $ceftmp['cef_index'];
$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');
unset($device_context);
if ($GLOBALS['snmp_status']) {
$cef_pfxs = snmpwalk_cache_twopart_oid($device, 'cefFIBSummaryEntry', array(), 'CISCO-CEF-MIB');
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();
}
示例14: snmpwalk_cache_threepart_oid
return;
}
$pws = snmpwalk_cache_threepart_oid($device, 'jnxVpnPwAssociatedInterface', $pws, 'JUNIPER-VPN-MIB', NULL, $flags);
$pws = snmpwalk_cache_threepart_oid($device, 'jnxVpnPwLocalSiteId', $pws, 'JUNIPER-VPN-MIB', NULL, $flags);
// pwID
$pws = snmpwalk_cache_threepart_oid($device, 'jnxVpnPwTunnelName', $pws, 'JUNIPER-VPN-MIB', NULL, $flags);
// pwDescr
$pws = snmpwalk_cache_threepart_oid($device, 'jnxVpnPwTunnelType', $pws, 'JUNIPER-VPN-MIB', NULL, $flags);
// pwPsnType
$pws = snmpwalk_cache_threepart_oid($device, 'jnxVpnRemotePeIdAddrType', $pws, 'JUNIPER-VPN-MIB', NULL, $flags);
// pwPeerAddrType
$pws = snmpwalk_cache_threepart_oid($device, 'jnxVpnRemotePeIdAddress', $pws, 'JUNIPER-VPN-MIB', NULL, $flags);
// pwPeerAddr
//$pws = snmpwalk_cache_oid($device, 'pwLocalIfMtu', $pws, 'JUNIPER-VPN-MIB');
//$pws = snmpwalk_cache_oid($device, 'pwRemoteIfMtu', $pws, 'JUNIPER-VPN-MIB');
$pws = snmpwalk_cache_threepart_oid($device, 'jnxVpnPwRemoteSiteId', $pws, 'JUNIPER-VPN-MIB', NULL, $flags);
// pwMplsPeerLdpID
if (OBS_DEBUG > 1) {
echo 'PWS_WALK: ' . count($pws) . "\n";
print_vars($pws);
}
foreach ($pws as $pw_type => $entry) {
foreach ($entry as $pw_name => $entry2) {
foreach ($entry2 as $pw_ifIndex => $pw) {
//if (strlen($pw['jnxVpnPwRowStatus']) && $pw['jnxVpnPwRowStatus'] != 'active') { continue; } // Skip inactive (active, notinService, notReady, createAndGo, createAndWait, destroy)
// Get full index
$pw_index = snmp_translate('jnxVpnPwRowStatus.' . $pw_type . '."' . $pw_name . '".' . $pw_ifIndex, 'JUNIPER-VPN-MIB');
$pw_index = str_replace('.1.3.6.1.4.1.2636.3.26.1.4.1.4.', '', $pw_index);
$peer_addr = hex2ip($pw['jnxVpnRemotePeIdAddress']);
$peer_addr_version = get_ip_version($peer_addr);
$peer_addr_type = $pw['jnxVpnRemotePeIdAddrType'];
示例15: snmpwalk_cache_threepart_oid
<?php
/**
* Observium
*
* This file is part of Observium.
*
* @package observium
* @subpackage discovery
* @author Adam Armstrong <adama@observium.org>
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2016 Observium Limited
*
*/
$lldp_array = snmpwalk_cache_threepart_oid($device, "lldpRemoteSystemsData", array(), "LLDP-MIB", NULL, OBS_SNMP_ALL | OBS_SNMP_CONCAT);
if ($lldp_array) {
if (OBS_DEBUG > 1) {
print_vars($lldp_array);
}
$dot1d_array = snmpwalk_cache_oid($device, "dot1dBasePortIfIndex", array(), "BRIDGE-MIB");
$lldp_local_array = snmpwalk_cache_oid($device, "lldpLocalSystemData", array(), "LLDP-MIB");
foreach ($lldp_array as $key => $lldp_if_array) {
foreach ($lldp_if_array as $entry_key => $lldp_instance) {
if (is_numeric($dot1d_array[$entry_key]['dot1dBasePortIfIndex']) && $device['os'] != "junos") {
$ifIndex = $dot1d_array[$entry_key]['dot1dBasePortIfIndex'];
} else {
$ifIndex = $entry_key;
}
// Get the port using BRIDGE-MIB
$port = dbFetchRow("SELECT * FROM `ports` WHERE `device_id` = ? AND `ifIndex` = ? AND `ifDescr` NOT LIKE 'Vlan%'", array($device['device_id'], $ifIndex));
// If BRIDGE-MIB failed, get the port using pure LLDP-MIB
if (!$port) {