本文整理汇总了PHP中snmpwalk_cache_oid函数的典型用法代码示例。如果您正苦于以下问题:PHP snmpwalk_cache_oid函数的具体用法?PHP snmpwalk_cache_oid怎么用?PHP snmpwalk_cache_oid使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了snmpwalk_cache_oid函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: snmpwalk_cache_oid
<?php
global $debug;
if ($device['os'] == 'mgeups') {
// blatently copyied from APC
echo 'MGE UPS External ';
// Environmental monitoring on UPSes etc
// FIXME upsmgConfigEnvironmentTable and upsmgEnvironmentSensorTable are used but there are others ...
$mge_env_data = snmpwalk_cache_oid($device, 'upsmgConfigEnvironmentTable', array(), 'MG-SNMP-UPS-MIB');
$mge_env_data = snmpwalk_cache_oid($device, 'upsmgEnvironmentSensorTable', $mge_env_data, 'MG-SNMP-UPS-MIB');
/*
upsmgConfigSensorIndex.1 = 1
upsmgConfigSensorName.1 = "Environment sensor"
upsmgConfigTemperatureLow.1 = 5
upsmgConfigTemperatureHigh.1 = 40
upsmgConfigTemperatureHysteresis.1 = 2
upsmgConfigHumidityLow.1 = 5
upsmgConfigHumidityHigh.1 = 90
upsmgConfigHumidityHysteresis.1 = 5
upsmgConfigInput1Name.1 = "Input #1"
upsmgConfigInput1ClosedLabel.1 = "closed"
upsmgConfigInput1OpenLabel.1 = "open"
upsmgConfigInput2Name.1 = "Input #2"
upsmgConfigInput2ClosedLabel.1 = "closed"
upsmgConfigInput2OpenLabel.1 = "open"
upsmgEnvironmentIndex.1 = 1
upsmgEnvironmentComFailure.1 = no
upsmgEnvironmentTemperature.1 = 287
upsmgEnvironmentTemperatureLow.1 = no
upsmgEnvironmentTemperatureHigh.1 = no
示例2: snmpwalk_cache_oid
<?php
# NETSWITCH-MIB::hpGlobalMemSlotIndex.1 = INTEGER: 1
# NETSWITCH-MIB::hpGlobalMemSlabCnt.1 = Counter32: 3966
# NETSWITCH-MIB::hpGlobalMemFreeSegCnt.1 = Counter32: 166
# NETSWITCH-MIB::hpGlobalMemAllocSegCnt.1 = Counter32: 3803
# NETSWITCH-MIB::hpGlobalMemTotalBytes.1 = INTEGER: 11337704
# NETSWITCH-MIB::hpGlobalMemFreeBytes.1 = INTEGER: 9669104
# NETSWITCH-MIB::hpGlobalMemAllocBytes.1 = INTEGER: 1668728
if (!is_array($mempool_cache['hpGlobal'])) {
$mempool_cache['hpGlobal'] = snmpwalk_cache_oid($device, "hpGlobal", NULL, "NETSWITCH-MIB", mib_dirs('hp'));
if ($debug) {
print_r($mempool_cache);
}
} else {
if ($debug) {
echo "Cached!";
}
}
$entry = $mempool_cache['hpGlobal'][$mempool[mempool_index]];
$mempool['units'] = "1";
$mempool['used'] = $entry['hpGlobalMemAllocBytes'];
$mempool['total'] = $entry['hpGlobalMemTotalBytes'];
$mempool['free'] = $entry['hpGlobalMemFreeBytes'];
示例3: snmpwalk_cache_oid
<?php
/**
* Observium
*
* This file is part of Observium.
*
* @package observium
* @subpackage poller
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2016 Observium Limited
*
*/
// IEEE802dot11-MIB::dot11manufacturerProductName.5 = STRING: UAP-LR
// IEEE802dot11-MIB::dot11manufacturerProductVersion.5 = STRING: BZ.ar7240.v3.1.9.2442.131217.1549
$data = snmpwalk_cache_oid($device, 'dot11manufacturerProductName', array(), 'IEEE802dot11-MIB');
if ($data) {
$data = snmpwalk_cache_oid($device, 'dot11manufacturerProductVersion', $data, 'IEEE802dot11-MIB');
$data = current($data);
$hardware = 'Unifi ' . $data['dot11manufacturerProductName'];
list(, $version) = preg_split('/\\.v/', $data['dot11manufacturerProductVersion']);
}
// EOF
示例4: snmp_get
$version = $data[1]['entPhysicalSoftwareRev'];
}
if (isset($data[1]['entPhysicalName']) && $data[1]['entPhysicalName'] != '') {
$hardware = $data[1]['entPhysicalName'];
}
if (isset($data[1]['entPhysicalModelName']) && $data[1]['entPhysicalModelName'] != '') {
$hardware = $data[1]['entPhysicalModelName'];
}
if (empty($hardware)) {
$hardware = snmp_get($device, 'sysObjectID.0', '-Osqv', 'SNMPv2-MIB:CISCO-PRODUCTS-MIB');
}
$stats = snmpwalk_cache_oid($device, "bsnAPEntry", $stats, 'AIRESPACE-WIRELESS-MIB', null, '-OQUsb');
$radios = snmpwalk_cache_oid($device, "bsnAPIfEntry", $radios, 'AIRESPACE-WIRELESS-MIB', null, '-OQUsb');
$APstats = snmpwalk_cache_oid($device, 'bsnApIfNoOfUsers', $APstats, 'AIRESPACE-WIRELESS-MIB', null, '-OQUsxb');
$loadParams = snmpwalk_cache_oid($device, "bsnAPIfLoadChannelUtilization", $loadParams, 'AIRESPACE-WIRELESS-MIB', null, '-OQUsb');
$interferences = snmpwalk_cache_oid($device, "bsnAPIfInterferencePower", $interferences, 'AIRESPACE-WIRELESS-MIB', null, '-OQUsb');
$numAccessPoints = count($stats);
$numClients = 0;
foreach ($APstats as $key => $value) {
$numClients += $value['bsnApIfNoOfUsers'];
}
$rrd_def = array('DS:NUMAPS:GAUGE:600:0:12500000000', 'DS:NUMCLIENTS:GAUGE:600:0:12500000000');
$fields = array('NUMAPS' => $numAccessPoints, 'NUMCLIENTS' => $numClients);
$tags = compact('rrd_def');
data_update($device, 'ciscowlc', $tags, $fields);
// also save the info about how many clients in the same place as the wireless module
$radio = 1;
$rrd_name = 'wificlients-radio' . $radio;
$rrd_def = 'DS:wificlients:GAUGE:600:-273:10000';
$fields = array('wificlients' => $numClients);
$tags = compact('radio', 'rrd_name', 'rrd_def');
示例5: snmpwalk_cache_oid
<?php
/**
* Observium
*
* This file is part of Observium.
*
* @package observium
* @subpackage poller
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2016 Observium Limited
*
*/
// EMBEDDED-NGX-MIB
if (!is_array($cache_storage['embedded-ngx-mib'])) {
$cache_storage['embedded-ngx-mib'] = snmpwalk_cache_oid($device, "swStorage", NULL, "EMBEDDED-NGX-MIB");
if (OBS_DEBUG && count($cache_storage['embedded-ngx-mib'])) {
print_vars($cache_storage['embedded-ngx-mib']);
}
}
$entry = $cache_storage['embedded-ngx-mib'][$storage['storage_index']];
$storage['units'] = 1024;
$storage['size'] = $entry['swStorageConfigTotal'] * $storage['units'];
$storage['free'] = $entry['swStorageConfigFree'] * $storage['units'];
$storage['used'] = $storage['size'] - $storage['free'];
// EOF
示例6: discover_sensor
// isDeviceConfigHumidityHysteresis.2 = INTEGER: 500
// 32768 = No sensor connected
if ($value != 32768 && $value != '') {
discover_sensor($valid['sensor'], 'humidity', $device, $oid, "isDeviceMonitorHumidity.{$index}", 'ispro-mib', $descr, 0.01, $value, $options);
}
$oid = ".1.3.6.1.4.1.19011.1.3.2.1.3.1.2.1.4.{$index}";
$value = $entry['isDeviceMonitorHumidityAlarm'];
// isDeviceMonitorHumidityAlarm.1 = INTEGER: normal(3)
// unknown = No sensor connected
if ($value != 'unknown' && $value != '') {
discover_sensor($valid['sensor'], 'state', $device, $oid, "isDeviceMonitorHumidityAlarm.{$index}", 'ispro-mib-threshold-state', $descr, 1, $value);
}
}
}
$oids = snmpwalk_cache_oid($device, 'isDeviceMonitorDigitalInTable', array(), 'ISPRO-MIB');
$oids = snmpwalk_cache_oid($device, 'isDeviceConfigDigitalInTable', $oids, 'ISPRO-MIB');
foreach ($oids as $index => $entry) {
// Unfortunately, there is no (direct) SNMP link between the sensors connected above, even though they are represented together in the Web UI.
// Unless we use a ugly "divide by 2" hack, we can't know if these alerts are meant to be "not displayed" like we do for Temp/Humidity.
// If you don't want digital sensors displayed, make sure they are set to Disabled and not Normal Open or Normal Close.
// isDeviceMonitorDigitalInIndex.1 = INTEGER: 1
// isDeviceMonitorDigitalInName.1 = STRING: "Alarm1-1"
// isDeviceMonitorDigitalIn.1 = INTEGER: inactive(2)
// isDeviceMonitorDigitalInAlarm.1 = INTEGER: normal(1)
$descr = $entry['isDeviceMonitorDigitalInName'];
$oid = "1.3.6.1.4.1.19011.1.3.2.1.3.1.3.1.4.{$index}";
$value = $entry['isDeviceMonitorDigitalInAlarm'];
if ($entry['isDeviceConfigDigitalInState'] != 'disabled' && $value != '') {
discover_sensor($valid['sensor'], 'state', $device, $oid, "isDeviceMonitorDigitalInAlarm.{$index}", 'ispro-mib-trigger-state', $descr, 1, $value);
}
}
示例7: snmp_get
if (isset($data[1]['entPhysicalName']) && $data[1]['entPhysicalName'] != '') {
$hardware = $data[1]['entPhysicalName'];
}
if (isset($data[1]['entPhysicalModelName']) && $data[1]['entPhysicalModelName'] != '') {
$hardware = $data[1]['entPhysicalModelName'];
}
if (empty($hardware)) {
$hardware = snmp_get($device, 'sysObjectID.0', '-Osqv', 'SNMPv2-MIB:CISCO-PRODUCTS-MIB');
}
$oids_AP_Name = array('bsnAPName');
$oids_AP_Users = array('bsnApIfNoOfUsers');
foreach ($oids_AP_Name as $oid) {
$stats = snmpwalk_cache_oid($device, $oid, $stats, 'AIRESPACE-WIRELESS-MIB', null, '-OQUsxb');
}
foreach ($oids_AP_Users as $oid) {
$APstats = snmpwalk_cache_oid($device, $oid, $APstats, 'AIRESPACE-WIRELESS-MIB', null, '-OQUsxb');
}
$numAccessPoints = count($stats);
$numClients = 0;
foreach ($APstats as $key => $value) {
$numClients += $value['bsnApIfNoOfUsers'];
}
$rrdfile = $host_rrd . '/ciscowlc' . safename('.rrd');
if (!is_file($rrdfile)) {
rrdtool_create($rrdfile, ' --step 300 DS:NUMAPS:GAUGE:600:0:12500000000 DS:NUMCLIENTS:GAUGE:600:0:12500000000 ' . $config['rrd_rra']);
}
$fields = array('NUMAPS' => $numAccessPoints, 'NUMCLIENTS' => $numClients);
$ret = rrdtool_update($rrdfile, $fields);
// also save the info about how many clients in the same place as the wireless module
$wificlientsrrd = $config['rrd_dir'] . '/' . $device['hostname'] . '/' . safename('wificlients-radio1.rrd');
if (!is_file($wificlientsrrd)) {
示例8: array
echo " IP";
// These are at the start of large trees that we don't want to walk the entirety of, so we snmp_get_multi them
$oids_gauge = array('tcpCurServerConn', 'tcpCurClientConn', 'tcpActiveServerConn', 'tcpCurClientConnClosing', 'tcpCurServerConnEstablished', 'tcpCurClientConnOpening', 'tcpCurClientConnEstablished', 'tcpCurServerConnClosing', 'tcpSpareConn', 'tcpSurgeQueueLen', 'tcpCurServerConnOpening', 'tcpCurPhysicalServers', 'tcpReuseHit');
$oids_counter = array('tcpTotServerConnOpened', 'tcpTotServerConnClosed', 'tcpTotClientConnOpened', 'tcpTotClientConnClosed', 'tcpTotSyn', 'tcpTotSynProbe', 'tcpTotSvrFin', 'tcpTotCltFin', 'tcpTotRxPkts', 'tcpTotRxBytes', 'tcpTotTxPkts', 'tcpTotTxBytes', 'tcpWaitToSyn', 'tcpTotZombieCltConnFlushed', 'tcpTotZombieSvrConnFlushed', 'tcpTotZombieHalfOpenCltConnFlushed', 'tcpTotZombieHalfOpenSvrConnFlushed', 'tcpTotZombieActiveHalfCloseCltConnFlushed', 'tcpTotZombieActiveHalfCloseSvrConnFlushed', 'tcpTotZombiePassiveHalfCloseCltConnFlushed', 'tcpTotZombiePassiveHalfCloseSrvConnFlushed', 'tcpErrBadCheckSum', 'tcpErrSynInSynRcvd', 'tcpErrSynInEst', 'tcpErrSynGiveUp', 'tcpErrSynSentBadAck', 'tcpErrSynRetry', 'tcpErrFinRetry', 'tcpErrFinGiveUp', 'tcpErrFinDup', 'tcpErrRst', 'tcpErrRstNonEst', 'tcpErrRstOutOfWindow', 'tcpErrRstInTimewait', 'tcpErrSvrRetrasmit', 'tcpErrCltRetrasmit', 'tcpErrFullRetrasmit', 'tcpErrPartialRetrasmit', 'tcpErrSvrOutOfOrder', 'tcpErrCltOutOfOrder', 'tcpErrCltHole', 'tcpErrSvrHole', 'tcpErrCookiePktSeqReject', 'tcpErrCookiePktSigReject', 'tcpErrCookiePktSeqDrop', 'tcpErrCookiePktMssReject', 'tcpErrRetransmit', 'tcpErrRetransmitGiveUp', 'pcbTotZombieCall', 'tcpTotSynHeld', 'tcpTotSynFlush', 'tcpTotFinWaitClosed', 'tcpErrAnyPortFail', 'tcpErrIpPortFail', 'tcpErrSentRst', 'tcpErrBadStateConn', 'tcpErrFastRetransmissions', 'tcpErrFirstRetransmissions', 'tcpErrSecondRetransmissions', 'tcpErrThirdRetransmissions', 'tcpErrForthRetransmissions', 'tcpErrFifthRetransmissions', 'tcpErrSixthRetransmissions', 'tcpErrSeventhRetransmissions', 'tcpErrDataAfterFin', 'tcpErrRstThreshold', 'tcpErrOutOfWindowPkts', 'tcpErrSynDroppedCongestion', 'tcpWaitData', 'tcpErrStrayPkt');
$oids = array_merge($oids_gauge, $oids_counter);
unset($snmpstring, $rrdupdate, $snmpdata, $snmpdata_cmd, $rrd_create);
$rrd_file = $config['rrd_dir'] . "/" . $device['hostname'] . "/netscaler-stats-tcp.rrd";
foreach ($oids_gauge as $oid) {
$oid_ds = truncate(str_replace("tcp", "", str_replace("Active", "Ac", str_replace("Passive", "Ps", str_replace("Zombie", "Zom", $oid)))), 19, '');
$rrd_create .= " DS:{$oid_ds}:GAUGE:600:U:100000000000";
}
foreach ($oids_counter as $oid) {
$oid_ds = truncate(str_replace("tcp", "", str_replace("Active", "Ac", str_replace("Passive", "Ps", str_replace("Zombie", "Zom", $oid)))), 19, '');
$rrd_create .= " DS:{$oid_ds}:COUNTER:600:U:100000000000";
}
$data = snmpwalk_cache_oid($device, "nsTcpStatsGroup", array(), "NS-ROOT-MIB");
$rrdupdate = "N";
foreach ($oids as $oid) {
if (is_numeric($data[0][$oid])) {
$rrdupdate .= ":" . $data[0][$oid];
} else {
$rrdupdate .= ":U";
}
}
if (!file_exists($rrd_file)) {
rrdtool_create($rrd_file, $rrd_create);
}
rrdtool_update($rrd_file, $rrdupdate);
$graphs['netscaler_tcp_conn'] = TRUE;
$graphs['netscaler_tcp_bits'] = TRUE;
$graphs['netscaler_tcp_pkts'] = TRUE;
示例9: snmpwalk_cache_oid
<?php
global $debug;
if ($device['os'] == "mgeups") {
# blatently copyied from APC
echo "MGE UPS External ";
# Environmental monitoring on UPSes etc
// FIXME upsmgConfigEnvironmentTable and upsmgEnvironmentSensorTable are used but there are others ...
$mge_env_data = snmpwalk_cache_oid($device, "upsmgConfigEnvironmentTable", array(), "MG-SNMP-UPS-MIB");
$mge_env_data = snmpwalk_cache_oid($device, "upsmgEnvironmentSensorTable", $mge_env_data, "MG-SNMP-UPS-MIB");
/*
upsmgConfigSensorIndex.1 = 1
upsmgConfigSensorName.1 = "Environment sensor"
upsmgConfigTemperatureLow.1 = 5
upsmgConfigTemperatureHigh.1 = 40
upsmgConfigTemperatureHysteresis.1 = 2
upsmgConfigHumidityLow.1 = 5
upsmgConfigHumidityHigh.1 = 90
upsmgConfigHumidityHysteresis.1 = 5
upsmgConfigInput1Name.1 = "Input #1"
upsmgConfigInput1ClosedLabel.1 = "closed"
upsmgConfigInput1OpenLabel.1 = "open"
upsmgConfigInput2Name.1 = "Input #2"
upsmgConfigInput2ClosedLabel.1 = "closed"
upsmgConfigInput2OpenLabel.1 = "open"
upsmgEnvironmentIndex.1 = 1
upsmgEnvironmentComFailure.1 = no
upsmgEnvironmentTemperature.1 = 287
upsmgEnvironmentTemperatureLow.1 = no
upsmgEnvironmentTemperatureHigh.1 = no
示例10: array
<?php
echo " hrDevice: ";
$hrDevice_oids = array('hrDevice', 'hrProcessorLoad');
unset($hrDevice_array);
foreach ($hrDevice_oids as $oid) {
$hrDevice_array = snmpwalk_cache_oid($device, $oid, $hrDevice_array, "HOST-RESOURCES-MIB:HOST-RESOURCES-TYPES");
}
if (is_array($hrDevice_array)) {
foreach ($hrDevice_array as $index => $entry) {
# Workaround bsnmpd reporting CPUs as hrDeviceOther (fuck you, FreeBSD.)
if ($entry['hrDeviceType'] == "hrDeviceOther" && preg_match('/^cpu[0-9]+:/', $entry['hrDeviceDescr'])) {
$entry['hrDeviceType'] = "hrDeviceProcessor";
}
if ($entry['hrDeviceType'] == "hrDeviceProcessor") {
$hrDeviceIndex = $entry['hrDeviceIndex'];
$usage_oid = ".1.3.6.1.2.1.25.3.3.1.2." . $index;
$usage = $entry['hrProcessorLoad'];
// What is this for? I have forgotten. What has : in its hrDeviceDescr?
// Set description to that found in hrDeviceDescr, first part only if containing a :
$descr_array = explode(":", $entry['hrDeviceDescr']);
if ($descr_array['1']) {
$descr = $descr_array['1'];
} else {
$descr = $descr_array['0'];
}
// Workaround to set fake description for Mikrotik who don't populate hrDeviceDescr
if ($device['os'] == "routeros" && !isset($entry['hrDeviceDescr'])) {
$descr = "Processor";
}
// Workaround to set fake description for Engenius who don't populate hrDeviceDescr
示例11: snmpwalk_cache_oid
<?php
/**
* Observium
*
* This file is part of Observium.
*
* @package observium
* @subpackage discovery
* @copyright (C) 2006-2014 Adam Armstrong
*
*/
// Note. $cache_discovery['ucd-snmp-mib'] - is cached 'UCD-SNMP-MIB::dskEntry' (see ucd-snmp-mib.inc.php in current directory)
$mib = 'HOST-RESOURCES-MIB';
if (!isset($cache_discovery['host-resources-mib'])) {
$cache_discovery['host-resources-mib'] = snmpwalk_cache_oid($device, "hrStorageEntry", NULL, "HOST-RESOURCES-MIB:HOST-RESOURCES-TYPES", mib_dirs());
if (OBS_DEBUG && count($cache_discovery['host-resources-mib'])) {
print_vars($cache_discovery['host-resources-mib']);
}
}
if (count($cache_discovery['host-resources-mib'])) {
echo " {$mib} ";
foreach ($cache_discovery['host-resources-mib'] as $index => $storage) {
$hc = 0;
$mib = 'HOST-RESOURCES-MIB';
$fstype = $storage['hrStorageType'];
$descr = $storage['hrStorageDescr'];
$units = $storage['hrStorageAllocationUnits'];
$deny = FALSE;
switch ($fstype) {
case 'hrStorageVirtualMemory':
示例12: array
<?php
$cpe_oids = array('cpeExtPsePortEnable', 'cpeExtPsePortDiscoverMode', 'cpeExtPsePortDeviceDetected', 'cpeExtPsePortIeeePd', 'cpeExtPsePortAdditionalStatus', 'cpeExtPsePortPwrMax', 'cpeExtPsePortPwrAllocated', 'cpeExtPsePortPwrAvailable', 'cpeExtPsePortPwrConsumption', 'cpeExtPsePortMaxPwrDrawn', 'cpeExtPsePortEntPhyIndex', 'cpeExtPsePortEntPhyIndex', 'cpeExtPsePortPolicingCapable', 'cpeExtPsePortPolicingEnable', 'cpeExtPsePortPolicingAction', 'cpeExtPsePortPwrManAlloc');
$peth_oids = array('pethPsePortAdminEnable', 'pethPsePortPowerPairsControlAbility', 'pethPsePortPowerPairs', 'pethPsePortDetectionStatus', 'pethPsePortPowerPriority', 'pethPsePortMPSAbsentCounter', 'pethPsePortType', 'pethPsePortPowerClassifications', 'pethPsePortInvalidSignatureCounter', 'pethPsePortPowerDeniedCounter', 'pethPsePortOverLoadCounter', 'pethPsePortShortCounter', 'pethMainPseConsumptionPower');
$port_stats = snmpwalk_cache_oid($device, 'pethPsePortEntry', $port_stats, 'POWER-ETHERNET-MIB');
$port_stats = snmpwalk_cache_oid($device, 'cpeExtPsePortEntry', $port_stats, 'CISCO-POWER-ETHERNET-EXT-MIB');
if ($port_stats[$port['ifIndex']] && $port['ifType'] == 'ethernetCsmacd' && isset($port_stats[$port['ifIndex']]['dot3StatsIndex'])) {
// Check to make sure Port data is cached.
$this_port =& $port_stats[$port['ifIndex']];
$rrdfile = $config['rrd_dir'] . '/' . $device['hostname'] . '/' . safename('port-' . $port['ifIndex'] . '-poe.rrd');
if (!file_exists($rrdfile)) {
$rrd_create .= $config['rrd_rra'];
// FIXME CISCOSPECIFIC
$rrd_create .= ' DS:PortPwrAllocated:GAUGE:600:0:U';
$rrd_create .= ' DS:PortPwrAvailable:GAUGE:600:0:U';
$rrd_create .= ' DS:PortConsumption:DERIVE:600:0:U';
$rrd_create .= ' DS:PortMaxPwrDrawn:GAUGE:600:0:U ';
rrdtool_create($rrdfile, $rrd_create);
}
$upd = "{$polled}:" . $port['cpeExtPsePortPwrAllocated'] . ':' . $port['cpeExtPsePortPwrAvailable'] . ':' . $port['cpeExtPsePortPwrConsumption'] . ':' . $port['cpeExtPsePortMaxPwrDrawn'];
$ret = rrdtool_update("{$rrdfile}", $upd);
echo 'PoE ';
}
//end if
示例13: snmpwalk_cache_oid
/**
* Observium
*
* This file is part of Observium.
*
* @package observium
* @subpackage discovery
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2016 Observium Limited
*
*/
$cml['temp'] = snmpwalk_cache_oid($device, 'scEnclTempTable', array(), 'COMPELLENT-MIB');
$cml['fan'] = snmpwalk_cache_oid($device, 'scEnclFanTable', array(), 'COMPELLENT-MIB');
$cml['ctrl'] = snmpwalk_cache_oid($device, 'scCtlrEntry', array(), 'COMPELLENT-MIB');
$cml['disk'] = snmpwalk_cache_oid($device, 'scDiskEntry', array(), 'COMPELLENT-MIB');
$cml['cache'] = snmpwalk_cache_oid($device, 'ScCacheEntry', array(), 'COMPELLENT-MIB');
foreach ($cml['temp'] as $index => $entry) {
$oid = '.1.3.6.1.4.1.16139.2.23.1.5.' . $index;
$descr = $entry['scEnclTempLocation'];
$value = $entry['scEnclTempCurrentC'];
if (is_numeric($value)) {
discover_sensor($valid['sensor'], 'temperature', $device, $oid, $index, 'compellent', $descr, 1, $value);
}
}
foreach ($cml['fan'] as $index => $entry) {
$oid = '.1.3.6.1.4.1.16139.2.20.1.3.' . $index;
$descr = $entry['scEnclFanLocation'];
$value = $entry['scEnclFanStatus'];
if ($value) {
discover_status($device, $oid, 'scEnclFanStatus.' . $index, 'compellent-mib-state', $descr, $value, array('entPhysicalClass' => 'fan'));
}
示例14: array
$netstats_poll['snmp']['oids'] = array('snmpInPkts', 'snmpOutPkts', 'snmpInBadVersions', 'snmpInBadCommunityNames', 'snmpInBadCommunityUses', 'snmpInASNParseErrs', 'snmpInTooBigs', 'snmpInNoSuchNames', 'snmpInBadValues', 'snmpInReadOnlys', 'snmpInGenErrs', 'snmpInTotalReqVars', 'snmpInTotalSetVars', 'snmpInGetRequests', 'snmpInGetNexts', 'snmpInSetRequests', 'snmpInGetResponses', 'snmpInTraps', 'snmpOutTooBigs', 'snmpOutNoSuchNames', 'snmpOutBadValues', 'snmpOutGenErrs', 'snmpOutGetRequests', 'snmpOutGetNexts', 'snmpOutSetRequests', 'snmpOutGetResponses', 'snmpOutTraps', 'snmpSilentDrops', 'snmpProxyDrops');
foreach ($netstats_poll as $type => $netstats) {
$oids = $netstats['oids'];
if (isset($netstats['oids_t'])) {
$oids_string = implode('.0 ', $netstats['oids_t']) . '.0';
$data = snmp_get_multi($device, $oids_string, '-OQUs', $netstats['mib'], mib_dirs());
// get testing oids
if (!count($data)) {
continue;
}
$data_array = $data[0];
$oids_string = implode('.0 ', array_diff($oids, $netstats['oids_t'])) . '.0';
$data = snmp_get_multi($device, $oids_string, '-OQUs', $netstats['mib'], mib_dirs());
$data_array += $data[0];
} else {
$data = snmpwalk_cache_oid($device, $type, array(), $netstats['mib'], mib_dirs());
if (!count($data)) {
continue;
}
$data_array = $data[0];
}
echo strtoupper($type) . ' ';
$rrd_file = $config['rrd_dir'] . '/' . $device['hostname'] . '/netstats-' . $type . '.rrd';
$rrd_create = '';
$rrd_update = 'N';
foreach ($oids as $oid) {
$oid_ds = truncate($oid, 19, '');
$rrd_create .= ' DS:' . $oid_ds . ':COUNTER:600:U:4294967295';
// Counter32 max value 2^32 = 4294967295
$value = is_numeric($data_array[$oid]) ? $data_array[$oid] : 'U';
$rrd_update .= ':' . $value;
示例15: time
if ($device['type'] == 'wireless' && $device['os'] == 'arubaos') {
global $config;
echo 'Aruba Controller: ';
$polled = time();
// Build SNMP Cache Array
// stuff about the controller
$switch_info_oids = array('wlsxSwitchRole', 'wlsxSwitchMasterIp');
$switch_counter_oids = array('wlsxSwitchTotalNumAccessPoints.0', 'wlsxSwitchTotalNumStationsAssociated.0');
$switch_apinfo_oids = array('wlsxWlanRadioEntry', 'wlanAPChInterferenceIndex');
$switch_apname_oids = array('wlsxWlanRadioEntry.16');
$aruba_oids = array_merge($switch_info_oids, $switch_counter_oids);
echo 'Caching Oids: ';
foreach ($aruba_oids as $oid) {
echo "{$oid} ";
$aruba_stats = snmpwalk_cache_oid($device, $oid, $aruba_stats, 'WLSX-SWITCH-MIB');
}
foreach ($switch_apinfo_oids as $oid) {
echo "{$oid} ";
$aruba_apstats = snmpwalk_cache_oid_num($device, $oid, $aruba_apstats, 'WLSX-WLAN-MIB');
}
foreach ($switch_apname_oids as $oid) {
echo "{$oid} ";
$aruba_apnames = snmpwalk_cache_oid_num($device, $oid, $aruba_apnames, 'WLSX-WLAN-MIB');
}
echo "\n";
$rrdfile = $host_rrd . '/aruba-controller' . safename('.rrd');
if (!is_file($rrdfile)) {
rrdtool_create($rrdfile, ' --step 300 DS:NUMAPS:GAUGE:600:0:12500000000 DS:NUMCLIENTS:GAUGE:600:0:12500000000 ' . $config['rrd_rra']);
}
$fields = array('NUMAPS' => $aruba_stats[0]['wlsxSwitchTotalNumAccessPoints'], 'NUMCLIENTS' => $aruba_stats[0]['wlsxSwitchTotalNumStationsAssociated']);