本文整理汇总了PHP中snmpwalk_cache_multi_oid函数的典型用法代码示例。如果您正苦于以下问题:PHP snmpwalk_cache_multi_oid函数的具体用法?PHP snmpwalk_cache_multi_oid怎么用?PHP snmpwalk_cache_multi_oid使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了snmpwalk_cache_multi_oid函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: d_echo
if (stripos($entry['jnxOperatingDescr'], 'sensor') || stripos($entry['jnxOperatingDescr'], 'fan')) {
continue;
}
d_echo($index . ' ' . $entry['jnxOperatingDescr'] . ' -> ' . $entry['jnxOperatingBuffer'] . ' -> ' . $entry['jnxOperatingDRAMSize'] . "\n");
$usage_oid = '.1.3.6.1.4.1.2636.3.1.13.1.8.' . $index;
$descr = $entry['jnxOperatingDescr'];
$usage = $entry['jnxOperatingBuffer'];
if (!strstr($descr, 'No') && !strstr($usage, 'No') && $descr != '') {
discover_mempool($valid_mempool, $device, $index, 'junos', $descr, '1', null, null);
}
}
//end if
}
//end foreach
} else {
$srx_mempools_array = snmpwalk_cache_multi_oid($device, 'jnxJsSPUMonitoringMemoryUsage', $srx_mempools_array, 'JUNIPER-SRX5000-SPU-MONITORING-MIB', 'junos');
if (is_array($srx_mempools_array)) {
foreach ($srx_mempools_array as $index => $entry) {
if ($index) {
$usage_oid = '.1.3.6.1.4.1.2636.3.39.1.12.1.1.1.5.' . $index;
$descr = 'Memory';
// No description in the table?
$usage = $entry['jnxJsSPUMonitoringMemoryUsage'];
discover_mempool($valid_mempool, $device, $index, 'junos', $descr, '1', null, null);
}
}
}
}
}
//end if
unset($mempools_array);
示例2: snmpwalk_cache_multi_oid
<?php
/**
* Observium
*
* This file is part of Observium.
*
* @package observium
* @subpackage poller
* @copyright (C) 2006-2014 Adam Armstrong
*
*/
$mib = 'JUNIPER-SRX5000-SPU-MONITORING-MIB';
$cache_mempool = snmpwalk_cache_multi_oid($device, 'jnxJsSPUMonitoringMemoryUsage', $cache_mempool, $mib, mib_dirs('junos'));
$mempool['perc'] = $cache_mempool[$index]['jnxJsSPUMonitoringMemoryUsage'];
// EOF
示例3: trim
$j_peerIndexes[$ip] = $entry['jnxBgpM2PeerIndex'];
break;
case 'ipv6':
$ip6 = trim(str_replace(' ', '', $entry['jnxBgpM2PeerRemoteAddr']), '"');
$ip6 = substr($ip6, 0, 4) . ':' . substr($ip6, 4, 4) . ':' . substr($ip6, 8, 4) . ':' . substr($ip6, 12, 4) . ':' . substr($ip6, 16, 4) . ':' . substr($ip6, 20, 4) . ':' . substr($ip6, 24, 4) . ':' . substr($ip6, 28, 4);
$ip6 = Net_IPv6::compress($ip6);
$j_peerIndexes[$ip6] = $entry['jnxBgpM2PeerIndex'];
break;
default:
echo "PANIC: Don't know RemoteAddrType " . $entry['jnxBgpM2PeerRemoteAddrType'] . "!\n";
break;
}
}
}
//end if
$j_prefixes = snmpwalk_cache_multi_oid($device, 'jnxBgpM2PrefixCountersTable', $jbgp, 'BGP4-V2-MIB-JUNIPER', $config['install_dir'] . '/mibs/junos');
$cbgpPeerAcceptedPrefixes = $j_prefixes[$j_peerIndexes[$peer['bgpPeerIdentifier']] . ".{$afi}." . $safis[$safi]]['jnxBgpM2PrefixInPrefixesAccepted'];
$cbgpPeerDeniedPrefixes = $j_prefixes[$j_peerIndexes[$peer['bgpPeerIdentifier']] . ".{$afi}." . $safis[$safi]]['jnxBgpM2PrefixInPrefixesRejected'];
$cbgpPeerAdvertisedPrefixes = $j_prefixes[$j_peerIndexes[$peer['bgpPeerIdentifier']] . ".{$afi}." . $safis[$safi]]['jnxBgpM2PrefixOutPrefixes'];
unset($j_prefixes);
unset($j_bgp);
unset($j_peerIndexes);
}
//end if
// FIXME THESE FIELDS DO NOT EXIST IN THE DATABASE!
$update = 'UPDATE bgpPeers_cbgp SET';
$peer['c_update']['AcceptedPrefixes'] = $cbgpPeerAcceptedPrefixes;
$peer['c_update']['DeniedPrefixes'] = $cbgpPeerDeniedPrefixes;
$peer['c_update']['PrefixAdminLimit'] = $cbgpPeerAdminLimit;
$peer['c_update']['PrefixThreshold'] = $cbgpPeerPrefixThreshold;
$peer['c_update']['PrefixClearThreshold'] = $cbgpPeerPrefixClearThreshold;
示例4: snmpwalk_cache_multi_oid
<?php
/**
* Observium
*
* This file is part of Observium.
*
* @package observium
* @subpackage poller
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2016 Observium Limited
*
*/
$cache_mempool = snmpwalk_cache_multi_oid($device, 'oacSysMemStatistics', $cache_mempool, 'ONEACCESS-SYS-MIB');
$index = $mempool['mempool_index'];
$mempool['total'] = $cache_mempool[$index]['oacSysMemoryTotal'];
$mempool['used'] = $cache_mempool[$index]['oacSysMemoryAllocated'];
$mempool['free'] = $cache_mempool[$index]['oacSysMemoryFree'];
// EOF
示例5: array
<?php
/*
* LibreNMS
*
* Copyright (c) 2016 Søren Friis Rosiak <sorenrosiak@gmail.com>
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation, either version 3 of the License, or (at your
* option) any later version. Please see LICENSE.txt at the top level of
* the source code distribution for details.
*/
if (strstr($device['hardware'], 'Dell')) {
$tables = array(array('processorDeviceStatusTable', '.1.3.6.1.4.1.674.10892.1.1100.32.1.5.', 'processorDeviceStatusStatus', 'processorDeviceStatusLocationName', 'MIB-Dell-10892'), array('memoryDeviceTable', '.1.3.6.1.4.1.674.10892.1.1100.50.1.5.', 'memoryDeviceStatus', 'memoryDeviceLocationName', 'MIB-Dell-10892'), array('powerSupplyTable', '.1.3.6.1.4.1.674.10892.1.600.12.1.5.', 'powerSupplyStatus', 'powerSupplyLocationName', 'MIB-Dell-10892'), array('intrusionTable', '.1.3.6.1.4.1.674.10892.1.300.70.1.5.', 'intrusionStatus', 'Intrusion', 'MIB-Dell-10892'), array('controllerTable', '.1.3.6.1.4.1.674.10893.1.20.130.1.1.5.', 'controllerState', 'controllerName', 'StorageManagement-MIB'), array('arrayDiskTable', '.1.3.6.1.4.1.674.10893.1.20.130.4.1.4.', 'arrayDiskState', 'arrayDiskName', 'StorageManagement-MIB'), array('virtualDiskTable', '.1.3.6.1.4.1.674.10893.1.20.140.1.1.4.', 'virtualDiskState', 'virtualDiskDeviceName', 'StorageManagement-MIB'), array('batteryTable', '.1.3.6.1.4.1.674.10893.1.20.130.15.1.4.', 'batteryState', 'batteryName', 'StorageManagement-MIB'));
foreach ($tables as $tablevalue) {
$temp = snmpwalk_cache_multi_oid($device, $tablevalue[0], array(), $tablevalue[4]);
$cur_oid = $tablevalue[1];
if (is_array($temp)) {
//Create State Index
$state_name = $tablevalue[2];
$state_index_id = create_state_index($state_name);
//Create State Translation
if ($state_index_id !== null) {
if ($state_name == 'processorDeviceStatusStatus' || $state_name == 'memoryDeviceStatus' || $state_name == 'powerSupplyStatus' || $state_name == 'intrusionStatus') {
$states = array(array($state_index_id, 'other', 0, 1, 3), array($state_index_id, 'unknown', 0, 2, 3), array($state_index_id, 'ok', 0, 3, 0), array($state_index_id, 'nonCritical', 0, 4, 1), array($state_index_id, 'critical', 0, 5, 2), array($state_index_id, 'nonRecoverable', 0, 6, 2));
} elseif ($state_name == 'controllerState') {
$states = array(array($state_index_id, 'ready', 0, 1, 0), array($state_index_id, 'failed', 0, 2, 2), array($state_index_id, 'online', 0, 3, 0), array($state_index_id, 'offline', 0, 4, 1), array($state_index_id, 'degraded', 0, 6, 2));
} elseif ($state_name == 'arrayDiskState') {
$states = array(array($state_index_id, 'ready', 0, 1, 0), array($state_index_id, 'failed', 0, 2, 2), array($state_index_id, 'online', 0, 3, 0), array($state_index_id, 'offline', 0, 4, 2), array($state_index_id, 'degraded', 0, 5, 2), array($state_index_id, 'recovering', 0, 6, 1), array($state_index_id, 'removed', 0, 7, 1), array($state_index_id, 'non-raid', 0, 8, 3), array($state_index_id, 'notReady', 0, 9, 1), array($state_index_id, 'resynching', 0, 10, 1), array($state_index_id, 'replacing', 0, 11, 1), array($state_index_id, 'spinningDown', 0, 12, 1), array($state_index_id, 'rebuild', 0, 13, 1), array($state_index_id, 'noMedia', 0, 14, 1), array($state_index_id, 'formatting', 0, 15, 1), array($state_index_id, 'diagnostics', 0, 16, 1), array($state_index_id, 'predictiveFailure', 0, 17, 2), array($state_index_id, 'initializing', 0, 18, 1), array($state_index_id, 'foreign', 0, 19, 1), array($state_index_id, 'clear', 0, 20, 1), array($state_index_id, 'unsupported', 0, 21, 2), array($state_index_id, 'incompatible', 0, 22, 2), array($state_index_id, 'readOnly', 0, 23, 2));
} elseif ($state_name == 'virtualDiskState') {
$states = array(array($state_index_id, 'unknown', 0, 0, 3), array($state_index_id, 'ready', 1, 1, 0), array($state_index_id, 'failed', 1, 2, 2), array($state_index_id, 'online', 1, 3, 1), array($state_index_id, 'offline', 1, 4, 2), array($state_index_id, 'degraded', 1, 6, 2), array($state_index_id, 'verifying', 1, 7, 1), array($state_index_id, 'resynching', 1, 15, 1), array($state_index_id, 'regenerating', 1, 16, 1), array($state_index_id, 'failedRedundancy', 1, 18, 2), array($state_index_id, 'rebuilding', 1, 24, 1), array($state_index_id, 'formatting', 1, 26, 1), array($state_index_id, 'reconstructing', 1, 32, 1), array($state_index_id, 'initializing', 1, 35, 1), array($state_index_id, 'backgroundInit', 1, 36, 1), array($state_index_id, 'permanentlyDegraded', 1, 52, 2));
示例6: snmpwalk_cache_multi_oid
/**
* Observium
*
* This file is part of Observium.
*
* @package observium
* @subpackage discovery
* @copyright (C) 2006-2014 Adam Armstrong
*
*/
// Huawei VRP mempools
$mib = 'HUAWEI-ENTITY-EXTENT-MIB';
echo " {$mib} ";
$mempool_array = snmpwalk_cache_multi_oid($device, "hwEntityMemUsage", NULL, $mib, mib_dirs('huawei'));
if (is_array($mempool_array)) {
$mempool_array = snmpwalk_cache_multi_oid($device, "hwEntityMemSize", $mempool_array, $mib, mib_dirs('huawei'));
$mempool_array = snmpwalk_cache_multi_oid($device, "hwEntityBomEnDesc", $mempool_array, $mib, mib_dirs('huawei'));
foreach ($mempool_array as $index => $entry) {
if (is_numeric($entry['hwEntityMemUsage']) && $entry['hwEntityMemSize'] > 0) {
$descr = rewrite_entity_name($entry['hwEntityBomEnDesc']);
$percent = $entry['hwEntityMemUsage'];
if (!strstr($descr, "No") && !strstr($percent, "No") && $descr != "") {
$total = $entry['hwEntityMemSize'];
$used = $total * $percent / 100;
discover_mempool($valid['mempool'], $device, $index, $mib, $descr, 1, $total, $used);
}
}
}
}
unset($mempool_array, $index, $descr, $total, $used, $percent);
// EOF
示例7: array
<?php
$oid = $mempool['mempool_index'];
if (!is_array($mempool_cache['junos'])) {
$mempool_cache['junos'] = array();
$mempool_cache['junos'] = snmpwalk_cache_multi_oid($device, "jnxOperatingBuffer", $mempool_cache['junos'], "JUNIPER-MIB", "+" . $config['install_dir'] . "/mibs/junos");
$mempool_cache['junos'] = snmpwalk_cache_multi_oid($device, "jnxOperatingDRAMSize", $mempool_cache['junos'], "JUNIPER-MIB", "+" . $config['install_dir'] . "/mibs/junos");
if ($debug) {
print_r($mempool_cache);
}
}
$entry = $mempool_cache['junos'][$device[device_id]][$mempool[mempool_index]];
$perc = $entry['jnxOperatingBuffer'];
$mempool['total'] = $entry['jnxOperatingDRAMSize'];
$mempool['used'] = $entry['jnxOperatingDRAMSize'] / 100 * $perc;
$mempool['free'] = $entry['jnxOperatingDRAMSize'] - $mempool['used'];
示例8: snmpwalk_cache_multi_oid
if ($device['os'] == 'ipoman') {
echo ' IPOMANII-MIB ';
if (!is_array($cache['ipoman'])) {
echo 'outletConfigDesc ';
$cache['ipoman']['out'] = snmpwalk_cache_multi_oid($device, 'outletConfigDesc', $cache['ipoman']['out'], 'IPOMANII-MIB');
echo 'outletConfigLocation ';
$cache['ipoman']['out'] = snmpwalk_cache_multi_oid($device, 'outletConfigLocation', $cache['ipoman']['out'], 'IPOMANII-MIB');
echo 'inletConfigDesc ';
$cache['ipoman']['in'] = snmpwalk_cache_multi_oid($device, 'inletConfigDesc', $cache['ipoman']['in'], 'IPOMANII-MIB');
}
$oids = array();
echo 'inletConfigFrequencyHigh ';
$oids = snmpwalk_cache_multi_oid($device, 'inletConfigFrequencyHigh', $oids, 'IPOMANII-MIB');
echo 'inletConfigFrequencyLow ';
$oids = snmpwalk_cache_multi_oid($device, 'inletConfigFrequencyLow', $oids, 'IPOMANII-MIB');
echo 'inletStatusFrequency ';
$oids = snmpwalk_cache_multi_oid($device, 'inletStatusFrequency', $oids, 'IPOMANII-MIB');
if (is_array($oids)) {
foreach ($oids as $index => $entry) {
$freq_oid = '.1.3.6.1.4.1.2468.1.4.2.1.3.1.3.1.4.' . $index;
$divisor = 10;
$descr = trim($cache['ipoman']['in'][$index]['inletConfigDesc'], '"') != '' ? trim($cache['ipoman']['in'][$index]['inletConfigDesc'], '"') : "Inlet {$index}";
$current = $entry['inletStatusFrequency'] / 10;
$low_limit = $entry['inletConfigFrequencyLow'];
$high_limit = $entry['inletConfigFrequencyHigh'];
discover_sensor($valid['sensor'], 'frequency', $device, $freq_oid, $index, 'ipoman', $descr, $divisor, '1', $low_limit, null, null, $high_limit, $current);
// FIXME: iPoMan 1201 also says it has 2 inlets, at least until firmware 1.06 - wtf?
}
}
}
//end if
示例9: snmpwalk_cache_multi_oid
<?php
/**
* Observium
*
* This file is part of Observium.
*
* @package observium
* @subpackage poller
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2016 Observium Limited
*
*/
$mib = 'JUNIPER-MIB';
$cache_mempool = snmpwalk_cache_multi_oid($device, 'jnxOperatingBuffer', $cache_mempool, $mib);
if ($mempool['mempool_precision'] == 1) {
$cache_mempool = snmpwalk_cache_multi_oid($device, 'jnxOperatingDRAMSize', $cache_mempool, $mib);
$mempool['total'] = $cache_mempool[$index]['jnxOperatingDRAMSize'];
} else {
$cache_mempool = snmpwalk_cache_multi_oid($device, 'jnxOperatingMemory', $cache_mempool, $mib);
$mempool['total'] = $cache_mempool[$index]['jnxOperatingMemory'];
}
$mempool['perc'] = $cache_mempool[$index]['jnxOperatingBuffer'];
// EOF
示例10: snmp_get
*
* @package observium
* @subpackage discovery
* @copyright (C) 2006-2014 Adam Armstrong
*
*/
echo " GEIST-MIB-V3 ";
$productTitle = snmp_get($device, 'productTitle.0', '-OQv', 'GEIST-MIB-V3', mib_dirs('geist'));
if ($productTitle) {
// Insert chassis as index 1, everything hangs off of this.
$system_index = 1;
$inventory[$system_index] = array('entPhysicalDescr' => $productTitle, 'entPhysicalClass' => 'chassis', 'entPhysicalName' => 'Chassis', 'entPhysicalIsFRU' => 'true', 'entPhysicalContainedIn' => 0, 'entPhysicalParentRelPos' => -1, 'entPhysicalMfgName' => 'Geist');
discover_inventory($valid['inventory'], $device, $system_index, $inventory[$system_index], 'geist-mib-v3');
$relPos = 1;
// Note: sensors without example SNMP output have not been tested.
$geist_sensors = array(array('descr' => 'Climate Monitor', 'prefix' => 'climate', 'oid' => 2, 'class' => 'sensor'), array('descr' => 'Power Monitor', 'prefix' => 'powMon', 'oid' => 3, 'class' => 'powerSupply', 'avail' => 1), array('descr' => 'Temperature Sensor', 'prefix' => 'tempSensor', 'oid' => 4, 'class' => 'sensor'), array('descr' => 'AF/HTD Sensor', 'prefix' => 'airFlowSensor', 'oid' => 5, 'class' => 'airflowSensor'), array('descr' => 'DELTA 3 Channel Controller', 'prefix' => 'ctrl3ChDELTA', 'oid' => 6, 'class' => 'sensor'), array('descr' => 'Door Sensor', 'prefix' => 'doorSensor', 'oid' => 7, 'class' => 'sensor'), array('descr' => 'Water Sensor', 'prefix' => 'waterSensor', 'oid' => 8, 'class' => 'sensor'), array('descr' => 'Current Sensor', 'prefix' => 'currentSensor', 'oid' => 9, 'class' => 'sensor'), array('descr' => 'Millivolt Sensor', 'prefix' => 'millivoltSensor', 'oid' => 10, 'class' => 'sensor'), array('descr' => '3 Channel Power Sensor', 'prefix' => 'power3ChSensor', 'oid' => 11, 'class' => 'sensor'), array('descr' => 'Outlet', 'prefix' => 'outlet', 'oid' => 12, 'class' => 'outlet'), array('descr' => 'Fan Controller Monitor', 'prefix' => 'vsfc', 'oid' => 13, 'class' => 'sensor'), array('descr' => '3 Channel Power Monitor', 'prefix' => 'ctrl3Ch', 'oid' => 14, 'class' => 'sensor'), array('descr' => 'Amperage Controller', 'prefix' => 'analogSensor', 'oid' => 15, 'class' => 'powerSupply'), array('descr' => 'Controlled outlet', 'prefix' => 'ctrlOutlet', 'oid' => 16, 'class' => 'outlet', 'avail' => 1), array('descr' => 'Dew Point Sensor', 'prefix' => 'dewpointSensor', 'oid' => 17, 'class' => 'sensor'), array('descr' => 'Digital Sensor', 'prefix' => 'digitalSensor', 'oid' => 18, 'class' => 'sensor'), array('descr' => 'DSTS Controller Sensor', 'prefix' => 'dstsSensor', 'oid' => 19, 'class' => 'sensor'), array('descr' => 'City Power Sensor', 'prefix' => 'cpmSensor', 'oid' => 20, 'class' => 'sensor'), array('descr' => 'Smoke Alarm Sensor', 'prefix' => 'smokeAlarm', 'oid' => 21, 'class' => 'sensor'), array('descr' => '-48VDC Sensor', 'prefix' => 'neg48VdcSensor', 'oid' => 22, 'class' => 'sensor'), array('descr' => '+30VDC Sensor', 'prefix' => 'pos30VdcSensor', 'oid' => 23, 'class' => 'sensor'), array('descr' => 'Analog Sensor', 'prefix' => 'analogSensor', 'oid' => 24, 'class' => 'sensor'), array('descr' => '3 Channel IEC Power Monitor', 'prefix' => 'ctrl3ChIEC', 'oid' => 25, 'class' => 'powerSupply'), array('descr' => 'Climate Relay Monitor', 'prefix' => 'climateRelay', 'oid' => 26, 'class' => 'sensor'), array('descr' => 'Controlled Relay', 'prefix' => 'ctrlRelay', 'oid' => 27, 'class' => 'relay', 'avail' => 1), array('descr' => 'Airspeed Switch Sensor', 'prefix' => 'airSpeedSwitchSensor', 'oid' => 28, 'class' => 'sensor'), array('descr' => 'DM16/48 Current Sensor', 'prefix' => 'powerDM', 'oid' => 29, 'class' => 'sensor'), array('descr' => 'I/O Expander', 'prefix' => 'ioExpander', 'oid' => 30, 'class' => 'sensor'), array('descr' => 'T3HD Sensor', 'prefix' => 't3hdSensor', 'oid' => 31, 'class' => 'sensor'), array('descr' => 'THD Sensor', 'prefix' => 'thdSensor', 'oid' => 32, 'class' => 'sensor'), array('descr' => '+60VDC Sensor', 'prefix' => 'pos60VdcSensor', 'oid' => 33, 'class' => 'sensor'), array('descr' => '3Phase Outlet Control', 'prefix' => 'ctrl2CirTot', 'oid' => 34, 'class' => 'outlet'), array('descr' => 'SC10 Sensor', 'prefix' => 'sc10Sensor', 'oid' => 35, 'class' => 'sensor'));
foreach ($geist_sensors as $sensor) {
$cache['geist'][$sensor['prefix'] . 'Table'] = snmpwalk_cache_multi_oid($device, $sensor['prefix'] . 'Table', array(), "GEIST-MIB-V3", mib_dirs('geist'));
foreach ($cache['geist'][$sensor['prefix'] . 'Table'] as $index => $entry) {
// Index can only be int in the database, so we create our own from, this sensor is at 21239.2.$oid.
$system_index = $sensor['oid'] * 256 + $index;
if ($sensor['avail'] || $entry[$sensor['prefix'] . 'Avail']) {
$inventory[$system_index] = array('entPhysicalDescr' => $sensor['descr'], 'entPhysicalClass' => $sensor['class'], 'entPhysicalName' => $entry[$sensor['prefix'] . 'Name'], 'entPhysicalSerialNum' => $entry[$sensor['prefix'] . 'Serial'], 'entPhysicalIsFRU' => 'true', 'entPhysicalContainedIn' => 1, 'entPhysicalParentRelPos' => $relPos, 'entPhysicalMfgName' => 'Geist');
discover_inventory($valid['inventory'], $device, $system_index, $inventory[$system_index], 'geist-mib-v3');
$relPos++;
}
}
}
}
unset($geist_sensors);
// EOF
示例11: foreach
// accessPXIdentProductNumber.0 = STRING: "AP9361"
// accessPXIdentHardwareRev.0 = STRING: "04"
// accessPXIdentDateOfManufacture.0 = STRING: "04/29/2010"
// accessPXIdentSerialNumber.0 = STRING: "QA1018180304"
// accessPXConfigCardReaderEnableDisableAction.0 = INTEGER: enable(2)
// accessPXConfigAutoRelockTime.0 = INTEGER: 60
// accessPXConfigCardFormat.0 = INTEGER: hidStd26(1)
// accessPXConfigBeaconName.0 = STRING: "Beacon Name"
// accessPXConfigBeaconLocation.0 = STRING: "Beacon Location"
// accessPXConfigBeaconAction.0 = INTEGER: disconnectedReadOnly(4)
// accessPXStatusBeaconName.0 = STRING: "Beacon Name"
// accessPXStatusBeaconLocation.0 = STRING: "Beacon Location"
// accessPXStatusBeaconCurrentState.0 = INTEGER: disconnected(4)
foreach (array("accessPX") as $table) {
echo "{$table} ";
$cache['apc'] = snmpwalk_cache_multi_oid($device, $table, $cache['apc'], "PowerNet-MIB");
}
foreach ($cache['apc'] as $index => $entry) {
// accessPXIdentAlarmStatus.0 = INTEGER: 3
if ($entry['accessPXIdentAlarmStatus']) {
$descr = 'Access PX Alarm Status';
$oid = ".1.3.6.1.4.1.318.1.1.20.1.1.1.{$index}";
discover_status($device, $oid, "accessPXIdentAlarmStatus.{$index}", 'powernet-accesspx-state', $descr, $entry['accessPXIdentAlarmStatus']);
}
// accessPXConfigFrontDoorLockControl.0 = INTEGER: lock(2)
// accessPXConfigFrontDoorMaxOpenTime.0 = INTEGER: 10
// accessPXStatusFrontDoorLock.0 = INTEGER: locked(2)
// accessPXStatusFrontDoor.0 = INTEGER: closed(2)
// accessPXStatusFrontDoorHandle.0 = INTEGER: closed(2)
// accessPXStatusFrontDoorMaxOpenTime.0 = INTEGER: 10
// accessPXStatusFrontDoorAlarmStatus.0 = INTEGER: 1
示例12: snmpwalk_cache_multi_oid
/**
* Observium
*
* This file is part of Observium.
*
* @package observium
* @subpackage discovery
* @copyright (C) 2006-2014 Adam Armstrong
*
*/
echo " GUDEADS-EPC8X-MIB ";
// GUDEADS-EPC8X-MIB::epc8TempSensor.1 = INTEGER: -9999 10th of degree Celsius
// GUDEADS-EPC8X-MIB::epc8TempSensor.2 = INTEGER: -9999 10th of degree Celsius
// GUDEADS-EPC8X-MIB::epc8HygroSensor.1 = INTEGER: -9999 10th of percentage humidity
// GUDEADS-EPC8X-MIB::epc8HygroSensor.2 = INTEGER: -9999 10th of percentage humidity
$cache['epc8x'] = snmpwalk_cache_multi_oid($device, "epc8SensorTable", array(), "GUDEADS-EPC8X-MIB", mib_dirs('gude'));
$scale = 0.1;
foreach ($cache['epc8x'] as $index => $entry) {
$oid = ".1.3.6.1.4.1.28507.1.1.3.2.1.2.{$index}";
$descr = "Temp Sensor {$index}";
$value = $entry['epc8TempSensor'];
if ($value != '' && $value != -9999) {
discover_sensor($valid['sensor'], 'temperature', $device, $oid, 'epc8TempSensor.' . $index, 'epc8x', $descr, $scale, $value * $scale);
}
$oid = ".1.3.6.1.4.1.28507.1.1.3.2.1.3.{$index}";
$descr = "Hygro Sensor {$index}";
$value = $entry['epc8HygroSensor'];
if ($value != '' && $value != -9999) {
discover_sensor($valid['sensor'], 'humidity', $device, $oid, 'epc8HygroSensor.' . $index, 'epc8x', $descr, $scale, $value * $scale);
}
}
示例13: array
if (!is_array($entity_array)) {
$entity_array = array();
echo " entPhysicalDescr";
$entity_array = snmpwalk_cache_multi_oid($device, "entPhysicalDescr", $entity_array, "CISCO-ENTITY-SENSOR-MIB");
echo " entPhysicalName";
$entity_array = snmpwalk_cache_multi_oid($device, "entPhysicalName", $entity_array, "CISCO-ENTITY-SENSOR-MIB");
}
$oids = array();
echo " entPhySensorType";
$oids = snmpwalk_cache_multi_oid($device, "entPhySensorType", $oids, "ENTITY-SENSOR-MIB");
echo " entPhySensorScale";
$oids = snmpwalk_cache_multi_oid($device, "entPhySensorScale", $oids, "ENTITY-SENSOR-MIB");
echo " entPhySensorPrecision";
$oids = snmpwalk_cache_multi_oid($device, "entPhySensorPrecision", $oids, "ENTITY-SENSOR-MIB");
echo " entPhySensorValue";
$oids = snmpwalk_cache_multi_oid($device, "entPhySensorValue", $oids, "ENTITY-SENSOR-MIB");
$entitysensor['voltsDC'] = "voltage";
$entitysensor['voltsAC'] = "voltage";
$entitysensor['amperes'] = "current";
$entitysensor['watts'] = "power";
$entitysensor['hertz'] = "freq";
$entitysensor['percentRH'] = "humidity";
$entitysensor['rpm'] = "fanspeed";
$entitysensor['celsius'] = "temperature";
$entitysensor['dBm'] = "dbm";
if (is_array($oids)) {
foreach ($oids as $index => $entry) {
#echo("[" . $entry['entPhySensorType'] . "|" . $entry['entPhySensorValue']. "|" . $index . "]");
if ($entitysensor[$entry['entPhySensorType']] && is_numeric($entry['entPhySensorValue']) && is_numeric($index)) {
$entPhysicalIndex = $index;
$oid = ".1.3.6.1.2.1.99.1.1.1.4." . $index;
示例14: array
*
*/
echo ' CISCO-RTTMON-MIB ';
$sla_states =& $GLOBALS['config']['mibs']['CISCO-RTTMON-MIB']['sla_states'];
// Events from MIB definitions
$sla_oids = array('jitter' => array('rttMonLatestJitterOperRTTMin', 'rttMonLatestJitterOperRTTMax', 'rttMonLatestJitterOperNumOfRTT', 'rttMonLatestJitterOperPacketLossSD', 'rttMonLatestJitterOperPacketLossDS'), 'icmpjitter' => array('rttMonLatestIcmpJitterRTTMin', 'rttMonLatestIcmpJitterRTTMax', 'rttMonLatestIcmpJitterNumRTT', 'rttMonLatestIcmpJitterPktLoss'));
$sla_poll = snmpwalk_cache_multi_oid($device, "rttMonLatestRttOperEntry", array(), 'CISCO-RTTMON-MIB');
foreach (dbFetchColumn("SELECT DISTINCT `rtt_type` FROM `slas` WHERE `device_id` = ? AND `rtt_type` != ? AND `deleted` = 0 AND `sla_status` = 'active';", array($device['device_id'], 'echo')) as $rtt_type) {
switch ($rtt_type) {
case 'jitter':
// Additional data for Jitter
$sla_poll = snmpwalk_cache_multi_oid($device, "rttMonLatestJitterOperEntry", $sla_poll, 'CISCO-RTTMON-MIB');
break;
case 'icmpjitter':
// Additional data for ICMP jitter
$sla_poll = snmpwalk_cache_multi_oid($device, "rttMonLatestIcmpJitterOperEntry", $sla_poll, 'CISCO-RTTMON-ICMP-MIB');
break;
}
}
// Uptime offset for timestamps
$uptime = timeticks_to_sec($poll_device['sysUpTime']);
$uptime_offset = time() - intval($uptime) / 100;
/// WARNING. System timezone BOMB
foreach ($sla_poll as $sla_index => $entry) {
if (!isset($entry['rttMonLatestRttOperCompletionTime']) && !isset($entry['rttMonLatestRttOperSense'])) {
// Skip additional multiindex entries from table
continue;
}
// Convert timestamps to unixtime
$entry['UnixTime'] = intval(timeticks_to_sec($entry['rttMonLatestRttOperTime']) / 100 + $uptime_offset);
$sla_state = array('rtt_value' => $entry['rttMonLatestRttOperCompletionTime'], 'rtt_sense' => $entry['rttMonLatestRttOperSense'], 'rtt_unixtime' => $entry['UnixTime']);
示例15: discover_processor
if ($debug) {
echo $index . " " . $entry['jnxOperatingDescr'] . " -> " . $entry['jnxOperatingCPU'] . " -> " . $entry['jnxOperatingDRAMSize'] . "\n";
}
$usage_oid = ".1.3.6.1.4.1.2636.3.1.13.1.8." . $index;
$descr = $entry['jnxOperatingDescr'];
$usage = $entry['jnxOperatingCPU'];
if (!strstr($descr, "No") && !strstr($usage, "No") && $descr != "") {
discover_processor($valid['processor'], $device, $usage_oid, $index, "junos", $descr, "1", $usage, NULL, NULL);
}
}
// End if checks
}
// End Foreach
}
// End if array
$srx_processors_array = snmpwalk_cache_multi_oid($device, "jnxJsSPUMonitoringCPUUsage", $srx_processors_array, "JUNIPER-SRX5000-SPU-MONITORING-MIB", '+' . $config['install_dir'] . "/mibs/junos");
if ($debug) {
print_r($processors_array);
}
if (is_array($srx_processors_array)) {
foreach ($srx_processors_array as $index => $entry) {
if (isset($index) && $index >= 0) {
$usage_oid = ".1.3.6.1.4.1.2636.3.39.1.12.1.1.1.4." . $index;
$descr = "CPU";
# No description in the table?
$usage = $entry['jnxJsSPUMonitoringCPUUsage'];
discover_processor($valid['processor'], $device, $usage_oid, $index, "junos", $descr, "1", $usage, NULL, NULL);
}
}
}
}