本文整理汇总了PHP中discover_status函数的典型用法代码示例。如果您正苦于以下问题:PHP discover_status函数的具体用法?PHP discover_status怎么用?PHP discover_status使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了discover_status函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: foreach
foreach ($config['mibs'][$mib]['status'] as $oid => $oid_data) {
print_cli($oid . ' [');
foreach ($oid_data['indexes'] as $index => $entry) {
$entry['oid'] = $oid;
if (empty($entry['oid_num'])) {
// Use snmptranslate if oid_num not set
$entry['oid_num'] = snmp_translate($oid . '.' . $index, $mib);
}
$value = snmp_get($device, $entry['oid_num'], '-OQUvsn');
if (is_numeric($value)) {
// Fetch description from oid if specified
if (isset($entry['oid_descr'])) {
$entry['descr'] = snmp_get($device, $entry['oid_descr'], '-OQUvs');
}
rename_rrd($device, "status-" . $entry['type'] . '-' . $index, "status-" . $entry['type'] . '-' . "{$oid}.{$index}");
discover_status($device, $entry['oid_num'], "{$oid}.{$index}", $entry['type'], $entry['descr'], $value, array('entPhysicalClass' => $entry['measured']));
}
}
print_cli('] ');
}
print_cli('] ');
}
}
if (OBS_DEBUG > 1 && count($valid['sensor'])) {
print_vars($valid['sensor']);
}
foreach (array_keys($config['sensor_types']) as $type) {
check_valid_sensors($device, $type, $valid['sensor']);
}
if (OBS_DEBUG > 1 && count($valid['status'])) {
print_vars($valid['status']);
示例2: discover_status
$value = $entry['npSmokeStatus'];
if ($value) {
discover_status($device, $oid, 'npSmokeStatus.' . $index, 'dskf-mib-smoke-state', $descr, $value, array('entPhysicalClass' => 'other'));
}
}
$cache_discovery['DKSF-50-11-X-X-X']['loop'] = snmpwalk_cache_multi_oid($device, 'npCurLoopTable', array(), 'DKSF-50-11-X-X-X');
foreach ($cache_discovery['DKSF-50-11-X-X-X']['loop'] as $index => $entry) {
if ($entry['npCurLoopPower'] == 'off' || $entry['npCurLoopStatus'] == 'notPowered') {
continue;
}
$descr = 'Analog Smoke ' . $index;
// Loop state
$oid = '.1.3.6.1.4.1.25728.8300.1.1.2.' . $index;
$value = $entry['npCurLoopStatus'];
if ($value) {
discover_status($device, $oid, 'npCurLoopStatus.' . $index, 'dskf-mib-loop-state', $descr, $value, array('entPhysicalClass' => 'other'));
}
// Loop current
$oid = '.1.3.6.1.4.1.25728.8300.1.1.3.' . $index;
$value = $entry['npCurLoopI'];
if ($value) {
discover_sensor($valid['sensor'], 'current', $device, $oid, 'npCurLoopI.' . $index, 'dskf-mib-loop', $descr, 0.001, $value);
}
// Loop voltage
$oid = '.1.3.6.1.4.1.25728.8300.1.1.4.' . $index;
$value = $entry['npCurLoopV'];
if ($value) {
discover_sensor($valid['sensor'], 'voltage', $device, $oid, 'npCurLoopV.' . $index, 'dskf-mib-loop', $descr, 0.001, $value);
}
// Loop resistance
$oid = '.1.3.6.1.4.1.25728.8300.1.1.5.' . $index;
示例3: discover_status
discover_status($device, $oid, "accessPXStatusFrontDoorAlarmStatus.{$index}", 'powernet-door-alarm-state', $descr, $entry['accessPXStatusFrontDoorAlarmStatus']);
}
// accessPXConfigRearDoorLockControl.0 = INTEGER: lock(2)
// accessPXConfigRearDoorMaxOpenTime.0 = INTEGER: 10
// accessPXStatusRearDoorLock.0 = INTEGER: locked(2)
// accessPXStatusRearDoor.0 = INTEGER: closed(2)
// accessPXStatusRearDoorHandle.0 = INTEGER: closed(2)
// accessPXStatusRearDoorMaxOpenTime.0 = INTEGER: 10
// accessPXStatusRearDoorAlarmStatus.0 = INTEGER: 1
if ($entry['accessPXStatusRearDoorLock']) {
$descr = 'Rear Door Lock';
$oid = ".1.3.6.1.4.1.318.1.1.20.1.6.1.{$index}";
discover_status($device, $oid, "accessPXStatusRearDoorLock.{$index}", 'powernet-door-lock-state', $descr, $entry['accessPXStatusRearDoorLock']);
}
if ($entry['accessPXStatusRearDoor']) {
$descr = 'Rear Door';
$oid = ".1.3.6.1.4.1.318.1.1.20.1.6.2.{$index}";
discover_status($device, $oid, "accessPXStatusRearDoor.{$index}", 'powernet-door-state', $descr, $entry['accessPXStatusRearDoor']);
}
if ($entry['accessPXStatusRearDoorHandle']) {
$descr = 'Rear Door Handle';
$oid = ".1.3.6.1.4.1.318.1.1.20.1.6.3.{$index}";
discover_status($device, $oid, "accessPXStatusRearDoorHandle.{$index}", 'powernet-door-state', $descr, $entry['accessPXStatusRearDoorHandle']);
}
if ($entry['accessPXStatusRearDoorAlarmStatus']) {
$descr = 'Rear Door Alarm Status';
$oid = ".1.3.6.1.4.1.318.1.1.20.1.6.5.{$index}";
discover_status($device, $oid, "accessPXStatusRearDoorAlarmStatus.{$index}", 'powernet-door-alarm-state', $descr, $entry['accessPXStatusRearDoorAlarmStatus']);
}
}
// EOF
示例4: hexdec
if ($entry['inletName'] != '') {
$descr = "Inlet {$index}: " . $entry['inletName'];
} else {
$descr = "Inlet {$index}";
}
$rmsCurrentThreshold = hexdec($inlet_thresholds["{$index}.{$measure_type}"]);
$limits = array('limit_low' => $inlet_thresholds[$index . '.' . $measure_type]['inletSensorEnabledThresholds'] & 128 ? $inlet_lower_crit_threshold[$index . '.' . $measure_type]['inletSensorLowerCriticalThreshold'] * $measure_data['scale'] : null, 'limit_low_warn' => $inlet_thresholds[$index . '.' . $measure_type]['inletSensorEnabledThresholds'] & 64 ? $inlet_lower_warn_threshold[$index . '.' . $measure_type]['inletSensorLowerWarningThreshold'] * $measure_data['scale'] : null, 'limit_high_warn' => $inlet_thresholds[$index . '.' . $measure_type]['inletSensorEnabledThresholds'] & 32 ? $inlet_upper_warn_threshold[$index . '.' . $measure_type]['inletSensorUpperWarningThreshold'] * $measure_data['scale'] : null, 'limit_high' => $inlet_thresholds[$index . '.' . $measure_type]['inletSensorEnabledThresholds'] & 16 ? $inlet_upper_crit_threshold[$index . '.' . $measure_type]['inletSensorUpperCriticalThreshold'] * $measure_data['scale'] : null);
if ($value !== false) {
discover_sensor($valid['sensor'], $measure_data['class'], $device, $oid, "inlet.{$index}.{$measure_type}", 'raritan', $descr, $measure_data['scale'], $value, $limits);
}
}
}
// Over Current Protectors
$over_current_protector_names = snmpwalk_cache_oid($device, "PDU2-MIB::overCurrentProtectorName.1", array(), "PDU2-MIB");
$protector_thresholds = snmpwalk_cache_oid($device, "PDU2-MIB::overCurrentProtectorSensorEnabledThresholds.1", array(), "PDU2-MIB");
$measurements = snmpwalk_cache_oid($device, "PDU2-MIB::measurementsOverCurrentProtectorSensorValue.1", array(), "PDU2-MIB");
$over_current_protector_lower_crit_threshold = snmpwalk_cache_oid($device, "PDU2-MIB::overCurrentProtectorSensorLowerCriticalThreshold.1", array(), "PDU2-MIB");
$over_current_protector_lower_warn_threshold = snmpwalk_cache_oid($device, "PDU2-MIB::overCurrentProtectorSensorLowerWarningThreshold.1", array(), "PDU2-MIB");
$over_current_protector_upper_warn_threshold = snmpwalk_cache_oid($device, "PDU2-MIB::overCurrentProtectorSensorUpperWarningThreshold.1", array(), "PDU2-MIB");
$over_current_protector_upper_crit_threshold = snmpwalk_cache_oid($device, "PDU2-MIB::overCurrentProtectorSensorUpperCriticalThreshold.1", array(), "PDU2-MIB");
foreach ($over_current_protector_names as $index => $entry) {
$limits = array('limit_low' => $protector_thresholds[$index . '.rmsCurrent']['overCurrentProtectorSensorEnabledThresholds'] & 128 ? $over_current_protector_lower_crit_threshold[$index . '.rmsCurrent']['overCurrentProtectorSensorLowerCriticalThreshold'] * 0.1 : null, 'limit_low_warn' => $protector_thresholds[$index . '.rmsCurrent']['overCurrentProtectorSensorEnabledThresholds'] & 64 ? $over_current_protector_lower_warn_threshold[$index . '.rmsCurrent']['overCurrentProtectorSensorLowerWarningThreshold'] * 0.1 : null, 'limit_high_warn' => $protector_thresholds[$index . '.rmsCurrent']['overCurrentProtectorSensorEnabledThresholds'] & 32 ? $over_current_protector_upper_warn_threshold[$index . '.rmsCurrent']['overCurrentProtectorSensorUpperWarningThreshold'] * 0.1 : null, 'limit_high' => $protector_thresholds[$index . '.rmsCurrent']['overCurrentProtectorSensorEnabledThresholds'] & 16 ? $over_current_protector_upper_crit_threshold[$index . '.rmsCurrent']['overCurrentProtectorSensorUpperCriticalThreshold'] * 0.1 : null);
$value = $measurements["{$index}.rmsCurrent"]['measurementsOverCurrentProtectorSensorValue'];
$oid = ".1.3.6.1.4.1.13742.6.5.3.3.1.4.{$index}.1";
discover_sensor($valid['sensor'], 'current', $device, $oid, "tripsensorvalue.{$index}", 'raritan', "Over Current Protector {$index}", 0.1, $value, $limits);
$value = $measurements["{$index}.trip"]['measurementsOverCurrentProtectorSensorValue'];
$oid = ".1.3.6.1.4.1.13742.6.5.3.3.1.4.{$index}.15";
// discover_sensor($valid['sensor'], 'state', $device, $oid, "tripsensor.$index", 'raritan', "Over Current Protector $index", NULL, $value, array('entPhysicalClass' => 'power'));
discover_status($device, $oid, "measurementsOverCurrentProtectorSensorValue" . $index, "pdu2-sensorstate", "Over Current Protector {$index}", $value, array('entPhysicalClass' => 'status'));
}
// EOF
示例5: print_debug
$stateoid = '.1.3.6.1.4.1.9.9.500.1.2.1.1.6.' . $index;
$statedescr = 'Switch ' . $entry['cswSwitchNumCurrent'] . ' stacking state';
if ($stack_count === 1 && $entry['cswSwitchNumCurrent'] == 1 && $stackredundant == 'false' && $ports_down === 2 && $entry['cswSwitchRole'] == 'master' && $entry['cswSwitchState'] == 'ready') {
// Heh, on IOS 15.x stacking is always enabled and does not have any way to detect if stack module exists and stacking is configured
$stack_count = 0;
print_debug("Stacking exists, but not configured and not active.");
break;
// exit foreach
}
if (!empty($entry['cswSwitchRole'])) {
discover_status($device, $roleoid, "cswSwitchRole.{$index}", 'cisco-stackwise-member-state', $roledescr, $entry['cswSwitchRole'], array('entPhysicalClass' => 'stack', 'entPhysicalIndex' => $index));
discover_status($device, $stateoid, "cswSwitchState.{$index}", 'cisco-stackwise-switch-state', $statedescr, $entry['cswSwitchState'], array('entPhysicalClass' => 'stack', 'entPhysicalIndex' => $index));
}
}
if ($stack_count) {
$oid = '.1.3.6.1.4.1.9.9.500.1.1.3.0';
$descr = 'Stack is redundant';
discover_status($device, $oid, "cswRingRedundant.0", 'cisco-stackwise-redundant-state', $descr, $stackredundant, array('entPhysicalClass' => 'stack'));
foreach ($stackportoper as $index => $entry) {
$oid = '.1.3.6.1.4.1.9.9.500.1.2.2.1.1.' . $index;
$port = get_port_by_index_cache($device, $index);
$descr = 'Stackport ' . $port['port_label'];
if (!empty($entry['cswStackPortOperStatus'])) {
$options = array('entPhysicalClass' => 'port', 'entPhysicalIndex' => $index, 'measured_class' => 'port', 'measured_entity' => $port['port_id']);
discover_status($device, $oid, "cswStackPortOperStatus.{$index}", 'cisco-stackwise-port-oper-state', $descr, $entry['cswStackPortOperStatus'], $options);
}
}
}
}
unset($device_tmp);
// EOF
示例6: snmpwalk_cache_twopart_oid
}
}
}
}
// Collect data about outputs
$outlets = snmpwalk_cache_twopart_oid($device, 'outletTable', array(), 'EATON-EPDU-MIB');
$outlets = snmpwalk_cache_twopart_oid($device, 'outletCurrentTable', $outlets, 'EATON-EPDU-MIB');
// Power statistics currently not collected.
//$outlets = snmpwalk_cache_twopart_oid($device, 'outletCurrentTable', $outlets, 'EATON-EPDU-MIB');
foreach ($outlets as $unit_id => $unit_data) {
foreach ($unit_data as $outlet_id => $outlet) {
$outlet_index = $unit_id . "." . $outlet_id;
$outlet_descr = "Unit {$unit_id} " . $outlet['outletName'] . " (" . $outlet['outletType'] . ")";
$outlet_capacity = $outlet['outletCurrentCapacity'] * 0.001;
$current_value = $outlet['outletCurrent'];
$percent_value = $outlet['outletCurrentPercentLoad'];
$status_value = $outlet['outletCurrentThStatus'];
$crest_value = $outlet['outletCurrentCrestFactor'];
$current_oid = '.1.3.6.1.4.1.534.6.6.7.6.4.1.3.' . $outlet_index;
$percent_oid = '.1.3.6.1.4.1.534.6.6.7.6.4.1.10.' . $outlet_index;
$status_oid = '.1.3.6.1.4.1.534.6.6.7.6.4.1.4.' . $outlet_index;
$crest_oid = '.1.3.6.1.4.1.534.6.6.7.6.4.1.9.' . $outlet_index;
discover_status($device, $status_oid, "outletCurrentThStatus." . $outlet_index, 'outletCurrentThStatus', $outlet_descr, $status_value, array('entPhysicalClass' => 'outlet'));
$limits = array('limit_low' => $entry['outletCurrentThLowerCritical'] * 0.001, 'limit_low_warn' => $entry['outletCurrentThLowerWarning'] * 0.001, 'limit_high' => $entry['outletCurrentThUpperCritical'] * 0.001, 'limit_high_warn' => $entry['outletCurrentThUpperWarning'] * 0.001);
discover_sensor($valid['sensor'], 'current', $device, $current_oid, "outletCurrent.{$outlet_index}", 'eaton-epdu-mib', $outlet_descr, 0.001, $current_value, $limits);
discover_sensor($valid['sensor'], 'load', $device, $percent_oid, "outletCurrentPercentLoad.{$outlet_index}", 'eaton-epdu-mib', $outlet_descr, 1, $percent_value);
discover_sensor($valid['sensor'], 'crestfactor', $device, $crest_oid, "outletCurrentCrestFactor.{$outlet_index}", 'eaton-epdu-mib', $outlet_descr, 1, $crest_value);
}
}
//print_r($outlets);
/// EOF
示例7: elseif
break;
case 'value':
if (in_array($unit, array('.C', 'degree C'))) {
$t = "temperature";
} elseif ($unit == "V") {
$t = "voltage";
} elseif ($unit == "%") {
if (stristr($name, "RPM")) {
$t = "load";
}
} elseif ($unit == "l/min") {
$t = "waterflow";
} elseif ($unit == "W") {
$t = "power";
} elseif ($unit == "A") {
$t = "current";
}
break;
default:
continue;
}
if ($t) {
if ($t == "status") {
discover_status($device, $oid, $index, "rittal-cmc-iii-state", $name, $value, array('entPhysicalClass' => 'other'));
} else {
$limits = array();
discover_sensor($valid['sensor'], $t, $device, $oid, "cmcIIIVarTable.{$deviceIndex}.{$sensorIndex}", "Rittal-CMC-III", $name, $scale, $value, $limits);
}
}
}
}
示例8: snmpwalk_cache_multi_oid
<?php
/**
* Observium
*
* This file is part of Observium.
*
* @package observium
* @subpackage discovery
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2016 Observium Limited
*
*/
echo " HH3C-STACK-MIB ";
$stack_members = snmpwalk_cache_multi_oid($device, 'hh3cStackBoardConfigTable', array(), 'HH3C-STACK-MIB', mib_dirs('hh3c'));
foreach ($stack_members as $index => $entry) {
//HH3C-STACK-MIB::hh3cStackBoardRole.112 = INTEGER: slave(1)
//HH3C-STACK-MIB::hh3cStackBoardBelongtoMember.112 = INTEGER: 1
$value = $entry['hh3cStackBoardRole'];
$oid = ".1.3.6.1.4.1.25506.2.91.3.1.1.{$index}";
$descr = "Board " . $entry['hh3cStackBoardBelongtoMember'];
discover_status($device, $oid, "hh3cStackBoardConfigTable." . $index, "hh3c-stack-board-status", $descr, $value, array('entPhysicalIndex' => $index, 'entPhysicalClass' => 'module'));
}
// EOF
示例9: array
case 'lock':
case 'access':
case 'detACfirstAlarm':
case 'detACmainAlarm':
case 'detACfault':
$t = 'status';
break;
default:
continue;
}
$name = $unit_name . ' ' . $name;
$limits = array();
if ($high != 0) {
$limits['limit_high'] = $high;
}
if ($low != 0) {
$limits['limit_low'] = $low;
}
if ($warn != 0) {
$limits['limit_warn_high'] = $warn;
}
if ($t == 'status') {
$oid = $table['statusOID'] . $index;
discover_status($device, $oid, $index, "rittal-cmc-tc-state", $name, $status, array('entPhysicalClass' => 'status'));
} else {
discover_sensor($valid['sensor'], $t, $device, $oid, "{$tablename}.{$index}", "Rittal-CMC-TC", $name, $scale, $value, $limits);
}
}
}
}
// EOF
示例10: discover_sensor
function discover_sensor(&$valid, $class, $device, $oid, $index, $type, $sensor_descr, $scale = 1, $current = NULL, $options = array(), $poller_type = 'snmp')
{
global $config;
// If this is actually a status indicator, pass it off to discover_status() then return.
if ($class == 'state' || $class == 'status') {
print_debug("Redirect call to discover_status().");
$return = discover_status($device, $oid, $index, $type, $sensor_descr, $current, $options, $poller_type);
return $return;
}
// Init main
$param_main = array('oid' => 'sensor_oid', 'sensor_descr' => 'sensor_descr', 'scale' => 'sensor_multiplier');
// Init numeric values
if (!is_numeric($scale) || $scale == 0) {
$scale = 1;
}
// Skip discovery sensor if value not numeric or null (default)
if ($current !== NULL) {
// Some retarded devices report data with spaces and commas
// STRING: " 20,4"
$current = snmp_fix_numeric($current);
}
if (is_numeric($current)) {
$f2c = FALSE;
if ($class == 'temperature') {
// This is weird hardcode for convert Fahrenheit to Celsius
foreach (array(1, 0.1) as $scale_f2c) {
if (float_cmp($scale, $scale_f2c * 5 / 9) === 0) {
//$scale = $scale_tmp;
$f2c = TRUE;
break;
}
}
}
if ($f2c) {
$current = f2c($current * $scale_f2c);
print_debug('TEMPERATURE sensor: Fahrenheit -> Celsius');
} else {
$current *= $scale;
}
} else {
if ($current !== NULL) {
print_debug("Sensor skipped by not numeric value: {$current}, {$sensor_descr} ");
return FALSE;
}
}
$param_limits = array('limit_high' => 'sensor_limit', 'limit_high_warn' => 'sensor_limit_warn', 'limit_low' => 'sensor_limit_low', 'limit_low_warn' => 'sensor_limit_low_warn');
foreach ($param_limits as $key => $column) {
${$key} = is_numeric($options[$key]) ? $options[$key] : NULL;
}
// Init optional
$param_opt = array('entPhysicalIndex', 'entPhysicalClass', 'entPhysicalIndex_measured', 'measured_class', 'measured_entity');
foreach ($param_opt as $key) {
${$key} = $options[$key] ? $options[$key] : NULL;
}
print_debug("发现传感器: {$class}, " . $device['hostname'] . ", {$oid}, {$index}, {$type}, {$sensor_descr}, SCALE: {$scale}, LIMITS: ({$limit_low}, {$limit_low_warn}, {$limit_high_warn}, {$limit_high}), CURRENT: {$current}, {$poller_type}, {$entPhysicalIndex}, {$entPhysicalClass}");
// Check sensor ignore filters
foreach ($config['ignore_sensor'] as $bi) {
if (strcasecmp($bi, $sensor_descr) == 0) {
print_debug("Skipped by equals: {$bi}, {$sensor_descr} ");
return FALSE;
}
}
foreach ($config['ignore_sensor_string'] as $bi) {
if (stripos($sensor_descr, $bi) !== FALSE) {
print_debug("Skipped by strpos: {$bi}, {$sensor_descr} ");
return FALSE;
}
}
foreach ($config['ignore_sensor_regexp'] as $bi) {
if (preg_match($bi, $sensor_descr) > 0) {
print_debug("Skipped by regexp: {$bi}, {$sensor_descr} ");
return FALSE;
}
}
if (!is_null($limit_low_warn) && !is_null($limit_high_warn) && $limit_low_warn > $limit_high_warn) {
// Fix high/low thresholds (i.e. on negative numbers)
list($limit_high_warn, $limit_low_warn) = array($limit_low_warn, $limit_high_warn);
}
if (dbFetchCell('SELECT COUNT(`sensor_id`) FROM `sensors`
WHERE `poller_type`= ? AND `sensor_class` = ? AND `device_id` = ? AND `sensor_type` = ? AND `sensor_index` = ?', array($poller_type, $class, $device['device_id'], $type, $index)) == '0') {
if (!$limit_high) {
$limit_high = sensor_limit_high($class, $current);
}
if (!$limit_low) {
$limit_low = sensor_limit_low($class, $current);
}
if (!is_null($limit_low) && !is_null($limit_high) && $limit_low > $limit_high) {
// Fix high/low thresholds (i.e. on negative numbers)
list($limit_high, $limit_low) = array($limit_low, $limit_high);
print_debug("High/low limits swapped.");
}
$sensor_insert = array('poller_type' => $poller_type, 'sensor_class' => $class, 'device_id' => $device['device_id'], 'sensor_index' => $index, 'sensor_type' => $type);
foreach ($param_main as $key => $column) {
$sensor_insert[$column] = ${$key};
}
foreach ($param_limits as $key => $column) {
// Convert strings/numbers to (float) or to array('NULL')
${$key} = ${$key} === NULL ? array('NULL') : (double) ${$key};
$sensor_insert[$column] = ${$key};
}
//.........这里部分代码省略.........
示例11: 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
*
*/
$atto_fc_ports = snmpwalk_cache_oid($device, 'fcPortPortNumber', array(), 'ATTO6500N-MIB');
foreach ($atto_fc_ports as $port) {
$index = $port['fcPortPortNumber'];
$sensorName = "FiberChannel Port.{$index}";
$oid = ".1.3.6.1.4.1.4547.2.3.3.1.1.3.{$index}";
// FIXME why value NULL? Just use the entry from $port['whatevertheoidis'] ?
discover_status($device, $index, "fcPortOperationalState.{$index}", 'atto6500n-mib-fcPort', $sensorName, NULL, array('entPhysicalClass' => 'port'));
}
$atto_sas_ports = snmpwalk_cache_oid($device, 'sasPortPortNumber', array(), 'ATTO6500N-MIB');
foreach ($atto_sas_ports as $port) {
$index = $port['sasPortPortNumber'];
$sensorName = "SAS Port {$index}";
$oid = ".1.3.6.1.4.1.4547.2.3.3.3.1.2.{$index}";
// FIXME same as above
discover_status($device, $index, "sasPortOperationalState.{$index}", 'atto6500n-mib-sasPort', $sensorName, NULL, array('entPhysicalClass' => 'port'));
}
unset($atto_fc_ports, $atto_sas_ports);
// EOF
示例12: snmpwalk_cache_oid
//LIEBERT-GP-ENVIRONMENTAL-MIB::lgpEnvStateCoolingCapacity.0 = Gauge32: 81 percent
//LIEBERT-GP-ENVIRONMENTAL-MIB::lgpEnvStateHeatingCapacity.0 = Gauge32: 0 percent
//LIEBERT-GP-ENVIRONMENTAL-MIB::lgpEnvStateOperatingReason.0 = INTEGER: none(1)
//LIEBERT-GP-ENVIRONMENTAL-MIB::lgpEnvStateOperatingMode.0 = INTEGER: auto(1)
//LIEBERT-GP-ENVIRONMENTAL-MIB::lgpEnvStateFanCapacity.0 = Gauge32: 60 percent
//LIEBERT-GP-ENVIRONMENTAL-MIB::lgpEnvStateFreeCoolingCapacity.0 = Gauge32: 0 percent
//LIEBERT-GP-ENVIRONMENTAL-MIB::lgpEnvStateDehumidifyingCapacity.0 = Gauge32: 81 percent
//LIEBERT-GP-ENVIRONMENTAL-MIB::lgpEnvStateHumidifyingCapacity.0 = Gauge32: 0 percent
//LIEBERT-GP-ENVIRONMENTAL-MIB::lgpEnvStateFreeCooling.0 = INTEGER: off(2)
//LIEBERT-GP-ENVIRONMENTAL-MIB::lgpEnvStateElectricHeater.0 = INTEGER: off(2)
//LIEBERT-GP-ENVIRONMENTAL-MIB::lgpEnvStateHotWater.0 = INTEGER: off(2)
$lgpEnvState = snmpwalk_cache_oid($device, 'lgpEnvState', array(), 'LIEBERT-GP-ENVIRONMENTAL-MIB');
$states = array('lgpEnvStateSystem' => array('type' => 'state', 'oid' => '.1.3.6.1.4.1.476.1.42.3.4.3.1.0'), 'lgpEnvStateCooling' => array('type' => 'state', 'oid' => '.1.3.6.1.4.1.476.1.42.3.4.3.2.0'), 'lgpEnvStateHumidifying' => array('type' => 'state', 'oid' => '.1.3.6.1.4.1.476.1.42.3.4.3.4.0'), 'lgpEnvStateDehumidifying' => array('type' => 'state', 'oid' => '.1.3.6.1.4.1.476.1.42.3.4.3.5.0'), 'lgpEnvStateFan' => array('type' => 'state', 'oid' => '.1.3.6.1.4.1.476.1.42.3.4.3.7.0'), 'lgpEnvStateFreeCooling' => array('type' => 'state', 'oid' => '.1.3.6.1.4.1.476.1.42.3.4.3.20.0'), 'lgpEnvStateElectricHeater' => array('type' => 'state', 'oid' => '.1.3.6.1.4.1.476.1.42.3.4.3.21.0'), 'lgpEnvStateHotWater' => array('type' => 'state', 'oid' => '.1.3.6.1.4.1.476.1.42.3.4.3.22.0'), 'lgpEnvStateCoolingCapacity' => array('type' => 'capacity', 'oid' => '.1.3.6.1.4.1.476.1.42.3.4.3.9.0'), 'lgpEnvStateHeatingCapacity' => array('type' => 'capacity', 'oid' => '.1.3.6.1.4.1.476.1.42.3.4.3.10.0'), 'lgpEnvStateFanCapacity' => array('type' => 'capacity', 'oid' => '.1.3.6.1.4.1.476.1.42.3.4.3.16.0'), 'lgpEnvStateFreeCoolingCapacity' => array('type' => 'capacity', 'oid' => '.1.3.6.1.4.1.476.1.42.3.4.3.17.0'), 'lgpEnvStateDehumidifyingCapacity' => array('type' => 'capacity', 'oid' => '.1.3.6.1.4.1.476.1.42.3.4.3.18.0'));
foreach ($lgpEnvState[0] as $name => $value) {
$descr = str_replace('lgpEnvState', '', $name);
$descr = trim(preg_replace('/([A-Z][a-z]+\\d*)/', '$1 ', $descr));
// turn "EnvStateSystem" into "Env State System"
if (isset($states[$name])) {
$oid = $states[$name]['oid'];
switch ($states[$name]['type']) {
case 'capacity':
// Capacity
discover_sensor($valid['sensor'], 'capacity', $device, $oid, "{$name}.0", 'liebert', $descr, 1, $value);
break;
default:
// Statuses
discover_status($device, $oid, "{$name}.0", 'liebert-state', $descr, $value);
}
}
}
// EOF
示例13: array
if (isset($entry['upsmgBatteryRemainingTime'])) {
$descr = "Battery Runtime Remaining";
$oid = ".1.3.6.1.4.1.705.1.5.1.{$index}";
$limits = array('limit_low' => snmp_get($device, "upsmgConfigLowBatteryTime.0", "-Oqv", "MG-SNMP-UPS-MIB"));
$value = $entry['upsmgBatteryRemainingTime'];
$scale = 1 / 60;
// FIXME: Use this as limit?
// MG-SNMP-UPS-MIB::upsmgConfigLowBatteryTime.0 = 180
discover_sensor($valid['sensor'], 'runtime', $device, $oid, "upsmgBatteryRemainingTime.{$index}", 'mge', $descr, $scale, $value);
}
// MG-SNMP-UPS-MIB::upsmgBatteryFaultBattery.0 = no
if (isset($entry['upsmgBatteryFaultBattery'])) {
$descr = "Battery Fault";
$oid = ".1.3.6.1.4.1.705.1.5.9.{$index}";
$value = $entry['upsmgBatteryFaultBattery'];
discover_status($device, $oid, "upsmgBatteryFaultBattery.{$index}", 'mge-status-state', $descr, $value, array('entPhysicalClass' => 'battery'));
}
// MG-SNMP-UPS-MIB::upsmgBatteryChargerFault.0 = no
if (isset($entry['upsmgBatteryChargerFault'])) {
$descr = "Charger Fault";
$oid = ".1.3.6.1.4.1.705.1.5.15.{$index}";
$value = $entry['upsmgBatteryChargerFault'];
discover_sensor($valid['sensor'], 'state', $device, $oid, "upsmgBatteryChargerFault.{$index}", 'mge-status-state', $descr, NULL, $value, array('entPhysicalClass' => 'battery'));
}
// MG-SNMP-UPS-MIB::upsmgBatteryLowBattery.0 = no
// According to MGE, LowCondition is the correct indicator, so we ignore LowBattery.
// MG-SNMP-UPS-MIB::upsmgBatteryLowCondition.0 = no
if (isset($entry['upsmgBatteryLowCondition'])) {
$descr = "Battery Low";
$oid = ".1.3.6.1.4.1.705.1.5.16.{$index}";
$value = $entry['upsmgBatteryLowCondition'];
示例14: snmp_get
<?php
/**
* Observium
*
* This file is part of Observium.
*
* @package observium
* @subpackage discovery
* @copyright (C) 2006-2015 Adam Armstrong
*
*/
echo " NS-ROOT-MIB ";
// Collect HAMode & HAState
$sysHighAvailabilityMode = snmp_get($device, 'sysHighAvailabilityMode.0', '-Ovq', 'NS-ROOT-MIB', mib_dirs('citrix'));
$haCurState = snmp_get($device, 'haCurState.0', '-Ovq', 'NS-ROOT-MIB', mib_dirs('citrix'));
if ($sysHighAvailabilityMode !== '' && $haCurState !== '') {
$descr = 'High Availability Status';
// $oid = '.1.3.6.1.4.1.5951.4.1.1.6.0'; $oid = '1.3.6.1.4.1.5951.4.1.1.23.24.0';
// $value = $sysHighAvailabilityMode; $value = $haCurState;
discover_status($device, 'netscaler-ha-0', '0', 'netscaler-ha', $descr, NULL, array('entPhysicalClass' => 'other'));
}
unset($sysHighAvailabilityMode);
unset($haCurState);
// EOF
示例15: explode
$descr = explode(',', $huawei['sensors_names'][$index]['hwEntityBomEnDesc']);
$value = $entry['hwEntityTemperature'];
if ($entry['hwEntityTemperature'] > 0 && $value <= 1000) {
$options = array('limit_high' => snmp_get($device, "hwEntityTemperatureThreshold.{$index}", '-Osqv', 'HUAWEI-ENTITY-EXTENT-MIB'));
discover_sensor($valid['sensor'], 'temperature', $device, $oid, $index, 'huawei', $descr[0], 1, $value, $options);
}
}
unset($options);
foreach ($huawei['fan'] as $index => $entry) {
$oid = '.1.3.6.1.4.1.2011.5.25.31.1.1.10.1.5.' . $index;
$fanstateoid = '.1.3.6.1.4.1.2011.5.25.31.1.1.10.1.7.' . $index;
$value = $entry['hwEntityFanSpeed'];
$descr = 'Slot ' . $entry['hwEntityFanSlot'] . ' Fan ' . $entry['hwEntityFanSn'];
if ($entry['hwEntityFanSpeed'] > 0) {
discover_sensor($valid['sensor'], 'load', $device, $oid, $index, 'huawei', $descr, 1, $value);
discover_status($device, $fanstateoid, $index, 'huawei-entity-ext-mib-fan-state', $descr, $entry['hwEntityFanState'], array('entPhysicalClass' => 'fan'));
}
}
foreach ($opticalarray as $index => $entry) {
if ($entry['entPhysicalClass'] === 'port') {
// Port found, get mapped ifIndex
$sensor_port = $opticalarray[$index];
if (isset($sensor_port['0']['entAliasMappingIdentifier']) && strpos($sensor_port['0']['entAliasMappingIdentifier'], 'fIndex')) {
list(, $ifIndex) = explode('.', $sensor_port['0']['entAliasMappingIdentifier']);
$port = get_port_by_index_cache($device['device_id'], $ifIndex);
$temperatureoid = '.1.3.6.1.4.1.2011.5.25.31.1.1.3.1.5.' . $index;
$voltageoid = '.1.3.6.1.4.1.2011.5.25.31.1.1.3.1.6.' . $index;
$biascurrentoid = '.1.3.6.1.4.1.2011.5.25.31.1.1.3.1.7.' . $index;
$rxpoweroid = '.1.3.6.1.4.1.2011.5.25.31.1.1.3.1.8.' . $index;
$txpoweroid = '.1.3.6.1.4.1.2011.5.25.31.1.1.3.1.9.' . $index;
//Optical module name