Commit version 24.12.13800

This commit is contained in:
2025-01-06 17:35:06 -05:00
parent b7f6a79c2c
commit 55d9218816
6133 changed files with 4239740 additions and 1374287 deletions

View File

@ -1,103 +1,92 @@
<?php
/**
* Observium
*
* This file is part of Observium.
*
* @package observium
* @subpackage discovery
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2019 Observium Limited
* @package observium
* @subpackage discovery
* @copyright (C) Adam Armstrong
*
*/
$oids = snmpwalk_cache_bare_oid($device, 'bufferinval', array(), 'ADF-1-MIB');
$oids = snmpwalk_cache_bare_oid($device, 'bufferinval', [], 'ADF-1-MIB');
$oid_defs = array();
$oid_defs[1] = array('name' => 'powerFactor', 'class' => 'powerfactor', 'scale' => '0.0001', 'descr' => '');
$oid_defs[2] = array('name' => 'voltageLL', 'class' => 'voltage', 'scale' => '0.1', 'descr' => 'LL');
$oid_defs[3] = array('name' => 'voltageLN', 'class' => 'voltage', 'scale' => '0.1', 'descr' => 'LN');
$oid_defs[4] = array('name' => 'current', 'class' => 'current', 'scale' => '0.01', 'descr' => '');
$oid_defs[5] = array('name' => 'frequency', 'class' => 'frequency', 'scale' => '0.01', 'descr' => '');
$oid_defs[6] = array('name' => 'currentL1', 'class' => 'current', 'scale' => '0.01', 'descr' => 'L1');
$oid_defs[7] = array('name' => 'currentL2', 'class' => 'current', 'scale' => '0.01', 'descr' => 'L2');
$oid_defs[8] = array('name' => 'currentL3', 'class' => 'current', 'scale' => '0.01', 'descr' => 'L3');
$oid_defs[9] = array('name' => 'currentN', 'class' => 'current', 'scale' => '0.01', 'descr' => 'N');
$oid_defs[10] = array('name' => 'voltageL1L2', 'class' => 'voltage', 'scale' => '0.1', 'descr' => 'L1L2');
$oid_defs[11] = array('name' => 'voltageL2L3', 'class' => 'voltage', 'scale' => '0.1', 'descr' => 'L2L3');
$oid_defs[12] = array('name' => 'voltageL3L1', 'class' => 'voltage', 'scale' => '0.1', 'descr' => 'L3L1');
$oid_defs[13] = array('name' => 'voltageL1N', 'class' => 'voltage', 'scale' => '0.1', 'descr' => 'L1N1');
$oid_defs[14] = array('name' => 'voltageL2N', 'class' => 'voltage', 'scale' => '0.1', 'descr' => 'L2N1');
$oid_defs[15] = array('name' => 'voltageL3N', 'class' => 'voltage', 'scale' => '0.1', 'descr' => 'L3N1');
$oid_defs = [];
$oid_defs[1] = ['name' => 'powerFactor', 'class' => 'powerfactor', 'scale' => '0.0001', 'descr' => ''];
$oid_defs[2] = ['name' => 'voltageLL', 'class' => 'voltage', 'scale' => '0.1', 'descr' => 'LL'];
$oid_defs[3] = ['name' => 'voltageLN', 'class' => 'voltage', 'scale' => '0.1', 'descr' => 'LN'];
$oid_defs[4] = ['name' => 'current', 'class' => 'current', 'scale' => '0.01', 'descr' => ''];
$oid_defs[5] = ['name' => 'frequency', 'class' => 'frequency', 'scale' => '0.01', 'descr' => ''];
$oid_defs[6] = ['name' => 'currentL1', 'class' => 'current', 'scale' => '0.01', 'descr' => 'L1'];
$oid_defs[7] = ['name' => 'currentL2', 'class' => 'current', 'scale' => '0.01', 'descr' => 'L2'];
$oid_defs[8] = ['name' => 'currentL3', 'class' => 'current', 'scale' => '0.01', 'descr' => 'L3'];
$oid_defs[9] = ['name' => 'currentN', 'class' => 'current', 'scale' => '0.01', 'descr' => 'N'];
$oid_defs[10] = ['name' => 'voltageL1L2', 'class' => 'voltage', 'scale' => '0.1', 'descr' => 'L1L2'];
$oid_defs[11] = ['name' => 'voltageL2L3', 'class' => 'voltage', 'scale' => '0.1', 'descr' => 'L2L3'];
$oid_defs[12] = ['name' => 'voltageL3L1', 'class' => 'voltage', 'scale' => '0.1', 'descr' => 'L3L1'];
$oid_defs[13] = ['name' => 'voltageL1N', 'class' => 'voltage', 'scale' => '0.1', 'descr' => 'L1N1'];
$oid_defs[14] = ['name' => 'voltageL2N', 'class' => 'voltage', 'scale' => '0.1', 'descr' => 'L2N1'];
$oid_defs[15] = ['name' => 'voltageL3N', 'class' => 'voltage', 'scale' => '0.1', 'descr' => 'L3N1'];
$i=1;
while($i < 29)
{
$i = 1;
while ($i < 29) {
if($i == 25 || $i == 26) { } else
{
if ($i == 25 || $i == 26) {
} else {
foreach ($oid_defs as $n => $x)
{
$x['index'] = $n + (($i - 1) * 15);
foreach ($oid_defs as $n => $x) {
$x['index'] = $n + (($i - 1) * 15);
if ($i > 26)
{
$x['index'] -= 10;
}
if ($i > 26) {
$x['index'] -= 10;
}
$x['oid_num'] = '.1.3.6.1.4.1.49314.1.1.1.4.9.' . $x['index'];
$x['oid_text'] = $x['name'] . $i;
$x['descr'] = 'Feed ' . $i . (strlen($config['custom']['adf-1-mib'][$i]['descr']) ? ' (' . $config['custom']['adf-1-mib'][$i]['descr'] . ')' : '') . ' ' . $x['descr'];
$x['value'] = $oids[$x['oid_text']] * $x['scale'];
$x['oid_num'] = '.1.3.6.1.4.1.49314.1.1.1.4.9.' . $x['index'];
$x['oid_text'] = $x['name'] . $i;
$x['descr'] = 'Feed ' . $i . (strlen($config['custom']['adf-1-mib'][$i]['descr']) ? ' (' . $config['custom']['adf-1-mib'][$i]['descr'] . ')' : '') . ' ' . $x['descr'];
$x['value'] = $oids[$x['oid_text']] * $x['scale'];
echo $x['oid_num'].' '.$x['oid_text'].PHP_EOL;
echo $x['oid_num'] . ' ' . $x['oid_text'] . PHP_EOL;
//print_r($x);
//print_r($x);
if (is_numeric($oids[$x['oid_text']]))
{
discover_sensor_ng($device, $x['class'], $mib, $x['name'], $x['oid_num'], $x['index'], 'adf01', $x['descr'], $x['scale'], $oids[$x['oid_text']]);
}
else
{
}
}
if (is_numeric($oids[$x['oid_text']])) {
discover_sensor_ng($device, $x['class'], $mib, $x['name'], $x['oid_num'], $x['index'], $x['descr'], $x['scale'], $oids[$x['oid_text']], [ 'sensor_type' => 'adf01' ]);
}
}
}
}
$i++;
$i++;
}
// Note that these multipliers MAY NOT be the same as the multipliers above!
$oid_defsi = array();
$oid_defsi[1] = array('name' => 'powerFactor', 'class' => 'powerfactor', 'scale' => '0.001', 'descr' => '');
$oid_defsi[2] = array('name' => 'voltageLL', 'class' => 'voltage', 'scale' => '1', 'descr' => 'LL');
$oid_defsi[3] = array('name' => 'current', 'class' => 'current', 'scale' => '1', 'descr' => '');
$oid_defsi[4] = array('name' => 'frequency', 'class' => 'frequency', 'scale' => '0.01', 'descr' => '');
$oid_defsi[5] = array('name' => 'currentL1', 'class' => 'current', 'scale' => '1', 'descr' => 'L1');
$oid_defsi[6] = array('name' => 'currentL2', 'class' => 'current', 'scale' => '1', 'descr' => 'L2');
$oid_defsi[7] = array('name' => 'currentL3', 'class' => 'current', 'scale' => '1', 'descr' => 'L3');
$oid_defsi[8] = array('name' => 'voltageL1L2', 'class' => 'voltage', 'scale' => '1', 'descr' => 'L1L2');
$oid_defsi[9] = array('name' => 'voltageL2L3', 'class' => 'voltage', 'scale' => '1', 'descr' => 'L2L3');
$oid_defsi[10] = array('name' => 'voltageL3L1', 'class' => 'voltage', 'scale' => '1', 'descr' => 'L3L1');
$oid_defsi = [];
$oid_defsi[1] = ['name' => 'powerFactor', 'class' => 'powerfactor', 'scale' => '0.001', 'descr' => ''];
$oid_defsi[2] = ['name' => 'voltageLL', 'class' => 'voltage', 'scale' => '1', 'descr' => 'LL'];
$oid_defsi[3] = ['name' => 'current', 'class' => 'current', 'scale' => '1', 'descr' => ''];
$oid_defsi[4] = ['name' => 'frequency', 'class' => 'frequency', 'scale' => '0.01', 'descr' => ''];
$oid_defsi[5] = ['name' => 'currentL1', 'class' => 'current', 'scale' => '1', 'descr' => 'L1'];
$oid_defsi[6] = ['name' => 'currentL2', 'class' => 'current', 'scale' => '1', 'descr' => 'L2'];
$oid_defsi[7] = ['name' => 'currentL3', 'class' => 'current', 'scale' => '1', 'descr' => 'L3'];
$oid_defsi[8] = ['name' => 'voltageL1L2', 'class' => 'voltage', 'scale' => '1', 'descr' => 'L1L2'];
$oid_defsi[9] = ['name' => 'voltageL2L3', 'class' => 'voltage', 'scale' => '1', 'descr' => 'L2L3'];
$oid_defsi[10] = ['name' => 'voltageL3L1', 'class' => 'voltage', 'scale' => '1', 'descr' => 'L3L1'];
foreach(array(25, 26) AS $i)
{
foreach($oid_defsi as $n => $x)
{
$x['index'] = $n + ((24) * 15) + (($i - 25) * 10);
$x['oid_num'] = '.1.3.6.1.4.1.49314.1.1.1.4.9.'.$x['index'];
$x['oid_text'] = $x['name'].$i;
$x['descr'] = 'Feed ' .$i. (strlen($config['custom']['adf-1-mib'][$i]['descr']) ? ' ('.$config['custom']['adf-1-mib'][$i]['descr'].')' : '') . ' ' . $x['descr'];
$x['value'] = $oids[$x['oid_text']];
foreach ([25, 26] as $i) {
foreach ($oid_defsi as $n => $x) {
$x['index'] = $n + ((24) * 15) + (($i - 25) * 10);
$x['oid_num'] = '.1.3.6.1.4.1.49314.1.1.1.4.9.' . $x['index'];
$x['oid_text'] = $x['name'] . $i;
$x['descr'] = 'Feed ' . $i . (strlen($config['custom']['adf-1-mib'][$i]['descr']) ? ' (' . $config['custom']['adf-1-mib'][$i]['descr'] . ')' : '') . ' ' . $x['descr'];
$x['value'] = $oids[$x['oid_text']];
//print_r($x);
//print_r($x);
if(is_numeric($oids[$x['oid_text']]))
{
discover_sensor_ng( $device, $x['class'], $mib, $x['name'], $x['oid_num'], $x['index'], 'adf01', $x['descr'], $x['scale'], $oids[$x['oid_text']]);
} else { }
}
if (is_numeric($oids[$x['oid_text']])) {
discover_sensor_ng($device, $x['class'], $mib, $x['name'], $x['oid_num'], $x['index'], $x['descr'], $x['scale'], $oids[$x['oid_text']], [ 'sensor_type' => 'adf01' ]);
}
}
}

View File

@ -0,0 +1,260 @@
<?php
/**
* Observium
*
* This file is part of Observium.
*
* @package observium
* @subpackage discovery
* @copyright (C) Adam Armstrong
*
*/
// ADTRAN-PLUGGABLE-PORT-MIB::adGenPluggablePortPluggableType.25200001 = INTEGER: sfp(2)
// ADTRAN-PLUGGABLE-PORT-MIB::adGenPluggablePortConnectorType.25200001 = INTEGER: fiberLC(2)
// ADTRAN-PLUGGABLE-PORT-MIB::adGenPluggablePortCapabilities.25200001 = BITS: BC pluggable(0) voltageReadable(2) wavelengthReadable(3) diagnosticsAvailable(4) wavelengthProvisionable(5)
// ADTRAN-PLUGGABLE-PORT-MIB::adGenPluggablePortState.25200001 = BITS: 40 portUp(1)
// ADTRAN-PLUGGABLE-PORT-MIB::adGenPluggablePortStatusBits.25200001 = BITS: E8 isPresent(0) isValid(1) isSupported(2) isTxEnabled(4)
// ADTRAN-PLUGGABLE-PORT-MIB::adGenPluggablePortAlarmBits.25200001 = BITS:
// ADTRAN-PLUGGABLE-PORT-MIB::adGenPluggablePortAlarmsSuppressed.25200001 = BITS:
// ADTRAN-PLUGGABLE-PORT-MIB::adGenPluggablePortBer.25200001 = Gauge32: 0
// ADTRAN-PLUGGABLE-PORT-MIB::adGenPluggablePortVendorName.25200001 = STRING: "Hisense"
// ADTRAN-PLUGGABLE-PORT-MIB::adGenPluggablePortVendorPartNumber.25200001 = STRING: "LTF2305-BH-AD"
// ADTRAN-PLUGGABLE-PORT-MIB::adGenPluggablePortVendorSerialNumber.25200001 = STRING: "LBADTN2112AJ693"
// ADTRAN-PLUGGABLE-PORT-MIB::adGenPluggablePortAdtranName.25200001 = STRING: "ADTRAN 10GBASE-LR10"
// ADTRAN-PLUGGABLE-PORT-MIB::adGenPluggablePortAdtranPartNumber.25200001 = STRING: "1442412F2"
// ADTRAN-PLUGGABLE-PORT-MIB::adGenPluggablePortAdtranClei.25200001 = STRING: "BVL3AYFDAA"
// ADTRAN-PLUGGABLE-PORT-MIB::adGenPluggablePortWavelength.25200001 = Gauge32: 1270
// ADTRAN-PLUGGABLE-PORT-MIB::adGenPluggablePortMinBitRate.25200001 = Gauge32: 9270
// ADTRAN-PLUGGABLE-PORT-MIB::adGenPluggablePortMaxBitRate.25200001 = Gauge32: 11330
// ADTRAN-PLUGGABLE-PORT-MIB::adGenPluggablePortReachLength.25200001 = Gauge32: 10
// ADTRAN-PLUGGABLE-PORT-MIB::adGenPluggablePortReachUnits.25200001 = INTEGER: reachUnit1Kmfor09um(1)
// ADTRAN-PLUGGABLE-PORT-MIB::adGenPluggablePortRxPower.25200001 = INTEGER: -35
// ADTRAN-PLUGGABLE-PORT-MIB::adGenPluggablePortRxPowerUnits.25200001 = INTEGER: tenthsDBm(2)
// ADTRAN-PLUGGABLE-PORT-MIB::adGenPluggablePortTxPower.25200001 = INTEGER: -24
// ADTRAN-PLUGGABLE-PORT-MIB::adGenPluggablePortTxPowerUnits.25200001 = INTEGER: tenthsDBm(2)
// ADTRAN-PLUGGABLE-PORT-MIB::adGenPluggablePortTxBias.25200001 = INTEGER: 20
// ADTRAN-PLUGGABLE-PORT-MIB::adGenPluggablePortTxBiasUnits.25200001 = INTEGER: milliAmps(1)
// ADTRAN-PLUGGABLE-PORT-MIB::adGenPluggablePortTemperature.25200001 = INTEGER: 39
// ADTRAN-PLUGGABLE-PORT-MIB::adGenPluggablePortTemperatureUnits.25200001 = INTEGER: celsius(1)
// ADTRAN-PLUGGABLE-PORT-MIB::adGenPluggablePortVoltage.25200001 = INTEGER: 3310
// ADTRAN-PLUGGABLE-PORT-MIB::adGenPluggablePortVendorRevision.25200001 = STRING: "A"
// ADTRAN-PLUGGABLE-PORT-MIB::adGenPluggablePortWavelengthPicoMeter.25200001 = Gauge32: 0
// ADTRAN-PLUGGABLE-PORT-MIB::adGenPluggableNumberOfXcvrChannels.25200001 = INTEGER: 1
// ADTRAN-PLUGGABLE-PORT-MIB::adGenPluggablePortPluggableType.1100001 = INTEGER: sfp(2)
// ADTRAN-PLUGGABLE-PORT-MIB::adGenPluggablePortConnectorType.1100001 = INTEGER: fiberSC(3)
// ADTRAN-PLUGGABLE-PORT-MIB::adGenPluggablePortCapabilities.1100001 = BITS: B8 pluggable(0) voltageReadable(2) wavelengthReadable(3) diagnosticsAvailable(4)
// ADTRAN-PLUGGABLE-PORT-MIB::adGenPluggablePortState.1100001 = BITS: 40 portUp(1)
// ADTRAN-PLUGGABLE-PORT-MIB::adGenPluggablePortStatusBits.1100001 = BITS: E8 isPresent(0) isValid(1) isSupported(2) isTxEnabled(4)
// ADTRAN-PLUGGABLE-PORT-MIB::adGenPluggablePortAlarmBits.1100001 = BITS:
// ADTRAN-PLUGGABLE-PORT-MIB::adGenPluggablePortAlarmsSuppressed.1100001 = BITS:
// ADTRAN-PLUGGABLE-PORT-MIB::adGenPluggablePortBer.1100001 = Gauge32: 0
// ADTRAN-PLUGGABLE-PORT-MIB::adGenPluggablePortVendorName.1100001 = STRING: "ADTRAN"
// ADTRAN-PLUGGABLE-PORT-MIB::adGenPluggablePortVendorPartNumber.1100001 = STRING: "1442543F2"
// ADTRAN-PLUGGABLE-PORT-MIB::adGenPluggablePortVendorSerialNumber.1100001 = STRING: "LBADTN2202AY538 "
// ADTRAN-PLUGGABLE-PORT-MIB::adGenPluggablePortAdtranName.1100001 = STRING: " "
// ADTRAN-PLUGGABLE-PORT-MIB::adGenPluggablePortAdtranPartNumber.1100001 = STRING: "1442543F2"
// ADTRAN-PLUGGABLE-PORT-MIB::adGenPluggablePortAdtranClei.1100001 = STRING: "BVL3BBSDAA"
// ADTRAN-PLUGGABLE-PORT-MIB::adGenPluggablePortWavelength.1100001 = Gauge32: 0
// ADTRAN-PLUGGABLE-PORT-MIB::adGenPluggablePortMinBitRate.1100001 = Gauge32: 0
// ADTRAN-PLUGGABLE-PORT-MIB::adGenPluggablePortMaxBitRate.1100001 = Gauge32: 0
// ADTRAN-PLUGGABLE-PORT-MIB::adGenPluggablePortReachLength.1100001 = Gauge32: 0
// ADTRAN-PLUGGABLE-PORT-MIB::adGenPluggablePortReachUnits.1100001 = INTEGER: reachUnit1Kmfor09um(1)
// ADTRAN-PLUGGABLE-PORT-MIB::adGenPluggablePortRxPower.1100001 = INTEGER: 0
// ADTRAN-PLUGGABLE-PORT-MIB::adGenPluggablePortRxPowerUnits.1100001 = INTEGER: tenthsDBm(2)
// ADTRAN-PLUGGABLE-PORT-MIB::adGenPluggablePortTxPower.1100001 = INTEGER: 53
// ADTRAN-PLUGGABLE-PORT-MIB::adGenPluggablePortTxPowerUnits.1100001 = INTEGER: tenthsDBm(2)
// ADTRAN-PLUGGABLE-PORT-MIB::adGenPluggablePortTxBias.1100001 = INTEGER: 4
// ADTRAN-PLUGGABLE-PORT-MIB::adGenPluggablePortTxBiasUnits.1100001 = INTEGER: milliAmps(1)
// ADTRAN-PLUGGABLE-PORT-MIB::adGenPluggablePortTemperature.1100001 = INTEGER: 42
// ADTRAN-PLUGGABLE-PORT-MIB::adGenPluggablePortTemperatureUnits.1100001 = INTEGER: celsius(1)
// ADTRAN-PLUGGABLE-PORT-MIB::adGenPluggablePortVoltage.1100001 = INTEGER: 3320
// ADTRAN-PLUGGABLE-PORT-MIB::adGenPluggablePortVendorRevision.1100001 = ""
// ADTRAN-PLUGGABLE-PORT-MIB::adGenPluggablePortWavelengthPicoMeter.1100001 = Gauge32: 0
$oids = snmp_cache_table($device, 'adGenPluggablePortTable', [], $mib); // also in inventory
print_debug_vars($oids);
if (!snmp_status()) {
return;
}
$oids_lane = snmpwalk_cache_twopart_oid($device, 'adGenPluggablePortChannelTable', [], $mib);
print_debug_vars($oids_lane);
foreach ($oids as $index => $entry) {
if ($entry['adGenPluggablePortConnectorType'] === 'none') {
// Not exist DDM
continue;
}
$entry['index'] = $index;
$match = [ 'measured_match' => [ 'entity_type' => 'port', 'field' => 'ifIndex', 'match' => '%index%' ] ];
$options = entity_measured_match_definition($device, $match, $entry);
$name = $options['port_label'];
$vendor_name = trim($entry['adGenPluggablePortVendorName'] . ' ' . $entry['adGenPluggablePortVendorPartNumber']);
if ($entry['adGenPluggablePortVendorSerialNumber']) {
$vendor_name .= ', SN:' . trim($entry['adGenPluggablePortVendorSerialNumber']);
}
if ($entry['adGenPluggablePortWavelength'] && $entry['adGenPluggablePortWavelength'] > 1) {
$vendor_name .= ', ' . $entry['adGenPluggablePortWavelength'] . 'nm';
}
// Temperature
$descr = $name . ' Temperature';
if ($vendor_name) {
$descr .= ' (' . $vendor_name . ')';
}
$class = 'temperature';
$oid_name = 'adGenPluggablePortTemperature';
$oid_num = '.1.3.6.1.4.1.664.5.70.4.1.1.1.27.' . $index;
$scale = str_starts_with($entry['adGenPluggablePortTemperatureUnits'], 'tenths') ? 0.1 : 1;
$value = $entry[$oid_name];
$opt = [];
if (str_ends_with($entry['adGenPluggablePortTemperatureUnits'], 'ahrenheit')) {
// fahrenheit, tenthsFahrenheit
$opt['sensor_unit'] = 'F';
}
discover_sensor_ng($device, $class, $mib, $oid_name, $oid_num, $index, $descr, $scale, $value, array_merge($options, $opt));
// Voltage
$descr = $name . ' Voltage';
if ($vendor_name) {
$descr .= ' (' . $vendor_name . ')';
}
$class = 'voltage';
$oid_name = 'adGenPluggablePortVoltage';
$oid_num = '.1.3.6.1.4.1.664.5.70.4.1.1.1.29.' . $index;
$scale = 0.001;
$value = $entry[$oid_name];
discover_sensor_ng($device, $class, $mib, $oid_name, $oid_num, $index, $descr, $scale, $value, $options);
if (isset($entry['adGenPluggableNumberOfXcvrChannels'], $oids_lane[$index]) && $entry['adGenPluggableNumberOfXcvrChannels'] > 1) {
// Multi Channel sensors
// ADTRAN-PLUGGABLE-PORT-MIB::adGenPluggablePortChannelRxPower.25200001.1 = INTEGER: -35
// ADTRAN-PLUGGABLE-PORT-MIB::adGenPluggablePortChannelRxPowerUnits.25200001.1 = INTEGER: tenthsDBm(2)
// ADTRAN-PLUGGABLE-PORT-MIB::adGenPluggablePortChannelTxPower.25200001.1 = INTEGER: -24
// ADTRAN-PLUGGABLE-PORT-MIB::adGenPluggablePortChannelTxPowerUnits.25200001.1 = INTEGER: tenthsDBm(2)
// ADTRAN-PLUGGABLE-PORT-MIB::adGenPluggablePortChannelTxBias.25200001.1 = INTEGER: 20
// ADTRAN-PLUGGABLE-PORT-MIB::adGenPluggablePortChannelTxBiasUnits.25200001.1 = INTEGER: milliAmps(1)
// ADTRAN-PLUGGABLE-PORT-MIB::adGenPluggablePortProvWaveLength.25200001 = INTEGER: 0
// ADTRAN-PLUGGABLE-PORT-MIB::adGenPluggablePortProvChannelNumber.25200001 = INTEGER: 0
foreach ($oids_lane[$index] as $lane => $lentry) {
$lname = $name . ' Lane ' . $lane;
$lindex = $index . '.' . $lane;
// TX Bias
$descr = $lname . ' TX Bias';
if ($vendor_name) {
$descr .= ' (' . $vendor_name . ')';
}
$class = 'current';
$oid_name = 'adGenPluggablePortChannelTxBias';
$oid_num = '.1.3.6.1.4.1.664.5.70.4.1.2.1.7.' . $lindex;
$scale = 0.001;
$value = $lentry[$oid_name];
discover_sensor_ng($device, $class, $mib, $oid_name, $oid_num, $lindex, $descr, $scale, $value, $options);
// TX Power
$descr = $lname . ' TX Power';
if ($vendor_name) {
$descr .= ' (' . $vendor_name . ')';
}
// dBm, tenthsDBm, microWatts, tenthsMicroWatts
if (str_contains($lentry['adGenPluggablePortChannelTxPowerUnits'], 'Watts')) {
$class = 'power';
$scale = str_starts_with($lentry['adGenPluggablePortChannelTxPowerUnits'], 'tenths') ? 0.0000001 : 0.000001;
} else {
$class = 'dbm';
$scale = str_starts_with($lentry['adGenPluggablePortChannelTxPowerUnits'], 'tenths') ? 0.1 : 1;
}
$oid_name = 'adGenPluggablePortChannelTxPower';
$oid_num = '.1.3.6.1.4.1.664.5.70.4.1.2.1.5.' . $lindex;
$value = $lentry[$oid_name];
discover_sensor_ng($device, $class, $mib, $oid_name, $oid_num, $lindex, $descr, $scale, $value, $options);
// RX Power
$descr = $lname . ' RX Power';
if ($vendor_name) {
$descr .= ' (' . $vendor_name . ')';
}
// dBm, tenthsDBm, microWatts, tenthsMicroWatts
if (str_contains($lentry['adGenPluggablePortChannelRxPowerUnits'], 'Watts')) {
$class = 'power';
$scale = str_starts_with($lentry['adGenPluggablePortChannelRxPowerUnits'], 'tenths') ? 0.0000001 : 0.000001;
} else {
$class = 'dbm';
$scale = str_starts_with($lentry['adGenPluggablePortChannelRxPowerUnits'], 'tenths') ? 0.1 : 1;
}
$oid_name = 'adGenPluggablePortChannelRxPower';
$oid_num = '.1.3.6.1.4.1.664.5.70.4.1.2.1.3.' . $lindex;
$value = $lentry[$oid_name];
discover_sensor_ng($device, $class, $mib, $oid_name, $oid_num, $lindex, $descr, $scale, $value, $options);
}
} else {
// TX Bias
$descr = $name . ' TX Bias';
if ($vendor_name) {
$descr .= ' (' . $vendor_name . ')';
}
$class = 'current';
$oid_name = 'adGenPluggablePortTxBias';
$oid_num = '.1.3.6.1.4.1.664.5.70.4.1.1.1.25.' . $index;
$scale = 0.001;
$value = $entry[$oid_name];
discover_sensor_ng($device, $class, $mib, $oid_name, $oid_num, $index, $descr, $scale, $value, $options);
// TX Power
$descr = $name . ' TX Power';
if ($vendor_name) {
$descr .= ' (' . $vendor_name . ')';
}
// dBm, tenthsDBm, microWatts, tenthsMicroWatts
if (str_contains($entry['adGenPluggablePortTxPowerUnits'], 'Watts')) {
$class = 'power';
$scale = str_starts_with($entry['adGenPluggablePortTxPowerUnits'], 'tenths') ? 0.0000001 : 0.000001;
} else {
$class = 'dbm';
$scale = str_starts_with($entry['adGenPluggablePortTxPowerUnits'], 'tenths') ? 0.1 : 1;
}
$oid_name = 'adGenPluggablePortTxPower';
$oid_num = '.1.3.6.1.4.1.664.5.70.4.1.1.1.23.' . $index;
$value = $entry[$oid_name];
discover_sensor_ng($device, $class, $mib, $oid_name, $oid_num, $index, $descr, $scale, $value, $options);
// RX Power
$descr = $name . ' RX Power';
if ($vendor_name) {
$descr .= ' (' . $vendor_name . ')';
}
// dBm, tenthsDBm, microWatts, tenthsMicroWatts
if (str_contains($entry['adGenPluggablePortRxPowerUnits'], 'Watts')) {
$class = 'power';
$scale = str_starts_with($entry['adGenPluggablePortRxPowerUnits'], 'tenths') ? 0.0000001 : 0.000001;
} else {
$class = 'dbm';
$scale = str_starts_with($entry['adGenPluggablePortRxPowerUnits'], 'tenths') ? 0.1 : 1;
}
$oid_name = 'adGenPluggablePortRxPower';
$oid_num = '.1.3.6.1.4.1.664.5.70.4.1.1.1.21.' . $index;
$value = $entry[$oid_name];
discover_sensor_ng($device, $class, $mib, $oid_name, $oid_num, $index, $descr, $scale, $value, $options);
}
}
// EOF

View File

@ -0,0 +1,46 @@
<?php
/**
* Observium
*
* This file is part of Observium.
*
* @package observium
* @subpackage discovery
* @copyright (C) Adam Armstrong
*
*/
// ADTRAN-TA5000-THERMAL-MGMT-MIB::adTA5kThermalSlotNumSensors.11 = INTEGER: 5
// ADTRAN-TA5000-THERMAL-MGMT-MIB::adTA5kThermalSlotNumSensors.252 = INTEGER: 10
// ADTRAN-TA5000-THERMAL-MGMT-MIB::adTA5kThermalSlotNumSensors.253 = INTEGER: 10
// ADTRAN-TA5000-THERMAL-MGMT-MIB::adTA5kThermalManagementSensorName.11.1 = STRING: Board 1
// ADTRAN-TA5000-THERMAL-MGMT-MIB::adTA5kThermalManagementSensorName.11.2 = STRING: Board 2
// ADTRAN-TA5000-THERMAL-MGMT-MIB::adTA5kThermalManagementSensorName.252.1 = STRING: Board
// ADTRAN-TA5000-THERMAL-MGMT-MIB::adTA5kThermalManagementSensorName.252.2 = STRING: Board
// ADTRAN-TA5000-THERMAL-MGMT-MIB::adTA5kThermalManagementSensorName.253.1 = STRING: Board
// ADTRAN-TA5000-THERMAL-MGMT-MIB::adTA5kThermalManagementSensorName.253.2 = STRING: Board
// ADTRAN-TA5000-THERMAL-MGMT-MIB::adTA5kThermalManagementSensorCurrTemp.11.1 = INTEGER: 420 0.1C
// ADTRAN-TA5000-THERMAL-MGMT-MIB::adTA5kThermalManagementSensorCurrTemp.11.2 = INTEGER: 520 0.1C
// ADTRAN-TA5000-THERMAL-MGMT-MIB::adTA5kThermalManagementSensorCurrTemp.252.1 = INTEGER: 485 0.1C
// ADTRAN-TA5000-THERMAL-MGMT-MIB::adTA5kThermalManagementSensorCurrTemp.252.2 = INTEGER: 435 0.1C
// ADTRAN-TA5000-THERMAL-MGMT-MIB::adTA5kThermalManagementSensorCurrTemp.253.1 = INTEGER: 495 0.1C
// ADTRAN-TA5000-THERMAL-MGMT-MIB::adTA5kThermalManagementSensorCurrTemp.253.2 = INTEGER: 435 0.1C
$oids = snmpwalk_cache_oid($device, 'adTA5kThermalManagementTable', [], $mib);
print_debug_vars($oids);
foreach ($oids as $index => $entry) {
[ $slot, $num ] = explode('.', $index);
$slot_name = snmp_cache_oid($device, 'adGenSlotProdName.'.$slot, 'ADTRAN-GENSLOT-MIB');
$descr = 'Slot ' . $slot . ', ' . $num . '. ' . $entry['adTA5kThermalManagementSensorName'] . ' (' . $slot_name . ')';
$class = 'temperature';
$oid_name = 'adTA5kThermalManagementSensorCurrTemp';
$oid_num = '.1.3.6.1.4.1.664.5.67.1.39.1.1.2.1.3.' . $index;
$scale = 0.1;
$value = $entry[$oid_name];
discover_sensor_ng($device, $class, $mib, $oid_name, $oid_num, $index, $descr, $scale, $value);
}
// EOF

View File

@ -1,5 +1,4 @@
<?php
/**
* Observium
*
@ -7,88 +6,79 @@
*
* @package observium
* @subpackage discovery
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2019 Observium Limited
* @copyright (C) Adam Armstrong
*
*/
$oids = snmpwalk_cache_oid($device, 'brzaccVLNewAdbUnitName', array(), 'ALVARION-DOT11-WLAN-MIB', NULL, OBS_SNMP_ALL_NUMERIC_INDEX);
$oids = snmpwalk_cache_oid($device, 'brzaccVLNewAdbUnitName', [], 'ALVARION-DOT11-WLAN-MIB', NULL, OBS_SNMP_ALL_NUMERIC_INDEX);
/// NOTE. New table prefer, because old use weird indexes
if ($oids)
{
//ALVARION-DOT11-WLAN-MIB::brzaccVLNewAdbUnitName.0.16.231.20.145.216 = "Kern Waste Tehachapi"
//ALVARION-DOT11-WLAN-MIB::brzaccVLNewAdbSNR.0.16.231.20.145.216 = 25
//ALVARION-DOT11-WLAN-MIB::brzaccVLNewAdbRSSI.0.16.231.20.145.216 = -76
$oids = snmpwalk_cache_oid($device, 'brzaccVLNewAdbSNR', $oids, 'ALVARION-DOT11-WLAN-MIB', NULL, OBS_SNMP_ALL_NUMERIC_INDEX);
$oids = snmpwalk_cache_oid($device, 'brzaccVLNewAdbRSSI', $oids, 'ALVARION-DOT11-WLAN-MIB', NULL, OBS_SNMP_ALL_NUMERIC_INDEX);
if ($oids) {
//ALVARION-DOT11-WLAN-MIB::brzaccVLNewAdbUnitName.0.16.231.20.145.216 = "Kern Waste Tehachapi"
//ALVARION-DOT11-WLAN-MIB::brzaccVLNewAdbSNR.0.16.231.20.145.216 = 25
//ALVARION-DOT11-WLAN-MIB::brzaccVLNewAdbRSSI.0.16.231.20.145.216 = -76
$oids = snmpwalk_cache_oid($device, 'brzaccVLNewAdbSNR', $oids, 'ALVARION-DOT11-WLAN-MIB', NULL, OBS_SNMP_ALL_NUMERIC_INDEX);
$oids = snmpwalk_cache_oid($device, 'brzaccVLNewAdbRSSI', $oids, 'ALVARION-DOT11-WLAN-MIB', NULL, OBS_SNMP_ALL_NUMERIC_INDEX);
foreach ($oids as $index => $entry)
{
$descr = $entry['brzaccVLNewAdbUnitName'];
foreach ($oids as $index => $entry) {
$descr = $entry['brzaccVLNewAdbUnitName'];
// Signal-to-Noise Ratio
if (is_numeric($entry['brzaccVLNewAdbSNR']))
{
$oid = ".1.3.6.1.4.1.12394.1.1.11.5.1.3.1.26.$index";
$value = $entry['brzaccVLNewAdbSNR'];
discover_sensor_ng($device,'snr', $mib, 'brzaccVLNewAdbSNR', $oid, $index, NULL, "$descr (SNR)", 1, $value, ['rename_rrd' => "alvarion-dot11.$index"]);
// Signal-to-Noise Ratio
if (is_numeric($entry['brzaccVLNewAdbSNR'])) {
$oid = ".1.3.6.1.4.1.12394.1.1.11.5.1.3.1.26.$index";
$value = $entry['brzaccVLNewAdbSNR'];
discover_sensor_ng($device, 'snr', $mib, 'brzaccVLNewAdbSNR', $oid, $index, "$descr (SNR)", 1, $value, ['rename_rrd' => "alvarion-dot11.$index"]);
}
// Received signal strength indication
if (is_numeric($entry['brzaccVLNewAdbRSSI'])) {
$oid = ".1.3.6.1.4.1.12394.1.1.11.5.1.3.1.54.$index";
$value = $entry['brzaccVLNewAdbRSSI'];
discover_sensor_ng($device, 'dbm', $mib, 'brzaccVLNewAdbRSSI', $oid, $index, "$descr (RSSI)", 1, $value, ['rename_rrd' => "alvarion-dot11.$index"]);
}
}
// Received signal strength indication
if (is_numeric($entry['brzaccVLNewAdbRSSI']))
{
$oid = ".1.3.6.1.4.1.12394.1.1.11.5.1.3.1.54.$index";
$value = $entry['brzaccVLNewAdbRSSI'];
discover_sensor_ng($device,'dbm', $mib, 'brzaccVLNewAdbRSSI', $oid, $index, NULL, "$descr (RSSI)", 1, $value, ['rename_rrd' => "alvarion-dot11.$index"]);
}
}
} else {
//ALVARION-DOT11-WLAN-MIB::brzaccVLAdbUnitName.1 = STRING: "Kern Waste Tehachapi"
//ALVARION-DOT11-WLAN-MIB::brzaccVLAdbSNR.1 = INTEGER: 28
//ALVARION-DOT11-WLAN-MIB::brzaccVLAdbRSSI.1 = INTEGER: -75
$oids = snmpwalk_cache_oid($device, 'brzaccVLAdbUnitName', array(), 'ALVARION-DOT11-WLAN-MIB');
$oids = snmpwalk_cache_oid($device, 'brzaccVLAdbSNR', $oids, 'ALVARION-DOT11-WLAN-MIB');
$oids = snmpwalk_cache_oid($device, 'brzaccVLAdbRSSI', $oids, 'ALVARION-DOT11-WLAN-MIB');
//ALVARION-DOT11-WLAN-MIB::brzaccVLAdbUnitName.1 = STRING: "Kern Waste Tehachapi"
//ALVARION-DOT11-WLAN-MIB::brzaccVLAdbSNR.1 = INTEGER: 28
//ALVARION-DOT11-WLAN-MIB::brzaccVLAdbRSSI.1 = INTEGER: -75
$oids = snmpwalk_cache_oid($device, 'brzaccVLAdbUnitName', [], 'ALVARION-DOT11-WLAN-MIB');
$oids = snmpwalk_cache_oid($device, 'brzaccVLAdbSNR', $oids, 'ALVARION-DOT11-WLAN-MIB');
$oids = snmpwalk_cache_oid($device, 'brzaccVLAdbRSSI', $oids, 'ALVARION-DOT11-WLAN-MIB');
foreach ($oids as $index => $entry)
{
$descr = $entry['brzaccVLAdbUnitName'];
foreach ($oids as $index => $entry) {
$descr = $entry['brzaccVLAdbUnitName'];
// Signal-to-Noise Ratio
if (is_numeric($entry['brzaccVLAdbSNR']))
{
$oid = ".1.3.6.1.4.1.12394.1.1.11.5.1.2.1.5.$index";
$value = $entry['brzaccVLAdbSNR'];
discover_sensor_ng($device,'snr', $mib, 'brzaccVLAdbSNR', $oid, $index, NULL, "$descr (SNR)", 1, $value, ['rename_rrd' => "alvarion-dot11.$index"]);
// Signal-to-Noise Ratio
if (is_numeric($entry['brzaccVLAdbSNR'])) {
$oid = ".1.3.6.1.4.1.12394.1.1.11.5.1.2.1.5.$index";
$value = $entry['brzaccVLAdbSNR'];
discover_sensor_ng($device, 'snr', $mib, 'brzaccVLAdbSNR', $oid, $index, "$descr (SNR)", 1, $value, ['rename_rrd' => "alvarion-dot11.$index"]);
}
// Received signal strength indication
if (is_numeric($entry['brzaccVLAdbRSSI'])) {
$oid = ".1.3.6.1.4.1.12394.1.1.11.5.1.2.1.46.$index";
$value = $entry['brzaccVLAdbRSSI'];
discover_sensor_ng($device, 'dbm', $mib, 'brzaccVLAdbRSSI', $oid, $index, "$descr (RSSI)", 1, $value, ['rename_rrd' => "alvarion-dot11.$index"]);
}
}
// Received signal strength indication
if (is_numeric($entry['brzaccVLAdbRSSI']))
{
$oid = ".1.3.6.1.4.1.12394.1.1.11.5.1.2.1.46.$index";
$value = $entry['brzaccVLAdbRSSI'];
discover_sensor_ng($device,'dbm', $mib, 'brzaccVLAdbRSSI', $oid, $index, NULL, "$descr (RSSI)", 1, $value, ['rename_rrd' => "alvarion-dot11.$index"]);
}
}
}
//ALVARION-DOT11-WLAN-MIB::brzaccVLAverageReceiveSNR.0 = INTEGER: 23
//ALVARION-DOT11-WLAN-TST-MIB::brzLighteShowAuAvgSNR.0 = INTEGER: 23
$average_snr = snmp_get($device, 'brzaccVLAverageReceiveSNR.0', '-OUqnv', 'ALVARION-DOT11-WLAN-MIB');
if (is_numeric($average_snr))
{
$oid = '.1.3.6.1.4.1.12394.1.1.11.1.0';
discover_sensor_ng($device,'snr', $mib, 'brzaccVLAverageReceiveSNR', $oid, 0, NULL, "Average SNR", 1, $value, ['rename_rrd' => "alvarion-dot11-average.0"]);
$average_snr = snmp_get_oid($device, 'brzaccVLAverageReceiveSNR.0', 'ALVARION-DOT11-WLAN-MIB');
if (is_numeric($average_snr)) {
$oid = '.1.3.6.1.4.1.12394.1.1.11.1.0';
discover_sensor_ng($device, 'snr', $mib, 'brzaccVLAverageReceiveSNR', $oid, 0, "Average SNR", 1, $average_snr, [ 'rename_rrd' => "alvarion-dot11-average.0" ]);
}
//ALVARION-DOT11-WLAN-TST-MIB::brzLighteAvgRssiRecieved.0 = INTEGER: 0
$average_rssi = snmp_get($device, 'brzLighteAvgRssiRecieved.0', '-OUqnv', 'ALVARION-DOT11-WLAN-TST-MIB');
if (is_numeric($average_rssi) && $average_rssi)
{
$oid = '.1.3.6.1.4.1.12394.3.2.3.2.1.0';
discover_sensor_ng($device,'dbm', $mib, 'brzLighteAvgRssiRecieved', $oid, 0, NULL, "Average RSSI", 1, $value, ['rename_rrd' => "alvarion-dot11-average.0"]);
$average_rssi = snmp_get_oid($device, 'brzLighteAvgRssiRecieved.0', 'ALVARION-DOT11-WLAN-TST-MIB');
if (is_numeric($average_rssi) && $average_rssi) {
$oid = '.1.3.6.1.4.1.12394.3.2.3.2.1.0';
discover_sensor_ng($device, 'dbm', $mib, 'brzLighteAvgRssiRecieved', $oid, 0, "Average RSSI", 1, $average_rssi, [ 'rename_rrd' => "alvarion-dot11-average.0" ]);
}
unset($oids, $oid, $value, $average_snr, $average_rssi, $descr);

View File

@ -6,7 +6,7 @@
*
* @package observium
* @subpackage discovery
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2022 Observium Limited
* @copyright (C) Adam Armstrong
*
*/
@ -14,23 +14,22 @@
$oids = snmp_walk($device, ".1.3.6.1.4.1.18928.1.1.2.14.1.2", "-Osqn", "");
print_debug($oids);
$oids = trim($oids);
if ($oids) echo("Areca Harddisk ");
foreach (explode("\n", $oids) as $data)
{
$data = trim($data);
if ($data)
{
list($oid,$descr) = explode(" ", $data,2);
$split_oid = explode('.',$oid);
$temperature_id = $split_oid[count($split_oid)-1];
$temperature_oid = ".1.3.6.1.4.1.18928.1.1.2.14.1.2.$temperature_id";
$temperature = snmp_get($device, $temperature_oid, "-Oqv", "");
$descr = "Hard disk $temperature_id";
if ($temperature != -128) # -128 = not measured/present
{
discover_sensor_ng($device,'temperature', $mib, '', $temperature_oid, zeropad($temperature_id), 'areca', $descr, 1, $temperature);
if ($oids) {
echo("Areca Harddisk ");
}
foreach (explode("\n", $oids) as $data) {
$data = trim($data);
if ($data) {
[ $oid, $descr ] = explode(" ", $data, 2);
$split_oid = explode('.', $oid);
$temperature_id = $split_oid[count($split_oid) - 1];
$temperature_oid = ".1.3.6.1.4.1.18928.1.1.2.14.1.2.$temperature_id";
$temperature = snmp_get_oid($device, $temperature_oid);
$descr = "Hard disk $temperature_id";
if ($temperature != -128) {
discover_sensor_ng($device, 'temperature', $mib, '', $temperature_oid, $temperature_id, $descr, 1, $temperature, [ 'sensor_type' => 'areca' ]);
}
}
}
}
// SAS enclosure sensors
@ -55,87 +54,89 @@ foreach (explode("\n", $oids) as $data)
// hwEnclosure02PowerState.1 = INTEGER: Ok(1)
for ($encNum = 1; $encNum <= 8; $encNum++) {
$table = "hwEnclosure$encNum";
$enclosures = snmpwalk_cache_oid($device, $table, [], "ARECA-SNMP-MIB");
if (!isset($enclosures[0]) || !$enclosures[0]["hwEnclosure0{$encNum}Installed"]) {
// Index 0 is the main enclosure data, we check if the enclosure is connected, but it will
// not have any sensors of its own, so we skip index 0.
continue;
}
$enclosure = $enclosures[0];
unset($enclosures[0]);
$name = $enclosure["hwEnclosure0{$encNum}Description"];
foreach ($enclosures as $index => $entry) {
if ($entry["hwEnclosure0{$encNum}VolIndex"]) {
$descr = $name . ' (' . $encNum . ') ' . $entry["hwEnclosure0{$encNum}VolDesc"];
$oid_num = ".1.3.6.1.4.1.18928.1.2.2." . ($encNum+1) . ".8.1.3.$index";
$oid_name = "hwEnclosure0{$encNum}VolValue";
$value = $entry[$oid_name];
//discover_sensor('voltage', $device, $oid_num, "$oid_name.$index", 'areca', $descr, 0.001, $value);
$options = [ 'rename_rrd' => "areca-$oid_name.%index%" ];
discover_sensor_ng($device, 'voltage', $mib, $oid_name, $oid_num, $index, NULL, $descr, 0.001, $value, $options);
$table = "hwEnclosure$encNum";
$enclosures = snmpwalk_cache_oid($device, $table, [], "ARECA-SNMP-MIB");
if (!isset($enclosures[0]) || !$enclosures[0]["hwEnclosure0{$encNum}Installed"]) {
// Index 0 is the main enclosure data, we check if the enclosure is connected, but it will
// not have any sensors of its own, so we skip index 0.
continue;
}
$enclosure = $enclosures[0];
unset($enclosures[0]);
$name = $enclosure["hwEnclosure0{$encNum}Description"];
if ($entry["hwEnclosure0{$encNum}FanIndex"]) {
$descr = $name . ' (' . $encNum . ') ' . $entry["hwEnclosure0{$encNum}FanDesc"];
$oid_num = ".1.3.6.1.4.1.18928.1.2.2." . ($encNum+1) . ".9.1.3.$index";
$oid_name = "hwEnclosure0{$encNum}FanSpeed";
$value = $entry[$oid_name];
foreach ($enclosures as $index => $entry) {
if ($entry["hwEnclosure0{$encNum}VolIndex"]) {
$descr = $name . ' (' . $encNum . ') ' . $entry["hwEnclosure0{$encNum}VolDesc"];
$oid_num = ".1.3.6.1.4.1.18928.1.2.2." . ($encNum + 1) . ".8.1.3.$index";
$oid_name = "hwEnclosure0{$encNum}VolValue";
$value = $entry[$oid_name];
//discover_sensor('fanspeed', $device, $oid_num, "$oid_name.$index", 'areca', $descr, 1, $value);
$options = [ 'rename_rrd' => "areca-$oid_name.%index%" ];
discover_sensor_ng($device, 'fanspeed', $mib, $oid_name, $oid_num, $index, NULL, $descr, 1, $value, $options);
//discover_sensor('voltage', $device, $oid_num, "$oid_name.$index", 'areca', $descr, 0.001, $value);
$options = ['rename_rrd' => "areca-$oid_name.%index%"];
discover_sensor_ng($device, 'voltage', $mib, $oid_name, $oid_num, $index, $descr, 0.001, $value, $options);
}
if ($entry["hwEnclosure0{$encNum}FanIndex"]) {
$descr = $name . ' (' . $encNum . ') ' . $entry["hwEnclosure0{$encNum}FanDesc"];
$oid_num = ".1.3.6.1.4.1.18928.1.2.2." . ($encNum + 1) . ".9.1.3.$index";
$oid_name = "hwEnclosure0{$encNum}FanSpeed";
$value = $entry[$oid_name];
//discover_sensor('fanspeed', $device, $oid_num, "$oid_name.$index", 'areca', $descr, 1, $value);
$options = ['rename_rrd' => "areca-$oid_name.%index%"];
discover_sensor_ng($device, 'fanspeed', $mib, $oid_name, $oid_num, $index, $descr, 1, $value, $options);
}
if ($entry["hwEnclosure0{$encNum}TempIndex"]) {
$descr = $name . ' (' . $encNum . ') ' . $entry["hwEnclosure0{$encNum}TempDesc"];
$oid_num = ".1.3.6.1.4.1.18928.1.2.2." . ($encNum + 1) . ".10.1.3.$index";
$oid_name = "hwEnclosure0{$encNum}TempValue";
$value = $entry[$oid_name];
//discover_sensor('temperature', $device, $oid_num, "$oid_name.$index", 'areca', $descr, 1, $value);
$options = ['rename_rrd' => "areca-$oid_name.%index%"];
discover_sensor_ng($device, 'temperature', $mib, $oid_name, $oid_num, $index, $descr, 1, $value, $options);
}
if ($entry["hwEnclosure0{$encNum}PowerIndex"]) {
$descr = $name . ' (' . $encNum . ') ' . $entry["hwEnclosure0{$encNum}PowerDesc"];
$oid_num = ".1.3.6.1.4.1.18928.1.2.2." . ($encNum + 1) . ".7.1.3.$index";
$oid_name = "hwEnclosure0{$encNum}PowerState";
$value = $entry[$oid_name];
//discover_status($device, $oid, "hwEnclosure0{$encNum}PowerState.$index", 'areca-power-state', $descr, $value, array('entPhysicalClass' => 'power'));
discover_status_ng($device, $mib, $oid_name, $oid_num, $index, 'areca-power-state', $descr, $value, ['entPhysicalClass' => 'power']);
}
}
if ($entry["hwEnclosure0{$encNum}TempIndex"]) {
$descr = $name . ' (' . $encNum . ') ' . $entry["hwEnclosure0{$encNum}TempDesc"];
$oid_num = ".1.3.6.1.4.1.18928.1.2.2." . ($encNum+1) . ".10.1.3.$index";
$oid_name = "hwEnclosure0{$encNum}TempValue";
$value = $entry[$oid_name];
//discover_sensor('temperature', $device, $oid_num, "$oid_name.$index", 'areca', $descr, 1, $value);
$options = [ 'rename_rrd' => "areca-$oid_name.%index%" ];
discover_sensor_ng($device, 'temperature', $mib, $oid_name, $oid_num, $index, NULL, $descr, 1, $value, $options);
}
if ($entry["hwEnclosure0{$encNum}PowerIndex"]) {
$descr = $name . ' (' . $encNum . ') ' . $entry["hwEnclosure0{$encNum}PowerDesc"];
$oid_num = ".1.3.6.1.4.1.18928.1.2.2." . ($encNum+1) . ".7.1.3.$index";
$oid_name = "hwEnclosure0{$encNum}PowerState";
$value = $entry[$oid_name];
//discover_status($device, $oid, "hwEnclosure0{$encNum}PowerState.$index", 'areca-power-state', $descr, $value, array('entPhysicalClass' => 'power'));
discover_status_ng($device, $mib, $oid_name, $oid_num, $index, 'areca-power-state', $descr, $value, [ 'entPhysicalClass' => 'power' ]);
}
}
}
// SAS HDD enclosure statuses
for ($encNum = 1; $encNum <= 8; $encNum++) {
$table = "hddEnclosure$encNum";
$enclosures = snmpwalk_cache_oid($device, $table, [], "ARECA-SNMP-MIB");
if (!isset($enclosures[0]) || !$enclosures[0]["hddEnclosure0{$encNum}Installed"]) {
// Index 0 is the main enclosure data, we check if the enclosure is connected, but it will
// not have any sensors of its own, so we skip index 0.
continue;
}
$enclosure = $enclosures[0];
unset($enclosures[0]);
$name = $enclosure["hddEnclosure0{$encNum}Description"];
$table = "hddEnclosure$encNum";
$enclosures = snmpwalk_cache_oid($device, $table, [], "ARECA-SNMP-MIB");
if (!isset($enclosures[0]) || !$enclosures[0]["hddEnclosure0{$encNum}Installed"]) {
// Index 0 is the main enclosure data, we check if the enclosure is connected, but it will
// not have any sensors of its own, so we skip index 0.
continue;
}
$enclosure = $enclosures[0];
unset($enclosures[0]);
$name = $enclosure["hddEnclosure0{$encNum}Description"];
foreach ($enclosures as $index => $entry) {
if ($entry["hddEnclosure0{$encNum}Name"] === 'N.A.') { continue; }
foreach ($enclosures as $index => $entry) {
if ($entry["hddEnclosure0{$encNum}Name"] === 'N.A.') {
continue;
}
$descr = 'Slot ' . $entry["hddEnclosure0{$encNum}Slots"] . ', ' . trim($entry["hddEnclosure0{$encNum}Name"]) . ' (SN: ' . trim($entry["hddEnclosure0{$encNum}Serial"]) . ", $name)";
$oid_num = ".1.3.6.1.4.1.18928.1.2.3." . $encNum . ".4.1.8.$index";
$oid_name = "hddEnclosure0{$encNum}State";
$value = $entry[$oid_name];
$descr = 'Slot ' . $entry["hddEnclosure0{$encNum}Slots"] . ', ' . trim($entry["hddEnclosure0{$encNum}Name"]) . ' (SN: ' . trim($entry["hddEnclosure0{$encNum}Serial"]) . ", $name)";
$oid_num = ".1.3.6.1.4.1.18928.1.2.3." . $encNum . ".4.1.8.$index";
$oid_name = "hddEnclosure0{$encNum}State";
$value = $entry[$oid_name];
discover_status_ng($device, $mib, $oid_name, $oid_num, $index, 'areca-hdd-state', $descr, $value, [ 'entPhysicalClass' => 'storage' ]);
}
discover_status_ng($device, $mib, $oid_name, $oid_num, $index, 'areca-hdd-state', $descr, $value, ['entPhysicalClass' => 'storage']);
}
}
// EOF

View File

@ -6,7 +6,7 @@
*
* @package observium
* @subpackage discovery
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2021 Observium Limited
* @copyright (C) Adam Armstrong
*
*/
@ -43,30 +43,30 @@
// ASCO-QEM-72EE2::normal_voltage_unbalance.0 = INTEGER: 0
if ($oids = snmp_get_multi_oid($device, 'normal_frequency.0 normal_voltage_phase_AB.0 normal_voltage_phase_BC.0 normal_voltage_phase_CA.0', [], 'ASCO-QEM-72EE2')) {
if (strlen($oids[0]['normal_frequency']) > 2) {
$scale_frequency = 0.01;
$scale_voltage = 0.1;
} else {
$scale_frequency = 1;
$scale_voltage = 1;
}
if (strlen($oids[0]['normal_frequency']) > 2) {
$scale_frequency = 0.01;
$scale_voltage = 0.1;
} else {
$scale_frequency = 1;
$scale_voltage = 1;
}
## Input frequency
$oid = '.1.3.6.1.4.1.7777.1.1.2.0';
$value = $oids[0]['normal_frequency'];
discover_sensor_ng($device, 'frequency', $mib, 'normal_frequency', $oid, '0', NULL, 'Input', $scale_frequency, $value);
## Input frequency
$oid = '.1.3.6.1.4.1.7777.1.1.2.0';
$value = $oids[0]['normal_frequency'];
discover_sensor_ng($device, 'frequency', $mib, 'normal_frequency', $oid, '0', 'Input', $scale_frequency, $value);
$oid = ".1.3.6.1.4.1.7777.1.1.12.0";
$value = $oids[0]['normal_voltage_phase_AB'];
discover_sensor_ng($device, 'voltage', $mib, 'normal_voltage_phase_AB', $oid, '0', NULL, 'Phase AB', $scale_voltage, $value);
$oid = ".1.3.6.1.4.1.7777.1.1.12.0";
$value = $oids[0]['normal_voltage_phase_AB'];
discover_sensor_ng($device, 'voltage', $mib, 'normal_voltage_phase_AB', $oid, '0', 'Phase AB', $scale_voltage, $value);
$oid = ".1.3.6.1.4.1.7777.1.1.13.0";
$value = $oids[0]['normal_voltage_phase_BC'];
discover_sensor_ng($device, 'voltage', $mib, 'normal_voltage_phase_BC', $oid, '0', NULL, 'Phase BC', $scale_voltage, $value);
$oid = ".1.3.6.1.4.1.7777.1.1.13.0";
$value = $oids[0]['normal_voltage_phase_BC'];
discover_sensor_ng($device, 'voltage', $mib, 'normal_voltage_phase_BC', $oid, '0', 'Phase BC', $scale_voltage, $value);
$oid = ".1.3.6.1.4.1.7777.1.1.14.0";
$value = $oids[0]['normal_voltage_phase_CA'];
discover_sensor_ng($device, 'voltage', $mib, 'normal_voltage_phase_CA', $oid, '0', NULL, 'Phase CA', $scale_voltage, $value);
$oid = ".1.3.6.1.4.1.7777.1.1.14.0";
$value = $oids[0]['normal_voltage_phase_CA'];
discover_sensor_ng($device, 'voltage', $mib, 'normal_voltage_phase_CA', $oid, '0', 'Phase CA', $scale_voltage, $value);
}
// ASCO-QEM-72EE2::main_on_normal.0 = INTEGER: 1
@ -77,35 +77,35 @@ if ($oids = snmp_get_multi_oid($device, 'normal_frequency.0 normal_voltage_phase
// ASCO-QEM-72EE2::emergency_source_available.0 = INTEGER: 0
if ($oids = snmp_get_multi_oid($device, 'main_on_normal.0 main_on_emergency.0 auxiliary_on_normal.0 auxiliary_on_emergency.0 normal_source_available.0 emergency_source_available.0', [], 'ASCO-QEM-72EE2')) {
$oid_name = 'main_on_normal';
$oid_num = '.1.3.6.1.4.1.7777.1.1.4.0';
$value = $oids[0][$oid_name];
discover_status_ng($device, $mib, $oid_name, $oid_num, '0', 'status-normal', 'Main On Normal', $value, [ 'entPhysicalClass' => 'power' ]);
$oid_name = 'main_on_normal';
$oid_num = '.1.3.6.1.4.1.7777.1.1.4.0';
$value = $oids[0][$oid_name];
discover_status_ng($device, $mib, $oid_name, $oid_num, '0', 'status-normal', 'Main On Normal', $value, ['entPhysicalClass' => 'power']);
$oid_name = 'main_on_emergency';
$oid_num = '.1.3.6.1.4.1.7777.1.1.5.0';
$value = $oids[0][$oid_name];
discover_status_ng($device, $mib, $oid_name, $oid_num, '0', 'status-emergency', 'Main On Emergency', $value, [ 'entPhysicalClass' => 'power' ]);
$oid_name = 'main_on_emergency';
$oid_num = '.1.3.6.1.4.1.7777.1.1.5.0';
$value = $oids[0][$oid_name];
discover_status_ng($device, $mib, $oid_name, $oid_num, '0', 'status-emergency', 'Main On Emergency', $value, ['entPhysicalClass' => 'power']);
$oid_name = 'auxiliary_on_normal';
$oid_num = '.1.3.6.1.4.1.7777.1.1.6.0';
$value = $oids[0][$oid_name];
discover_status_ng($device, $mib, $oid_name, $oid_num, '0', 'status-normal', 'Auxiliary On Normal', $value, [ 'entPhysicalClass' => 'power' ]);
$oid_name = 'auxiliary_on_normal';
$oid_num = '.1.3.6.1.4.1.7777.1.1.6.0';
$value = $oids[0][$oid_name];
discover_status_ng($device, $mib, $oid_name, $oid_num, '0', 'status-normal', 'Auxiliary On Normal', $value, ['entPhysicalClass' => 'power']);
$oid_name = 'auxiliary_on_emergency';
$oid_num = '.1.3.6.1.4.1.7777.1.1.7.0';
$value = $oids[0][$oid_name];
discover_status_ng($device, $mib, $oid_name, $oid_num, '0', 'status-emergency', 'Auxiliary On Emergency', $value, [ 'entPhysicalClass' => 'power' ]);
$oid_name = 'auxiliary_on_emergency';
$oid_num = '.1.3.6.1.4.1.7777.1.1.7.0';
$value = $oids[0][$oid_name];
discover_status_ng($device, $mib, $oid_name, $oid_num, '0', 'status-emergency', 'Auxiliary On Emergency', $value, ['entPhysicalClass' => 'power']);
$oid_name = 'normal_source_available';
$oid_num = '.1.3.6.1.4.1.7777.1.1.8.0';
$value = $oids[0][$oid_name];
discover_status_ng($device, $mib, $oid_name, $oid_num, '0', 'status-normal', 'Normal Source Available', $value, [ 'entPhysicalClass' => 'power' ]);
$oid_name = 'normal_source_available';
$oid_num = '.1.3.6.1.4.1.7777.1.1.8.0';
$value = $oids[0][$oid_name];
discover_status_ng($device, $mib, $oid_name, $oid_num, '0', 'status-normal', 'Normal Source Available', $value, ['entPhysicalClass' => 'power']);
$oid_name = 'emergency_source_available';
$oid_num = '.1.3.6.1.4.1.7777.1.1.9.0';
$value = $oids[0][$oid_name];
discover_status_ng($device, $mib, $oid_name, $oid_num, '0', 'status-emergency', 'Emergency Source Available', $value, [ 'entPhysicalClass' => 'power' ]);
$oid_name = 'emergency_source_available';
$oid_num = '.1.3.6.1.4.1.7777.1.1.9.0';
$value = $oids[0][$oid_name];
discover_status_ng($device, $mib, $oid_name, $oid_num, '0', 'status-emergency', 'Emergency Source Available', $value, ['entPhysicalClass' => 'power']);
}
// EOF

View File

@ -6,37 +6,37 @@
*
* @package observium
* @subpackage discovery
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2021 Observium Limited
* @copyright (C) Adam Armstrong
*
*/
// Currently not possible convert to definitions because type detection is hard, based on descriptions
// SAME code in FORTINET-FORTIGATE-MIB
// ATEN-IPMI-MIB::sensorNumber.2 = INTEGER: 10
// ATEN-IPMI-MIB::sensorReading.2 = Wrong Type (should be INTEGER): STRING: "53.000"
// ATEN-IPMI-MIB::sensorPositiveHysteresis.2 = INTEGER: 0
// ATEN-IPMI-MIB::sensorNegativeHysteresis.2 = INTEGER: 0
// ATEN-IPMI-MIB::lncThreshold.2 = Wrong Type (should be INTEGER): STRING: "10.000"
// ATEN-IPMI-MIB::lcThreshold.2 = Wrong Type (should be INTEGER): STRING: "5.000"
// ATEN-IPMI-MIB::lnrThreshold.2 = Wrong Type (should be INTEGER): STRING: "5.000"
// ATEN-IPMI-MIB::uncThreshold.2 = Wrong Type (should be INTEGER): STRING: "85.000"
// ATEN-IPMI-MIB::ucThreshold.2 = Wrong Type (should be INTEGER): STRING: "90.000"
// ATEN-IPMI-MIB::unrThreshold.2 = Wrong Type (should be INTEGER): STRING: "105.000"
// ATEN-IPMI-MIB::eventAssertionEnable.2 = INTEGER: 2560
// ATEN-IPMI-MIB::eventDeassertionEnable.2 = INTEGER: 2560
// ATEN-IPMI-MIB::sensorIDString.2 = STRING: "PCH Temp"
// ATEN-IPMI-MIB::sensorNumber.3 = INTEGER: 10
// ATEN-IPMI-MIB::sensorReading.3 = STRING: "37.000"
// ATEN-IPMI-MIB::sensorPositiveHysteresis.3 = INTEGER: 0
// ATEN-IPMI-MIB::sensorNegativeHysteresis.3 = INTEGER: 0
// ATEN-IPMI-MIB::lncThreshold.3 = STRING: "10.000"
// ATEN-IPMI-MIB::lcThreshold.3 = STRING: "5.000"
// ATEN-IPMI-MIB::lnrThreshold.3 = STRING: "5.000"
// ATEN-IPMI-MIB::uncThreshold.3 = STRING: "85.000"
// ATEN-IPMI-MIB::ucThreshold.3 = STRING: "90.000"
// ATEN-IPMI-MIB::unrThreshold.3 = STRING: "105.000"
// ATEN-IPMI-MIB::eventAssertionEnable.3 = INTEGER: 2560
// ATEN-IPMI-MIB::eventDeassertionEnable.3 = INTEGER: 2560
// ATEN-IPMI-MIB::sensorIDString.3 = STRING: "PCH Temp"
// ATEN-IPMI-MIB::sensorNumber.75 = INTEGER: 0
// ATEN-IPMI-MIB::sensorReading.75 = Wrong Type (should be INTEGER): STRING: "0.000"
// ATEN-IPMI-MIB::sensorReading.75 = STRING: "0.000"
// ATEN-IPMI-MIB::sensorPositiveHysteresis.75 = INTEGER: 0
// ATEN-IPMI-MIB::sensorNegativeHysteresis.75 = INTEGER: 0
// ATEN-IPMI-MIB::lncThreshold.75 = Wrong Type (should be INTEGER): STRING: "0.000"
// ATEN-IPMI-MIB::lcThreshold.75 = Wrong Type (should be INTEGER): STRING: "0.000"
// ATEN-IPMI-MIB::lnrThreshold.75 = Wrong Type (should be INTEGER): STRING: "0.000"
// ATEN-IPMI-MIB::uncThreshold.75 = Wrong Type (should be INTEGER): STRING: "0.000"
// ATEN-IPMI-MIB::ucThreshold.75 = Wrong Type (should be INTEGER): STRING: "0.000"
// ATEN-IPMI-MIB::unrThreshold.75 = Wrong Type (should be INTEGER): STRING: "0.000"
// ATEN-IPMI-MIB::lncThreshold.75 = STRING: "0.000"
// ATEN-IPMI-MIB::lcThreshold.75 = STRING: "0.000"
// ATEN-IPMI-MIB::lnrThreshold.75 = STRING: "0.000"
// ATEN-IPMI-MIB::uncThreshold.75 = STRING: "0.000"
// ATEN-IPMI-MIB::ucThreshold.75 = STRING: "0.000"
// ATEN-IPMI-MIB::unrThreshold.75 = STRING: "0.000"
// ATEN-IPMI-MIB::eventAssertionEnable.75 = INTEGER: 0
// ATEN-IPMI-MIB::eventDeassertionEnable.75 = INTEGER: 0
// ATEN-IPMI-MIB::sensorIDString.75 = ""
@ -81,79 +81,102 @@
// ATEN-IPMI-MIB::sensorIDString.38 = STRING: "AOC_SAS Temp"
// ATEN-IPMI-MIB::sensorIDString.39 = STRING: "HDD Temp"
// ATEN-IPMI-MIB::sensorIDString.40 = STRING: "HDD Status"
$oids = snmpwalk_cache_oid($device, "sensorTable", array(), "ATEN-IPMI-MIB", NULL, OBS_SNMP_ALL_ASCII);
$oids = snmpwalk_cache_oid($device, "sensorTable", [], "ATEN-IPMI-MIB", NULL, OBS_SNMP_ALL_ASCII);
print_debug_vars($oids);
$limits = [ 'limit_low' => 'lcThreshold', 'limit_low_warn' => 'lncThreshold',
'limit_high' => 'ucThreshold', 'limit_high_warn' => 'uncThreshold' ];
$limits = ['limit_low' => 'lcThreshold', 'limit_low_warn' => 'lncThreshold',
'limit_high' => 'ucThreshold', 'limit_high_warn' => 'uncThreshold'];
foreach ($oids as $index => $entry) {
// skip empty sensors
if ($entry['sensorNumber'] == 0 || $entry['sensorIDString'] === '') { continue; }
$descr = trim($entry['sensorIDString'], ' .');
$oid_name = 'sensorReading';
$oid_num = '.1.3.6.1.4.1.21317.1.3.1.2.'.$index;
$scale = 1;
$value = $entry[$oid_name];
// Limits
// [lncThreshold] => string(6) "10.000"
// [lcThreshold] => string(5) "5.000"
// [lnrThreshold] => string(5) "5.000"
// [uncThreshold] => string(7) "100.000"
// [ucThreshold] => string(7) "105.000"
// [unrThreshold] => string(7) "110.000"
// [lncThreshold] => string(7) "700.000"
// [lcThreshold] => string(7) "500.000"
// [lnrThreshold] => string(7) "300.000"
// [uncThreshold] => string(9) "25300.000"
// [ucThreshold] => string(9) "25400.000"
// [unrThreshold] => string(9) "25500.000"
$options = [];
foreach ($limits as $limit => $limit_oid) {
if (isset($entry[$limit_oid]) && $entry[$limit_oid] != 0) {
$options[$limit] = $entry[$limit_oid];
// skip empty sensors
if ($entry['sensorNumber'] == 0 || $entry['sensorIDString'] === '') {
continue;
}
}
$limits_count = count($options);
// Detect class based on descr anv value (this is derp, table not have other data for detect class
if (str_iends($descr, ' Temp')) {
if ($value == 0 && !$limits_count) { continue; }
$descr = str_replace(' Temp', '', $descr);
$class = 'temperature';
} elseif (str_icontains_array($descr, 'Fan')) {
if ($value == 0 && !$limits_count) { continue; }
if ($value > 100 || $value == 0) {
$class = 'fanspeed';
} elseif ($value > 0) {
$class = 'load';
$options = [];
$descr = trim($entry['sensorIDString'], ' .');
$oid_name = 'sensorReading';
$oid_num = '.1.3.6.1.4.1.21317.1.3.1.2.' . $index;
$scale = 1;
$value = $entry[$oid_name];
// Limits
// [lncThreshold] => string(6) "10.000"
// [lcThreshold] => string(5) "5.000"
// [lnrThreshold] => string(5) "5.000"
// [uncThreshold] => string(7) "100.000"
// [ucThreshold] => string(7) "105.000"
// [unrThreshold] => string(7) "110.000"
// [lncThreshold] => string(7) "700.000"
// [lcThreshold] => string(7) "500.000"
// [lnrThreshold] => string(7) "300.000"
// [uncThreshold] => string(9) "25300.000"
// [ucThreshold] => string(9) "25400.000"
// [unrThreshold] => string(9) "25500.000"
$options = [];
foreach ($limits as $limit => $limit_oid) {
if (isset($entry[$limit_oid]) && $entry[$limit_oid] != 0) {
$options[$limit] = $entry[$limit_oid];
}
}
} elseif (preg_match('/\d+V(SB|DD)?\d*$/', $descr) || preg_match('/P\d+V\d+/', $descr) || preg_match('/^\d+(\.\d+)?V/', $descr) ||
str_icontains_array($descr, [ 'VCC', 'VTT', 'VDD', 'VDQ', 'VBAT', 'VSA', 'Vcore', 'VIN', 'VOUT', 'Vbus', 'Vsht', 'VDimm', 'Vcpu', 'PVNN' ])) {
if ($value == 0) { continue; }
$class = 'voltage';
} elseif (str_icontains_array($descr, [ 'Status', 'Intru' ])) {
$physical_class = str_istarts($descr, 'PS') ? 'powersupply' : 'other';
$options = [ 'entPhysicalClass' => $physical_class ];
$limits_count = count($options);
// if (str_starts($value, '0x')) {
// $options['status_unit'] = 'hex';
// }
$type = str_icontains_array($descr, 'Intru') ? 'aten-state-invert' : 'aten-state';
discover_status_ng($device, $mib, $oid_name, $oid_num, $index, $type, $descr, $value, $options);
continue;
} else {
// FIXME, not always?
if ($value == 0 && !$limits_count) { continue; }
$class = 'temperature';
}
// Detect class based on descr anv value (this is derp, table not have other data for detect class
if (str_iends($descr, [' Temp', ' Temperature'])) {
if ($value == 0 && !$limits_count) {
continue;
}
$descr = str_replace([' Temp', ' Temperature'], '', $descr);
$class = 'temperature';
} elseif (str_icontains_array($descr, 'Fan')) {
if ($value == 0 && !$limits_count) {
continue;
}
if ($value > 100 || $value == 0) {
$class = 'fanspeed';
} elseif ($value > 0) {
$class = 'load';
$options = [];
}
} elseif (str_iends($descr, [' Curr', ' Current', ' IIN' ])) {
if ($value == 0) {
continue;
}
$descr = str_replace([' Curr', ' Current' ], '', $descr);
$class = 'current';
} elseif (str_iends($descr, [' Pwr', ' Power', ' POUT' ])) {
if ($value == 0) {
continue;
}
$descr = str_replace([' Pwr', ' Power' ], '', $descr);
$class = 'power';
} elseif (preg_match('/\d+V(SB|DD)?\d*$/', $descr) || preg_match('/P\d+V\d+/', $descr) || preg_match('/^\d+(\.\d+)?V/', $descr) ||
str_icontains_array($descr, [ 'VCC', 'VPP', 'VTT', 'VDD', 'VDQ', 'VBAT', 'VSA', 'Vcore', 'VIN', 'VOUT',
'Vbus', 'Vsht', 'VDimm', 'Vcpu', 'PVNN', 'SOC', 'VMEM' ])) {
if ($value == 0) {
continue;
}
$class = 'voltage';
} elseif (str_icontains_array($descr, ['Status', 'Intru'])) {
$physical_class = str_istarts($descr, 'PS') ? 'powersupply' : 'other';
$options = ['entPhysicalClass' => $physical_class];
discover_sensor_ng($device, $class, $mib, $oid_name, $oid_num, $index, NULL, $descr, $scale, $value, $options);
// if (str_starts($value, '0x')) {
// $options['status_unit'] = 'hex';
// }
$type = str_icontains_array($descr, 'Intru') ? 'aten-state-invert' : 'aten-state';
discover_status_ng($device, $mib, $oid_name, $oid_num, $index, $type, $descr, $value, $options);
continue;
} else {
// FIXME, not always?
if ($value == 0 && !$limits_count) {
continue;
}
$class = 'temperature';
}
discover_sensor_ng($device, $class, $mib, $oid_name, $oid_num, $index, $descr, $scale, $value, $options);
}
// EOF

View File

@ -6,7 +6,7 @@
*
* @package observium
* @subpackage discovery
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2022 Observium Limited
* @copyright (C) Adam Armstrong
*
*/
@ -36,60 +36,60 @@
//ATEN-PE-CFG::deviceMaxPMT.1 = INTEGER: -3000
//ATEN-PE-CFG::deviceMaxPDMT.1 = INTEGER: -3000
$oids = snmpwalk_cache_oid($device, "deviceIntegerValueEntry", [], 'ATEN-PE-CFG');
$oids = snmpwalk_cache_oid($device, "deviceConfigEntry", $oids, 'ATEN-PE-CFG');
$oids = snmpwalk_cache_oid($device, "deviceIntegerValueEntry", [], 'ATEN-PE-CFG');
$oids = snmpwalk_cache_oid($device, "deviceConfigEntry", $oids, 'ATEN-PE-CFG');
print_debug_vars($oids);
$count = safe_count($oids);
$scale = 0.001;
foreach ($oids as $index => $entry) {
$descr = ($count > 1 ? "Device $index" : "Device");
$descr = ($count > 1 ? "Device $index" : "Device");
// Current
if (is_numeric($entry['deviceIntegerCurrent']) && $entry['deviceIntegerCurrent'] != -2000000) {
$oid = '.1.3.6.1.4.1.21317.1.3.2.2.2.1.99.1.2.' . $index;
$value = $entry['deviceIntegerCurrent'];
$options = [ 'limit_high' => (isset($entry['deviceMaxCurMT']) && $entry['deviceMaxCurMT'] > -3000 ? $entry['deviceMaxCurMT'] * 0.1 : NULL),
'limit_low' => (isset($entry['deviceMinCurMT']) && $entry['deviceMinCurMT'] > -3000 ? $entry['deviceMinCurMT'] * 0.1 : NULL) ];
// Current
if (is_numeric($entry['deviceIntegerCurrent']) && $entry['deviceIntegerCurrent'] != -2000000) {
$oid = '.1.3.6.1.4.1.21317.1.3.2.2.2.1.99.1.2.' . $index;
$value = $entry['deviceIntegerCurrent'];
$options = ['limit_high' => (isset($entry['deviceMaxCurMT']) && $entry['deviceMaxCurMT'] > -3000 ? $entry['deviceMaxCurMT'] * 0.1 : NULL),
'limit_low' => (isset($entry['deviceMinCurMT']) && $entry['deviceMinCurMT'] > -3000 ? $entry['deviceMinCurMT'] * 0.1 : NULL)];
$options['rename_rrd'] = "aten-pe-deviceIntegerCurrent.$index";
discover_sensor_ng($device,'current', $mib, 'deviceIntegerCurrent', $oid, $index, NULL, $descr . ' Current', $scale, $value, $options);
}
$options['rename_rrd'] = "aten-pe-deviceIntegerCurrent.$index";
discover_sensor_ng($device, 'current', $mib, 'deviceIntegerCurrent', $oid, $index, $descr . ' Current', $scale, $value, $options);
}
// Voltage
if (is_numeric($entry['deviceIntegerVoltage']) && $entry['deviceIntegerVoltage'] != -2000000) {
$oid = '.1.3.6.1.4.1.21317.1.3.2.2.2.1.99.1.3.' . $index;
$value = $entry['deviceIntegerVoltage'];
$options = [ 'limit_high' => (isset($entry['deviceMaxVolMT']) && $entry['deviceMaxVolMT'] > -3000 ? $entry['deviceMaxVolMT'] * 0.1 : NULL),
'limit_low' => (isset($entry['deviceMinVolMT']) && $entry['deviceMinVolMT'] > -3000 ? $entry['deviceMinVolMT'] * 0.1 : NULL) ];
// Voltage
if (is_numeric($entry['deviceIntegerVoltage']) && $entry['deviceIntegerVoltage'] != -2000000) {
$oid = '.1.3.6.1.4.1.21317.1.3.2.2.2.1.99.1.3.' . $index;
$value = $entry['deviceIntegerVoltage'];
$options = ['limit_high' => (isset($entry['deviceMaxVolMT']) && $entry['deviceMaxVolMT'] > -3000 ? $entry['deviceMaxVolMT'] * 0.1 : NULL),
'limit_low' => (isset($entry['deviceMinVolMT']) && $entry['deviceMinVolMT'] > -3000 ? $entry['deviceMinVolMT'] * 0.1 : NULL)];
$options['rename_rrd'] = "aten-pe-deviceIntegerVoltage.$index";
discover_sensor_ng($device, 'voltage', $mib, 'deviceIntegerVoltage', $oid, $index, NULL, $descr . ' Voltage', $scale, $value, $options);
}
$options['rename_rrd'] = "aten-pe-deviceIntegerVoltage.$index";
discover_sensor_ng($device, 'voltage', $mib, 'deviceIntegerVoltage', $oid, $index, $descr . ' Voltage', $scale, $value, $options);
}
// Power
if (is_numeric($entry['deviceIntegerPower']) && $entry['deviceIntegerPower'] != -2000000) {
$oid = '.1.3.6.1.4.1.21317.1.3.2.2.2.1.99.1.4.' . $index;
$value = $entry['deviceIntegerPower'];
$options = [ 'limit_high' => (isset($entry['deviceMaxPMT']) && $entry['deviceMaxPMT'] > -3000 ? $entry['deviceMaxPMT'] * 0.1 : NULL),
'limit_low' => (isset($entry['deviceMinPMT']) && $entry['deviceMinPMT'] > -3000 ? $entry['deviceMinPMT'] * 0.1 : NULL) ];
// Power
if (is_numeric($entry['deviceIntegerPower']) && $entry['deviceIntegerPower'] != -2000000) {
$oid = '.1.3.6.1.4.1.21317.1.3.2.2.2.1.99.1.4.' . $index;
$value = $entry['deviceIntegerPower'];
$options = ['limit_high' => (isset($entry['deviceMaxPMT']) && $entry['deviceMaxPMT'] > -3000 ? $entry['deviceMaxPMT'] * 0.1 : NULL),
'limit_low' => (isset($entry['deviceMinPMT']) && $entry['deviceMinPMT'] > -3000 ? $entry['deviceMinPMT'] * 0.1 : NULL)];
$options['rename_rrd'] = "aten-pe-deviceIntegerPower.$index";
discover_sensor_ng($device, 'power', $mib, 'deviceIntegerPower', $oid, $index, NULL, $descr . ' Power', $scale, $value, $options);
}
$options['rename_rrd'] = "aten-pe-deviceIntegerPower.$index";
discover_sensor_ng($device, 'power', $mib, 'deviceIntegerPower', $oid, $index, $descr . ' Power', $scale, $value, $options);
}
/* FIXME. Currently unsupported
// Power Dissipation
if (is_numeric($entry['deviceIntegerPowerDissipation']) && $entry['deviceIntegerPowerDissipation'] != -2000000) {
$oid = '.1.3.6.1.4.1.21317.1.3.2.2.2.1.99.1.5.' . $index;
$value = $entry['deviceIntegerPowerDissipation'];
$options = array('limit_high' => (isset($entry['deviceMaxPDMT']) && $entry['deviceMaxPDMT'] > -3000 ? $entry['deviceMaxPDMT'] * 0.1 : NULL),
'limit_low' => (isset($entry['deviceMinPDMT']) && $entry['deviceMinPDMT'] > -3000 ? $entry['deviceMinPDMT'] * 0.1 : NULL));
/* FIXME. Currently unsupported
// Power Dissipation
if (is_numeric($entry['deviceIntegerPowerDissipation']) && $entry['deviceIntegerPowerDissipation'] != -2000000) {
$oid = '.1.3.6.1.4.1.21317.1.3.2.2.2.1.99.1.5.' . $index;
$value = $entry['deviceIntegerPowerDissipation'];
$options = array('limit_high' => (isset($entry['deviceMaxPDMT']) && $entry['deviceMaxPDMT'] > -3000 ? $entry['deviceMaxPDMT'] * 0.1 : NULL),
'limit_low' => (isset($entry['deviceMinPDMT']) && $entry['deviceMinPDMT'] > -3000 ? $entry['deviceMinPDMT'] * 0.1 : NULL));
discover_sensor('counter', $device, $oid, "deviceIntegerPowerDissipation.$index", 'aten-pe', $descr . ' Power Dissipation', $scale, $value, $options);
}
*/
discover_sensor('counter', $device, $oid, "deviceIntegerPowerDissipation.$index", 'aten-pe', $descr . ' Power Dissipation', $scale, $value, $options);
}
*/
}
//ATEN-PE-CFG::sensorIntegerValueIndex.1 = INTEGER: 1
@ -155,44 +155,44 @@ foreach ($oids as $index => $entry) {
//ATEN-PE-CFG::sensorMaxPressMT.5 = INTEGER: -2000000
//ATEN-PE-CFG::sensorMaxPressMT.6 = INTEGER: -2000000
$oids = snmpwalk_cache_oid($device, "sensorIntegerValueEntry", [], 'ATEN-PE-CFG');
$oids = snmpwalk_cache_oid($device, "deviceSensorTresholdEntry", $oids, 'ATEN-PE-CFG');
$oids = snmpwalk_cache_oid($device, "sensorIntegerValueEntry", [], 'ATEN-PE-CFG');
$oids = snmpwalk_cache_oid($device, "deviceSensorTresholdEntry", $oids, 'ATEN-PE-CFG');
$scale = 0.001;
print_debug_vars($oids);
foreach ($oids as $index => $entry) {
// Temperature
if (is_numeric($entry['sensorIntegerTemperature']) && $entry['sensorIntegerTemperature'] > -1000000) {
$oid = '.1.3.6.1.4.1.21317.1.3.2.2.2.1.100.1.2.' . $index;
$value = $entry['sensorIntegerTemperature'];
$options = [ 'limit_high' => (isset($entry['sensorMaxTempMT']) && $entry['sensorMaxTempMT'] > -3000 ? $entry['sensorMaxTempMT'] * 0.1 : NULL),
'limit_low' => (isset($entry['sensorMinTempMT']) && $entry['sensorMinTempMT'] > -3000 ? $entry['sensorMinTempMT'] * 0.1 : NULL) ];
// Temperature
if (is_numeric($entry['sensorIntegerTemperature']) && $entry['sensorIntegerTemperature'] > -1000000) {
$oid = '.1.3.6.1.4.1.21317.1.3.2.2.2.1.100.1.2.' . $index;
$value = $entry['sensorIntegerTemperature'];
$options = ['limit_high' => (isset($entry['sensorMaxTempMT']) && $entry['sensorMaxTempMT'] > -3000 ? $entry['sensorMaxTempMT'] * 0.1 : NULL),
'limit_low' => (isset($entry['sensorMinTempMT']) && $entry['sensorMinTempMT'] > -3000 ? $entry['sensorMinTempMT'] * 0.1 : NULL)];
$options['rename_rrd'] = "aten-pe-sensorIntegerTemperature.$index";
discover_sensor_ng($device, 'temperature', $mib, 'sensorIntegerTemperature', $oid, $index, NULL, "Temperature $index", $scale, $value, $options);
}
$options['rename_rrd'] = "aten-pe-sensorIntegerTemperature.$index";
discover_sensor_ng($device, 'temperature', $mib, 'sensorIntegerTemperature', $oid, $index, "Temperature $index", $scale, $value, $options);
}
// Humidity
if (is_numeric($entry['sensorIntegerHumidity']) && $entry['sensorIntegerHumidity'] > -1000000) {
$oid = '.1.3.6.1.4.1.21317.1.3.2.2.2.1.100.1.3.' . $index;
$value = $entry['sensorIntegerHumidity'];
$options = [ 'limit_high' => (isset($entry['sensorMaxHumMT']) && $entry['sensorMaxHumMT'] > -3000 ? $entry['sensorMaxHumMT'] * 0.1 : NULL),
'limit_low' => (isset($entry['sensorMinHumMT']) && $entry['sensorMinHumMT'] > -3000 ? $entry['sensorMinHumMT'] * 0.1 : NULL) ];
// Humidity
if (is_numeric($entry['sensorIntegerHumidity']) && $entry['sensorIntegerHumidity'] > -1000000) {
$oid = '.1.3.6.1.4.1.21317.1.3.2.2.2.1.100.1.3.' . $index;
$value = $entry['sensorIntegerHumidity'];
$options = ['limit_high' => (isset($entry['sensorMaxHumMT']) && $entry['sensorMaxHumMT'] > -3000 ? $entry['sensorMaxHumMT'] * 0.1 : NULL),
'limit_low' => (isset($entry['sensorMinHumMT']) && $entry['sensorMinHumMT'] > -3000 ? $entry['sensorMinHumMT'] * 0.1 : NULL)];
$options['rename_rrd'] = "aten-pe-sensorIntegerHumidity.$index";
discover_sensor_ng($device, 'humidity', $mib, 'sensorIntegerHumidity', $oid, $index, NULL, "Humidity $index", $scale, $value, $options);
}
$options['rename_rrd'] = "aten-pe-sensorIntegerHumidity.$index";
discover_sensor_ng($device, 'humidity', $mib, 'sensorIntegerHumidity', $oid, $index, "Humidity $index", $scale, $value, $options);
}
// Pressure
if (is_numeric($entry['sensorIntegerPressure']) && $entry['sensorIntegerPressure'] > -1000000) {
$oid = '.1.3.6.1.4.1.21317.1.3.2.2.2.1.100.1.2.' . $index;
$value = $entry['sensorIntegerPressure'];
$options = [ 'limit_high' => (isset($entry['sensorMaxPressMT']) && $entry['sensorMaxPressMT'] > -3000 ? $entry['sensorMaxPressMT'] * 0.1 : NULL),
'limit_low' => (isset($entry['sensorMinPressMT']) && $entry['sensorMinPressMT'] > -3000 ? $entry['sensorMinPressMT'] * 0.1 : NULL) ];
// Pressure
if (is_numeric($entry['sensorIntegerPressure']) && $entry['sensorIntegerPressure'] > -1000000) {
$oid = '.1.3.6.1.4.1.21317.1.3.2.2.2.1.100.1.2.' . $index;
$value = $entry['sensorIntegerPressure'];
$options = ['limit_high' => (isset($entry['sensorMaxPressMT']) && $entry['sensorMaxPressMT'] > -3000 ? $entry['sensorMaxPressMT'] * 0.1 : NULL),
'limit_low' => (isset($entry['sensorMinPressMT']) && $entry['sensorMinPressMT'] > -3000 ? $entry['sensorMinPressMT'] * 0.1 : NULL)];
$options['rename_rrd'] = "aten-pe-sensorIntegerPressure.$index";
discover_sensor_ng($device, 'pressure', $mib, 'sensorIntegerPressure', $oid, $index, NULL, "Pressure $index", $scale, $value, $options);
}
$options['rename_rrd'] = "aten-pe-sensorIntegerPressure.$index";
discover_sensor_ng($device, 'pressure', $mib, 'sensorIntegerPressure', $oid, $index, "Pressure $index", $scale, $value, $options);
}
}
// Can be up to 42
@ -210,11 +210,11 @@ foreach ($oids as $index => $entry) {
$max_outlets = snmp_get_oid($device, 'outletnumber.0', 'ATEN-PE-CFG');
for ($i = 1; $i <= $max_outlets; $i++) {
$descr = 'Outlet '. $i . ' (' . snmp_get_oid($device, 'outletName.'.$i, 'ATEN-PE-CFG') . ')';
$oid_name = 'outlet'.$i.'Status';
$oid_num = snmp_translate($oid_name.'.0', $mib);
$value = snmp_get_oid($device, $oid_name.'.0', 'ATEN-PE-CFG');
discover_status_ng($device, $mib, $oid_name, $oid_num, '0', 'outletStatus', $descr, $value, [ 'entPhysicalClass' => 'outlet' ]);
$descr = 'Outlet ' . $i . ' (' . snmp_get_oid($device, 'outletName.' . $i, 'ATEN-PE-CFG') . ')';
$oid_name = 'outlet' . $i . 'Status';
$oid_num = snmp_translate($oid_name . '.0', $mib);
$value = snmp_get_oid($device, $oid_name . '.0', 'ATEN-PE-CFG');
discover_status_ng($device, $mib, $oid_name, $oid_num, '0', 'outletStatus', $descr, $value, ['entPhysicalClass' => 'outlet']);
}
// EOF

View File

@ -6,7 +6,7 @@
*
* @package observium
* @subpackage discovery
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2022 Observium Limited
* @copyright (C) Adam Armstrong
*
*/
@ -22,46 +22,48 @@ $oids = snmpwalk_cache_oid($device, 'tempSensorEntry', [], $mib, NULL, OBS_SNMP_
print_debug_vars($oids);
foreach ($oids as $index => $entry) {
//if ($entry['tempSensorStatus'] == 'failure') { continue; } // ok(1), failure(2), outOfBoundary(3)
//if ($entry['tempSensorStatus'] == 'failure') { continue; } // ok(1), failure(2), outOfBoundary(3)
// common(1), housing(2), rack(3), cpu(4)
list($tempSensorType, $tempSensorId) = explode('.', $index);
switch ($tempSensorType) {
case '1':
$descr = 'System temperature';
break;
case '2':
$descr = 'Housing temperature';
break;
case '3':
$descr = 'Rack temperature';
break;
case '4':
$descr = 'CPU temperature';
break;
default:
$descr = 'Temperature';
}
if (count($oids) > 1) {
$descr .= ' ' . $tempSensorId;
}
// common(1), housing(2), rack(3), cpu(4)
[$tempSensorType, $tempSensorId] = explode('.', $index);
switch ($tempSensorType) {
case '1':
$descr = 'System temperature';
break;
case '2':
$descr = 'Housing temperature';
break;
case '3':
$descr = 'Rack temperature';
break;
case '4':
$descr = 'CPU temperature';
break;
default:
$descr = 'Temperature';
}
if (count($oids) > 1) {
$descr .= ' ' . $tempSensorId;
}
$scale = 1;
$oid_name = 'tempSensorValue';
$oid_num = '.1.3.6.1.4.1.368.4.1.3.1.4.'.$index;
$value = $entry[$oid_name];
$scale = 1;
$oid_name = 'tempSensorValue';
$oid_num = '.1.3.6.1.4.1.368.4.1.3.1.4.' . $index;
$value = $entry[$oid_name];
if ($value <= 0) { continue; }
if ($value <= 0) {
continue;
}
discover_sensor_ng($device, 'temperature', $mib, $oid_name, $oid_num, $index, NULL, $descr, $scale, $value);
discover_sensor_ng($device, 'temperature', $mib, $oid_name, $oid_num, $index, $descr, $scale, $value);
$oid_name = 'tempSensorStatus';
$oid_num = '.1.3.6.1.4.1.368.4.1.3.1.3.'.$index;
$type = 'axisStatus';
$value = $entry[$oid_name];
$oid_name = 'tempSensorStatus';
$oid_num = '.1.3.6.1.4.1.368.4.1.3.1.3.' . $index;
$type = 'axisStatus';
$value = $entry[$oid_name];
discover_status_ng($device, $mib, $oid_name, $oid_num, $index, $type, $descr, $value, [ 'entPhysicalClass' => 'other' ]);
discover_status_ng($device, $mib, $oid_name, $oid_num, $index, $type, $descr, $value, ['entPhysicalClass' => 'other']);
}
// Fan Sensor
@ -69,34 +71,34 @@ $oids = snmpwalk_cache_oid($device, 'fanEntry', [], $mib, NULL, OBS_SNMP_ALL_NUM
print_debug_vars($oids);
foreach ($oids as $index => $entry) {
// common(1), housing(2), rack(3), cpu(4)
list($SensorType, $SensorId) = explode('.', $index);
switch ($SensorType) {
case '1':
$descr = 'System fan';
break;
case '2':
$descr = 'Housing fan';
break;
case '3':
$descr = 'Rack fan';
break;
case '4':
$descr = 'CPU fan';
break;
default:
$descr = 'Fan';
}
if (count($oids) > 1) {
$descr .= ' ' . $SensorId;
}
// common(1), housing(2), rack(3), cpu(4)
[$SensorType, $SensorId] = explode('.', $index);
switch ($SensorType) {
case '1':
$descr = 'System fan';
break;
case '2':
$descr = 'Housing fan';
break;
case '3':
$descr = 'Rack fan';
break;
case '4':
$descr = 'CPU fan';
break;
default:
$descr = 'Fan';
}
if (count($oids) > 1) {
$descr .= ' ' . $SensorId;
}
$oid_name = 'fanStatus';
$oid_num = '.1.3.6.1.4.1.368.4.1.2.1.3.'.$index;
$type = 'axisStatus';
$value = $entry[$oid_name];
$oid_name = 'fanStatus';
$oid_num = '.1.3.6.1.4.1.368.4.1.2.1.3.' . $index;
$type = 'axisStatus';
$value = $entry[$oid_name];
discover_status_ng($device, $mib, $oid_name, $oid_num, $index, $type, $descr, $value, [ 'entPhysicalClass' => 'fan' ]);
discover_status_ng($device, $mib, $oid_name, $oid_num, $index, $type, $descr, $value, ['entPhysicalClass' => 'fan']);
}
// EOF

View File

@ -6,93 +6,86 @@
*
* @package observium
* @subpackage discovery
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2021 Observium Limited
* @copyright (C) Adam Armstrong
*
*/
$modulecurrentmax = 160;
$oids = snmpwalk_cache_oid($device, "sBTAModulesRPCEntry", array(), 'Baytech-MIB-403-1');
$oids = snmpwalk_cache_oid($device, "sBTAModulesRPCEntry", [], 'Baytech-MIB-403-1');
$count = safe_count($oids);
$scale = 0.1;
print_debug_vars($oids);
foreach ($oids as $index => $entry)
{
$descr = ($count > 1 ? "Module $index" : "Module");
foreach ($oids as $index => $entry) {
$descr = ($count > 1 ? "Module $index" : "Module");
// Current
if (is_numeric($entry['sBTAModulesRPCCurrent']) && $entry['sBTAModulesRPCCurrent'] > -1)
{
$oid = '.1.3.6.1.4.1.4779.1.3.5.2.1.4.' . $index;
$value = $entry['sBTAModulesRPCCurrent'];
// Current
if (is_numeric($entry['sBTAModulesRPCCurrent']) && $entry['sBTAModulesRPCCurrent'] > -1) {
$oid = '.1.3.6.1.4.1.4779.1.3.5.2.1.4.' . $index;
$value = $entry['sBTAModulesRPCCurrent'];
// $options = array('limit_high' => (isset($entry['sBTAModulesRPCCurrentAlarmThreshold']) && $entry['sBTAModulesRPCCurrentAlarmThreshold'] > -3000 ? $entry['sBTAModulesRPCCurrentAlarmThreshold'] * 0.1 : NULL),
$options = array('limit_high' => $modulecurrentmax * $scale ,
'limit_low' => (isset($entry['sBTAModulesRPCLowCurrentThreshold']) && $entry['sBTAModulesRPCLowCurrentThreshold'] > -3000 ? $entry['sBTAModulesRPCLowCurrentThreshold'] * 0.1 : NULL));
$options = ['limit_high' => $modulecurrentmax * $scale,
'limit_low' => (isset($entry['sBTAModulesRPCLowCurrentThreshold']) && $entry['sBTAModulesRPCLowCurrentThreshold'] > -3000 ? $entry['sBTAModulesRPCLowCurrentThreshold'] * 0.1 : NULL)];
$options['rename_rrd'] = "baytech-sBTAModulesRPCCurrent.$index";
discover_sensor_ng($device,'current', $mib, 'sBTAModulesRPCCurrent', $oid, $index, NULL, $descr . ' Current', $scale, $value, $options);
}
$options['rename_rrd'] = "baytech-sBTAModulesRPCCurrent.$index";
discover_sensor_ng($device, 'current', $mib, 'sBTAModulesRPCCurrent', $oid, $index, $descr . ' Current', $scale, $value, $options);
}
// Voltage
if (is_numeric($entry['sBTAModulesRPCVoltage']) && $entry['sBTAModulesRPCVoltage'] != -2000000)
{
$oid = '.1.3.6.1.4.1.4779.1.3.5.2.1.6.' . $index;
$value = $entry['sBTAModulesRPCVoltage'];
$options = array('limit_high' => (isset($entry['sBTAModulesRPCOverVoltageThreshold']) && $entry['sBTAModulesRPCOverVoltageThreshold'] > -3000 ? $entry['sBTAModulesRPCOverVoltageThreshold'] * 0.1 : NULL),
'limit_low' => (isset($entry['sBTAModulesRPCUnderVoltageThreshold']) && $entry['sBTAModulesRPCUnderVoltageThreshold'] > -3000 ? $entry['sBTAModulesRPCUnderVoltageThreshold'] * 0.1 : NULL));
// Voltage
if (is_numeric($entry['sBTAModulesRPCVoltage']) && $entry['sBTAModulesRPCVoltage'] != -2000000) {
$oid = '.1.3.6.1.4.1.4779.1.3.5.2.1.6.' . $index;
$value = $entry['sBTAModulesRPCVoltage'];
$options = ['limit_high' => (isset($entry['sBTAModulesRPCOverVoltageThreshold']) && $entry['sBTAModulesRPCOverVoltageThreshold'] > -3000 ? $entry['sBTAModulesRPCOverVoltageThreshold'] * 0.1 : NULL),
'limit_low' => (isset($entry['sBTAModulesRPCUnderVoltageThreshold']) && $entry['sBTAModulesRPCUnderVoltageThreshold'] > -3000 ? $entry['sBTAModulesRPCUnderVoltageThreshold'] * 0.1 : NULL)];
$options['rename_rrd'] = "baytech-sBTAModulesRPCVoltage.$index";
discover_sensor_ng($device,'voltage', $mib, 'sBTAModulesRPCVoltage', $oid, $index, NULL, $descr . ' Voltage', $scale, $value, $options);
}
$options['rename_rrd'] = "baytech-sBTAModulesRPCVoltage.$index";
discover_sensor_ng($device, 'voltage', $mib, 'sBTAModulesRPCVoltage', $oid, $index, $descr . ' Voltage', $scale, $value, $options);
}
// Power
if (is_numeric($entry['sBTAModulesRPCPower']) && $entry['sBTAModulesRPCPower'] != -2000000)
{
$oid = '.1.3.6.1.4.1.4779.1.3.5.2.1.7.' . $index;
$value = $entry['sBTAModulesRPCPower'];
$options = array('limit_high' => (isset($entry['NOTSUPPORTED']) && $entry['NOTSUPPORTED'] > -3000 ? $entry['NOTSUPPORTED'] : 3328),
'limit_low' => (isset($entry['NOTSUPPORTED']) && $entry['NOTSUPPORTED'] > -3000 ? $entry['NOTSUPPORTED'] : 0));
// Power
if (is_numeric($entry['sBTAModulesRPCPower']) && $entry['sBTAModulesRPCPower'] != -2000000) {
$oid = '.1.3.6.1.4.1.4779.1.3.5.2.1.7.' . $index;
$value = $entry['sBTAModulesRPCPower'];
$options = ['limit_high' => (isset($entry['NOTSUPPORTED']) && $entry['NOTSUPPORTED'] > -3000 ? $entry['NOTSUPPORTED'] : 3328),
'limit_low' => (isset($entry['NOTSUPPORTED']) && $entry['NOTSUPPORTED'] > -3000 ? $entry['NOTSUPPORTED'] : 0)];
$options['rename_rrd'] = "baytech-sBTAModulesRPCPower.$index";
discover_sensor_ng($device,'power', $mib, 'sBTAModulesRPCPower', $oid, $index, NULL, $descr . ' Power', 1, $value, $options);
}
$options['rename_rrd'] = "baytech-sBTAModulesRPCPower.$index";
discover_sensor_ng($device, 'power', $mib, 'sBTAModulesRPCPower', $oid, $index, $descr . ' Power', 1, $value, $options);
}
// Temperature
if (is_numeric($entry['sBTAModulesRPCTemperature']) && $entry['sBTAModulesRPCTemperature'] > -1000000)
{
$oid = '.1.3.6.1.4.1.4779.1.3.5.2.1.8.' . $index;
$value = $entry['sBTAModulesRPCTemperature'];
$options = array('limit_high' => (isset($entry['sBTAModulesRPCOverTempThreshold']) && $entry['sBTAModulesRPCOverTempThreshold'] > -3000 ? $entry['sBTAModulesRPCOverTempThreshold'] * 0.1 : NULL),
'limit_low' => (isset($entry['NOTSUPPORTED']) && $entry['NOTSUPPORTED'] > -3000 ? $entry['NOTSUPPORTED'] * 0.1 : NULL));
// Temperature
if (is_numeric($entry['sBTAModulesRPCTemperature']) && $entry['sBTAModulesRPCTemperature'] > -1000000) {
$oid = '.1.3.6.1.4.1.4779.1.3.5.2.1.8.' . $index;
$value = $entry['sBTAModulesRPCTemperature'];
$options = ['limit_high' => (isset($entry['sBTAModulesRPCOverTempThreshold']) && $entry['sBTAModulesRPCOverTempThreshold'] > -3000 ? $entry['sBTAModulesRPCOverTempThreshold'] * 0.1 : NULL),
'limit_low' => (isset($entry['NOTSUPPORTED']) && $entry['NOTSUPPORTED'] > -3000 ? $entry['NOTSUPPORTED'] * 0.1 : NULL)];
$options['rename_rrd'] = "baytech-sBTAModulesRPCTemperature.$index";
discover_sensor_ng($device,'temperature', $mib, 'sBTAModulesRPCTemperature', $oid, $index, NULL, $descr, $scale, $value, $options);
}
$options['rename_rrd'] = "baytech-sBTAModulesRPCTemperature.$index";
discover_sensor_ng($device, 'temperature', $mib, 'sBTAModulesRPCTemperature', $oid, $index, $descr, $scale, $value, $options);
}
}
$oids = snmpwalk_cache_oid($device, "sBTAModulesRPCBreakersEntry", array(), 'Baytech-MIB-403-1');
$oids = snmpwalk_cache_oid($device, "sBTAModulesRPCBreakersEntry", [], 'Baytech-MIB-403-1');
$count = safe_count($oids);
$scale = 0.1;
print_debug_vars($oids);
foreach ($oids as $index => $entry)
{
$module = $entry['sBTAModulesRPCBreakersModulesIndex'];
$breaker = $entry['sBTAModulesRPCBreakersBreakersIndex'];
$descr = "Breaker $module.$breaker";
foreach ($oids as $index => $entry) {
$module = $entry['sBTAModulesRPCBreakersModulesIndex'];
$breaker = $entry['sBTAModulesRPCBreakersBreakersIndex'];
$descr = "Breaker $module.$breaker";
// Current
if (is_numeric($entry['sBTAModulesRPCBreakersCurrent']) && $entry['sBTAModulesRPCBreakersCurrent'] > -1)
{
$oid = ".1.3.6.1.4.1.4779.1.3.5.9.1.4.$module.$breaker";
$value = $entry['sBTAModulesRPCBreakersCurrent'];
$options = array('limit_high' => (isset($entry['sBTAModulesRPCBreakersCurrentAlarmThreshold']) && $entry['sBTAModulesRPCBreakersCurrentAlarmThreshold'] > -3000 ? $entry['sBTAModulesRPCBreakersCurrentAlarmThreshold'] * 0.1 : NULL),
'limit_low' => 0);
// Current
if (is_numeric($entry['sBTAModulesRPCBreakersCurrent']) && $entry['sBTAModulesRPCBreakersCurrent'] > -1) {
$oid = ".1.3.6.1.4.1.4779.1.3.5.9.1.4.$module.$breaker";
$value = $entry['sBTAModulesRPCBreakersCurrent'];
$options = ['limit_high' => (isset($entry['sBTAModulesRPCBreakersCurrentAlarmThreshold']) && $entry['sBTAModulesRPCBreakersCurrentAlarmThreshold'] > -3000 ? $entry['sBTAModulesRPCBreakersCurrentAlarmThreshold'] * 0.1 : NULL),
'limit_low' => 0];
$options['rename_rrd'] = "baytech-sBTAModulesRPCBreakersCurrent.$module.$breaker";
discover_sensor_ng($device,'current', $mib, 'sBTAModulesRPCBreakersCurrent', $oid, "$module.$breaker", NULL, $descr . ' Current', $scale, $value, $options);
}
$options['rename_rrd'] = "baytech-sBTAModulesRPCBreakersCurrent.$module.$breaker";
discover_sensor_ng($device, 'current', $mib, 'sBTAModulesRPCBreakersCurrent', $oid, "$module.$breaker", $descr . ' Current', $scale, $value, $options);
}
}
// EOF

View File

@ -1,5 +1,4 @@
<?php
/**
* Observium
*
@ -7,7 +6,7 @@
*
* @package observium
* @subpackage discovery
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2019 Observium Limited
* @copyright (C) Adam Armstrong
*
*/
@ -17,60 +16,55 @@ $mib = 'BETTER-NETWORKS-ETHERNETBOX-MIB';
echo("$mib ");
switch (snmp_get($device, 'tempunit.0', '-Oqvn', $mib))
{
case 1:
$tempunit = 'F';
break;
case 2:
$tempunit = 'K';
break;
default:
$tempunit = 'C';
switch (snmp_get($device, 'tempunit.0', '-Oqvn', $mib)) {
case 1:
$tempunit = 'F';
break;
case 2:
$tempunit = 'K';
break;
default:
$tempunit = 'C';
}
$oids = snmpwalk_cache_oid($device, 'sensorEntry', array(), $mib);
$oids = snmpwalk_cache_oid($device, 'sensorEntry', [], $mib);
print_debug_vars($oids);
foreach ($oids as $index => $entry)
{
$descr = $entry['name'];
foreach ($oids as $index => $entry) {
$descr = $entry['name'];
if (is_numeric($entry['valueint10']))
{
$scale = 0.1;
$oid_name = 'valueint10';
$oid_num = ".1.3.6.1.4.1.14848.2.1.2.1.5.{$index}";
} else {
$scale = 1;
$oid_name = 'valueint';
$oid_num = ".1.3.6.1.4.1.14848.2.1.2.1.4.{$index}";
}
$type = $mib . '-' . $oid_name;
$value = $entry[$oid_name];
$options = array();
if (is_numeric($entry['valueint10'])) {
$scale = 0.1;
$oid_name = 'valueint10';
$oid_num = ".1.3.6.1.4.1.14848.2.1.2.1.5.{$index}";
} else {
$scale = 1;
$oid_name = 'valueint';
$oid_num = ".1.3.6.1.4.1.14848.2.1.2.1.4.{$index}";
}
$type = $mib . '-' . $oid_name;
$value = $entry[$oid_name];
$options = [];
$sensor_type = FALSE;
// 0=no sensor, 1=temperature, 2=brightness, 3=humidity, 4= switch contact 5 = voltage detector 6 = smoke sensor
switch ($entry['sensortype'])
{
case 1:
$sensor_type = 'temperature';
$options['sensor_unit'] = $tempunit;
break;
case 2:
$sensor_type = 'illuminance';
break;
case 3:
$sensor_type = 'humidity';
$options['limit_high'] = 90;
$options['limit_low'] = 10;
break;
}
if ($sensor_type)
{
discover_sensor_ng($device, $sensor_type, $mib, $oid_name, $oid_num, $index, NULL, $descr, $scale, $value, $options);
}
$sensor_type = FALSE;
// 0=no sensor, 1=temperature, 2=brightness, 3=humidity, 4= switch contact 5 = voltage detector 6 = smoke sensor
switch ($entry['sensortype']) {
case 1:
$sensor_type = 'temperature';
$options['sensor_unit'] = $tempunit;
break;
case 2:
$sensor_type = 'illuminance';
break;
case 3:
$sensor_type = 'humidity';
$options['limit_high'] = 90;
$options['limit_low'] = 10;
break;
}
if ($sensor_type) {
discover_sensor_ng($device, $sensor_type, $mib, $oid_name, $oid_num, $index, $descr, $scale, $value, $options);
}
}

View File

@ -6,7 +6,7 @@
*
* @package observium
* @subpackage discovery
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2021 Observium Limited
* @copyright (C) Adam Armstrong
*
*/
@ -20,37 +20,41 @@
//BLUECOAT-SG-SENSOR-MIB::deviceSensorTimeStamp.11 = Timeticks: (3426521929) 396 days, 14:06:59.29 Hundredths of seconds
//BLUECOAT-SG-SENSOR-MIB::deviceSensorName.11 = STRING: +3.3V bus voltage 2 (Vcc)
$sensor_array = snmpwalk_cache_oid($device, 'deviceSensorValueTable', array(), 'BLUECOAT-SG-SENSOR-MIB');
$sensor_array = snmpwalk_cache_oid($device, 'deviceSensorValueTable', [], 'BLUECOAT-SG-SENSOR-MIB');
$sensor_classes = [
//'other' => 'state', // ?
//'truthvalue' => 'state', // ?
'volts' => 'voltage',
'rpm' => 'fanspeed',
'celsius' => 'temperature',
'dBm' => 'dbm'
//'other' => 'state', // ?
//'truthvalue' => 'state', // ?
'volts' => 'voltage',
'rpm' => 'fanspeed',
'celsius' => 'temperature',
'dBm' => 'dbm'
];
foreach ($sensor_array as $index => $entry) {
if (isset($sensor_classes[$entry['deviceSensorUnits']]) && is_numeric($entry['deviceSensorValue']) && is_numeric($index) &&
$entry['deviceSensorStatus'] !== 'unavailable' && $entry['deviceSensorStatus'] !== 'nonoperational') {
if (isset($sensor_classes[$entry['deviceSensorUnits']]) && is_numeric($entry['deviceSensorValue']) && is_numeric($index) &&
$entry['deviceSensorStatus'] !== 'unavailable' && $entry['deviceSensorStatus'] !== 'nonoperational') {
$descr = rewrite_entity_name($entry['deviceSensorName']);
$oid = ".1.3.6.1.4.1.3417.2.1.1.1.1.1.5.".$index;
$class = $sensor_classes[$entry['deviceSensorUnits']];
$scale = si_to_scale($entry['deviceSensorScale']);
$value = $entry['deviceSensorValue'];
$oid_name = 'bluecoat-sg-proxy-mib';
$descr = rewrite_entity_name($entry['deviceSensorName']);
$oid = ".1.3.6.1.4.1.3417.2.1.1.1.1.1.5." . $index;
$class = $sensor_classes[$entry['deviceSensorUnits']];
$scale = si_to_scale($entry['deviceSensorScale']);
$value = $entry['deviceSensorValue'];
$oid_name = 'bluecoat-sg-proxy-mib';
if ($class === 'temperature' && ($value * $scale) > 200) { continue; } // only why not possible convert to definitions
if ($value == -127) { continue; }
if ($class === 'temperature' && ($value * $scale) > 200) {
continue;
} // only why not possible convert to definitions
if ($value == -127) {
continue;
}
$options = array();
$options['rename_rrd'] = "bluecoat-sg-proxy-mib-$index";
$options['oid_scale_si'] = "deviceSensorScale"; // need walk this oid on every poll
$options = [];
$options['rename_rrd'] = "bluecoat-sg-proxy-mib-$index";
$options['oid_scale_si'] = "deviceSensorScale"; // need to walk this oid on every poll
discover_sensor_ng($device, $class, $mib, $oid_name, $oid, $index, NULL, $descr, $scale, $value, $options);
}
discover_sensor_ng($device, $class, $mib, $oid_name, $oid, $index, $descr, $scale, $value, $options);
}
}
unset($sensor_classes, $oids, $oids_arista, $sensor_array, $index, $scale, $class, $value, $descr, $ok, $options);

View File

@ -6,7 +6,7 @@
*
* @package observium
* @subpackage discovery
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2021 Observium Limited
* @copyright (C) Adam Armstrong
*
*/
@ -14,7 +14,7 @@ $bcsiIfMediaInfoEntry = snmpwalk_cache_oid($device, 'bcsiIfMediaInfoEntry', [],
print_debug_vars($bcsiIfMediaInfoEntry);
// Single-line
$bcsiOptMonInfoEntry = snmpwalk_cache_oid($device, 'bcsiOptMonInfoEntry', [], 'BROCADE-OPTICAL-MONITORING-MIB');
$bcsiOptMonInfoEntry = snmpwalk_cache_oid($device, 'bcsiOptMonInfoEntry', [], 'BROCADE-OPTICAL-MONITORING-MIB');
print_debug_vars($bcsiOptMonInfoEntry);
// Multi-line
@ -22,156 +22,158 @@ $bcsiOptMonLaneEntry = snmpwalk_multipart_oid($device, 'bcsiOptMonLaneEntry', []
print_debug_vars($bcsiOptMonLaneEntry);
foreach ($bcsiOptMonLaneEntry as $ifIndex => $transeiver) {
$multilane = count($transeiver) > 1; // Check if transceiver multi-lane (40G/100G)
$multilane = count($transeiver) > 1; // Check if transceiver multi-lane (40G/100G)
foreach ($transeiver as $lane => $entry) {
$index = $ifIndex . '.' . $lane;
foreach ($transeiver as $lane => $entry) {
$index = $ifIndex . '.' . $lane;
$entry['ifIndex'] = $ifIndex;
$entry['index'] = $index;
$match = [ 'measured_match' => [ 'entity_type' => 'port', 'field' => 'ifIndex', 'match' => '%ifIndex%' ] ];
$options = entity_measured_match_definition($device, $match, $entry);
//print_debug_vars($options);
$entry['ifIndex'] = $ifIndex;
$entry['index'] = $index;
$match = ['measured_match' => ['entity_type' => 'port', 'field' => 'ifIndex', 'match' => '%ifIndex%']];
$options = entity_measured_match_definition($device, $match, $entry);
//print_debug_vars($options);
$name = $options['port_label'];
if ($multilane) {
// For multilane append lane number
$name .= ' Lane '. $lane;
$name = $options['port_label'];
if ($multilane) {
// For multilane append lane number
$name .= ' Lane ' . $lane;
}
if (isset($bcsiIfMediaInfoEntry[$ifIndex])) {
$name .= ' (' . $bcsiIfMediaInfoEntry[$ifIndex]['bcsiIfMediaVendorName'] . ' ' . $bcsiIfMediaInfoEntry[$ifIndex]['bcsiIfMediaPartNumber'] . ')';
}
// Temperature
$descr = $name . ' Temperature';
$class = 'temperature';
$oid_name = 'bcsiOptMonLaneTemperature';
$oid_num = '.1.3.6.1.4.1.1588.3.1.8.1.1.1.2.' . $index;
$scale = 1;
$value = $entry[$oid_name];
discover_sensor_ng($device, $class, $mib, $oid_name, $oid_num, $index, $descr, $scale, $value, $options);
// Tx Bias
$descr = $name . ' Tx Bias';
$class = 'current';
$oid_name = 'bcsiOptMonLaneTxBiasCurrent';
$oid_num = '.1.3.6.1.4.1.1588.3.1.8.1.1.1.9.' . $index;
$scale = 0.001;
$value = $entry[$oid_name];
discover_sensor_ng($device, $class, $mib, $oid_name, $oid_num, $index, $descr, $scale, $value, $options);
// Tx Power
$descr = $name . ' Tx Power';
$class = 'power';
$oid_name = 'bcsiOptMonLaneTxPowerVal';
$oid_num = '.1.3.6.1.4.1.1588.3.1.8.1.1.1.5.' . $index;
$scale = 0.000001;
$value = $entry[$oid_name];
if ($entry['bcsiOptMonLaneTxPowerStatus'] !== 'notSupported') {
discover_sensor_ng($device, $class, $mib, $oid_name, $oid_num, $index, $descr, $scale, $value, $options);
}
// Tx Power Status
$descr = $name . ' Tx Power Status';
$class = 'port';
$oid_name = 'bcsiOptMonLaneTxPowerStatus';
$oid_num = '.1.3.6.1.4.1.1588.3.1.8.1.1.1.3.' . $index;
$value = $entry[$oid_name];
discover_status_ng($device, $mib, $oid_name, $oid_num, $index, 'bcsiOptMonPowerStatus', $descr, $value, $options);
// Rx Power
$descr = $name . ' Rx Power';
$class = 'power';
$oid_name = 'bcsiOptMonLaneRxPowerVal';
$oid_num = '.1.3.6.1.4.1.1588.3.1.8.1.1.1.8.' . $index;
$scale = 0.000001;
$value = $entry[$oid_name];
if ($entry['bcsiOptMonLaneRxPowerStatus'] !== 'notSupported') {
discover_sensor_ng($device, $class, $mib, $oid_name, $oid_num, $index, $descr, $scale, $value, $options);
}
// Rx Power Status
$descr = $name . ' Rx Power Status';
$class = 'port';
$oid_name = 'bcsiOptMonLaneRxPowerStatus';
$oid_num = '.1.3.6.1.4.1.1588.3.1.8.1.1.1.6.' . $index;
$value = $entry[$oid_name];
discover_status_ng($device, $mib, $oid_name, $oid_num, $index, 'bcsiOptMonPowerStatus', $descr, $value, $options);
}
if (isset($bcsiIfMediaInfoEntry[$ifIndex])) {
$name .= ' (' . $bcsiIfMediaInfoEntry[$ifIndex]['bcsiIfMediaVendorName'] . ' ' . $bcsiIfMediaInfoEntry[$ifIndex]['bcsiIfMediaPartNumber'] . ')';
}
// Temperature
$descr = $name . ' Temperature';
$class = 'temperature';
$oid_name = 'bcsiOptMonLaneTemperature';
$oid_num = '.1.3.6.1.4.1.1588.3.1.8.1.1.1.2.'.$index;
$scale = 1;
$value = $entry[$oid_name];
discover_sensor_ng($device, $class, $mib, $oid_name, $oid_num, $index, NULL, $descr, $scale, $value, $options);
// Tx Bias
$descr = $name . ' Tx Bias';
$class = 'current';
$oid_name = 'bcsiOptMonLaneTxBiasCurrent';
$oid_num = '.1.3.6.1.4.1.1588.3.1.8.1.1.1.9.'.$index;
$scale = 0.001;
$value = $entry[$oid_name];
discover_sensor_ng($device, $class, $mib, $oid_name, $oid_num, $index, NULL, $descr, $scale, $value, $options);
// Tx Power
$descr = $name . ' Tx Power';
$class = 'power';
$oid_name = 'bcsiOptMonLaneTxPowerVal';
$oid_num = '.1.3.6.1.4.1.1588.3.1.8.1.1.1.5.'.$index;
$scale = 0.000001;
$value = $entry[$oid_name];
if ($entry['bcsiOptMonLaneTxPowerStatus'] !== 'notSupported') {
discover_sensor_ng($device, $class, $mib, $oid_name, $oid_num, $index, NULL, $descr, $scale, $value, $options);
}
// Tx Power Status
$descr = $name . ' Tx Power Status';
$class = 'port';
$oid_name = 'bcsiOptMonLaneTxPowerStatus';
$oid_num = '.1.3.6.1.4.1.1588.3.1.8.1.1.1.3.'.$index;
$value = $entry[$oid_name];
discover_status_ng($device, $mib, $oid_name, $oid_num, $index, 'bcsiOptMonPowerStatus', $descr, $value, $options);
// Rx Power
$descr = $name . ' Rx Power';
$class = 'power';
$oid_name = 'bcsiOptMonLaneRxPowerVal';
$oid_num = '.1.3.6.1.4.1.1588.3.1.8.1.1.1.8.'.$index;
$scale = 0.000001;
$value = $entry[$oid_name];
if ($entry['bcsiOptMonLaneRxPowerStatus'] !== 'notSupported') {
discover_sensor_ng($device, $class, $mib, $oid_name, $oid_num, $index, NULL, $descr, $scale, $value, $options);
}
// Rx Power Status
$descr = $name . ' Rx Power Status';
$class = 'port';
$oid_name = 'bcsiOptMonLaneRxPowerStatus';
$oid_num = '.1.3.6.1.4.1.1588.3.1.8.1.1.1.6.'.$index;
$value = $entry[$oid_name];
discover_status_ng($device, $mib, $oid_name, $oid_num, $index, 'bcsiOptMonPowerStatus', $descr, $value, $options);
}
}
foreach ($bcsiOptMonInfoEntry as $ifIndex => $entry) {
// Skip Multi-lane entries
if (isset($bcsiOptMonLaneEntry[$ifIndex])) { continue; }
// Skip Multi-lane entries
if (isset($bcsiOptMonLaneEntry[$ifIndex])) {
continue;
}
$index = $ifIndex;
$entry['ifIndex'] = $ifIndex;
$entry['index'] = $index;
$match = [ 'measured_match' => [ 'entity_type' => 'port', 'field' => 'ifIndex', 'match' => '%ifIndex%' ] ];
$options = entity_measured_match_definition($device, $match, $entry);
//print_debug_vars($options);
$index = $ifIndex;
$entry['ifIndex'] = $ifIndex;
$entry['index'] = $index;
$match = ['measured_match' => ['entity_type' => 'port', 'field' => 'ifIndex', 'match' => '%ifIndex%']];
$options = entity_measured_match_definition($device, $match, $entry);
//print_debug_vars($options);
$name = $options['port_label'];
$name = $options['port_label'];
if (isset($bcsiIfMediaInfoEntry[$ifIndex])) {
$name .= ' (' . $bcsiIfMediaInfoEntry[$ifIndex]['bcsiIfMediaVendorName'] . ' ' . $bcsiIfMediaInfoEntry[$ifIndex]['bcsiIfMediaPartNumber'] . ')';
}
if (isset($bcsiIfMediaInfoEntry[$ifIndex])) {
$name .= ' (' . $bcsiIfMediaInfoEntry[$ifIndex]['bcsiIfMediaVendorName'] . ' ' . $bcsiIfMediaInfoEntry[$ifIndex]['bcsiIfMediaPartNumber'] . ')';
}
// Temperature
$descr = $name . ' Temperature';
$class = 'temperature';
$oid_name = 'bcsiOptMonTemperature';
$oid_num = '.1.3.6.1.4.1.1588.3.1.8.1.2.1.1.'.$index;
$scale = 1;
$value = $entry[$oid_name];
discover_sensor_ng($device, $class, $mib, $oid_name, $oid_num, $index, NULL, $descr, $scale, $value, $options);
// Temperature
$descr = $name . ' Temperature';
$class = 'temperature';
$oid_name = 'bcsiOptMonTemperature';
$oid_num = '.1.3.6.1.4.1.1588.3.1.8.1.2.1.1.' . $index;
$scale = 1;
$value = $entry[$oid_name];
discover_sensor_ng($device, $class, $mib, $oid_name, $oid_num, $index, $descr, $scale, $value, $options);
// Tx Bias
$descr = $name . ' Tx Bias';
$class = 'current';
$oid_name = 'bcsiOptMonTxBiasCurrent';
$oid_num = '.1.3.6.1.4.1.1588.3.1.8.1.2.1.8.'.$index;
$scale = 0.001;
$value = $entry[$oid_name];
discover_sensor_ng($device, $class, $mib, $oid_name, $oid_num, $index, NULL, $descr, $scale, $value, $options);
// Tx Bias
$descr = $name . ' Tx Bias';
$class = 'current';
$oid_name = 'bcsiOptMonTxBiasCurrent';
$oid_num = '.1.3.6.1.4.1.1588.3.1.8.1.2.1.8.' . $index;
$scale = 0.001;
$value = $entry[$oid_name];
discover_sensor_ng($device, $class, $mib, $oid_name, $oid_num, $index, $descr, $scale, $value, $options);
// Tx Power
$descr = $name . ' Tx Power';
$class = 'power';
$oid_name = 'bcsiOptMonTxPowerVal';
$oid_num = '.1.3.6.1.4.1.1588.3.1.8.1.2.1.4.'.$index;
$scale = 0.000001;
$value = $entry[$oid_name];
if ($entry['bcsiOptMonTxPowerStatus'] !== 'notSupported') {
discover_sensor_ng($device, $class, $mib, $oid_name, $oid_num, $index, NULL, $descr, $scale, $value, $options);
}
// Tx Power
$descr = $name . ' Tx Power';
$class = 'power';
$oid_name = 'bcsiOptMonTxPowerVal';
$oid_num = '.1.3.6.1.4.1.1588.3.1.8.1.2.1.4.' . $index;
$scale = 0.000001;
$value = $entry[$oid_name];
if ($entry['bcsiOptMonTxPowerStatus'] !== 'notSupported') {
discover_sensor_ng($device, $class, $mib, $oid_name, $oid_num, $index, $descr, $scale, $value, $options);
}
// Tx Power Status
$descr = $name . ' Tx Power Status';
$class = 'port';
$oid_name = 'bcsiOptMonTxPowerStatus';
$oid_num = '.1.3.6.1.4.1.1588.3.1.8.1.2.1.2.'.$index;
$value = $entry[$oid_name];
discover_status_ng($device, $mib, $oid_name, $oid_num, $index, 'bcsiOptMonPowerStatus', $descr, $value, $options);
// Tx Power Status
$descr = $name . ' Tx Power Status';
$class = 'port';
$oid_name = 'bcsiOptMonTxPowerStatus';
$oid_num = '.1.3.6.1.4.1.1588.3.1.8.1.2.1.2.' . $index;
$value = $entry[$oid_name];
discover_status_ng($device, $mib, $oid_name, $oid_num, $index, 'bcsiOptMonPowerStatus', $descr, $value, $options);
// Rx Power
$descr = $name . ' Rx Power';
$class = 'power';
$oid_name = 'bcsiOptMonRxPowerVal';
$oid_num = '.1.3.6.1.4.1.1588.3.1.8.1.2.1.7.'.$index;
$scale = 0.000001;
$value = $entry[$oid_name];
if ($entry['bcsiOptMonRxPowerStatus'] !== 'notSupported') {
discover_sensor_ng($device, $class, $mib, $oid_name, $oid_num, $index, NULL, $descr, $scale, $value, $options);
}
// Rx Power
$descr = $name . ' Rx Power';
$class = 'power';
$oid_name = 'bcsiOptMonRxPowerVal';
$oid_num = '.1.3.6.1.4.1.1588.3.1.8.1.2.1.7.' . $index;
$scale = 0.000001;
$value = $entry[$oid_name];
if ($entry['bcsiOptMonRxPowerStatus'] !== 'notSupported') {
discover_sensor_ng($device, $class, $mib, $oid_name, $oid_num, $index, $descr, $scale, $value, $options);
}
// Rx Power Status
$descr = $name . ' Rx Power Status';
$class = 'port';
$oid_name = 'bcsiOptMonRxPowerStatus';
$oid_num = '.1.3.6.1.4.1.1588.3.1.8.1.2.1.5.'.$index;
$value = $entry[$oid_name];
discover_status_ng($device, $mib, $oid_name, $oid_num, $index, 'bcsiOptMonPowerStatus', $descr, $value, $options);
// Rx Power Status
$descr = $name . ' Rx Power Status';
$class = 'port';
$oid_name = 'bcsiOptMonRxPowerStatus';
$oid_num = '.1.3.6.1.4.1.1588.3.1.8.1.2.1.5.' . $index;
$value = $entry[$oid_name];
discover_status_ng($device, $mib, $oid_name, $oid_num, $index, 'bcsiOptMonPowerStatus', $descr, $value, $options);
}
// EOF

View File

@ -1,5 +1,4 @@
<?php
/**
* Observium
*
@ -7,7 +6,7 @@
*
* @package observium
* @subpackage discovery
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2019 Observium Limited
* @copyright (C) Adam Armstrong
*
*/
@ -16,18 +15,16 @@
$numeric_oids = [
['oid_num' => '.1.3.6.1.4.1.9839.2.1.2.1.0', 'class' => 'temperature', 'scale' => 0.1, 'type' => 'denco-analog', 'descr' => 'Temperature'],
['oid_num' => '.1.3.6.1.4.1.9839.2.1.2.2.0', 'class' => 'humidity', 'scale' => 0.1, 'type' => 'denco-analog', 'descr' => 'Humidity'],
['oid_num' => '.1.3.6.1.4.1.9839.2.1.2.2.0', 'class' => 'humidity', 'scale' => 0.1, 'type' => 'denco-analog', 'descr' => 'Humidity'],
];
foreach ($numeric_oids as $entry)
{
$value = snmp_get_oid($device, $entry['oid_num']);
$scale = isset($entry['scale']) ? $entry['scale'] : 1;
$options = [];
if ($value > 0 && $value != 32767)
{
discover_sensor_ng($device, $entry['class'], NULL, NULL, $entry['oid_num'], 0, $entry['type'], $entry['descr'], $scale, $value, $options);
}
foreach ($numeric_oids as $entry) {
$value = snmp_get_oid($device, $entry['oid_num']);
$scale = $entry['scale'] ?? 1;
$options = [ 'sensor_type' => $entry['type'] ];
if ($value > 0 && $value != 32767) {
discover_sensor_ng($device, $entry['class'], NULL, NULL, $entry['oid_num'], 0, $entry['descr'], $scale, $value, $options);
}
}
// EOF

View File

@ -1,5 +1,4 @@
<?php
/**
* Observium
*
@ -7,48 +6,44 @@
*
* @package observium
* @subpackage discovery
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2019 Observium Limited
* @copyright (C) Adam Armstrong
*
*/
$chkpnt['temp'] = snmpwalk_cache_oid($device, 'tempertureSensorEntry', array(), 'CHECKPOINT-MIB');
$chkpnt['fan'] = snmpwalk_cache_oid($device, 'fanSpeedSensorEntry', array(), 'CHECKPOINT-MIB');
$chkpnt['volt'] = snmpwalk_cache_oid($device, 'voltageSensorEntry', array(), 'CHECKPOINT-MIB');
$chkpnt['temp'] = snmpwalk_cache_oid($device, 'tempertureSensorEntry', [], 'CHECKPOINT-MIB');
$chkpnt['fan'] = snmpwalk_cache_oid($device, 'fanSpeedSensorEntry', [], 'CHECKPOINT-MIB');
$chkpnt['volt'] = snmpwalk_cache_oid($device, 'voltageSensorEntry', [], 'CHECKPOINT-MIB');
foreach ($chkpnt['temp'] as $index => $entry)
{
$oid = '.1.3.6.1.4.1.2620.1.6.7.8.1.1.3.'.$index;
$descr = $entry['tempertureSensorName'];
$object = 'tempertureSensorValue';
$value = $entry['tempertureSensorValue'];
if ($entry['tempertureSensorValue'] > 0 && $value <= 1000)
{
discover_sensor_ng($device, 'temperature', $mib, $object, $oid, $index, NULL, $descr, 1, $value, ['rename_rrd' => "checkpoint-$index"]);
}
foreach ($chkpnt['temp'] as $index => $entry) {
$oid = '.1.3.6.1.4.1.2620.1.6.7.8.1.1.3.' . $index;
$descr = $entry['tempertureSensorName'];
$object = 'tempertureSensorValue';
$value = $entry['tempertureSensorValue'];
if ($entry['tempertureSensorValue'] > 0 && $value <= 1000) {
discover_sensor_ng($device, 'temperature', $mib, $object, $oid, $index, $descr, 1, $value, [ 'rename_rrd' => "checkpoint-$index" ]);
}
}
foreach ($chkpnt['fan'] as $index => $entry)
{
$oid = '.1.3.6.1.4.1.2620.1.6.7.8.2.1.3.'.$index;
$object = 'fanSpeedSensorValue';
$descr = $entry['fanSpeedSensorName'];
$value = $entry['fanSpeedSensorValue'];
if ($entry['fanSpeedSensorValue'] > 0)
{
discover_sensor_ng($device,'fanspeed', $mib, $object, $oid, $index, NULL, $descr, 1, $value, ['rename_rrd' => "checkpoint-$index"]);
}
foreach ($chkpnt['fan'] as $index => $entry) {
$oid = '.1.3.6.1.4.1.2620.1.6.7.8.2.1.3.' . $index;
$object = 'fanSpeedSensorValue';
$descr = $entry['fanSpeedSensorName'];
$value = $entry['fanSpeedSensorValue'];
if ($entry['fanSpeedSensorValue'] > 0) {
discover_sensor_ng($device, 'fanspeed', $mib, $object, $oid, $index, $descr, 1, $value, [ 'rename_rrd' => "checkpoint-$index" ]);
}
}
foreach ($chkpnt['volt'] as $index => $entry)
{
$oid = '.1.3.6.1.4.1.2620.1.6.7.8.3.1.3.'.$index;
$object = 'voltageSensorValue';
$descr = $entry['voltageSensorName'];
$value = $entry['voltageSensorValue'];
if (is_numeric($value) && $value > 0)
{
discover_sensor_ng($device,'voltage', $mib, $object, $oid, $index, NULL, $descr, 1, $value, ['rename_rrd' => "checkpoint-$index"]);
}
foreach ($chkpnt['volt'] as $index => $entry) {
$oid = '.1.3.6.1.4.1.2620.1.6.7.8.3.1.3.' . $index;
$object = 'voltageSensorValue';
$descr = $entry['voltageSensorName'];
$value = $entry['voltageSensorValue'];
if (is_numeric($value) && $value > 0) {
discover_sensor_ng($device, 'voltage', $mib, $object, $oid, $index, $descr, 1, $value, [ 'rename_rrd' => "checkpoint-$index" ]);
}
}
unset($chkpnt);
// EOF

View File

@ -1,5 +1,4 @@
<?php
/**
* Observium
*
@ -7,14 +6,14 @@
*
* @package observium
* @subpackage discovery
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2019 Observium Limited
* @copyright (C) Adam Armstrong
*
*/
// RIP falz 2017-05
// falz 2017-05
$cienaWsXcvrObjects_oids = array(
$cienaWsXcvrObjects_oids = [
'cwsXcvrTemperatureActual',
'cwsXcvrTemperatureThresholdHighAlarmThreshold',
'cwsXcvrTemperatureThresholdLowAlarmThreshold',
@ -32,138 +31,124 @@ $cienaWsXcvrObjects_oids = array(
'cwsXcvrTxPowerThresholdLowAlarmThreshold',
'cwsXcvrTxPowerThresholdHighWarningThreshold',
'cwsXcvrTxPowerThresholdLowWarningThreshold'
);
];
$oids = array();
foreach ($cienaWsXcvrObjects_oids as $oid)
{
$oids = snmpwalk_cache_oid($device, $oid, $oids, 'CIENA-WS-XCVR-MIB');
$oids = [];
foreach ($cienaWsXcvrObjects_oids as $oid) {
$oids = snmpwalk_cache_oid($device, $oid, $oids, 'CIENA-WS-XCVR-MIB');
}
foreach ($oids as $index => $entry)
{
foreach ($oids as $index => $entry) {
// array index looks like [4.0] if theres only one lane, or [24.1.0] if there are >1 lanes such as LR4. it will then be 24.1.0 ... 24.4.0.
// the first number is is ifIndex, grab it.
list($ifIndex,$lane,) = explode(".", $index, 3);
// array index looks like [4.0] if theres only one lane, or [24.1.0] if there are >1 lanes such as LR4. it will then be 24.1.0 ... 24.4.0.
// the first number is is ifIndex, grab it.
[ $ifIndex, $lane, ] = explode(".", $index, 3);
// if 2nd element is greater than 0, it's the lane number (1-4 for LR4)
if ($lane > 0)
{
$laneDescr = " Lane " . $lane;
}
// if 2nd element is greater than 0, it's the lane number (1-4 for LR4)
if ($lane > 0) {
$laneDescr = " Lane " . $lane;
}
$options = array('entPhysicalIndex' => $index);
$options = ['entPhysicalIndex' => $index];
$port = get_port_by_index_cache($device['device_id'], $ifIndex);
if (is_array($port))
{
$entry['ifDescr'] = $port['ifDescr'];
$options['measured_class'] = 'port';
$options['measured_entity'] = $port['port_id'];
} else {
$entry['ifDescr'] = snmp_get($device, "ifDescr.$ifIndex", '-Oqv', 'IF-MIB');
}
$port = get_port_by_index_cache($device['device_id'], $ifIndex);
if (is_array($port)) {
$entry['ifDescr'] = $port['ifDescr'];
$options['measured_class'] = 'port';
$options['measured_entity'] = $port['port_id'];
} else {
$entry['ifDescr'] = snmp_get($device, "ifDescr.$ifIndex", '-Oqv', 'IF-MIB');
}
// ciena $ifDescr is stupidly long: "Ciena Waveserver 100GigEthernet 1". trim off the first part to save some bits
$entry['ifDescr'] = preg_replace('/^Ciena Waveserver /', '', $entry['ifDescr']);
#echo $entry['ifDescr'];
// ciena $ifDescr is stupidly long: "Ciena Waveserver 100GigEthernet 1". trim off the first part to save some bits
$entry['ifDescr'] = preg_replace('/^Ciena Waveserver /', '', $entry['ifDescr']);
#echo $entry['ifDescr'];
// CIENA-WS-XCVR-MIB::cwsXcvrTemperatureActual.4.0 = INTEGER: 32
// CIENA-WS-XCVR-MIB::cwsXcvrTemperatureThresholdHighAlarmThreshold.4.0 = INTEGER: 78
// CIENA-WS-XCVR-MIB::cwsXcvrTemperatureThresholdLowAlarmThreshold.4.0 = INTEGER: 0
// CIENA-WS-XCVR-MIB::cwsXcvrTemperatureThresholdHighWarningThreshold.4.0 = INTEGER: 69
// CIENA-WS-XCVR-MIB::cwsXcvrTemperatureThresholdLowWarningThreshold.4.0 = INTEGER: 0
// CIENA-WS-XCVR-MIB::cwsXcvrTemperatureActual.4.0 = INTEGER: 32
// CIENA-WS-XCVR-MIB::cwsXcvrTemperatureThresholdHighAlarmThreshold.4.0 = INTEGER: 78
// CIENA-WS-XCVR-MIB::cwsXcvrTemperatureThresholdLowAlarmThreshold.4.0 = INTEGER: 0
// CIENA-WS-XCVR-MIB::cwsXcvrTemperatureThresholdHighWarningThreshold.4.0 = INTEGER: 69
// CIENA-WS-XCVR-MIB::cwsXcvrTemperatureThresholdLowWarningThreshold.4.0 = INTEGER: 0
$descr = $entry['ifDescr'] . ' Temp';
$oid_name = 'cwsXcvrTemperatureActual';
$oid_num = '.1.3.6.1.4.1.1271.3.4.15.13.1.2.'.$index;
$type = 'cwsXcvrTemperatureActual'; // $mib . '-' . $oid_name;
if (version_compare($device['version'], '1.6', '>='))
{
// See: http://jira.observium.org/browse/OBS-2753
$scale = 0.001;
} else {
$scale = 1;
}
$value = $entry[$oid_name];
$descr = $entry['ifDescr'] . ' Temp';
$oid_name = 'cwsXcvrTemperatureActual';
$oid_num = '.1.3.6.1.4.1.1271.3.4.15.13.1.2.' . $index;
if (version_compare($device['version'], '1.6', '>=')) {
// See: http://jira.observium.org/browse/OBS-2753
$scale = 0.001;
} else {
$scale = 1;
}
$value = $entry[$oid_name];
$limits = array('limit_high' => $entry['cwsXcvrTemperatureThresholdHighAlarmThreshold'],
'limit_low' => $entry['cwsXcvrTemperatureThresholdLowAlarmThreshold'],
'limit_high_warn' => $entry['cwsXcvrTemperatureThresholdHighWarningThreshold'],
'limit_low_warn' => $entry['cwsXcvrTemperatureThresholdLowWarningThreshold']);
$limits = ['limit_high' => $entry['cwsXcvrTemperatureThresholdHighAlarmThreshold'],
'limit_low' => $entry['cwsXcvrTemperatureThresholdLowAlarmThreshold'],
'limit_high_warn' => $entry['cwsXcvrTemperatureThresholdHighWarningThreshold'],
'limit_low_warn' => $entry['cwsXcvrTemperatureThresholdLowWarningThreshold']];
if ($value != 0)
{
$limits['rename_rrd'] = 'cwsXcvrTemperatureActual-'.$index;
discover_sensor_ng($device,'temperature', $mib, $oid_name, $oid_num, $index, NULL, $descr, $scale, $value, array_merge($options, $limits));
}
if ($value != 0) {
$limits['rename_rrd'] = 'cwsXcvrTemperatureActual-' . $index;
discover_sensor_ng($device, 'temperature', $mib, $oid_name, $oid_num, $index, $descr, $scale, $value, array_merge($options, $limits));
}
if ($entry['cwsXcvrChannelTxPowerActual'] == 0 && $entry['cwsXcvrChannelRxPowerActual'] == 0)
{
// Skip other empty dom sensors
continue;
}
if ($entry['cwsXcvrChannelTxPowerActual'] == 0 && $entry['cwsXcvrChannelRxPowerActual'] == 0) {
// Skip other empty dom sensors
continue;
}
#CIENA-WS-XCVR-MIB::cwsXcvrChannelRxPowerActual.4.1.0 = INTEGER: -15.8
#CIENA-WS-XCVR-MIB::cwsXcvrRxPowerThresholdHighAlarmThreshold.4.1.0 = INTEGER: 5.5
#CIENA-WS-XCVR-MIB::cwsXcvrRxPowerThresholdLowAlarmThreshold.4.1.0 = INTEGER: -22.5
#CIENA-WS-XCVR-MIB::cwsXcvrRxPowerThresholdHighWarningThreshold.4.1.0 = INTEGER: .0
#CIENA-WS-XCVR-MIB::cwsXcvrRxPowerThresholdLowWarningThreshold.4.1.0 = INTEGER: .0
#CIENA-WS-XCVR-MIB::cwsXcvrChannelRxPowerActual.4.1.0 = INTEGER: -15.8
#CIENA-WS-XCVR-MIB::cwsXcvrRxPowerThresholdHighAlarmThreshold.4.1.0 = INTEGER: 5.5
#CIENA-WS-XCVR-MIB::cwsXcvrRxPowerThresholdLowAlarmThreshold.4.1.0 = INTEGER: -22.5
#CIENA-WS-XCVR-MIB::cwsXcvrRxPowerThresholdHighWarningThreshold.4.1.0 = INTEGER: .0
#CIENA-WS-XCVR-MIB::cwsXcvrRxPowerThresholdLowWarningThreshold.4.1.0 = INTEGER: .0
$descr = $entry['ifDescr'] . $laneDescr . " RX Power";
$oid_name = 'cwsXcvrChannelRxPowerActual';
$oid_num = '.1.3.6.1.4.1.1271.3.4.15.17.1.2.'.$index;
$type = 'cwsXcvrChannelRxPowerActual'; // $mib . '-' . $oid_name;
$scale = .1;
$value = $entry[$oid_name];
$descr = $entry['ifDescr'] . $laneDescr . " RX Power";
$oid_name = 'cwsXcvrChannelRxPowerActual';
$oid_num = '.1.3.6.1.4.1.1271.3.4.15.17.1.2.' . $index;
$scale = 0.1;
$value = $entry[$oid_name];
$limits = array('limit_high' => $entry['cwsXcvrRxPowerThresholdHighAlarmThreshold'] ,
'limit_low' => $entry['cwsXcvrRxPowerThresholdLowAlarmThreshold'] ,
'limit_high_warn' => $entry['cwsXcvrRxPowerThresholdHighWarningThreshold'] ,
'limit_low_warn' => $entry['cwsXcvrRxPowerThresholdLowWarningThreshold'] );
$limits = ['limit_high' => $entry['cwsXcvrRxPowerThresholdHighAlarmThreshold'],
'limit_low' => $entry['cwsXcvrRxPowerThresholdLowAlarmThreshold'],
'limit_high_warn' => $entry['cwsXcvrRxPowerThresholdHighWarningThreshold'],
'limit_low_warn' => $entry['cwsXcvrRxPowerThresholdLowWarningThreshold']];
# some interfaces always return .0 for warnings, unset them if this is the case.
if ( $entry['cwsXcvrRxPowerThresholdHighWarningThreshold'] == .0 || $entry['cwsXcvrRxPowerThresholdLowWarningThreshold'] == .0)
{
unset($limits['limit_low_warn']);
unset($limits['limit_high_warn']);
}
# some interfaces always return .0 for warnings, unset them if this is the case.
if ($entry['cwsXcvrRxPowerThresholdHighWarningThreshold'] == .0 || $entry['cwsXcvrRxPowerThresholdLowWarningThreshold'] == .0) {
unset($limits['limit_low_warn'], $limits['limit_high_warn']);
}
$limits['rename_rrd'] = 'cwsXcvrChannelRxPowerActual-'.$index;
discover_sensor_ng($device,'dbm', $mib, $oid_name, $oid_num, $index, NULL, $descr, $scale, $value, array_merge($options, $limits));
$limits['rename_rrd'] = 'cwsXcvrChannelRxPowerActual-' . $index;
discover_sensor_ng($device, 'dbm', $mib, $oid_name, $oid_num, $index, $descr, $scale, $value, array_merge($options, $limits));
// CIENA-WS-XCVR-MIB::cwsXcvrChannelTxPowerActual.4.1.0 = INTEGER: 1.5
// CIENA-WS-XCVR-MIB::cwsXcvrTxPowerThresholdHighAlarmThreshold.4.1.0 = INTEGER: 4.5
// CIENA-WS-XCVR-MIB::cwsXcvrTxPowerThresholdLowAlarmThreshold.4.1.0 = INTEGER: -8.5
// CIENA-WS-XCVR-MIB::cwsXcvrTxPowerThresholdHighWarningThreshold.4.1.0 = INTEGER: .0
// CIENA-WS-XCVR-MIB::cwsXcvrTxPowerThresholdLowWarningThreshold.4.1.0 = INTEGER: .0
// CIENA-WS-XCVR-MIB::cwsXcvrChannelTxPowerActual.4.1.0 = INTEGER: 1.5
// CIENA-WS-XCVR-MIB::cwsXcvrTxPowerThresholdHighAlarmThreshold.4.1.0 = INTEGER: 4.5
// CIENA-WS-XCVR-MIB::cwsXcvrTxPowerThresholdLowAlarmThreshold.4.1.0 = INTEGER: -8.5
// CIENA-WS-XCVR-MIB::cwsXcvrTxPowerThresholdHighWarningThreshold.4.1.0 = INTEGER: .0
// CIENA-WS-XCVR-MIB::cwsXcvrTxPowerThresholdLowWarningThreshold.4.1.0 = INTEGER: .0
$descr = $entry['ifDescr'] . $laneDescr . " TX Power";
$oid_name = 'cwsXcvrChannelTxPowerActual';
$oid_num = '.1.3.6.1.4.1.1271.3.4.15.20.1.2.' . $index;
$type = 'cwsXcvrChannelTxPowerActual'; // $mib . '-' . $oid_name;
$scale = .1;
$value = $entry[$oid_name];
$descr = $entry['ifDescr'] . $laneDescr . " TX Power";
$oid_name = 'cwsXcvrChannelTxPowerActual';
$oid_num = '.1.3.6.1.4.1.1271.3.4.15.20.1.2.' . $index;
$scale = 0.1;
$value = $entry[$oid_name];
$limits = array('limit_high' => $entry['cwsXcvrTxPowerThresholdHighAlarmThreshold'] ,
'limit_low' => $entry['cwsXcvrTxPowerThresholdLowAlarmThreshold'] ,
'limit_high_warn' => $entry['cwsXcvrTxPowerThresholdHighWarningThreshold'] ,
'limit_low_warn' => $entry['cwsXcvrTxPowerThresholdLowWarningThreshold'] );
$limits = [ 'limit_high' => $entry['cwsXcvrTxPowerThresholdHighAlarmThreshold'],
'limit_low' => $entry['cwsXcvrTxPowerThresholdLowAlarmThreshold'],
'limit_high_warn' => $entry['cwsXcvrTxPowerThresholdHighWarningThreshold'],
'limit_low_warn' => $entry['cwsXcvrTxPowerThresholdLowWarningThreshold'] ];
# some interfaces always return .0 for warnings, unset them if this is the case.
if ($entry['cwsXcvrTxPowerThresholdHighWarningThreshold'] == .0 || $entry['cwsXcvrTxPowerThresholdLowWarningThreshold'] == .0)
{
unset($limits['limit_low_warn']);
unset($limits['limit_high_warn']);
}
# some interfaces always return .0 for warnings, unset them if this is the case.
if ($entry['cwsXcvrTxPowerThresholdHighWarningThreshold'] == .0 || $entry['cwsXcvrTxPowerThresholdLowWarningThreshold'] == .0) {
unset($limits['limit_low_warn'], $limits['limit_high_warn']);
}
$limits['rename_rrd'] = 'cwsXcvrChannelTxPowerActual-'.$index;
discover_sensor_ng($device,'dbm', $mib, $oid_name, $oid_num, $index, $type, $descr, $scale, $value, array_merge($options, $limits));
$limits['rename_rrd'] = 'cwsXcvrChannelTxPowerActual-' . $index;
discover_sensor_ng($device, 'dbm', $mib, $oid_name, $oid_num, $index, $descr, $scale, $value, array_merge($options, $limits));
}
// EOF

View File

@ -6,193 +6,192 @@
*
* @package observium
* @subpackage discovery
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2021 Observium Limited
* @copyright (C) Adam Armstrong
*
*/
// Skip statuses if we have any status from CISCO-ENVMON-MIB (for exclude duplicates)
$skip_status = dbExist('status', '`device_id` = ? AND `status_type` = ? AND `status_deleted` = ?', array($device['device_id'], 'cisco-envmon-state', 0));
$skip_status = dbExist('status', '`device_id` = ? AND `status_type` = ? AND `status_deleted` = ?', [$device['device_id'], 'cisco-envmon-state', 0]);
// Walk CISCO-ENTITY-FRU-CONTROL-MIB oids
$entity_array = array();
$oids = array('cefcFRUPowerStatusEntry', 'cefcFanTrayStatusEntry', 'cefcFanEntry', 'cefcModuleEntry');
foreach ($oids as $oid)
{
$entity_array = snmpwalk_cache_oid($device, $oid, $entity_array, 'CISCO-ENTITY-FRU-CONTROL-MIB');
$entity_array = [];
$oids = ['cefcFRUPowerStatusEntry', 'cefcFanTrayStatusEntry', 'cefcFanEntry', 'cefcModuleEntry'];
foreach ($oids as $oid) {
$entity_array = snmpwalk_cache_oid($device, $oid, $entity_array, 'CISCO-ENTITY-FRU-CONTROL-MIB');
}
// split PowerSupplyGroup from common walk array
$cefcFRUPowerSupplyGroupEntry = snmpwalk_cache_oid($device, 'cefcFRUPowerSupplyGroupEntry', array(), 'CISCO-ENTITY-FRU-CONTROL-MIB');
$cefcFRUPowerSupplyGroupEntry = snmpwalk_cache_oid($device, 'cefcFRUPowerSupplyGroupEntry', [], 'CISCO-ENTITY-FRU-CONTROL-MIB');
if (count($entity_array))
{
// Pre-cache entity mib (if not cached in inventory module)
if (is_array($GLOBALS['cache']['entity-mib']))
{
$entity_mib = $GLOBALS['cache']['entity-mib'];
print_debug("ENTITY-MIB already cached");
} else {
$entity_mib = array();
$oids = array('entPhysicalDescr', 'entPhysicalName', 'entPhysicalClass', 'entPhysicalContainedIn', 'entPhysicalParentRelPos');
foreach ($oids as $oid)
{
$entity_mib = snmpwalk_cache_oid($device, $oid, $entity_mib, 'ENTITY-MIB:CISCO-ENTITY-VENDORTYPE-OID-MIB');
if (!$GLOBALS['snmp_status']) { break; }
}
//$entity_mib = snmpwalk_cache_twopart_oid($device, 'entAliasMappingIdentifier', $entity_mib, 'ENTITY-MIB:IF-MIB');
}
// Merge with ENTITY-MIB
if (safe_count($entity_mib))
{
// Power & Fan
foreach ($entity_array as $index => $entry)
{
if (isset($entity_mib[$index]))
{
$entity_array[$index] = array_merge($entity_mib[$index], $entry);
}
}
// PowerSupplyGroup
foreach ($cefcFRUPowerSupplyGroupEntry as $index => $entry)
{
if (isset($entity_mib[$index]))
{
$cefcFRUPowerSupplyGroupEntry[$index] = array_merge($entity_mib[$index], $entry);
}
}
}
unset($entity_mib);
print_debug_vars($cefcFRUPowerSupplyGroupEntry);
print_debug_vars($entity_array);
foreach ($cefcFRUPowerSupplyGroupEntry as $index => $entry)
{
$descr = $entry['entPhysicalDescr'];
$oid_name = 'cefcTotalDrawnCurrent';
$oid_num = '.1.3.6.1.4.1.9.9.117.1.1.1.1.4.'.$index;
$type = $mib . '-' . $oid_name;
if (str_istarts($entry['cefcPowerUnits'], 'centi'))
{
$scale = 0.01; // cefcPowerUnits.100000470 = STRING: CentiAmps @ 12V
}
else if (str_istarts($entry['cefcPowerUnits'], 'milli'))
{
$scale = 0.001; // cefcPowerUnits.18 = STRING: milliAmps12v
if (!safe_empty($entity_array)) {
// Pre-cache entity mib (if not cached in inventory module)
if (is_array($GLOBALS['cache']['snmp']['ENTITY-MIB'][$device['device_id']])) {
// If this already received in inventory module, skip walking
$entity_mib = $GLOBALS['cache']['snmp']['ENTITY-MIB'][$device['device_id']];
print_debug("ENTITY-MIB already cached");
} else {
// FIXME. Other?
$scale = 1;
}
$value = $entry[$oid_name];
if ($value > 0)
{
// Limits
$options = array();
if ($entry['cefcTotalAvailableCurrent'] > 0)
{
if (substr($entry['cefcTotalAvailableCurrent'], -2) === '00')
{
// Cisco 4900M:
// cefcPowerUnits.9 = centiAmpsAt12V
// cefcTotalAvailableCurrent.9 = 8000
// cefcTotalDrawnCurrent.9 = 4883
$options['limit_high'] = $entry['cefcTotalAvailableCurrent'] * $scale;
} else {
// Cisco 2901:
// cefcPowerUnits.18 = milliAmps12v
// cefcTotalAvailableCurrent.18 = 1659
// cefcTotalDrawnCurrent.18 = 9641
$options['limit_high'] = ($value + $entry['cefcTotalAvailableCurrent']) * $scale;
$entity_mibs = snmp_mib_entity_vendortype($device, 'ENTITY-MIB');
$snmp_flags = OBS_SNMP_ALL;
snmp_log_error(OBS_SNMP_ERROR_OID_NOT_INCREASING, FALSE); // disable log error for next snmpwalk
$entity_mib = snmpwalk_cache_oid($device, "entPhysicalDescr", [], $entity_mibs);
if (!snmp_status() && snmp_error_code() === OBS_SNMP_ERROR_OID_NOT_INCREASING) {
// Try refetch with NOINCREASE
$snmp_flags |= OBS_SNMP_NOINCREASE;
print_debug("WARNING! snmpwalk error 'OID not increasing' detected, try snmpwalk with -Cc option.");
$entity_mib = snmpwalk_cache_oid($device, "entPhysicalDescr", $entity_mib, $entity_mibs, NULL, $snmp_flags);
}
if (snmp_status()) {
$oids = ['entPhysicalName', 'entPhysicalClass', 'entPhysicalContainedIn', 'entPhysicalParentRelPos', 'entPhysicalVendorType'];
foreach ($oids as $oid) {
$entity_mib = snmpwalk_cache_oid($device, $oid, $entity_mib, $entity_mibs, NULL, $snmp_flags);
if (!snmp_status()) {
break;
}
}
//$entity_mib = snmpwalk_cache_twopart_oid($device, 'entAliasMappingIdentifier', $entity_array, 'ENTITY-MIB:IF-MIB', NULL, $snmp_flags);
//$GLOBALS['cache']['snmp']['ENTITY-MIB'][$device['device_id']] = $entity_mib;
}
$options['limit_high_warn'] = $options['limit_high'] * 0.8; // 80%
}
discover_sensor_ng($device, 'current', $mib, 'cefcTotalDrawnCurrent', $oid_num, $index, NULL, $descr, $scale, $value, $options);
}
$oid_name = 'cefcPowerRedundancyOperMode';
$oid_num = '.1.3.6.1.4.1.9.9.117.1.1.1.1.5.'.$index;
$type = 'cefcPowerRedundancyType';
$value = $entry[$oid_name];
// Merge with ENTITY-MIB
if (!safe_empty($entity_mib)) {
// Power & Fan
foreach ($entity_array as $index => $entry) {
if (isset($entity_mib[$index])) {
$entity_array[$index] = array_merge($entity_mib[$index], $entry);
}
}
// PowerSupplyGroup
foreach ($cefcFRUPowerSupplyGroupEntry as $index => $entry) {
if (isset($entity_mib[$index])) {
$cefcFRUPowerSupplyGroupEntry[$index] = array_merge($entity_mib[$index], $entry);
}
}
}
unset($entity_mib);
discover_status_ng($device, $mib, $oid_name, $oid_num, $index, $type, $descr, $value, array('entPhysicalClass' => 'powersupply'));
}
print_debug_vars($cefcFRUPowerSupplyGroupEntry);
print_debug_vars($entity_array);
foreach ($entity_array as $index => $entry)
{
if (!is_numeric($index)) { continue; }
foreach ($cefcFRUPowerSupplyGroupEntry as $index => $entry) {
$descr = $entry['entPhysicalDescr'];
$descr = $entry['entPhysicalDescr'];
$oid_name = 'cefcTotalDrawnCurrent';
$oid_num = '.1.3.6.1.4.1.9.9.117.1.1.1.1.4.' . $index;
$type = $mib . '-' . $oid_name;
// Power Supplies
// CISCO-ENTITY-FRU-CONTROL-MIB::cefcFRUPowerAdminStatus.470 = INTEGER: on(1)
// CISCO-ENTITY-FRU-CONTROL-MIB::cefcFRUPowerOperStatus.470 = INTEGER: on(2)
if (!$skip_status && $entry['entPhysicalClass'] == 'powerSupply' && $entry['cefcFRUPowerAdminStatus'] != 'off')
{
$oid_name = 'cefcFRUPowerOperStatus';
$oid_num = '.1.3.6.1.4.1.9.9.117.1.1.2.1.2.'.$index;
$type = 'PowerOperType';
$value = $entry[$oid_name];
if (str_istarts($entry['cefcPowerUnits'], 'centi')) {
$scale = 0.01; // cefcPowerUnits.100000470 = STRING: CentiAmps @ 12V
} elseif (str_istarts($entry['cefcPowerUnits'], 'milli')) {
$scale = 0.001; // cefcPowerUnits.18 = STRING: milliAmps12v
} else {
// FIXME. Other?
$scale = 1;
}
$value = $entry[$oid_name];
if ($value > 0) {
// Limits
$options = [];
if ($entry['cefcTotalAvailableCurrent'] > 0) {
if (str_ends($entry['cefcTotalAvailableCurrent'], '00')) {
// Cisco 4900M:
// cefcPowerUnits.9 = centiAmpsAt12V
// cefcTotalAvailableCurrent.9 = 8000
// cefcTotalDrawnCurrent.9 = 4883
$options['limit_high'] = $entry['cefcTotalAvailableCurrent'] * $scale;
} else {
// Cisco 2901:
// cefcPowerUnits.18 = milliAmps12v
// cefcTotalAvailableCurrent.18 = 1659
// cefcTotalDrawnCurrent.18 = 9641
$options['limit_high'] = ($value + $entry['cefcTotalAvailableCurrent']) * $scale;
}
$options['limit_high_warn'] = $options['limit_high'] * 0.8; // 80%
}
discover_sensor_ng($device, 'current', $mib, 'cefcTotalDrawnCurrent', $oid_num, $index, $descr, $scale, $value, $options);
}
discover_status_ng($device, $mib, $oid_name, $oid_num, $index, $type, $descr, $value, array('entPhysicalClass' => 'powersupply'));
$oid_name = 'cefcPowerRedundancyOperMode';
$oid_num = '.1.3.6.1.4.1.9.9.117.1.1.1.1.5.' . $index;
$type = 'cefcPowerRedundancyType';
$value = $entry[$oid_name];
discover_status_ng($device, $mib, $oid_name, $oid_num, $index, $type, $descr, $value, ['entPhysicalClass' => 'powersupply']);
}
// A negative value expresses current used by the FRU.
// A positive value expresses current supplied by the FRU.
// CISCO-ENTITY-FRU-CONTROL-MIB::cefcFRUCurrent.470 = INTEGER: 2810
// CISCO-ENTITY-FRU-CONTROL-MIB::cefcFRUActualInputCurrent.470 = INTEGER: 45558
// CISCO-ENTITY-FRU-CONTROL-MIB::cefcFRUActualOutputCurrent.470 = INTEGER: 61000
foreach ($entity_array as $index => $entry) {
if (!is_numeric($index)) {
continue;
}
// Fans
// CISCO-ENTITY-FRU-CONTROL-MIB::cefcFanTrayOperStatus.534 = INTEGER: up(2)
// CISCO-ENTITY-FRU-CONTROL-MIB::cefcFanTrayDirection.534 = INTEGER: backToFront(3)
if (!$skip_status && $entry['entPhysicalClass'] == 'fan')
{
$oid_name = 'cefcFanTrayOperStatus';
$oid_num = '.1.3.6.1.4.1.9.9.117.1.4.1.1.1.'.$index;
$type = 'cefcFanTrayOperStatus';
$value = $entry[$oid_name];
$descr = $entry['entPhysicalDescr'];
discover_status_ng($device, $mib, $oid_name, $oid_num, $index, $type, $descr, $value, array('entPhysicalClass' => 'fan'));
// Power Supplies
// CISCO-ENTITY-FRU-CONTROL-MIB::cefcFRUPowerAdminStatus.470 = INTEGER: on(1)
// CISCO-ENTITY-FRU-CONTROL-MIB::cefcFRUPowerOperStatus.470 = INTEGER: on(2)
if (!$skip_status && $entry['entPhysicalClass'] == 'powerSupply' && $entry['cefcFRUPowerAdminStatus'] != 'off') {
$oid_name = 'cefcFRUPowerOperStatus';
$oid_num = '.1.3.6.1.4.1.9.9.117.1.1.2.1.2.' . $index;
$type = 'PowerOperType';
$value = $entry[$oid_name];
discover_status_ng($device, $mib, $oid_name, $oid_num, $index, $type, $descr, $value, ['entPhysicalClass' => 'powersupply']);
}
// A negative value expresses current used by the FRU.
// A positive value expresses current supplied by the FRU.
// CISCO-ENTITY-FRU-CONTROL-MIB::cefcFRUCurrent.470 = INTEGER: 2810
// CISCO-ENTITY-FRU-CONTROL-MIB::cefcFRUActualInputCurrent.470 = INTEGER: 45558
// CISCO-ENTITY-FRU-CONTROL-MIB::cefcFRUActualOutputCurrent.470 = INTEGER: 61000
// Fans
// CISCO-ENTITY-FRU-CONTROL-MIB::cefcFanTrayOperStatus.534 = INTEGER: up(2)
// CISCO-ENTITY-FRU-CONTROL-MIB::cefcFanTrayDirection.534 = INTEGER: backToFront(3)
if (!$skip_status && $entry['entPhysicalClass'] === 'fan') {
$oid_name = 'cefcFanTrayOperStatus';
$oid_num = '.1.3.6.1.4.1.9.9.117.1.4.1.1.1.' . $index;
$type = 'cefcFanTrayOperStatus';
$value = $entry[$oid_name];
discover_status_ng($device, $mib, $oid_name, $oid_num, $index, $type, $descr, $value, ['entPhysicalClass' => 'fan']);
}
// CISCO-ENTITY-FRU-CONTROL-MIB::cefcFanSpeed.119000 = Gauge32: 9326 rpm
// CISCO-ENTITY-FRU-CONTROL-MIB::cefcFanSpeedPercent.119000 = INTEGER: 57 percent
if (isset($entry['cefcFanSpeed']) && $entry['cefcFanSpeed'] > 0) {
$options = [];
// Detect limits based on speed percent
if (isset($entry['cefcFanSpeedPercent']) && $entry['cefcFanSpeedPercent'] > 0) {
$max = ($entry['cefcFanSpeed'] * 100) / $entry['cefcFanSpeedPercent'];
$options = ['limit_high' => (int)($max * 0.95), 'limit_high_warn' => (int)($max * 0.8), 'limit_low' => 0];
}
$oid_name = 'cefcFanSpeed';
$oid_num = '.1.3.6.1.4.1.9.9.117.1.4.2.1.1.' . $index;
$value = $entry[$oid_name];
discover_sensor_ng($device, 'fanspeed', $mib, $oid_name, $oid_num, $index, $descr, 1, $value, $options);
}
// Modules
// CISCO-ENTITY-FRU-CONTROL-MIB::cefcModuleAdminStatus.22 = INTEGER: enabled(1)
// CISCO-ENTITY-FRU-CONTROL-MIB::cefcModuleOperStatus.22 = INTEGER: ok(2)
// CISCO-ENTITY-FRU-CONTROL-MIB::cefcModuleResetReason.22 = INTEGER: unknown(1)
// CISCO-ENTITY-FRU-CONTROL-MIB::cefcModuleStatusLastChangeTime.22 = Timeticks: (0) 0:00:00.00
// CISCO-ENTITY-FRU-CONTROL-MIB::cefcModuleLastClearConfigTime.22 = Timeticks: (158892673) 18 days, 9:22:06.73
// CISCO-ENTITY-FRU-CONTROL-MIB::cefcModuleResetReasonDescription.22 = STRING:
// CISCO-ENTITY-FRU-CONTROL-MIB::cefcModuleUpTime.22 = Gauge32: 1988824
if (isset($entry['cefcModuleOperStatus']) && $entry['cefcModuleAdminStatus'] === 'enabled') {
$oid_name = 'cefcModuleOperStatus';
$oid_num = '.1.3.6.1.4.1.9.9.117.1.2.1.1.2.' . $index;
$type = 'cefcModuleOperStatus';
$value = $entry[$oid_name];
discover_status_ng($device, $mib, $oid_name, $oid_num, $index, $type, $descr, $value, ['entPhysicalClass' => $entry['entPhysicalClass']]);
}
}
// CISCO-ENTITY-FRU-CONTROL-MIB::cefcFanSpeed.119000 = Gauge32: 9326 rpm
// CISCO-ENTITY-FRU-CONTROL-MIB::cefcFanSpeedPercent.119000 = INTEGER: 57 percent
if (isset($entry['cefcFanSpeed']) && $entry['cefcFanSpeed'] > 0)
{
$options = [];
// Detect limits based on speed percent
if (isset($entry['cefcFanSpeedPercent']) && $entry['cefcFanSpeedPercent'] > 0)
{
$max = ($entry['cefcFanSpeed'] * 100) / $entry['cefcFanSpeedPercent'];
$options = ['limit_high' => intval($max * 0.95), 'limit_high_warn' => intval($max * 0.8), 'limit_low' => 0];
}
$oid_name = 'cefcFanSpeed';
$oid_num = '.1.3.6.1.4.1.9.9.117.1.4.2.1.1.'.$index;
$value = $entry[$oid_name];
discover_sensor_ng($device, 'fanspeed', $mib, $oid_name, $oid_num, $index, NULL, $descr, 1, $value, $options);
}
// Modules
// CISCO-ENTITY-FRU-CONTROL-MIB::cefcModuleAdminStatus.22 = INTEGER: enabled(1)
// CISCO-ENTITY-FRU-CONTROL-MIB::cefcModuleOperStatus.22 = INTEGER: ok(2)
// CISCO-ENTITY-FRU-CONTROL-MIB::cefcModuleResetReason.22 = INTEGER: unknown(1)
// CISCO-ENTITY-FRU-CONTROL-MIB::cefcModuleStatusLastChangeTime.22 = Timeticks: (0) 0:00:00.00
// CISCO-ENTITY-FRU-CONTROL-MIB::cefcModuleLastClearConfigTime.22 = Timeticks: (158892673) 18 days, 9:22:06.73
// CISCO-ENTITY-FRU-CONTROL-MIB::cefcModuleResetReasonDescription.22 = STRING:
// CISCO-ENTITY-FRU-CONTROL-MIB::cefcModuleUpTime.22 = Gauge32: 1988824
if (isset($entry['cefcModuleOperStatus']) && $entry['cefcModuleAdminStatus'] == 'enabled')
{
$oid_name = 'cefcModuleOperStatus';
$oid_num = '.1.3.6.1.4.1.9.9.117.1.2.1.1.2.'.$index;
$type = 'cefcModuleOperStatus';
$value = $entry[$oid_name];
discover_status_ng($device, $mib, $oid_name, $oid_num, $index, $type, $descr, $value, array('entPhysicalClass' => $entry['entPhysicalClass']));
}
}
}
unset($cefcFRUPowerSupplyGroupEntry, $entity_array, $skip_status);

View File

@ -6,23 +6,26 @@
*
* @package observium
* @subpackage discovery
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2022 Observium Limited
* @copyright (C) Adam Armstrong
*
*/
$entity_array = snmpwalk_cache_oid($device, 'entSensorValueEntry', $entity_array, 'CISCO-ENTITY-SENSOR-MIB');
if (snmp_status()) {
if (is_array($GLOBALS['cache']['snmp']['ENTITY-MIB'][$device['device_id']])) {
if (!snmp_status()) {
return;
}
if (is_array($GLOBALS['cache']['snmp']['ENTITY-MIB'][$device['device_id']])) {
// If this already received in inventory module, skip walking
foreach ($GLOBALS['cache']['snmp']['ENTITY-MIB'][$device['device_id']] as $index => $entry) {
if (isset($entity_array[$index])) {
$entity_array[$index] = array_merge($entity_array[$index], $entry);
} else {
$entity_array[$index] = $entry;
}
if (isset($entity_array[$index])) {
$entity_array[$index] = array_merge($entity_array[$index], $entry);
} else {
$entity_array[$index] = $entry;
}
}
print_debug("ENTITY-MIB already cached");
} else {
} else {
$entity_mibs = snmp_mib_entity_vendortype($device, 'ENTITY-MIB');
$snmp_flags = OBS_SNMP_ALL;
@ -30,423 +33,495 @@ if (snmp_status()) {
$entity_array = snmpwalk_cache_oid($device, "entPhysicalDescr", $entity_array, $entity_mibs);
if (!snmp_status() && snmp_error_code() === OBS_SNMP_ERROR_OID_NOT_INCREASING) {
// Try refetch with NOINCREASE
$snmp_flags |= OBS_SNMP_NOINCREASE;
print_debug("WARNING! snmpwalk error 'OID not increasing' detected, try snmpwalk with -Cc option.");
// Try refetch with NOINCREASE
$snmp_flags |= OBS_SNMP_NOINCREASE;
print_debug("WARNING! snmpwalk error 'OID not increasing' detected, try snmpwalk with -Cc option.");
$entity_array = snmpwalk_cache_oid($device, "entPhysicalDescr", $entity_array, $entity_mibs, NULL, $snmp_flags);
$entity_array = snmpwalk_cache_oid($device, "entPhysicalDescr", $entity_array, $entity_mibs, NULL, $snmp_flags);
}
if (snmp_status()) {
$oids = [ 'entPhysicalName', 'entPhysicalClass', 'entPhysicalContainedIn', 'entPhysicalParentRelPos', 'entPhysicalVendorType' ];
foreach ($oids as $oid) {
$entity_array = snmpwalk_cache_oid($device, $oid, $entity_array, $entity_mibs, NULL, $snmp_flags);
if (!snmp_status()) {
break;
}
}
$entity_array = snmpwalk_cache_twopart_oid($device, 'entAliasMappingIdentifier', $entity_array, 'ENTITY-MIB:IF-MIB', NULL, $snmp_flags);
$GLOBALS['cache']['snmp']['ENTITY-MIB'][$device['device_id']] = $entity_array;
}
}
$t_oids = [ 'entSensorThresholdSeverity', 'entSensorThresholdRelation', 'entSensorThresholdValue' ];
$t_entity_array = [];
foreach ($t_oids as $oid) {
$t_entity_array = snmpwalk_cache_twopart_oid($device, $oid, $t_entity_array, 'CISCO-ENTITY-SENSOR-MIB');
}
// http://tools.cisco.com/Support/SNMP/do/BrowseOID.do?local=en&translate=Translate&typeName=SensorDataType
/* sensor measurement data types. valid values are:
other(1): a measure other than those listed below
unknown(2): unknown measurement, or arbitrary, relative numbers
voltsAC(3): electric potential
voltsDC(4): electric potential
amperes(5): electric current
watts(6): power
hertz(7): frequency
celsius(8): temperature
percentRH(9): percent relative humidity
rpm(10): shaft revolutions per minute
cmm(11): cubic meters per minute (airflow)
truthvalue(12): value takes { true(1), false(2) }
specialEnum(13): value takes user defined enumerated values
dBm(14): dB relative to 1mW of power
*/
$c_entitysensor = [
'voltsAC' => 'voltage',
'voltsDC' => 'voltage',
'amperes' => 'current',
'watts' => 'power',
'hertz' => 'frequency',
'celsius' => 'temperature',
'percentRH' => 'humidity',
'rpm' => 'fanspeed',
'cmm' => 'airflow',
'truthvalue' => 'state',
//'specialEnum' => 'gauge', // This sensors seems as useless
'dBm' => 'dbm'
];
$i = [];
foreach ($entity_array as $index => $entry) {
if (is_numeric($index) && isset($c_entitysensor[$entry['entSensorType']]) &&
is_numeric($entry['entSensorValue']) && $entry['entSensorStatus'] === 'ok') {
$ok = TRUE;
$options = [ 'entPhysicalIndex' => $index ];
$descr = rewrite_entity_name($entry['entPhysicalDescr']);
if ($device['os'] === 'cisco-firepower') {
$descr = $entry['entPhysicalName'];
} elseif ($entry['entPhysicalDescr'] && $entry['entPhysicalName']) {
// Check if entPhysicalDescr equals entPhysicalName,
// Also compare like this: 'TenGigabitEthernet2/1 Bias Current' and 'Te2/1 Bias Current'
if (!str_starts($entry['entPhysicalDescr'], substr($entry['entPhysicalName'], 0, 2))) {
$descr .= " - " . rewrite_entity_name($entry['entPhysicalName']);
}
} elseif (safe_empty($entry['entPhysicalDescr'])) {
$descr = rewrite_entity_name($entry['entPhysicalName']);
}
// Set description based on measured entity if it exists
if (is_numeric($entry['entSensorMeasuredEntity']) && $entry['entSensorMeasuredEntity']) {
if ($device['os'] === 'cisco-firepower') {
// FirePOWER has next to useless layout of ENTITY-SENSOR-MIB. Sensors don't have an ENTITY-MIB entry, so there is no way to tell apart individual sensors on the same entity.
// We just use the index to make them look less identical. It sucks, though.
$descr = rewrite_entity_name($entity_array[$entry['entSensorMeasuredEntity']]['entPhysicalName']) . ' ('.$index.')';
} else {
$measured_descr = rewrite_entity_name($entity_array[$entry['entSensorMeasuredEntity']]['entPhysicalDescr']);
if (safe_empty($measured_descr)) {
$measured_descr = rewrite_entity_name($entity_array[$entry['entSensorMeasuredEntity']]['entPhysicalName']);
}
if ($measured_descr && !str_starts($measured_descr, substr($descr, 0, 2))) {
$descr = $measured_descr . " - " . $descr;
}
}
}
$oid = ".1.3.6.1.4.1.9.9.91.1.1.1.1.4.$index";
$value = $entry['entSensorValue'];
switch ($c_entitysensor[$entry['entSensorType']]) {
case 'state':
// Statuses
$type = 'state';
// 1:other, 2:unknown, 3:chassis, 4:backplane, 5:container, 6:powerSupply,
// 7:fan, 8:sensor, 9:module, 10:port, 11:stack, 12:cpu
$options['entPhysicalClass'] = $entry['entPhysicalClass'];
$sensor_type = 'cisco-entity-state';
break;
case 'counter':
// Counters
$type = 'counter';
//$options['measured_class'] = $entry['entPhysicalClass'];
$sensor_type = 'cisco-entity-state';
break;
default:
// Normal sensors
$type = $c_entitysensor[$entry['entSensorType']];
$sensor_type = 'cisco-entity-sensor';
if ($entry['entSensorType'] === 'cmm') {
$options['sensor_unit'] = 'CMM';
}
}
// Returning blatantly broken value. IGNORE.
if ($value == "-32768" || $value == "-127") {
$ok = FALSE;
} elseif (safe_empty($descr)) {
// Empty description. Lots of these on Nexus and Cisco APIC
$i[$type]++;
$descr = 'Sensor ' . $i[$type];
if ($value == 0) { $ok = FALSE; }
}
print_debug_vars($descr);
print_debug_vars($scale);
print_debug_vars($entry);
// Now try to search port bounded with sensor by ENTITY-MIB
if ($ok && in_array($type, [ 'temperature', 'voltage', 'current', 'dbm', 'power' ])) {
$port = get_port_by_ent_index($device, $index);
$options['entPhysicalIndex'] = $index;
if (is_array($port)) {
$entry['ifDescr'] = $port['port_label'];
$options['measured_class'] = 'port';
$options['measured_entity'] = $port['port_id'];
$options['measured_entity_label'] = $port['port_label'];
$options['entPhysicalIndex_measured'] = $port['ifIndex'];
// Fix Port description based on vendor type
if ($entry['entPhysicalVendorType'] && !str_icontains_array($descr, [ 'Power', 'Current', 'Voltage', 'Temperature' ])) {
switch ($entry['entPhysicalVendorType']) {
case 'cevSensorTransceiverVoltage':
$descr .= ' Transceiver Voltage';
break;
case 'cevSensorTransceiverCurrent':
$descr .= ' Transceiver Bias Current';
break;
case 'cevSensorTransceiverTemp':
$descr .= ' Transceiver Temperature';
break;
case 'cevSensorTransceiverRxPwr':
$descr .= ' Transceiver Receive Power';
break;
case 'cevSensorTransceiverTxPwr':
$descr .= ' Transceiver Transmit Power';
$oids = ['entPhysicalName', 'entPhysicalClass', 'entPhysicalContainedIn', 'entPhysicalParentRelPos', 'entPhysicalVendorType'];
foreach ($oids as $oid) {
$entity_array = snmpwalk_cache_oid($device, $oid, $entity_array, $entity_mibs, NULL, $snmp_flags);
if (!snmp_status()) {
break;
}
}
}
}
// Set thresholds for numeric sensors
$limits = [];
$scale = NULL;
if ($c_entitysensor[$entry['entSensorType']] !== 'state') {
$precision = $entry['entSensorPrecision'];
if ($device['os'] === 'iosxe' && $precision > 0 &&
version_compare($device['version'], '16.11', '>=') && version_compare($device['version'], '16.12', '<')) {
// See: https://jira.observium.org/browse/OBS-3026
// Note, issue not actual on firmware less than 16.11, not sure if fixed on newer firmwares
// Seems as not actual on 16.12.x, see: https://jira.observium.org/browse/OBS-3707
// I not sure that this fully correct, but for issue case - works
$precision -= 1;
} elseif ($device['os'] === 'iosxr' && $precision > 0 && $type === 'power' &&
$device['version'] === '6.4.2' && preg_match('/ASR\-90\d{2}/', $device['hardware'])) {
// See: https://jira.observium.org/browse/OBS-4079
// ASR9k 32bit platform issue for power sensor
$precision -= 1;
}
$scale = si_to_scale($entry['entSensorScale'], $precision);
// Check thresholds for this entry
foreach ($t_entity_array[$index] as $t_index => $t_entry) {
if ($t_entry['entSensorThresholdValue'] == "-32768") { continue; }
/* Sometime thresholds have duplicate limits, see:
* https://jira.observium.org/browse/OBS-2752
entSensorType.1019 = celsius
entSensorScale.1019 = units
entSensorPrecision.1019 = 0
entSensorValue.1019 = 24
entSensorStatus.1019 = ok
entSensorThresholdSeverity.1019.1 = minor
entSensorThresholdSeverity.1019.2 = major
entSensorThresholdSeverity.1019.3 = critical
entSensorThresholdSeverity.1019.4 = critical
entSensorThresholdRelation.1019.1 = greaterOrEqual
entSensorThresholdRelation.1019.2 = greaterOrEqual
entSensorThresholdRelation.1019.3 = greaterOrEqual
entSensorThresholdRelation.1019.4 = greaterOrEqual
entSensorThresholdValue.1019.1 = 55
entSensorThresholdValue.1019.2 = 65
entSensorThresholdValue.1019.3 = 75
entSensorThresholdValue.1019.4 = 100
*/
/* Another case, when critical limits is zero, see:
* https://jira.observium.org/browse/OBS-2819
entSensorThresholdSeverity.2130160.1 = minor
entSensorThresholdSeverity.2130160.2 = minor
entSensorThresholdSeverity.2130160.3 = major
entSensorThresholdSeverity.2130160.4 = major
entSensorThresholdSeverity.2130160.5 = critical
entSensorThresholdSeverity.2130160.6 = critical
entSensorThresholdRelation.2130160.1 = lessOrEqual
entSensorThresholdRelation.2130160.2 = greaterOrEqual
entSensorThresholdRelation.2130160.3 = lessOrEqual
entSensorThresholdRelation.2130160.4 = greaterOrEqual
entSensorThresholdRelation.2130160.5 = lessOrEqual
entSensorThresholdRelation.2130160.6 = greaterOrEqual
entSensorThresholdValue.2130160.1 = 31000000
entSensorThresholdValue.2130160.2 = 34650000
entSensorThresholdValue.2130160.3 = 29700000
entSensorThresholdValue.2130160.4 = 36300000
entSensorThresholdValue.2130160.5 = 0
entSensorThresholdValue.2130160.6 = 0
*/
/* Another case, when minor limits is zero, see:
* https://jira.observium.org/browse/OBS-2819?focusedCommentId=21323#comment-21323
entSensorThresholdSeverity.2224410.1 = minor
entSensorThresholdSeverity.2224410.2 = minor
entSensorThresholdSeverity.2224410.3 = major
entSensorThresholdSeverity.2224410.4 = major
entSensorThresholdSeverity.2224410.5 = critical
entSensorThresholdSeverity.2224410.6 = critical
entSensorThresholdRelation.2224410.1 = lessOrEqual
entSensorThresholdRelation.2224410.2 = greaterOrEqual
entSensorThresholdRelation.2224410.3 = lessOrEqual
entSensorThresholdRelation.2224410.4 = greaterOrEqual
entSensorThresholdRelation.2224410.5 = lessOrEqual
entSensorThresholdRelation.2224410.6 = greaterOrEqual
entSensorThresholdValue.2224410.1 = 0
entSensorThresholdValue.2224410.2 = 0
entSensorThresholdValue.2224410.3 = -1059981
entSensorThresholdValue.2224410.4 = 450002
entSensorThresholdValue.2224410.5 = -1459670
entSensorThresholdValue.2224410.6 = 749999
*/
switch ($t_entry['entSensorThresholdSeverity']) {
case 'critical':
// Prefer critical over major
if (in_array($t_entry['entSensorThresholdRelation'], [ 'greaterOrEqual', 'greaterThan' ])) {
if (isset($limits['limit_high'])) { break; } // Use first threshold entry
$limits['limit_high'] = $t_entry['entSensorThresholdValue'] * $scale;
} elseif (in_array($t_entry['entSensorThresholdRelation'], [ 'lessOrEqual', 'lessThan' ])) {
if (isset($limits['limit_low'])) { break; } // Use first threshold entry
$limits['limit_low'] = $t_entry['entSensorThresholdValue'] * $scale;
}
// FIXME. Not used: equalTo, notEqualTo
break;
case 'major':
// Prefer critical over major,
if (in_array($t_entry['entSensorThresholdRelation'], [ 'greaterOrEqual', 'greaterThan' ])) {
if (isset($limits['limit_high_major'])) { break; } // Use first threshold entry
$limits['limit_high_major'] = $t_entry['entSensorThresholdValue'] * $scale;
} elseif (in_array($t_entry['entSensorThresholdRelation'], [ 'lessOrEqual', 'lessThan' ])) {
if (isset($limits['limit_low_major'])) { break; } // Use first threshold entry
$limits['limit_low_major'] = $t_entry['entSensorThresholdValue'] * $scale;
}
break;
case 'minor':
if (in_array($t_entry['entSensorThresholdRelation'], [ 'greaterOrEqual', 'greaterThan' ])) {
if (isset($limits['limit_high_warn'])) { break; } // Use first threshold entry
$limits['limit_high_warn'] = $t_entry['entSensorThresholdValue'] * $scale;
} elseif (in_array($t_entry['entSensorThresholdRelation'], [ 'lessOrEqual', 'lessThan' ])) {
if (isset($limits['limit_low_warn'])) { break; } // Use first threshold entry
$limits['limit_low_warn'] = $t_entry['entSensorThresholdValue'] * $scale;
}
// FIXME. Not used: equalTo, notEqualTo
break;
case 'other':
// Probably here should be equalTo, notEqualTo.. never saw
break;
}
}
// Fixes for high thresholds issues in IOS-XR (and others)
if (!isset($limits['limit_high']) && isset($limits['limit_high_major'])) {
// Use major thresholds if critical not set
$limits['limit_high'] = $limits['limit_high_major'];
unset($limits['limit_high_major']);
} elseif (isset($limits['limit_high']) && $limits['limit_high'] == 0 &&
isset($limits['limit_high_major']) && $limits['limit_high_major'] != 0) {
// critical limit is zero, use major
$limits['limit_high'] = $limits['limit_high_major'];
unset($limits['limit_high_major']);
}
if (isset($limits['limit_high_warn']) && $limits['limit_high_warn'] == 0 &&
isset($limits['limit_high_major']) && $limits['limit_high_major'] != 0) {
// minor limit is zero, use major
$limits['limit_high_warn'] = $limits['limit_high_major'];
}
// Fixes for low thresholds issues in IOS-XR (and others)
if (!isset($limits['limit_low']) && isset($limits['limit_low_major'])) {
// Use major thresholds if critical not set
$limits['limit_low'] = $limits['limit_low_major'];
unset($limits['limit_low_major']);
} elseif (isset($limits['limit_low']) && $limits['limit_low'] == 0 &&
isset($limits['limit_low_major']) && $limits['limit_low_major'] != 0) {
// critical limit is zero, use major
$limits['limit_low'] = $limits['limit_low_major'];
unset($limits['limit_low_major']);
}
if (isset($limits['limit_low_warn']) && $limits['limit_low_warn'] == 0 &&
isset($limits['limit_low_major']) && $limits['limit_low_major'] != 0) {
// minor limit is zero, use major
$limits['limit_low_warn'] = $limits['limit_low_major'];
}
unset($limits['limit_high_major'], $limits['limit_low_major']);
// This port sensors really always return 0, see:
// https://jira.observium.org/browse/OBS-3335
/*
entPhysicalDescr.2134256 = Voltage Sensor
entPhysicalVendorType.2134256 = cevSensorNCS4KVol
entPhysicalContainedIn.2134256 = 2134017
entPhysicalClass.2134256 = sensor
entPhysicalParentRelPos.2134256 = 4
entPhysicalName.2134256 = GigabitEthernet0/0/0/1-3.3 V
entPhysicalHardwareRev.2134256 =
entPhysicalFirmwareRev.2134256 =
entPhysicalSoftwareRev.2134256 =
entPhysicalSerialNum.2134256 =
entPhysicalMfgName.2134256 =
entPhysicalModelName.2134256 = N/A
entPhysicalAlias.2134256 =
entPhysicalAssetID.2134256 =
entPhysicalIsFRU.2134256 = false
entSensorType.2134256 = voltsDC
entSensorScale.2134256 = milli
entSensorPrecision.2134256 = 4
entSensorValue.2134256 = 0
entSensorStatus.2134256 = ok
entSensorValueTimeStamp.2134256 = 0:0:00:00.00
entSensorValueUpdateRate.2134256 = 10
entSensorMeasuredEntity.2134256 = 2134017
entSensorThresholdSeverity.2134256.1 = minor
entSensorThresholdSeverity.2134256.2 = minor
entSensorThresholdSeverity.2134256.3 = major
entSensorThresholdSeverity.2134256.4 = major
entSensorThresholdSeverity.2134256.5 = critical
entSensorThresholdSeverity.2134256.6 = critical
entSensorThresholdRelation.2134256.1 = lessOrEqual
entSensorThresholdRelation.2134256.2 = greaterOrEqual
entSensorThresholdRelation.2134256.3 = lessOrEqual
entSensorThresholdRelation.2134256.4 = greaterOrEqual
entSensorThresholdRelation.2134256.5 = lessOrEqual
entSensorThresholdRelation.2134256.6 = greaterOrEqual
entSensorThresholdValue.2134256.1 = 0
entSensorThresholdValue.2134256.2 = 0
entSensorThresholdValue.2134256.3 = 0
entSensorThresholdValue.2134256.4 = 0
entSensorThresholdValue.2134256.5 = 0
entSensorThresholdValue.2134256.6 = 0
*/
if ($options['measured_class'] === 'port' && $value == 0 &&
$limits['limit_high'] == 0 && $limits['limit_high_warn'] == 0 &&
$limits['limit_low'] == 0 && $limits['limit_low_warn'] == 0) {
unset($limits['limit_high'], $limits['limit_high_warn'], $limits['limit_low'], $limits['limit_low_warn']);
if (!($type === 'dbm' || $port['ifOperStatus'] === 'up')) {
$ok = FALSE;
}
}
// Some Cisco sensors have all limits as same value (f.u. cisco), then leave only one limit
if ((float_cmp($limits['limit_high'], $limits['limit_low']) === 0) &&
(float_cmp($limits['limit_high_warn'], $limits['limit_low_warn']) === 0) &&
(float_cmp($limits['limit_high'], $limits['limit_high_warn']) === 0)) {
unset($limits['limit_high_warn'], $limits['limit_low_warn'], $limits['limit_low']);
}
// https://jira.observium.org/browse/OBS-3597
// End Threshold code
}
if ($ok) {
$options = array_merge($limits, $options);
if ($type === 'state') {
//truthvalue
$options['rename_rrd'] = 'cisco-entity-state-' . $index;
discover_status_ng($device, $mib, 'entSensorValue', $oid, $index, $sensor_type, $descr, $value, $options);
} elseif ($type === 'counter') {
discover_counter($device, $entry['entPhysicalClass'], $mib, 'entSensorValue', $oid, $index, $descr, $scale, $value, $options);
} else {
$options['rename_rrd'] = 'cisco-entity-sensor-'.$index;
discover_sensor_ng($device, $type, $mib, 'entSensorValue', $oid, $index, NULL, $descr, $scale, $value, $options);
}
}
$entity_array = snmpwalk_cache_twopart_oid($device, 'entAliasMappingIdentifier', $entity_array, 'ENTITY-MIB:IF-MIB', NULL, $snmp_flags);
$GLOBALS['cache']['snmp']['ENTITY-MIB'][$device['device_id']] = $entity_array;
}
}
$t_oids = [ 'entSensorThresholdSeverity', 'entSensorThresholdRelation', 'entSensorThresholdValue' ];
$t_entity_array = [];
foreach ($t_oids as $oid) {
$t_entity_array = snmpwalk_cache_twopart_oid($device, $oid, $t_entity_array, 'CISCO-ENTITY-SENSOR-MIB');
}
// http://tools.cisco.com/Support/SNMP/do/BrowseOID.do?local=en&translate=Translate&typeName=SensorDataType
/* sensor measurement data types. valid values are:
other(1): a measure other than those listed below
unknown(2): unknown measurement, or arbitrary, relative numbers
voltsAC(3): electric potential
voltsDC(4): electric potential
amperes(5): electric current
watts(6): power
hertz(7): frequency
celsius(8): temperature
percentRH(9): percent relative humidity
rpm(10): shaft revolutions per minute
cmm(11): cubic meters per minute (airflow)
truthvalue(12): value takes { true(1), false(2) }
specialEnum(13): value takes user defined enumerated values
dBm(14): dB relative to 1mW of power
*/
$c_entitysensor = [
'voltsAC' => 'voltage',
'voltsDC' => 'voltage',
'amperes' => 'current',
'watts' => 'power',
'hertz' => 'frequency',
'celsius' => 'temperature',
'percentRH' => 'humidity',
'rpm' => 'fanspeed',
'cmm' => 'airflow',
'truthvalue' => 'state',
//'specialEnum' => 'gauge', // This sensors seems as useless
'dBm' => 'dbm'
];
//print_vars($entity_array);
$i = [];
foreach ($entity_array as $index => $entry) {
if (is_numeric($index) && isset($c_entitysensor[$entry['entSensorType']]) &&
is_numeric($entry['entSensorValue']) && $entry['entSensorStatus'] === 'ok') {
$ok = TRUE;
$options = ['entPhysicalIndex' => $index];
$descr = rewrite_entity_name($entry['entPhysicalDescr']);
if ($device['os'] === 'cisco-firepower') {
$descr = $entry['entPhysicalName'];
} elseif ($entry['entPhysicalDescr'] && $entry['entPhysicalName']) {
// Check if entPhysicalDescr equals entPhysicalName,
// Also compare like this: 'TenGigabitEthernet2/1 Bias Current' and 'Te2/1 Bias Current'
if (!str_starts($entry['entPhysicalDescr'], substr($entry['entPhysicalName'], 0, 2))) {
$descr .= " - " . rewrite_entity_name($entry['entPhysicalName']);
}
} elseif (safe_empty($entry['entPhysicalDescr'])) {
$descr = rewrite_entity_name($entry['entPhysicalName']);
}
// Set description based on measured entity if it exists
if (is_numeric($entry['entSensorMeasuredEntity']) && $entry['entSensorMeasuredEntity']) {
if ($entity_array[$entry['entSensorMeasuredEntity']]['entPhysicalClass'] == 'chassis') {
// Skip Chassis parents
} elseif ($device['os'] === 'cisco-firepower') {
// FirePOWER has next to useless layout of ENTITY-SENSOR-MIB. Sensors don't have an ENTITY-MIB entry, so there is no way to tell apart individual sensors on the same entity.
// We just use the index to make them look less identical. It sucks, though.
$descr = rewrite_entity_name($entity_array[$entry['entSensorMeasuredEntity']]['entPhysicalName']) . ' (' . $index . ')';
} else {
$measured_descr = rewrite_entity_name($entity_array[$entry['entSensorMeasuredEntity']]['entPhysicalDescr']);
if (safe_empty($measured_descr)) {
$measured_descr = rewrite_entity_name($entity_array[$entry['entSensorMeasuredEntity']]['entPhysicalName']);
}
if ($measured_descr && !str_starts($measured_descr, substr($descr, 0, 2))) {
$descr = $measured_descr . " - " . $descr;
}
}
}
// If name contains description and is longer than description, then it likely contains the parent, so just use it.
if (str_contains($entry['entPhysicalName'], $entry['entPhysicalDescr']) &&
strlen($entry['entPhysicalName']) > strlen($entry['entPhysicalDescr'])) {
$descr = $entry['entPhysicalName'];
}
$oid = ".1.3.6.1.4.1.9.9.91.1.1.1.1.4.$index";
$value = $entry['entSensorValue'];
switch ($c_entitysensor[$entry['entSensorType']]) {
case 'state':
// Statuses
$type = 'state';
// 1:other, 2:unknown, 3:chassis, 4:backplane, 5:container, 6:powerSupply,
// 7:fan, 8:sensor, 9:module, 10:port, 11:stack, 12:cpu
$options['entPhysicalClass'] = $entry['entPhysicalClass'];
$sensor_type = 'cisco-entity-state';
break;
case 'counter':
// Counters
$type = 'counter';
//$options['measured_class'] = $entry['entPhysicalClass'];
$sensor_type = 'cisco-entity-state';
break;
default:
// Normal sensors
$type = $c_entitysensor[$entry['entSensorType']];
$sensor_type = 'cisco-entity-sensor';
if ($entry['entSensorType'] === 'cmm') {
$options['sensor_unit'] = 'CMM';
}
}
// Returning blatantly broken value. IGNORE.
if ($value == "-32768" || $value == "-127") {
$ok = FALSE;
} elseif (safe_empty($descr)) {
// Empty description. Lots of these on Nexus and Cisco APIC
$i[$type]++;
$descr = 'Sensor ' . $i[$type];
if ($value == 0) {
$ok = FALSE;
}
}
print_debug_vars($descr);
print_debug_vars($scale);
print_debug_vars($entry);
// Now try to search port bounded with sensor by ENTITY-MIB
if ($ok && in_array($type, [ 'temperature', 'voltage', 'current', 'dbm', 'power' ])) {
$port = get_port_by_ent_index($device, $index);
$options['entPhysicalIndex'] = $index;
if (is_array($port)) {
$entry['ifDescr'] = $port['port_label'];
$options['measured_class'] = 'port';
$options['measured_entity'] = $port['port_id'];
$options['measured_entity_label'] = $port['port_label'];
$options['entPhysicalIndex_measured'] = $port['ifIndex'];
// Fix Port description based on vendor type
if ($entry['entPhysicalVendorType'] && !str_icontains_array($descr, [ 'Power', 'Current', 'Voltage', 'Temperature' ])) {
switch ($entry['entPhysicalVendorType']) {
case 'cevSensorTransceiverVoltage':
$descr .= ' Transceiver Voltage';
break;
case 'cevSensorTransceiverCurrent':
$descr .= ' Transceiver Bias Current';
break;
case 'cevSensorTransceiverTemp':
$descr .= ' Transceiver Temperature';
break;
case 'cevSensorTransceiverRxPwr':
$descr .= ' Transceiver Receive Power';
break;
case 'cevSensorTransceiverTxPwr':
$descr .= ' Transceiver Transmit Power';
break;
}
}
}
}
// Append nice measured entity label for well sorted
if ($sensor_type === 'cisco-entity-sensor' && empty($options['measured_entity_label']) &&
preg_match('/^(?<class>[\w\-]+?( \w+)?)\d* (?<entity>\S+)$/', $entry['entPhysicalName'], $matches)) {
$options['measured_entity_label'] = $matches['entity'];
if (empty($options['entPhysicalClass'])) {
// capacity 0/PM1/SP
// chassis ASR-9001-S
// cpu 0/RSP0/CPU0
// current 0/PM1/SP
// daughtercard 0/0/CPU0
// fan0 0/FT0/SP
// fantray 0/FT0/SP
// module 0/RSP0/CPU0
// module mau 0/0/2/1
// power-module 0/PM1/SP
// power Rx 0/0/2/1
// power Tx 0/0/2/1
// slot 0/RSP0
// slot mau 0/0/2/3
// speed 0/FT0/SP
// subslot 0/0/2
// temperature 0/RSP0/CPU0
// voltage 0/RSP0/CPU0
switch (strtolower($matches['class'])) {
case 'fan':
case 'fantray':
case 'cpu':
case 'chassis':
case 'module':
$options['entPhysicalClass'] = strtolower($matches['class']);
break;
case 'power-module':
case 'power module':
$options['entPhysicalClass'] = 'powerSupply';
break;
default:
if (str_contains($entry['entPhysicalName'], 'Power Module')) {
$options['entPhysicalClass'] = 'powerSupply';
}
}
}
}
// Set thresholds for numeric sensors
$limits = [];
$scale = NULL;
if ($c_entitysensor[$entry['entSensorType']] !== 'state') {
$precision = $entry['entSensorPrecision'];
if ($device['os'] === 'iosxe' && $precision > 0 &&
version_compare($device['version'], '16.11', '>=') && version_compare($device['version'], '16.12', '<')) {
// See: https://jira.observium.org/browse/OBS-3026
// Note, issue not actual on firmware less than 16.11, not sure if fixed on newer firmwares
// Seems as not actual on 16.12.x, see: https://jira.observium.org/browse/OBS-3707
// I not sure that this fully correct, but for issue case - works
$precision -= 1;
} elseif ($device['os'] === 'iosxr' && $precision > 0 && $type === 'power' &&
$device['version'] === '6.4.2' && preg_match('/ASR\-90\d{2}/', $device['hardware'])) {
// See: https://jira.observium.org/browse/OBS-4079
// ASR9k 32bit platform issue for power sensor
$precision -= 1;
}
$scale = si_to_scale($entry['entSensorScale'], $precision);
// Check thresholds for this entry
foreach ($t_entity_array[$index] as $t_index => $t_entry) {
if ($t_entry['entSensorThresholdValue'] == "-32768") {
continue;
}
/* Sometime thresholds have duplicate limits, see:
* https://jira.observium.org/browse/OBS-2752
entSensorType.1019 = celsius
entSensorScale.1019 = units
entSensorPrecision.1019 = 0
entSensorValue.1019 = 24
entSensorStatus.1019 = ok
entSensorThresholdSeverity.1019.1 = minor
entSensorThresholdSeverity.1019.2 = major
entSensorThresholdSeverity.1019.3 = critical
entSensorThresholdSeverity.1019.4 = critical
entSensorThresholdRelation.1019.1 = greaterOrEqual
entSensorThresholdRelation.1019.2 = greaterOrEqual
entSensorThresholdRelation.1019.3 = greaterOrEqual
entSensorThresholdRelation.1019.4 = greaterOrEqual
entSensorThresholdValue.1019.1 = 55
entSensorThresholdValue.1019.2 = 65
entSensorThresholdValue.1019.3 = 75
entSensorThresholdValue.1019.4 = 100
*/
/* Another case, when critical limits is zero, see:
* https://jira.observium.org/browse/OBS-2819
entSensorThresholdSeverity.2130160.1 = minor
entSensorThresholdSeverity.2130160.2 = minor
entSensorThresholdSeverity.2130160.3 = major
entSensorThresholdSeverity.2130160.4 = major
entSensorThresholdSeverity.2130160.5 = critical
entSensorThresholdSeverity.2130160.6 = critical
entSensorThresholdRelation.2130160.1 = lessOrEqual
entSensorThresholdRelation.2130160.2 = greaterOrEqual
entSensorThresholdRelation.2130160.3 = lessOrEqual
entSensorThresholdRelation.2130160.4 = greaterOrEqual
entSensorThresholdRelation.2130160.5 = lessOrEqual
entSensorThresholdRelation.2130160.6 = greaterOrEqual
entSensorThresholdValue.2130160.1 = 31000000
entSensorThresholdValue.2130160.2 = 34650000
entSensorThresholdValue.2130160.3 = 29700000
entSensorThresholdValue.2130160.4 = 36300000
entSensorThresholdValue.2130160.5 = 0
entSensorThresholdValue.2130160.6 = 0
*/
/* Another case, when minor limits is zero, see:
* https://jira.observium.org/browse/OBS-2819?focusedCommentId=21323#comment-21323
entSensorThresholdSeverity.2224410.1 = minor
entSensorThresholdSeverity.2224410.2 = minor
entSensorThresholdSeverity.2224410.3 = major
entSensorThresholdSeverity.2224410.4 = major
entSensorThresholdSeverity.2224410.5 = critical
entSensorThresholdSeverity.2224410.6 = critical
entSensorThresholdRelation.2224410.1 = lessOrEqual
entSensorThresholdRelation.2224410.2 = greaterOrEqual
entSensorThresholdRelation.2224410.3 = lessOrEqual
entSensorThresholdRelation.2224410.4 = greaterOrEqual
entSensorThresholdRelation.2224410.5 = lessOrEqual
entSensorThresholdRelation.2224410.6 = greaterOrEqual
entSensorThresholdValue.2224410.1 = 0
entSensorThresholdValue.2224410.2 = 0
entSensorThresholdValue.2224410.3 = -1059981
entSensorThresholdValue.2224410.4 = 450002
entSensorThresholdValue.2224410.5 = -1459670
entSensorThresholdValue.2224410.6 = 749999
*/
switch ($t_entry['entSensorThresholdSeverity']) {
case 'critical':
// Prefer critical over major
if (in_array($t_entry['entSensorThresholdRelation'], ['greaterOrEqual', 'greaterThan'])) {
if (isset($limits['limit_high'])) {
break;
} // Use first threshold entry
$limits['limit_high'] = $t_entry['entSensorThresholdValue'] * $scale;
} elseif (in_array($t_entry['entSensorThresholdRelation'], ['lessOrEqual', 'lessThan'])) {
if (isset($limits['limit_low'])) {
break;
} // Use first threshold entry
$limits['limit_low'] = $t_entry['entSensorThresholdValue'] * $scale;
}
// FIXME. Not used: equalTo, notEqualTo
break;
case 'major':
// Prefer critical over major,
if (in_array($t_entry['entSensorThresholdRelation'], ['greaterOrEqual', 'greaterThan'])) {
if (isset($limits['limit_high_major'])) {
break;
} // Use first threshold entry
$limits['limit_high_major'] = $t_entry['entSensorThresholdValue'] * $scale;
} elseif (in_array($t_entry['entSensorThresholdRelation'], ['lessOrEqual', 'lessThan'])) {
if (isset($limits['limit_low_major'])) {
break;
} // Use first threshold entry
$limits['limit_low_major'] = $t_entry['entSensorThresholdValue'] * $scale;
}
break;
case 'minor':
if (in_array($t_entry['entSensorThresholdRelation'], ['greaterOrEqual', 'greaterThan'])) {
if (isset($limits['limit_high_warn'])) {
break;
} // Use first threshold entry
$limits['limit_high_warn'] = $t_entry['entSensorThresholdValue'] * $scale;
} elseif (in_array($t_entry['entSensorThresholdRelation'], ['lessOrEqual', 'lessThan'])) {
if (isset($limits['limit_low_warn'])) {
break;
} // Use first threshold entry
$limits['limit_low_warn'] = $t_entry['entSensorThresholdValue'] * $scale;
}
// FIXME. Not used: equalTo, notEqualTo
break;
case 'other':
// Probably here should be equalTo, notEqualTo.. never saw
break;
}
}
// Fixes for high thresholds issues in IOS-XR (and others)
if (!isset($limits['limit_high']) && isset($limits['limit_high_major'])) {
// Use major thresholds if critical not set
$limits['limit_high'] = $limits['limit_high_major'];
unset($limits['limit_high_major']);
} elseif (isset($limits['limit_high'], $limits['limit_high_major']) &&
$limits['limit_high'] == 0 && $limits['limit_high_major'] != 0) {
// critical limit is zero, use major
$limits['limit_high'] = $limits['limit_high_major'];
unset($limits['limit_high_major']);
}
if (isset($limits['limit_high_warn'], $limits['limit_high_major']) &&
$limits['limit_high_warn'] == 0 && $limits['limit_high_major'] != 0) {
// minor limit is zero, use major
$limits['limit_high_warn'] = $limits['limit_high_major'];
}
// Fixes for low thresholds issues in IOS-XR (and others)
if (!isset($limits['limit_low']) && isset($limits['limit_low_major'])) {
// Use major thresholds if critical not set
$limits['limit_low'] = $limits['limit_low_major'];
unset($limits['limit_low_major']);
} elseif (isset($limits['limit_low'], $limits['limit_low_major']) &&
$limits['limit_low'] == 0 && $limits['limit_low_major'] != 0) {
// critical limit is zero, use major
$limits['limit_low'] = $limits['limit_low_major'];
unset($limits['limit_low_major']);
}
if (isset($limits['limit_low_warn'], $limits['limit_low_major']) &&
$limits['limit_low_warn'] == 0 && $limits['limit_low_major'] != 0) {
// minor limit is zero, use major
$limits['limit_low_warn'] = $limits['limit_low_major'];
}
unset($limits['limit_high_major'], $limits['limit_low_major']);
// This port sensors really always return 0, see:
// https://jira.observium.org/browse/OBS-3335
/*
entPhysicalDescr.2134256 = Voltage Sensor
entPhysicalVendorType.2134256 = cevSensorNCS4KVol
entPhysicalContainedIn.2134256 = 2134017
entPhysicalClass.2134256 = sensor
entPhysicalParentRelPos.2134256 = 4
entPhysicalName.2134256 = GigabitEthernet0/0/0/1-3.3 V
entPhysicalHardwareRev.2134256 =
entPhysicalFirmwareRev.2134256 =
entPhysicalSoftwareRev.2134256 =
entPhysicalSerialNum.2134256 =
entPhysicalMfgName.2134256 =
entPhysicalModelName.2134256 = N/A
entPhysicalAlias.2134256 =
entPhysicalAssetID.2134256 =
entPhysicalIsFRU.2134256 = false
entSensorType.2134256 = voltsDC
entSensorScale.2134256 = milli
entSensorPrecision.2134256 = 4
entSensorValue.2134256 = 0
entSensorStatus.2134256 = ok
entSensorValueTimeStamp.2134256 = 0:0:00:00.00
entSensorValueUpdateRate.2134256 = 10
entSensorMeasuredEntity.2134256 = 2134017
entSensorThresholdSeverity.2134256.1 = minor
entSensorThresholdSeverity.2134256.2 = minor
entSensorThresholdSeverity.2134256.3 = major
entSensorThresholdSeverity.2134256.4 = major
entSensorThresholdSeverity.2134256.5 = critical
entSensorThresholdSeverity.2134256.6 = critical
entSensorThresholdRelation.2134256.1 = lessOrEqual
entSensorThresholdRelation.2134256.2 = greaterOrEqual
entSensorThresholdRelation.2134256.3 = lessOrEqual
entSensorThresholdRelation.2134256.4 = greaterOrEqual
entSensorThresholdRelation.2134256.5 = lessOrEqual
entSensorThresholdRelation.2134256.6 = greaterOrEqual
entSensorThresholdValue.2134256.1 = 0
entSensorThresholdValue.2134256.2 = 0
entSensorThresholdValue.2134256.3 = 0
entSensorThresholdValue.2134256.4 = 0
entSensorThresholdValue.2134256.5 = 0
entSensorThresholdValue.2134256.6 = 0
*/
if ($options['measured_class'] === 'port' && $value == 0 &&
$limits['limit_high'] == 0 && $limits['limit_high_warn'] == 0 &&
$limits['limit_low'] == 0 && $limits['limit_low_warn'] == 0) {
unset($limits['limit_high'], $limits['limit_high_warn'], $limits['limit_low'], $limits['limit_low_warn']);
if (!($type === 'dbm' || $port['ifOperStatus'] === 'up')) {
$ok = FALSE;
}
}
// Some Cisco sensors have all limits as same value (f.u. cisco), then leave only one limit
if ((float_cmp($limits['limit_high'], $limits['limit_low']) === 0) &&
(float_cmp($limits['limit_high_warn'], $limits['limit_low_warn']) === 0) &&
(float_cmp($limits['limit_high'], $limits['limit_high_warn']) === 0)) {
unset($limits['limit_high_warn'], $limits['limit_low_warn'], $limits['limit_low']);
}
// https://jira.observium.org/browse/OBS-3597
// End Threshold code
}
if ($ok) {
$options = array_merge($limits, $options);
if ($type === 'state') {
//truthvalue
$options['rename_rrd'] = 'cisco-entity-state-' . $index;
discover_status_ng($device, $mib, 'entSensorValue', $oid, $index, $sensor_type, $descr, $value, $options);
} elseif ($type === 'counter') {
discover_counter($device, $entry['entPhysicalClass'], $mib, 'entSensorValue', $oid, $index, $descr, $scale, $value, $options);
} else {
$options['rename_rrd'] = 'cisco-entity-sensor-' . $index;
discover_sensor_ng($device, $type, $mib, 'entSensorValue', $oid, $index, $descr, $scale, $value, $options);
}
}
}
}
}
unset($oids, $t_oids, $entity_array, $t_entity_array, $index, $scale, $type, $value, $descr, $ok, $ifIndex, $sensor_port);

View File

@ -1,5 +1,4 @@
<?php
/**
* Observium
*
@ -7,7 +6,7 @@
*
* @package observium
* @subpackage discovery
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2019 Observium Limited
* @copyright (C) Adam Armstrong
*
*/
@ -17,177 +16,173 @@ $sensor_type = 'cisco-envmon';
$sensor_state_type = 'cisco-envmon-state';
// Temperatures:
$oids = snmpwalk_cache_oid($device, 'ciscoEnvMonTemperatureStatusEntry', array(), 'CISCO-ENVMON-MIB');
$oids = snmpwalk_cache_oid($device, 'ciscoEnvMonTemperatureStatusEntry', [], 'CISCO-ENVMON-MIB');
foreach ($oids as $index => $entry)
{
$descr = $entry['ciscoEnvMonTemperatureStatusDescr'];
if ($descr == '') { continue; } // Skip sensors with empty description, seems like Cisco bug
foreach ($oids as $index => $entry) {
$descr = $entry['ciscoEnvMonTemperatureStatusDescr'];
if ($descr == '') {
continue;
} // Skip sensors with empty description, seems like Cisco bug
if (isset($entry['ciscoEnvMonTemperatureStatusValue']))
{
// Clean descr:
// SW#1, Sensor#1, GREEN
$descr_replace = [
', GREEN' => '', ' GREEN,' => ',',
', YELLOW' => '', ' YELLOW,' => ',',
', RED' => '', ' RED,' => ',',
];
$descr = array_str_replace($descr_replace, $descr);
if (isset($entry['ciscoEnvMonTemperatureStatusValue'])) {
$oid = '.1.3.6.1.4.1.9.9.13.1.3.1.3.'.$index;
// Exclude duplicated entries from CISCO-ENTITY-SENSOR
//$ent_exist = dbFetchCell('SELECT COUNT(*) FROM `sensors` WHERE `device_id` = ? AND `sensor_type` = ? AND `sensor_class` = ? AND (`sensor_descr` LIKE ? OR `sensor_descr` LIKE ?) AND CONCAT(`sensor_limit`) = ?;',
$ent_exist = dbExist('sensors', '`device_id` = ? AND `sensor_type` = ? AND `sensor_class` = ? AND (`sensor_descr` LIKE ? OR `sensor_descr` LIKE ?) AND CONCAT(`sensor_limit`) = ?',
array($device['device_id'], 'CISCO-ENTITY-SENSOR-MIB-entSensorValue', 'temperature', $descr.'%', '%- '.$descr, $entry['ciscoEnvMonTemperatureThreshold']));
if (!$ent_exist && $entry['ciscoEnvMonTemperatureStatusValue'] != 0)
{
$options = array();
$options['limit_high'] = $entry['ciscoEnvMonTemperatureThreshold'];
$options['rename_rrd'] = 'cisco-envmon-'.$index;
discover_sensor_ng( $device,'temperature', $mib, 'ciscoEnvMonTemperatureStatusValue', $oid, $index, NULL, $descr, 1, $entry['ciscoEnvMonTemperatureStatusValue'], $options);
// Skip if this is a duplicate of an entSensor entry.
if (isset($GLOBALS['valid']['sensor']['temperature']['CISCO-ENTITY-SENSOR-MIB-entSensorValue'][$index])) {
print_debug("entSensor exists. Skipping.");
continue;
}
// Clean descr:
// SW#1, Sensor#1, GREEN
$descr_replace = [
', GREEN' => '', ' GREEN,' => ',',
', YELLOW' => '', ' YELLOW,' => ',',
', RED' => '', ' RED,' => ',',
];
$descr = array_str_replace($descr_replace, $descr);
$oid = '.1.3.6.1.4.1.9.9.13.1.3.1.3.' . $index;
// Exclude duplicated entries from CISCO-ENTITY-SENSOR
//$ent_exist = dbFetchCell('SELECT COUNT(*) FROM `sensors` WHERE `device_id` = ? AND `sensor_type` = ? AND `sensor_class` = ? AND (`sensor_descr` LIKE ? OR `sensor_descr` LIKE ?) AND CONCAT(`sensor_limit`) = ?;',
$ent_exist = dbExist('sensors', '`device_id` = ? AND `sensor_type` = ? AND `sensor_class` = ? AND (`sensor_descr` LIKE ? OR `sensor_descr` LIKE ?)',
[ $device['device_id'], 'CISCO-ENTITY-SENSOR-MIB-entSensorValue', 'temperature', $descr . '%', '%- ' . $descr ]);
if (!$ent_exist && $entry['ciscoEnvMonTemperatureStatusValue'] != 0) {
$options = [];
$options['limit_high'] = $entry['ciscoEnvMonTemperatureThreshold'];
$options['rename_rrd'] = 'cisco-envmon-' . $index;
discover_sensor_ng($device, 'temperature', $mib, 'ciscoEnvMonTemperatureStatusValue', $oid, $index, $descr, 1, $entry['ciscoEnvMonTemperatureStatusValue'], $options);
}
} elseif (isset($entry['ciscoEnvMonTemperatureState'])) {
$oid = '.1.3.6.1.4.1.9.9.13.1.3.1.6.' . $index;
// Exclude duplicated entries from CISCO-ENTITY-SENSOR
//$ent_exist = dbFetchCell('SELECT COUNT(*) FROM `sensors` WHERE `device_id` = ? AND `sensor_type` = ? AND `sensor_class` = ? AND (`sensor_descr` LIKE ? OR `sensor_descr` LIKE ?);',
$ent_exist = dbExist('sensors', '`device_id` = ? AND `sensor_type` = ? AND `sensor_class` = ? AND (`sensor_descr` LIKE ? OR `sensor_descr` LIKE ?)',
[$device['device_id'], 'cisco-entity-state', 'state', $descr . '%', '%- ' . $descr]);
// Not numerical values, only states
if (!$ent_exist) {
$options['rename_rrd'] = $sensor_state_type . '-temp-' . $index;
discover_status_ng($device, $mib, 'ciscoEnvMonTemperatureState', $oid, $index, $sensor_state_type, $descr, $entry['ciscoEnvMonTemperatureState'], ['entPhysicalClass' => 'chassis']);
}
}
}
elseif (isset($entry['ciscoEnvMonTemperatureState']))
{
$oid = '.1.3.6.1.4.1.9.9.13.1.3.1.6.'.$index;
// Exclude duplicated entries from CISCO-ENTITY-SENSOR
//$ent_exist = dbFetchCell('SELECT COUNT(*) FROM `sensors` WHERE `device_id` = ? AND `sensor_type` = ? AND `sensor_class` = ? AND (`sensor_descr` LIKE ? OR `sensor_descr` LIKE ?);',
$ent_exist = dbExist('sensors', '`device_id` = ? AND `sensor_type` = ? AND `sensor_class` = ? AND (`sensor_descr` LIKE ? OR `sensor_descr` LIKE ?)',
array($device['device_id'], 'cisco-entity-state', 'state', $descr.'%', '%- '.$descr));
// Not numerical values, only states
if (!$ent_exist)
{
$options['rename_rrd'] = $sensor_state_type.'-temp-'.$index;
discover_status_ng($device, $mib, 'ciscoEnvMonTemperatureState', $oid, $index, $sensor_state_type, $descr, $entry['ciscoEnvMonTemperatureState'], array('entPhysicalClass' => 'chassis'));
}
}
}
// Voltages
$scale = si_to_scale('milli');
$oids = snmpwalk_cache_oid($device, 'ciscoEnvMonVoltageStatusEntry', array(), 'CISCO-ENVMON-MIB');
$oids = snmpwalk_cache_oid($device, 'ciscoEnvMonVoltageStatusEntry', [], 'CISCO-ENVMON-MIB');
foreach ($oids as $index => $entry)
{
$descr = str_replace(' in mV', '', $entry['ciscoEnvMonVoltageStatusDescr']);
if ($descr == '') { continue; } // Skip sensors with empty description, seems like Cisco bug
foreach ($oids as $index => $entry) {
$descr = str_replace(' in mV', '', $entry['ciscoEnvMonVoltageStatusDescr']);
if ($descr == '') {
continue;
} // Skip sensors with empty description, seems like Cisco bug
if (isset($entry['ciscoEnvMonVoltageStatusValue']))
{
$oid = '.1.3.6.1.4.1.9.9.13.1.2.1.3.'.$index;
// Exclude duplicated entries from CISCO-ENTITY-SENSOR
//$query = 'SELECT COUNT(*) FROM `sensors` WHERE `device_id` = ? AND `sensor_type` = ? AND `sensor_class` = ? AND (`sensor_descr` LIKE ? OR `sensor_descr` LIKE ?) ';
$where = '`device_id` = ? AND `sensor_type` = ? AND `sensor_class` = ? AND (`sensor_descr` LIKE ? OR `sensor_descr` LIKE ?) ';
$where .= ($entry['ciscoEnvMonVoltageThresholdHigh'] > $entry['ciscoEnvMonVoltageThresholdLow']) ? 'AND CONCAT(`sensor_limit`) = ? AND CONCAT(`sensor_limit_low`) = ?' : 'AND CONCAT(`sensor_limit_low`) = ? AND CONCAT(`sensor_limit`) = ?'; //swich negative numbers
//$ent_exist = dbFetchCell($query, array($device['device_id'], 'CISCO-ENTITY-SENSOR-MIB-entSensorValue', 'voltage', $descr.'%', '%- '.$descr, $entry['ciscoEnvMonVoltageThresholdHigh'] * $scale, $entry['ciscoEnvMonVoltageThresholdLow'] * $scale));
$ent_exist = dbExist('sensors', $where, array($device['device_id'], 'CISCO-ENTITY-SENSOR-MIB-entSensorValue', 'voltage', $descr.'%', '%- '.$descr, $entry['ciscoEnvMonVoltageThresholdHigh'] * $scale, $entry['ciscoEnvMonVoltageThresholdLow'] * $scale));
if (!$ent_exist)
{
$options = array('limit_high' => $entry['ciscoEnvMonVoltageThresholdLow'] * $scale,
'limit_low' => $entry['ciscoEnvMonVoltageThresholdHigh'] * $scale);
if (isset($entry['ciscoEnvMonVoltageStatusValue'])) {
$oid = '.1.3.6.1.4.1.9.9.13.1.2.1.3.' . $index;
// Exclude duplicated entries from CISCO-ENTITY-SENSOR
//$query = 'SELECT COUNT(*) FROM `sensors` WHERE `device_id` = ? AND `sensor_type` = ? AND `sensor_class` = ? AND (`sensor_descr` LIKE ? OR `sensor_descr` LIKE ?) ';
$where = '`device_id` = ? AND `sensor_type` = ? AND `sensor_class` = ? AND (`sensor_descr` LIKE ? OR `sensor_descr` LIKE ?) ';
//$ent_exist = dbFetchCell($query, array($device['device_id'], 'CISCO-ENTITY-SENSOR-MIB-entSensorValue', 'voltage', $descr.'%', '%- '.$descr, $entry['ciscoEnvMonVoltageThresholdHigh'] * $scale, $entry['ciscoEnvMonVoltageThresholdLow'] * $scale));
$ent_exist = dbExist('sensors', $where, [ $device['device_id'], 'CISCO-ENTITY-SENSOR-MIB-entSensorValue', 'voltage', $descr . '%', '%- ' . $descr ]);
if (!$ent_exist) {
$options = ['limit_high' => $entry['ciscoEnvMonVoltageThresholdLow'] * $scale,
'limit_low' => $entry['ciscoEnvMonVoltageThresholdHigh'] * $scale];
$options['rename_rrd'] = 'cisco-envmon-'.$index;
discover_sensor_ng( $device,'voltage', $mib, 'ciscoEnvMonVoltageStatusValue', $oid, $index, NULL, $descr, $scale, $entry['ciscoEnvMonVoltageStatusValue'], $options);
$options['rename_rrd'] = 'cisco-envmon-' . $index;
discover_sensor_ng($device, 'voltage', $mib, 'ciscoEnvMonVoltageStatusValue', $oid, $index, $descr, $scale, $entry['ciscoEnvMonVoltageStatusValue'], $options);
}
} elseif (isset($entry['ciscoEnvMonVoltageState'])) {
$oid = '.1.3.6.1.4.1.9.9.13.1.2.1.7.' . $index;
//$query = 'SELECT COUNT(*) FROM `status` WHERE `device_id` = ? AND `status_type` = ? AND (`sensor_descr` LIKE ? OR `sensor_descr` LIKE ?);';
//$ent_exist = dbFetchCell($query, array($device['device_id'], 'cisco-entity-state', $descr.'%', '%- '.$descr));
$where = '`device_id` = ? AND `status_type` = ? AND (`sensor_descr` LIKE ? OR `sensor_descr` LIKE ?)';
$ent_exist = dbExist('status', $where, [$device['device_id'], 'cisco-entity-state', $descr . '%', '%- ' . $descr]);
if (!$ent_exist) {
$options['rename_rrd'] = $sensor_state_type . '-voltage-' . $index;
discover_status_ng($device, $mib, 'ciscoEnvMonVoltageState', $oid, $index, $sensor_state_type, $descr, $entry['ciscoEnvMonVoltageState'], [ 'entPhysicalClass' => 'chassis' ]);
}
}
}
else if (isset($entry['ciscoEnvMonVoltageState']))
{
$oid = '.1.3.6.1.4.1.9.9.13.1.2.1.7.'.$index;
//$query = 'SELECT COUNT(*) FROM `status` WHERE `device_id` = ? AND `status_type` = ? AND (`sensor_descr` LIKE ? OR `sensor_descr` LIKE ?);';
//$ent_exist = dbFetchCell($query, array($device['device_id'], 'cisco-entity-state', $descr.'%', '%- '.$descr));
$where = '`device_id` = ? AND `status_type` = ? AND (`sensor_descr` LIKE ? OR `sensor_descr` LIKE ?)';
$ent_exist = dbExist('status', $where, array($device['device_id'], 'cisco-entity-state', $descr.'%', '%- '.$descr));
if (!$ent_exist)
{
$options['rename_rrd'] = $sensor_state_type.'-voltage-'.$index;
discover_status_ng($device, $mib, 'ciscoEnvMonVoltageState', $oid, $index, $sensor_state_type, $descr, $entry['ciscoEnvMonVoltageState'], array('entPhysicalClass' => 'chassis'));
}
}
}
// Supply
$oids = snmpwalk_cache_oid($device, 'ciscoEnvMonSupplyStatusEntry', array(), 'CISCO-ENVMON-MIB');
$oids = snmpwalk_cache_oid($device, 'ciscoEnvMonSupplyStatusEntry', [], 'CISCO-ENVMON-MIB');
foreach ($oids as $index => $entry)
{
$descr = $entry['ciscoEnvMonSupplyStatusDescr'];
if ($descr == '') { continue; } // Skip sensors with empty description, seems like Cisco bug
foreach ($oids as $index => $entry) {
$descr = $entry['ciscoEnvMonSupplyStatusDescr'];
if ($descr == '') {
continue;
} // Skip sensors with empty description, seems like Cisco bug
if (isset($entry['ciscoEnvMonSupplyState']))
{
$oid = '.1.3.6.1.4.1.9.9.13.1.5.1.3.'.$index;
// Exclude duplicated entries from CISCO-ENTITY-SENSOR
//$ent_exist = dbFetchCell('SELECT COUNT(*) FROM `status` WHERE `device_id` = ? AND `status_type` = ? AND (`status_descr` LIKE ? OR `status_descr` LIKE ?);',
$ent_exist = dbExist('status', '`device_id` = ? AND `status_type` = ? AND (`status_descr` LIKE ? OR `status_descr` LIKE ?)',
array($device['device_id'], 'cisco-entity-state', $descr.'%', '%- '.$descr));
if (!$ent_exist)
{
// Clean descr:
// Sw1, PS1 Normal, RPS NotExist
// Switch 1 - Power Supply A, Normal
$descr_replace = [
', ' . $entry['ciscoEnvMonSupplyState'] => '',
' ' . $entry['ciscoEnvMonSupplyState'] . ',' => ',',
', RPS NotExist' => ''
];
$descr = array_str_replace($descr_replace, $descr);
if (in_array($entry['ciscoEnvMonSupplySource'], [ 'ac', 'dc' ])) // Exclude poll Source for just AC/DC
{
$descr .= ' (' . strtoupper($entry['ciscoEnvMonSupplySource']) . ')';
}
if (isset($entry['ciscoEnvMonSupplyState'])) {
$oid = '.1.3.6.1.4.1.9.9.13.1.5.1.3.' . $index;
// Exclude duplicated entries from CISCO-ENTITY-SENSOR
//$ent_exist = dbFetchCell('SELECT COUNT(*) FROM `status` WHERE `device_id` = ? AND `status_type` = ? AND (`status_descr` LIKE ? OR `status_descr` LIKE ?);',
$ent_exist = dbExist('status', '`device_id` = ? AND `status_type` = ? AND (`status_descr` LIKE ? OR `status_descr` LIKE ?)',
[$device['device_id'], 'cisco-entity-state', $descr . '%', '%- ' . $descr]);
if (!$ent_exist) {
// Clean descr:
// Sw1, PS1 Normal, RPS NotExist
// Switch 1 - Power Supply A, Normal
$descr_replace = [
', ' . $entry['ciscoEnvMonSupplyState'] => '',
' ' . $entry['ciscoEnvMonSupplyState'] . ',' => ',',
', RPS NotExist' => ''
];
$descr = array_str_replace($descr_replace, $descr);
if (in_array($entry['ciscoEnvMonSupplySource'], ['ac', 'dc'])) // Exclude poll Source for just AC/DC
{
$descr .= ' (' . strtoupper($entry['ciscoEnvMonSupplySource']) . ')';
}
$options['rename_rrd'] = $sensor_state_type.'-supply-'.$index;
discover_status_ng($device, $mib, 'ciscoEnvMonSupplyState', $oid, $index, $sensor_state_type, $descr, $entry['ciscoEnvMonSupplyState'], array('entPhysicalClass' => 'powersupply'));
$options['rename_rrd'] = $sensor_state_type . '-supply-' . $index;
discover_status_ng($device, $mib, 'ciscoEnvMonSupplyState', $oid, $index, $sensor_state_type, $descr, $entry['ciscoEnvMonSupplyState'], ['entPhysicalClass' => 'powersupply']);
$oid_name = 'ciscoEnvMonSupplySource';
$oid_num = '.1.3.6.1.4.1.9.9.13.1.5.1.4.'.$index;
$type = 'ciscoEnvMonSupplySource';
$value = $entry[$oid_name];
$oid_name = 'ciscoEnvMonSupplySource';
$oid_num = '.1.3.6.1.4.1.9.9.13.1.5.1.4.' . $index;
$type = 'ciscoEnvMonSupplySource';
$value = $entry[$oid_name];
if (!in_array($value, [ 'ac', 'dc' ])) // Exclude poll Source for just AC/DC, keep Redundant
{
$options['rename_rrd'] = 'ciscoEnvMonSupplySource-ciscoEnvMonSupplySource.' . $index;
discover_status_ng($device, $mib, $oid_name, $oid_num, $index, $type, $descr . ' Source', $value, ['entPhysicalClass' => 'powersupply']);
}
if (!in_array($value, ['ac', 'dc'])) // Exclude poll Source for just AC/DC, keep Redundant
{
$options['rename_rrd'] = 'ciscoEnvMonSupplySource-ciscoEnvMonSupplySource.' . $index;
discover_status_ng($device, $mib, $oid_name, $oid_num, $index, $type, $descr . ' Source', $value, ['entPhysicalClass' => 'powersupply']);
}
}
}
}
}
// Fans
echo(" Fans ");
$oids = snmpwalk_cache_oid($device, 'ciscoEnvMonFanStatusEntry', array(), 'CISCO-ENVMON-MIB');
$oids = snmpwalk_cache_oid($device, 'ciscoEnvMonFanStatusEntry', [], 'CISCO-ENVMON-MIB');
foreach ($oids as $index => $entry)
{
$descr = $entry['ciscoEnvMonFanStatusDescr'];
if ($descr == '') { continue; } // Skip sensors with empty description, seems like Cisco bug
foreach ($oids as $index => $entry) {
$descr = $entry['ciscoEnvMonFanStatusDescr'];
if ($descr == '') {
continue;
} // Skip sensors with empty description, seems like Cisco bug
if (isset($entry['ciscoEnvMonFanState']))
{
$oid = '.1.3.6.1.4.1.9.9.13.1.4.1.3.'.$index;
// Exclude duplicated entries from CISCO-ENTITY-SENSOR
//$ent_exist = dbFetchCell('SELECT COUNT(*) FROM `status` WHERE `device_id` = ? AND `status_type` = ? AND (`status_descr` LIKE ? OR `status_descr` LIKE ?);',
$ent_exist = dbExist('status', '`device_id` = ? AND `status_type` = ? AND (`status_descr` LIKE ? OR `status_descr` LIKE ?)',
array($device['device_id'], 'cisco-entity-state', $descr.'%', '%- '.$descr));
if (isset($entry['ciscoEnvMonFanState'])) {
$oid = '.1.3.6.1.4.1.9.9.13.1.4.1.3.' . $index;
// Exclude duplicated entries from CISCO-ENTITY-SENSOR
//$ent_exist = dbFetchCell('SELECT COUNT(*) FROM `status` WHERE `device_id` = ? AND `status_type` = ? AND (`status_descr` LIKE ? OR `status_descr` LIKE ?);',
$ent_exist = dbExist('status', '`device_id` = ? AND `status_type` = ? AND (`status_descr` LIKE ? OR `status_descr` LIKE ?)',
[$device['device_id'], 'cisco-entity-state', $descr . '%', '%- ' . $descr]);
if (!$ent_exist)
{
// Clean descr:
// Switch 1 - FAN - T1 3, Normal
$descr_replace = [
', ' . $entry['ciscoEnvMonFanState'] => '',
' ' . $entry['ciscoEnvMonFanState'] . ',' => ','
];
$descr = array_str_replace($descr_replace, $descr);
if (!$ent_exist) {
// Clean descr:
// Switch 1 - FAN - T1 3, Normal
$descr_replace = [
', ' . $entry['ciscoEnvMonFanState'] => '',
' ' . $entry['ciscoEnvMonFanState'] . ',' => ','
];
$descr = array_str_replace($descr_replace, $descr);
$options['rename_rrd'] = $sensor_state_type.'-fan-'.$index;
discover_status_ng($device, $mib, 'ciscoEnvMonFanState', $oid, $index, $sensor_state_type, $descr, $entry['ciscoEnvMonFanState'], array('entPhysicalClass' => 'fan'));
$options['rename_rrd'] = $sensor_state_type . '-fan-' . $index;
discover_status_ng($device, $mib, 'ciscoEnvMonFanState', $oid, $index, $sensor_state_type, $descr, $entry['ciscoEnvMonFanState'], [ 'entPhysicalClass' => 'fan' ]);
}
}
}
}
// EOF

View File

@ -6,7 +6,7 @@
*
* @package observium
* @subpackage discovery
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2021 Observium Limited
* @copyright (C) Adam Armstrong
*
*/
@ -43,58 +43,54 @@ CISCO-POWER-ETHERNET-EXT-MIB::cpeExtPsePortPwrManAlloc.1.2 = Gauge32: 0 milliwat
CISCO-POWER-ETHERNET-EXT-MIB::cpeExtPsePortPwrManAlloc.1.3 = Gauge32: 0 milliwatts
*/
$oids = snmpwalk_cache_oid($device, 'cpeExtPsePortEntry', array(), $mib);
$oids = snmpwalk_cache_oid($device, 'cpeExtPsePortEntry', [], $mib);
print_debug_vars($oids);
foreach ($oids as $index => $entry)
{
if ($entry['cpeExtPsePortEnable'] == 'disable' ||
($entry['cpeExtPsePortPwrAllocated'] == 0 &&
$entry['cpeExtPsePortPwrAvailable'] == 0 &&
$entry['cpeExtPsePortPwrConsumption'] == 0 &&
$entry['cpeExtPsePortMaxPwrDrawn'] == 0))
{
// Skip PoE disabled or Down ports
continue;
}
foreach ($oids as $index => $entry) {
if ($entry['cpeExtPsePortEnable'] == 'disable' ||
($entry['cpeExtPsePortPwrAllocated'] == 0 &&
$entry['cpeExtPsePortPwrAvailable'] == 0 &&
$entry['cpeExtPsePortPwrConsumption'] == 0 &&
$entry['cpeExtPsePortMaxPwrDrawn'] == 0)) {
// Skip PoE disabled or Down ports
continue;
}
// Detect PoE Group and port
list($pethPsePortGroupIndex, $cpeExtPsePortIndex) = explode('.', $index);
// Detect PoE Group and port
[ $pethPsePortGroupIndex, $cpeExtPsePortIndex ] = explode('.', $index);
$group = $pethPsePortGroupIndex > 1 ? " Group $pethPsePortGroupIndex" : ''; // Add group name if group number greater than 1
$group = $pethPsePortGroupIndex > 1 ? " Group $pethPsePortGroupIndex" : ''; // Add group name if group number greater than 1
$options = array('entPhysicalIndex' => $entry['cpeExtPsePortEntPhyIndex']);
$port = get_port_by_ent_index($device, $entry['cpeExtPsePortEntPhyIndex']);
//print_vars($port);
$options = ['entPhysicalIndex' => $entry['cpeExtPsePortEntPhyIndex']];
$port = get_port_by_ent_index($device, $entry['cpeExtPsePortEntPhyIndex']);
//print_vars($port);
if (is_array($port))
{
$entry['ifDescr'] = $port['ifDescr'];
$options['measured_class'] = 'port';
$options['measured_entity'] = $port['port_id'];
$options['entPhysicalIndex_measured'] = $port['ifIndex'];
} else {
$entry['ifDescr'] = "Port $cpeExtPsePortIndex";
}
if (is_array($port)) {
$entry['ifDescr'] = $port['ifDescr'];
$options['measured_class'] = 'port';
$options['measured_entity'] = $port['port_id'];
$options['entPhysicalIndex_measured'] = $port['ifIndex'];
} else {
$entry['ifDescr'] = "Port $cpeExtPsePortIndex";
}
$descr = $entry['ifDescr'] . ' PoE Power' . $group;
$scale = 0.001;
$descr = $entry['ifDescr'] . ' PoE Power' . $group;
$scale = 0.001;
$oid_name = 'cpeExtPsePortPwrConsumption';
$oid_num = '.1.3.6.1.4.1.9.9.402.1.2.1.9.'.$index;
$type = $mib . '-' . $oid_name;
$value = $entry[$oid_name];
$oid_name = 'cpeExtPsePortPwrConsumption';
$oid_num = '.1.3.6.1.4.1.9.9.402.1.2.1.9.' . $index;
$type = $mib . '-' . $oid_name;
$value = $entry[$oid_name];
// Limits
$options['limit_high'] = max($entry['cpeExtPsePortPwrAllocated'], $entry['cpeExtPsePortPwrAvailable']) * $scale;
if ($options['limit_high'] > 0)
{
$options['limit_high_warn'] = $options['limit_high'] - ($options['limit_high'] / 10);
} else {
unset($options['limit_high']);
}
// Limits
$options['limit_high'] = max($entry['cpeExtPsePortPwrAllocated'], $entry['cpeExtPsePortPwrAvailable']) * $scale;
if ($options['limit_high'] > 0) {
$options['limit_high_warn'] = $options['limit_high'] - ($options['limit_high'] / 10);
} else {
unset($options['limit_high']);
}
discover_sensor_ng($device,'power', $mib, $oid_name, $oid_num, $index, NULL, $descr, $scale, $value, $options);
discover_sensor_ng($device, 'power', $mib, $oid_name, $oid_num, $index, $descr, $scale, $value, $options);
}
// EOF

View File

@ -6,7 +6,7 @@
*
* @package observium
* @subpackage discovery
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2020 Observium Limited
* @copyright (C) Adam Armstrong
*
*/
@ -27,93 +27,83 @@
//CISCOSB-PHY-MIB::rlPhyTestGetResult.74.rlPhyTestTableLOS = INTEGER: 0
//CISCOSB-PHY-MIB::rlPhyTestGetResult.74.rlPhyTestTableTxFault = INTEGER: 0
$oids = snmpwalk_cache_twopart_oid($device, 'rlPhyTestGetResult', array(), 'CISCOSB-PHY-MIB');
$new_oids = array();
foreach ($oids as $index => $entry)
{
if (!isset($entry['rlPhyTestTableTransceiverTemp']) || $entry['rlPhyTestTableTransceiverTemp']['rlPhyTestGetResult'] == 0) { continue; } // Skip all non-dom entries
$new_oids[$index] = $entry;
$oids = snmpwalk_cache_twopart_oid($device, 'rlPhyTestGetResult', [], 'CISCOSB-PHY-MIB');
$new_oids = [];
foreach ($oids as $index => $entry) {
if (!isset($entry['rlPhyTestTableTransceiverTemp']) || $entry['rlPhyTestTableTransceiverTemp']['rlPhyTestGetResult'] == 0) {
continue;
} // Skip all non-dom entries
$new_oids[$index] = $entry;
}
if (count($new_oids) == 0)
{
// Stop walk if not exist DOM sensors
return;
if (count($new_oids) == 0) {
// Stop walk if not exist DOM sensors
return;
}
// Get additional OIDs
$oids = snmpwalk_cache_twopart_oid($device, 'rlPhyTestGetUnits', $oids, 'CISCOSB-PHY-MIB');
$oids = snmpwalk_cache_twopart_oid($device, 'rlPhyTestGetStatus', $oids, 'CISCOSB-PHY-MIB');
$oids = snmpwalk_cache_twopart_oid($device, 'rlPhyTestGetUnits', $oids, 'CISCOSB-PHY-MIB');
$oids = snmpwalk_cache_twopart_oid($device, 'rlPhyTestGetStatus', $oids, 'CISCOSB-PHY-MIB');
//print_vars($oids);
foreach ($new_oids as $index => $entry1)
{
foreach ($oids[$index] as $oid_name => $entry)
{
if (!in_array($entry['rlPhyTestGetStatus'], array('success', 'inProgress'))) { continue; }
foreach ($new_oids as $index => $entry1) {
foreach ($oids[$index] as $oid_name => $entry) {
if (!in_array($entry['rlPhyTestGetStatus'], [ 'success', 'inProgress' ])) {
continue;
}
switch ($entry['rlPhyTestGetUnits'])
{
case 'microVolt':
case 'microAmper':
case 'microOham':
case 'microWatt':
$scale = si_to_scale('micro');
break;
case 'milidbm':
$scale = si_to_scale('milli');
break;
case 'decidbm':
$scale = si_to_scale('deci');
break;
default:
$scale = 1;
if (str_starts_with($entry['rlPhyTestGetUnits'], 'micro')) {
$scale = si_to_scale('micro');
} elseif (str_starts_with($entry['rlPhyTestGetUnits'], 'mili')) {
$scale = si_to_scale('milli');
} elseif (str_starts_with($entry['rlPhyTestGetUnits'], 'deci')) {
$scale = si_to_scale('deci');
} else {
$scale = 1;
}
$options = ['entPhysicalIndex' => $index];
$port = get_port_by_index_cache($device['device_id'], $index);
if (is_array($port)) {
$entry['ifDescr'] = $port['ifDescr'];
$options['measured_class'] = 'port';
$options['measured_entity'] = $port['port_id'];
} else {
$entry['ifDescr'] = snmp_get($device, "ifDescr." . $index, "-Oqv", "IF-MIB");
}
switch ($oid_name) {
case 'rlPhyTestTableTransceiverTemp':
$descr = $entry['ifDescr'] . " Temperature";
$oid = ".1.3.6.1.4.1.9.6.1.101.90.1.2.1.3.$index.5";
$class = 'temperature';
break;
case 'rlPhyTestTableTransceiverSupply':
$descr = $entry['ifDescr'] . " Voltage";
$oid = ".1.3.6.1.4.1.9.6.1.101.90.1.2.1.3.$index.6";
$class = 'voltage';
break;
case 'rlPhyTestTableTxBias':
$descr = $entry['ifDescr'] . " Bias Current";
$oid = ".1.3.6.1.4.1.9.6.1.101.90.1.2.1.3.$index.7";
$class = 'current';
break;
case 'rlPhyTestTableTxOutput':
$descr = $entry['ifDescr'] . " TX Power";
$oid = ".1.3.6.1.4.1.9.6.1.101.90.1.2.1.3.$index.8";
$class = 'dbm';
break;
case 'rlPhyTestTableRxOpticalPower':
$descr = $entry['ifDescr'] . " RX Power";
$oid = ".1.3.6.1.4.1.9.6.1.101.90.1.2.1.3.$index.9";
$class = 'dbm';
break;
default:
continue 2;
}
$value = $entry['rlPhyTestGetResult'];
discover_sensor_ng($device, $class, $mib, 'rlPhyTestGetResult', $oid, "$index.$oid_name", $descr, $scale, $value, $options); // Note, same rrd index format as in mibs definitions
}
$options = array('entPhysicalIndex' => $index);
$port = get_port_by_index_cache($device['device_id'], $index);
if (is_array($port))
{
$entry['ifDescr'] = $port['ifDescr'];
$options['measured_class'] = 'port';
$options['measured_entity'] = $port['port_id'];
} else {
$entry['ifDescr'] = snmp_get($device, "ifDescr.".$index, "-Oqv", "IF-MIB");
}
switch ($oid_name)
{
case 'rlPhyTestTableTransceiverTemp':
$descr = $entry['ifDescr'] . " Temperature";
$oid = ".1.3.6.1.4.1.9.6.1.101.90.1.2.1.3.$index.5";
$class = 'temperature';
break;
case 'rlPhyTestTableTransceiverSupply':
$descr = $entry['ifDescr'] . " Voltage";
$oid = ".1.3.6.1.4.1.9.6.1.101.90.1.2.1.3.$index.6";
$class = 'voltage';
break;
case 'rlPhyTestTableTxBias':
$descr = $entry['ifDescr'] . " Bias Current";
$oid = ".1.3.6.1.4.1.9.6.1.101.90.1.2.1.3.$index.7";
$class = 'current';
break;
case 'rlPhyTestTableTxOutput':
$descr = $entry['ifDescr'] . " TX Power";
$oid = ".1.3.6.1.4.1.9.6.1.101.90.1.2.1.3.$index.8";
$class = 'dbm';
break;
case 'rlPhyTestTableRxOpticalPower':
$descr = $entry['ifDescr'] . " RX Power";
$oid = ".1.3.6.1.4.1.9.6.1.101.90.1.2.1.3.$index.9";
$class = 'dbm';
break;
default:
continue 2;
}
$value = $entry['rlPhyTestGetResult'];
discover_sensor_ng($device, $class, $mib, 'rlPhyTestGetResult', $oid, "$index.$oid_name", NULL, $descr, $scale, $value, $options); // Note, same rrd index format as in mibs definitions
}
}
// EOF

View File

@ -1,5 +1,4 @@
<?php
/**
* Observium
*
@ -7,212 +6,188 @@
*
* @package observium
* @subpackage discovery
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2019 Observium Limited
* @copyright (C) Adam Armstrong
*
*/
// Here DOM sensors for OcNOS os, currently not possible convert to definitions
// because used multichannel sensors (ie for 40G/100G interfaces)
$cmmTrans = snmpwalk_multipart_oid($device, "cmmTransEEPROMTable", array(), "CMM-CHASSIS-MIB");
$cmmTransDDM = snmpwalk_multipart_oid($device, "cmmTransDDMTable", array(), "CMM-CHASSIS-MIB");
$cmmTrans = snmpwalk_multipart_oid($device, "cmmTransEEPROMTable", [], "CMM-CHASSIS-MIB");
$cmmTransDDM = snmpwalk_multipart_oid($device, "cmmTransDDMTable", [], "CMM-CHASSIS-MIB");
print_debug_vars($cmmTrans);
print_debug_vars($cmmTransDDM);
foreach ($cmmTrans as $unit => $unit_entry)
{
foreach ($unit_entry as $trans_index => $trans_entry)
{
// Skip not installed
if ($trans_entry['cmmTransPresence'] == 'notpresent') { continue; }
foreach ($cmmTrans as $unit => $unit_entry) {
foreach ($unit_entry as $trans_index => $trans_entry) {
// Skip not installed
if ($trans_entry['cmmTransPresence'] == 'notpresent') {
continue;
}
// Single channel transceivers, detect port
if ($trans_entry['cmmTransNoOfChannels'] === '1')
{
$trans_port = dbFetchRow('SELECT * FROM `ports` WHERE `device_id` = ? AND `ifType` = ? AND `ifName` REGEXP ?', array($device['device_id'], 'ethernetCsmacd', '[^[:digit:][:punct:]]'.$trans_index.'$'));
// Hrm, this is better query, but port_label_num fills only after first polling (after first discovery)
//$trans_port = dbFetchRow('SELECT * FROM `ports` WHERE `device_id` = ? AND `ifType` = ? AND `port_label_num` = ?', array($device['device_id'], 'ethernetCsmacd', $trans_index));
//print_vars($port);
} else {
$trans_port = NULL;
// Single channel transceivers, detect port
if ($trans_entry['cmmTransNoOfChannels'] === '1') {
$trans_port = dbFetchRow('SELECT * FROM `ports` WHERE `device_id` = ? AND `ifType` = ? AND `ifName` REGEXP ?', [$device['device_id'], 'ethernetCsmacd', '[^[:digit:][:punct:]]' . $trans_index . '$']);
// Hrm, this is better query, but port_label_num fills only after first polling (after first discovery)
//$trans_port = dbFetchRow('SELECT * FROM `ports` WHERE `device_id` = ? AND `ifType` = ? AND `port_label_num` = ?', array($device['device_id'], 'ethernetCsmacd', $trans_index));
//print_vars($port);
} else {
$trans_port = NULL;
}
foreach ($cmmTransDDM[$unit][$trans_index] as $channel_index => $entry) {
// Multichannel tranceivers
if ($trans_entry['cmmTransNoOfChannels'] > 1 || empty($trans_port)) {
$port = dbFetchRow('SELECT * FROM `ports` WHERE `device_id` = ? AND `ifType` = ? AND `ifName` REGEXP ?', [$device['device_id'], 'ethernetCsmacd', '[^[:digit:][:punct:]]' . $trans_index . '/' . $channel_index . '$']);
} else {
$port = $trans_port;
}
$options = ['entPhysicalIndex' => $trans_index];
if ($port) {
$name = $port['ifName'];
$options['measured_class'] = 'port';
$options['measured_entity'] = $port['port_id'];
} else {
$name = "Port $trans_index Channel $channel_index";
}
// Append extended transceiver info
$name_ext = ' (' . $trans_entry['cmmTransVendorName'] . ' ' . $trans_entry['cmmTransVendorPartNumber'] . ' ' . $trans_entry['cmmTransLengthKmtrs'] . 'km)';
$index = "$unit.$trans_index.$channel_index";
$descr = $name . ' Temperature' . $name_ext;
$oid_name = 'cmmTransTemperature';
$oid_num = '.1.3.6.1.4.1.36673.100.1.2.3.1.2.' . $index;
$scale = 0.01;
//$type = $mib . '-' . $oid_name;
$value = $entry[$oid_name];
if ($value > -100000) // '-100001' indicates unavailable
{
$limits = $options;
if ($entry['cmmTransTempCriticalThresholdMax'] > -100000) {
$limits['limit_high'] = $entry['cmmTransTempCriticalThresholdMax'] * $scale;
}
if ($entry['cmmTransTempAlertThresholdMax'] > -100000) {
$limits['limit_high_warn'] = $entry['cmmTransTempAlertThresholdMax'] * $scale;
}
if ($entry['cmmTransTempAlertThresholdMin'] > -100000) {
$limits['limit_low_warn'] = $entry['cmmTransTempAlertThresholdMin'] * $scale;
}
if ($entry['cmmTransTempCriticalThresholdMin'] > -100000) {
$limits['limit_low'] = $entry['cmmTransTempCriticalThresholdMin'] * $scale;
}
discover_sensor_ng($device, 'temperature', $mib, $oid_name, $oid_num, $index, $descr, $scale, $value, $limits);
}
$descr = $name . ' Voltage' . $name_ext;
$oid_name = 'cmmTransVoltage';
$oid_num = '.1.3.6.1.4.1.36673.100.1.2.3.1.7.' . $index;
$scale = 0.001;
//$type = $mib . '-' . $oid_name;
$value = $entry[$oid_name];
if ($value > -100000) // '-100001' indicates unavailable
{
$limits = $options;
if ($entry['cmmTransVoltCriticalThresholdMax'] > -100000) {
$limits['limit_high'] = $entry['cmmTransVoltCriticalThresholdMax'] * $scale;
}
if ($entry['cmmTransVoltAlertThresholdMax'] > -100000) {
$limits['limit_high_warn'] = $entry['cmmTransVoltAlertThresholdMax'] * $scale;
}
if ($entry['cmmTransVoltAlertThresholdMin'] > -100000) {
$limits['limit_low_warn'] = $entry['cmmTransVoltAlertThresholdMin'] * $scale;
}
if ($entry['cmmTransVoltCriticalThresholdMin'] > -100000) {
$limits['limit_low'] = $entry['cmmTransVoltCriticalThresholdMin'] * $scale;
}
discover_sensor_ng($device, 'voltage', $mib, $oid_name, $oid_num, $index, $descr, $scale, $value, $limits);
}
$descr = $name . ' Bias Current' . $name_ext;
$oid_name = 'cmmTransLaserBiasCurrent';
$oid_num = '.1.3.6.1.4.1.36673.100.1.2.3.1.12.' . $index;
$scale = 0.001;
//$type = $mib . '-' . $oid_name;
$value = $entry[$oid_name];
if ($value > -100000) // '-100001' indicates unavailable
{
$limits = $options;
if ($entry['cmmTransLaserBiasCurrCriticalThresholdMax'] > -100000) {
$limits['limit_high'] = $entry['cmmTransLaserBiasCurrCriticalThresholdMax'] * $scale;
}
if ($entry['cmmTransLaserBiasCurrAlertThresholdMax'] > -100000) {
$limits['limit_high_warn'] = $entry['cmmTransLaserBiasCurrAlertThresholdMax'] * $scale;
}
if ($entry['cmmTransLaserBiasCurrAlertThresholdMin'] > -100000) {
$limits['limit_low_warn'] = $entry['cmmTransLaserBiasCurrAlertThresholdMin'] * $scale;
}
if ($entry['cmmTransLaserBiasCurrCriticalThresholdMin'] > -100000) {
$limits['limit_low'] = $entry['cmmTransLaserBiasCurrCriticalThresholdMin'] * $scale;
}
discover_sensor_ng($device, 'current', $mib, $oid_name, $oid_num, $index, $descr, $scale, $value, $limits);
}
$descr = $name . ' Transmit Power' . $name_ext;
$oid_name = 'cmmTransTxPower';
$oid_num = '.1.3.6.1.4.1.36673.100.1.2.3.1.17.' . $index;
$scale = 0.001;
//$type = $mib . '-' . $oid_name;
$value = $entry[$oid_name];
if ($value > -100000) // '-100001' indicates unavailable
{
$limits = $options;
if ($entry['cmmTransTxPowerCriticalThresholdMax'] > -100000) {
$limits['limit_high'] = $entry['cmmTransTxPowerCriticalThresholdMax'] * $scale;
}
if ($entry['cmmTransTxPowerAlertThresholdMax'] > -100000) {
$limits['limit_high_warn'] = $entry['cmmTransTxPowerAlertThresholdMax'] * $scale;
}
if ($entry['cmmTransTxPowerAlertThresholdMin'] > -100000) {
$limits['limit_low_warn'] = $entry['cmmTransTxPowerAlertThresholdMin'] * $scale;
}
if ($entry['cmmTransTxPowerCriticalThresholdMin'] > -100000) {
$limits['limit_low'] = $entry['cmmTransTxPowerCriticalThresholdMin'] * $scale;
}
discover_sensor_ng($device, 'dbm', $mib, $oid_name, $oid_num, $index, $descr, $scale, $value, $limits);
}
$descr = $name . ' Receive Power' . $name_ext;
$oid_name = 'cmmTransRxPower';
$oid_num = '.1.3.6.1.4.1.36673.100.1.2.3.1.22.' . $index;
$scale = 0.001;
//$type = $mib . '-' . $oid_name;
$value = $entry[$oid_name];
if ($value > -100000) // '-100001' indicates unavailable
{
$limits = $options;
if ($entry['cmmTransRxPowerCriticalThresholdMax'] > -100000) {
$limits['limit_high'] = $entry['cmmTransRxPowerCriticalThresholdMax'] * $scale;
}
if ($entry['cmmTransRxPowerAlertThresholdMax'] > -100000) {
$limits['limit_high_warn'] = $entry['cmmTransRxPowerAlertThresholdMax'] * $scale;
}
if ($entry['cmmTransRxPowerAlertThresholdMin'] > -100000) {
$limits['limit_low_warn'] = $entry['cmmTransRxPowerAlertThresholdMin'] * $scale;
}
if ($entry['cmmTransRxPowerCriticalThresholdMin'] > -100000) {
$limits['limit_low'] = $entry['cmmTransRxPowerCriticalThresholdMin'] * $scale;
}
discover_sensor_ng($device, 'dbm', $mib, $oid_name, $oid_num, $index, $descr, $scale, $value, $limits);
}
}
}
foreach ($cmmTransDDM[$unit][$trans_index] as $channel_index => $entry)
{
// Multichannel tranceivers
if ($trans_entry['cmmTransNoOfChannels'] > 1 || empty($trans_port))
{
$port = dbFetchRow('SELECT * FROM `ports` WHERE `device_id` = ? AND `ifType` = ? AND `ifName` REGEXP ?', array($device['device_id'], 'ethernetCsmacd', '[^[:digit:][:punct:]]'.$trans_index.'/'.$channel_index.'$'));
} else {
$port = $trans_port;
}
$options = array('entPhysicalIndex' => $trans_index);
if ($port)
{
$name = $port['ifName'];
$options['measured_class'] = 'port';
$options['measured_entity'] = $port['port_id'];
} else {
$name = "Port $trans_index Channel $channel_index";
}
// Append extended transceiver info
$name_ext = ' ('.$trans_entry['cmmTransVendorName'].' '.$trans_entry['cmmTransVendorPartNumber'].' '.$trans_entry['cmmTransLengthKmtrs'].'km)';
$index = "$unit.$trans_index.$channel_index";
$descr = $name . ' Temperature' . $name_ext;
$oid_name = 'cmmTransTemperature';
$oid_num = '.1.3.6.1.4.1.36673.100.1.2.3.1.2.'.$index;
$scale = 0.01;
//$type = $mib . '-' . $oid_name;
$value = $entry[$oid_name];
if ($value > -100000) // '-100001' indicates unavailable
{
$limits = $options;
if ($entry['cmmTransTempCriticalThresholdMax'] > -100000)
{
$limits['limit_high'] = $entry['cmmTransTempCriticalThresholdMax'] * $scale;
}
if ($entry['cmmTransTempAlertThresholdMax'] > -100000)
{
$limits['limit_high_warn'] = $entry['cmmTransTempAlertThresholdMax'] * $scale;
}
if ($entry['cmmTransTempAlertThresholdMin'] > -100000)
{
$limits['limit_low_warn'] = $entry['cmmTransTempAlertThresholdMin'] * $scale;
}
if ($entry['cmmTransTempCriticalThresholdMin'] > -100000)
{
$limits['limit_low'] = $entry['cmmTransTempCriticalThresholdMin'] * $scale;
}
discover_sensor_ng($device, 'temperature', $mib, $oid_name, $oid_num, $index, NULL, $descr, $scale, $value, $limits);
}
$descr = $name . ' Voltage' . $name_ext;
$oid_name = 'cmmTransVoltage';
$oid_num = '.1.3.6.1.4.1.36673.100.1.2.3.1.7.'.$index;
$scale = 0.001;
//$type = $mib . '-' . $oid_name;
$value = $entry[$oid_name];
if ($value > -100000) // '-100001' indicates unavailable
{
$limits = $options;
if ($entry['cmmTransVoltCriticalThresholdMax'] > -100000)
{
$limits['limit_high'] = $entry['cmmTransVoltCriticalThresholdMax'] * $scale;
}
if ($entry['cmmTransVoltAlertThresholdMax'] > -100000)
{
$limits['limit_high_warn'] = $entry['cmmTransVoltAlertThresholdMax'] * $scale;
}
if ($entry['cmmTransVoltAlertThresholdMin'] > -100000)
{
$limits['limit_low_warn'] = $entry['cmmTransVoltAlertThresholdMin'] * $scale;
}
if ($entry['cmmTransVoltCriticalThresholdMin'] > -100000)
{
$limits['limit_low'] = $entry['cmmTransVoltCriticalThresholdMin'] * $scale;
}
discover_sensor_ng($device, 'voltage', $mib, $oid_name, $oid_num, $index, NULL, $descr, $scale, $value, $limits);
}
$descr = $name . ' Bias Current' . $name_ext;
$oid_name = 'cmmTransLaserBiasCurrent';
$oid_num = '.1.3.6.1.4.1.36673.100.1.2.3.1.12.'.$index;
$scale = 0.001;
//$type = $mib . '-' . $oid_name;
$value = $entry[$oid_name];
if ($value > -100000) // '-100001' indicates unavailable
{
$limits = $options;
if ($entry['cmmTransLaserBiasCurrCriticalThresholdMax'] > -100000)
{
$limits['limit_high'] = $entry['cmmTransLaserBiasCurrCriticalThresholdMax'] * $scale;
}
if ($entry['cmmTransLaserBiasCurrAlertThresholdMax'] > -100000)
{
$limits['limit_high_warn'] = $entry['cmmTransLaserBiasCurrAlertThresholdMax'] * $scale;
}
if ($entry['cmmTransLaserBiasCurrAlertThresholdMin'] > -100000)
{
$limits['limit_low_warn'] = $entry['cmmTransLaserBiasCurrAlertThresholdMin'] * $scale;
}
if ($entry['cmmTransLaserBiasCurrCriticalThresholdMin'] > -100000)
{
$limits['limit_low'] = $entry['cmmTransLaserBiasCurrCriticalThresholdMin'] * $scale;
}
discover_sensor_ng($device, 'current', $mib, $oid_name, $oid_num, $index, NULL, $descr, $scale, $value, $limits);
}
$descr = $name . ' Transmit Power' . $name_ext;
$oid_name = 'cmmTransTxPower';
$oid_num = '.1.3.6.1.4.1.36673.100.1.2.3.1.17.'.$index;
$scale = 0.001;
//$type = $mib . '-' . $oid_name;
$value = $entry[$oid_name];
if ($value > -100000) // '-100001' indicates unavailable
{
$limits = $options;
if ($entry['cmmTransTxPowerCriticalThresholdMax'] > -100000)
{
$limits['limit_high'] = $entry['cmmTransTxPowerCriticalThresholdMax'] * $scale;
}
if ($entry['cmmTransTxPowerAlertThresholdMax'] > -100000)
{
$limits['limit_high_warn'] = $entry['cmmTransTxPowerAlertThresholdMax'] * $scale;
}
if ($entry['cmmTransTxPowerAlertThresholdMin'] > -100000)
{
$limits['limit_low_warn'] = $entry['cmmTransTxPowerAlertThresholdMin'] * $scale;
}
if ($entry['cmmTransTxPowerCriticalThresholdMin'] > -100000)
{
$limits['limit_low'] = $entry['cmmTransTxPowerCriticalThresholdMin'] * $scale;
}
discover_sensor_ng($device, 'dbm', $mib, $oid_name, $oid_num, $index, NULL, $descr, $scale, $value, $limits);
}
$descr = $name . ' Receive Power' . $name_ext;
$oid_name = 'cmmTransRxPower';
$oid_num = '.1.3.6.1.4.1.36673.100.1.2.3.1.22.'.$index;
$scale = 0.001;
//$type = $mib . '-' . $oid_name;
$value = $entry[$oid_name];
if ($value > -100000) // '-100001' indicates unavailable
{
$limits = $options;
if ($entry['cmmTransRxPowerCriticalThresholdMax'] > -100000)
{
$limits['limit_high'] = $entry['cmmTransRxPowerCriticalThresholdMax'] * $scale;
}
if ($entry['cmmTransRxPowerAlertThresholdMax'] > -100000)
{
$limits['limit_high_warn'] = $entry['cmmTransRxPowerAlertThresholdMax'] * $scale;
}
if ($entry['cmmTransRxPowerAlertThresholdMin'] > -100000)
{
$limits['limit_low_warn'] = $entry['cmmTransRxPowerAlertThresholdMin'] * $scale;
}
if ($entry['cmmTransRxPowerCriticalThresholdMin'] > -100000)
{
$limits['limit_low'] = $entry['cmmTransRxPowerCriticalThresholdMin'] * $scale;
}
discover_sensor_ng($device, 'dbm', $mib, $oid_name, $oid_num, $index, NULL, $descr, $scale, $value, $limits);
}
}
}
}
// EOF

View File

@ -6,72 +6,71 @@
*
* @package observium
* @subpackage discovery
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2020 Observium Limited
* @copyright (C) Adam Armstrong
*
*/
// Power Supplies
$oids = snmpwalk_cache_oid($device, 'cpqHeFltTolPwrSupply', array(), 'CPQHLTH-MIB');
$oids = snmpwalk_cache_oid($device, 'cpqHeFltTolPwrSupply', [], 'CPQHLTH-MIB');
foreach ($oids as $index => $entry)
{
if (in_array($entry['cpqHeFltTolPowerSupplyPresent'], [ 'absent', 'other' ])) { continue; }
foreach ($oids as $index => $entry) {
if (in_array($entry['cpqHeFltTolPowerSupplyPresent'], ['absent', 'other'])) {
continue;
}
$descr = "PSU ".$entry['cpqHeFltTolPowerSupplyBay'];
$descr = "PSU " . $entry['cpqHeFltTolPowerSupplyBay'];
$oid = ".1.3.6.1.4.1.232.6.2.9.3.1.7.$index";
$oid_name = 'cpqHeFltTolPowerSupplyCapacityUsed';
$value = $entry['cpqHeFltTolPowerSupplyCapacityUsed'];
$options = array('limit_high' => $entry['cpqHeFltTolPowerSupplyCapacityMaximum']);
$oid = ".1.3.6.1.4.1.232.6.2.9.3.1.7.$index";
$oid_name = 'cpqHeFltTolPowerSupplyCapacityUsed';
$value = $entry['cpqHeFltTolPowerSupplyCapacityUsed'];
$options = ['limit_high' => $entry['cpqHeFltTolPowerSupplyCapacityMaximum']];
if ($entry['cpqHeFltTolPowerSupplyCapacityMaximum'] != 0)
{
$options['rename_rrd'] = "cpqhlth-cpqHeFltTolPwrSupply.$index";
discover_sensor_ng($device, 'power', $mib, $oid_name, $oid, $index, NULL, $descr, 1, $value, $options);
}
if ($entry['cpqHeFltTolPowerSupplyCapacityMaximum'] != 0) {
$options['rename_rrd'] = "cpqhlth-cpqHeFltTolPwrSupply.$index";
discover_sensor_ng($device, 'power', $mib, $oid_name, $oid, $index, $descr, 1, $value, $options);
}
$oid = ".1.3.6.1.4.1.232.6.2.9.3.1.4.$index";
$value = $entry['cpqHeFltTolPowerSupplyCondition'];
$oid = ".1.3.6.1.4.1.232.6.2.9.3.1.4.$index";
$value = $entry['cpqHeFltTolPowerSupplyCondition'];
discover_status_ng($device, $mib, 'cpqHeFltTolPowerSupplyCondition', $oid, $index, 'cpqhlth-state', $descr . ' Status', $value, array('entPhysicalClass' => 'powersupply'));
discover_status_ng($device, $mib, 'cpqHeFltTolPowerSupplyCondition', $oid, $index, 'cpqhlth-state', $descr . ' Status', $value, ['entPhysicalClass' => 'powersupply']);
$oid = ".1.3.6.1.4.1.232.6.2.9.3.1.18.$index";
$value = $entry['cpqHeFltTolPowerSupplyErrorCondition'];
$oid = ".1.3.6.1.4.1.232.6.2.9.3.1.18.$index";
$value = $entry['cpqHeFltTolPowerSupplyErrorCondition'];
discover_status_ng($device, $mib, 'cpqHeFltTolPowerSupplyErrorCondition', $oid, $index, 'cpqHeFltTolPowerSupplyErrorCondition', $descr . ' Condition', $value, array('entPhysicalClass' => 'powersupply'));
discover_status_ng($device, $mib, 'cpqHeFltTolPowerSupplyErrorCondition', $oid, $index, 'cpqHeFltTolPowerSupplyErrorCondition', $descr . ' Condition', $value, ['entPhysicalClass' => 'powersupply']);
}
// Temperatures
$oids = snmpwalk_cache_oid($device, 'CpqHeTemperatureEntry', array(), 'CPQHLTH-MIB');
$oids = snmpwalk_cache_oid($device, 'CpqHeTemperatureEntry', [], 'CPQHLTH-MIB');
$descPatterns = array('/Cpu/', '/PowerSupply/', '/IoBoard/i');
$descReplace = array('CPU', 'PSU', 'IO Board');
$descCount = array('CPU' => 1, 'PSU' => 1, 'IO Board' => 1);
$descPatterns = ['/Cpu/', '/PowerSupply/', '/IoBoard/i'];
$descReplace = ['CPU', 'PSU', 'IO Board'];
$descCount = ['CPU' => 1, 'PSU' => 1, 'IO Board' => 1];
foreach ($oids as $index => $entry)
{
if ($entry['cpqHeTemperatureThreshold'] > 0)
{
$descr = ucfirst($entry['cpqHeTemperatureLocale']);
foreach ($oids as $index => $entry) {
if ($entry['cpqHeTemperatureThreshold'] > 0) {
$descr = ucfirst($entry['cpqHeTemperatureLocale']);
if ($descr === 'System' || $descr === 'Memory') { continue; }
if ($descr === 'Cpu' || $descr === 'PowerSupply')
{
$descr = preg_replace($descPatterns, $descReplace, $descr);
$descr = $descr.' '.$descCount[$descr]++;
if ($descr === 'System' || $descr === 'Memory') {
continue;
}
if ($descr === 'Cpu' || $descr === 'PowerSupply') {
$descr = preg_replace($descPatterns, $descReplace, $descr);
$descr = $descr . ' ' . $descCount[$descr]++;
}
$oid = ".1.3.6.1.4.1.232.6.2.6.8.1.4.$index";
$oid_name = 'cpqHeTemperatureCelsius';
$value = $entry['cpqHeTemperatureCelsius'];
$options = ['limit_high' => $entry['cpqHeTemperatureThreshold']];
$options['rename_rrd'] = "cpqhlth-CpqHeTemperatureEntry.$index";
discover_sensor_ng($device, 'temperature', $mib, $oid_name, $oid, $index, $descr, 1, $value, $options);
}
$oid = ".1.3.6.1.4.1.232.6.2.6.8.1.4.$index";
$oid_name = 'cpqHeTemperatureCelsius';
$value = $entry['cpqHeTemperatureCelsius'];
$options = array('limit_high' =>$entry['cpqHeTemperatureThreshold']);
$options['rename_rrd'] = "cpqhlth-CpqHeTemperatureEntry.$index";
discover_sensor_ng($device,'temperature', $mib, $oid_name, $oid, $index, NULL, $descr, 1, $value, $options);
}
}
// Memory Modules
@ -83,85 +82,76 @@ foreach ($oids as $index => $entry)
// CPQHLTH-MIB::cpqHeResMem2ModuleCondition.1 = INTEGER: ok(2)
$oids = snmpwalk_cache_oid($device, 'cpqHeResMem2ModuleStatus', [], 'CPQHLTH-MIB');
if (snmp_status())
{
$oids = snmpwalk_cache_oid($device, 'cpqHeResMem2ModuleHwLocation', $oids, 'CPQHLTH-MIB');
$oids = snmpwalk_cache_oid($device, 'cpqHeResMem2ModuleType', $oids, 'CPQHLTH-MIB');
$oids = snmpwalk_cache_oid($device, 'cpqHeResMem2ModuleFrequency', $oids, 'CPQHLTH-MIB');
$oids = snmpwalk_cache_oid($device, 'cpqHeResMem2ModulePartNo', $oids, 'CPQHLTH-MIB');
$oids = snmpwalk_cache_oid($device, 'cpqHeResMem2ModuleSize', $oids, 'CPQHLTH-MIB');
$oids = snmpwalk_cache_oid($device, 'cpqHeResMem2ModuleCondition', $oids, 'CPQHLTH-MIB');
if (snmp_status()) {
$oids = snmpwalk_cache_oid($device, 'cpqHeResMem2ModuleHwLocation', $oids, 'CPQHLTH-MIB');
$oids = snmpwalk_cache_oid($device, 'cpqHeResMem2ModuleType', $oids, 'CPQHLTH-MIB');
$oids = snmpwalk_cache_oid($device, 'cpqHeResMem2ModuleFrequency', $oids, 'CPQHLTH-MIB');
$oids = snmpwalk_cache_oid($device, 'cpqHeResMem2ModulePartNo', $oids, 'CPQHLTH-MIB');
$oids = snmpwalk_cache_oid($device, 'cpqHeResMem2ModuleSize', $oids, 'CPQHLTH-MIB');
$oids = snmpwalk_cache_oid($device, 'cpqHeResMem2ModuleCondition', $oids, 'CPQHLTH-MIB');
}
foreach ($oids as $index => $entry)
{
if (isset($entry['cpqHeResMem2ModuleStatus']) && $entry['cpqHeResMem2ModuleStatus'] != 'notPresent')
{
if (empty($entry['cpqHeResMem2ModuleHwLocation']))
{
$cpqHeResMem2ModuleType = [
// other(1),
// board(2),
// cpqSingleWidthModule(3),
// cpqDoubleWidthModule(4),
'simm' => 'SIMM',
'pcmcia' => 'PCMCIA',
// compaq-specific(7),
'dimm' => 'DIMM',
// smallOutlineDimm(9),
'rimm' => 'RIMM',
'srimm' => 'SRIMM',
'fb-dimm' => 'FB-DIMM',
'dimmddr' => 'DIMM DDR',
'dimmddr2' => 'DIMM DDR2',
'dimmddr3' => 'DIMM DDR3',
'dimmfbd2' => 'DIMM FBD2',
'fb-dimmddr2' => 'FB-DIMM DDR2',
'fb-dimmddr3' => 'FB-DIMM DDR3',
'dimmddr4' => 'DIMM DDR4',
// hpe-specific(20)
];
foreach ($oids as $index => $entry) {
if (isset($entry['cpqHeResMem2ModuleStatus']) && $entry['cpqHeResMem2ModuleStatus'] != 'notPresent') {
if (empty($entry['cpqHeResMem2ModuleHwLocation'])) {
$cpqHeResMem2ModuleType = [
// other(1),
// board(2),
// cpqSingleWidthModule(3),
// cpqDoubleWidthModule(4),
'simm' => 'SIMM',
'pcmcia' => 'PCMCIA',
// compaq-specific(7),
'dimm' => 'DIMM',
// smallOutlineDimm(9),
'rimm' => 'RIMM',
'srimm' => 'SRIMM',
'fb-dimm' => 'FB-DIMM',
'dimmddr' => 'DIMM DDR',
'dimmddr2' => 'DIMM DDR2',
'dimmddr3' => 'DIMM DDR3',
'dimmfbd2' => 'DIMM FBD2',
'fb-dimmddr2' => 'FB-DIMM DDR2',
'fb-dimmddr3' => 'FB-DIMM DDR3',
'dimmddr4' => 'DIMM DDR4',
// hpe-specific(20)
];
if (isset($cpqHeResMem2ModuleType[$entry['cpqHeResMem2ModuleType']]))
{
$descr = $cpqHeResMem2ModuleType[$entry['cpqHeResMem2ModuleType']];
} else {
$descr = 'DIMM';
}
$descr .= ' '.$index;
if (isset($cpqHeResMem2ModuleType[$entry['cpqHeResMem2ModuleType']])) {
$descr = $cpqHeResMem2ModuleType[$entry['cpqHeResMem2ModuleType']];
} else {
$descr = 'DIMM';
}
$descr .= ' ' . $index;
} else {
$descr = $entry['cpqHeResMem2ModuleHwLocation'];
} else {
$descr = $entry['cpqHeResMem2ModuleHwLocation'];
}
$addition = [];
if (!empty($entry['cpqHeResMem2ModuleSize'])) {
$addition[] = format_bi($entry['cpqHeResMem2ModuleSize'] * 1024) . 'b';
}
if ($entry['cpqHeResMem2ModuleFrequency'] > 0) {
$addition[] = $entry['cpqHeResMem2ModuleFrequency'] . 'MHz';
}
if (!empty($entry['cpqHeResMem2ModulePartNo'])) {
$addition[] = trim($entry['cpqHeResMem2ModulePartNo']);
}
if ($addition) {
$descr .= ' (' . implode(', ', $addition) . ')';
}
$oid = ".1.3.6.1.4.1.232.6.2.14.13.1.19." . $index;
$status = $entry['cpqHeResMem2ModuleStatus'];
discover_status_ng($device, $mib, 'cpqHeResMem2ModuleStatus', $oid, $index, 'cpqHeResMem2ModuleStatus', $descr . ' Status', $status, ['entPhysicalClass' => 'memory']);
$oid = ".1.3.6.1.4.1.232.6.2.14.13.1.20." . $index;
$status = $entry['cpqHeResMem2ModuleCondition'];
discover_status_ng($device, $mib, 'cpqHeResMem2ModuleCondition', $oid, $index, 'cpqHeResMem2ModuleCondition', $descr . ' Condition', $status, ['entPhysicalClass' => 'memory']);
}
$addition = [];
if (!empty($entry['cpqHeResMem2ModuleSize']))
{
$addition[] = format_bi($entry['cpqHeResMem2ModuleSize'] * 1024) . 'b';
}
if ($entry['cpqHeResMem2ModuleFrequency'] > 0)
{
$addition[] = $entry['cpqHeResMem2ModuleFrequency'] . 'MHz';
}
if (!empty($entry['cpqHeResMem2ModulePartNo']))
{
$addition[] = trim($entry['cpqHeResMem2ModulePartNo']);
}
if ($addition)
{
$descr .= ' (' . implode(', ', $addition) . ')';
}
$oid = ".1.3.6.1.4.1.232.6.2.14.13.1.19.".$index;
$status = $entry['cpqHeResMem2ModuleStatus'];
discover_status_ng($device, $mib, 'cpqHeResMem2ModuleStatus', $oid, $index, 'cpqHeResMem2ModuleStatus', $descr.' Status', $status, array('entPhysicalClass' => 'memory'));
$oid = ".1.3.6.1.4.1.232.6.2.14.13.1.20.".$index;
$status = $entry['cpqHeResMem2ModuleCondition'];
discover_status_ng($device, $mib, 'cpqHeResMem2ModuleCondition', $oid, $index, 'cpqHeResMem2ModuleCondition', $descr.' Condition', $status, array('entPhysicalClass' => 'memory'));
}
}
unset($oids);

View File

@ -6,131 +6,125 @@
*
* @package observium
* @subpackage discovery
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2021 Observium Limited
* @copyright (C) Adam Armstrong
*
*/
// Controllers
$oids = snmpwalk_cache_oid($device, 'cpqDaCntlrEntry', array(), 'CPQIDA-MIB');
$oids = snmpwalk_cache_oid($device, 'cpqDaCntlrEntry', [], 'CPQIDA-MIB');
foreach ($oids as $index => $entry) {
if (isset($entry['cpqDaCntlrBoardStatus']))
{
$hardware = rewrite_cpqida_hardware($entry['cpqDaCntlrModel']);
$descr = $hardware . ' (' . $entry['cpqDaCntlrHwLocation'] . ')';
if (isset($entry['cpqDaCntlrBoardStatus'])) {
$hardware = rewrite_cpqida_hardware($entry['cpqDaCntlrModel']);
$descr = $hardware . ' (' . $entry['cpqDaCntlrHwLocation'] . ')';
$oid = ".1.3.6.1.4.1.232.3.2.2.1.1.10.".$index;
$status = $entry['cpqDaCntlrBoardStatus'];
$oid = ".1.3.6.1.4.1.232.3.2.2.1.1.10." . $index;
$status = $entry['cpqDaCntlrBoardStatus'];
discover_status_ng($device, $mib, 'cpqDaCntlrBoardStatus', $oid, $index, 'cpqDaCntlrBoardStatus', $descr . ' Board Status', $status, array('entPhysicalClass' => 'controller'));
discover_status_ng($device, $mib, 'cpqDaCntlrBoardStatus', $oid, $index, 'cpqDaCntlrBoardStatus', $descr . ' Board Status', $status, ['entPhysicalClass' => 'controller']);
$oid = ".1.3.6.1.4.1.232.3.2.2.1.1.6.".$index;
$status = $entry['cpqDaCntlrCondition'];
$oid = ".1.3.6.1.4.1.232.3.2.2.1.1.6." . $index;
$status = $entry['cpqDaCntlrCondition'];
discover_status_ng($device, $mib, 'cpqDaCntlrCondition', $oid, $index, 'cpqDaCntlrCondition', $descr . ' Condition', $status, array('entPhysicalClass' => 'controller'));
discover_status_ng($device, $mib, 'cpqDaCntlrCondition', $oid, $index, 'cpqDaCntlrCondition', $descr . ' Condition', $status, ['entPhysicalClass' => 'controller']);
if ($entry['cpqDaCntlrCurrentTemp'] > 0)
{
$oid = ".1.3.6.1.4.1.232.3.2.2.1.1.32.".$index;
$value = $entry['cpqDaCntlrCurrentTemp'];
$descr = $hardware.' ('.$entry['cpqDaCntlrHwLocation'].')';
if ($entry['cpqDaCntlrCurrentTemp'] > 0) {
$oid = ".1.3.6.1.4.1.232.3.2.2.1.1.32." . $index;
$value = $entry['cpqDaCntlrCurrentTemp'];
$descr = $hardware . ' (' . $entry['cpqDaCntlrHwLocation'] . ')';
$options = [ 'rename_rrd' => "cpqida-cntrl-temp-cpqDaCntlrEntry.%index%" ];
discover_sensor_ng($device, 'temperature', $mib, 'cpqDaCntlrCurrentTemp', $oid, $index, NULL, $descr, 1, $value, $options);
$options = ['rename_rrd' => "cpqida-cntrl-temp-cpqDaCntlrEntry.%index%"];
discover_sensor_ng($device, 'temperature', $mib, 'cpqDaCntlrCurrentTemp', $oid, $index, $descr, 1, $value, $options);
}
}
}
}
// Physical Disks
$oids = snmpwalk_cache_oid($device, 'cpqDaPhyDrv', array(), 'CPQIDA-MIB');
$oids = snmpwalk_cache_oid($device, 'cpqDaPhyDrv', [], 'CPQIDA-MIB');
foreach ($oids as $index => $entry)
{
foreach ($oids as $index => $entry) {
$name = $entry['cpqDaPhyDrvLocationString'];
if (!empty($entry['cpqDaPhyDrvModel']))
{
$name .= ' ('.trim($entry['cpqDaPhyDrvModel']).')';
}
if (!empty($entry['cpqDaPhyDrvSerialNum']))
{
$name .= ' ('.trim($entry['cpqDaPhyDrvSerialNum']).')';
}
$name = $entry['cpqDaPhyDrvLocationString'];
if (!empty($entry['cpqDaPhyDrvModel'])) {
$name .= ' (' . trim($entry['cpqDaPhyDrvModel']) . ')';
}
if (!empty($entry['cpqDaPhyDrvSerialNum'])) {
$name .= ' (' . trim($entry['cpqDaPhyDrvSerialNum']) . ')';
}
if ($entry['cpqDaPhyDrvTemperatureThreshold'] > 0)
{
$descr = $name; // "HDD ".$entry['cpqDaPhyDrvBay'];
$oid = ".1.3.6.1.4.1.232.3.2.5.1.1.70.".$index;
$value = $entry['cpqDaPhyDrvCurrentTemperature'];
$options = array('limit_high' => $entry['cpqDaPhyDrvTemperatureThreshold']);
if ($entry['cpqDaPhyDrvTemperatureThreshold'] > 0) {
$descr = $name; // "HDD ".$entry['cpqDaPhyDrvBay'];
$oid = ".1.3.6.1.4.1.232.3.2.5.1.1.70." . $index;
$value = $entry['cpqDaPhyDrvCurrentTemperature'];
$options = ['limit_high' => $entry['cpqDaPhyDrvTemperatureThreshold']];
$options['rename_rrd'] = "cpqida-cpqDaPhyDrv.%index%";
discover_sensor_ng($device, 'temperature', $mib, 'cpqDaPhyDrvCurrentTemperature', $oid, $index, NULL, $descr, 1, $value, $options);
$options['rename_rrd'] = "cpqida-cpqDaPhyDrv.%index%";
discover_sensor_ng($device, 'temperature', $mib, 'cpqDaPhyDrvCurrentTemperature', $oid, $index, $descr, 1, $value, $options);
}
}
$oid = '.1.3.6.1.4.1.232.3.2.5.1.1.6.' . $index;
$state = $entry['cpqDaPhyDrvStatus'];
$oid = '.1.3.6.1.4.1.232.3.2.5.1.1.6.' . $index;
$state = $entry['cpqDaPhyDrvStatus'];
discover_status_ng($device, $mib, 'cpqDaPhyDrvStatus', $oid, $index, 'cpqDaPhyDrvStatus', $name . ' Status', $state, array('entPhysicalClass' => 'physicalDrive'));
discover_status_ng($device, $mib, 'cpqDaPhyDrvStatus', $oid, $index, 'cpqDaPhyDrvStatus', $name . ' Status', $state, ['entPhysicalClass' => 'physicalDrive']);
$oid = '.1.3.6.1.4.1.232.3.2.5.1.1.37.' . $index;
$state = $entry['cpqDaPhyDrvCondition'];
$oid = '.1.3.6.1.4.1.232.3.2.5.1.1.37.' . $index;
$state = $entry['cpqDaPhyDrvCondition'];
discover_status_ng($device, $mib, 'cpqDaPhyDrvCondition', $oid, $index, 'cpqDaPhyDrvCondition', $name . ' Condition', $state, array('entPhysicalClass' => 'physicalDrive'));
discover_status_ng($device, $mib, 'cpqDaPhyDrvCondition', $oid, $index, 'cpqDaPhyDrvCondition', $name . ' Condition', $state, ['entPhysicalClass' => 'physicalDrive']);
$oid = '.1.3.6.1.4.1.232.3.2.5.1.1.57.' . $index;
$state = $entry['cpqDaPhyDrvSmartStatus'];
$oid = '.1.3.6.1.4.1.232.3.2.5.1.1.57.' . $index;
$state = $entry['cpqDaPhyDrvSmartStatus'];
discover_status_ng($device, $mib, 'cpqDaPhyDrvSmartStatus', $oid, $index, 'cpqDaPhyDrvSmartStatus', $name . ' S.M.A.R.T.', $state, array('entPhysicalClass' => 'physicalDrive'));
discover_status_ng($device, $mib, 'cpqDaPhyDrvSmartStatus', $oid, $index, 'cpqDaPhyDrvSmartStatus', $name . ' S.M.A.R.T.', $state, ['entPhysicalClass' => 'physicalDrive']);
$oid = '.1.3.6.1.4.1.232.3.2.5.1.1.9.' . $index;
discover_counter($device, 'lifetime', $mib, 'cpqDaPhyDrvRefHours', $oid, $index, $name . ' Hours', 3600, $entry['cpqDaPhyDrvRefHours'], array('entPhysicalClass' => 'physicalDrive'));
$oid = '.1.3.6.1.4.1.232.3.2.5.1.1.9.' . $index;
discover_counter($device, 'lifetime', $mib, 'cpqDaPhyDrvRefHours', $oid, $index, $name . ' Hours', 3600, $entry['cpqDaPhyDrvRefHours'], ['entPhysicalClass' => 'physicalDrive']);
}
// Logical Disks
$oids = snmpwalk_cache_oid($device, 'cpqDaLogDrv', array(), 'CPQIDA-MIB');
$oids = snmpwalk_cache_oid($device, 'cpqDaLogDrv', [], 'CPQIDA-MIB');
foreach ($oids as $index => $entry) {
$controller = rewrite_cpqida_hardware($entry['cpqDaCntlrModel']) . ' #' . $entry['cpqDaLogDrvCntlrIndex'];
$name = 'Logical Drive ' . $entry['cpqDaLogDrvIndex'];
if (!safe_empty($entry['cpqDaLogDrvOsName'])) {
$name .= ' (' . $entry['cpqDaLogDrvOsName'] . $controller . ')';
} else {
$name .= ' (' . $controller . ')';
}
$controller = rewrite_cpqida_hardware($entry['cpqDaCntlrModel']) . ' #' . $entry['cpqDaLogDrvCntlrIndex'];
$name = 'Logical Drive ' . $entry['cpqDaLogDrvIndex'];
if (!safe_empty($entry['cpqDaLogDrvOsName'])) {
$name .= ' (' . $entry['cpqDaLogDrvOsName'] . $controller . ')';
} else {
$name .= ' (' . $controller . ')';
}
$oid = '.1.3.6.1.4.1.232.3.2.3.1.1.4.' . $index;
$state = $entry['cpqDaLogDrvStatus'];
$oid = '.1.3.6.1.4.1.232.3.2.3.1.1.4.' . $index;
$state = $entry['cpqDaLogDrvStatus'];
discover_status_ng($device, $mib, 'cpqDaLogDrvStatus', $oid, $index, 'cpqDaLogDrvStatus', $name . ' Status', $state, array('entPhysicalClass' => 'logicalDrive'));
discover_status_ng($device, $mib, 'cpqDaLogDrvStatus', $oid, $index, 'cpqDaLogDrvStatus', $name . ' Status', $state, ['entPhysicalClass' => 'logicalDrive']);
$oid = '.1.3.6.1.4.1.232.3.2.3.1.1.11.' . $index;
$state = $entry['cpqDaLogDrvCondition'];
$oid = '.1.3.6.1.4.1.232.3.2.3.1.1.11.' . $index;
$state = $entry['cpqDaLogDrvCondition'];
discover_status_ng($device, $mib, 'cpqDaLogDrvCondition', $oid, $index, 'cpqDaLogDrvCondition', $name . ' Condition', $state, array('entPhysicalClass' => 'logicalDrive'));
discover_status_ng($device, $mib, 'cpqDaLogDrvCondition', $oid, $index, 'cpqDaLogDrvCondition', $name . ' Condition', $state, ['entPhysicalClass' => 'logicalDrive']);
// Do not ignore wrong 4294967295 value, because controller no other state when rebuild or initialization
// CPQIDA-MIB::cpqDaLogDrvPercentRebuild.3.1 = Gauge32: 4294967295
//if ($entry['cpqDaLogDrvPercentRebuild'] < 4294967295) {
// Do not ignore wrong 4294967295 value, because controller no other state when rebuild or initialization
// CPQIDA-MIB::cpqDaLogDrvPercentRebuild.3.1 = Gauge32: 4294967295
//if ($entry['cpqDaLogDrvPercentRebuild'] < 4294967295) {
$descr = $name . ' Rebuild';
$oid = ".1.3.6.1.4.1.232.3.2.3.1.1.12." . $index;
$value = $entry['cpqDaLogDrvPercentRebuild'];
$options = [ 'limit_low' => 15, 'limit_low_warn' => 50 ];
discover_sensor_ng($device, 'progress', $mib, 'cpqDaLogDrvPercentRebuild', $oid, $index, NULL, $descr, 1, $value, $options);
//}
// CPQIDA-MIB::cpqDaLogDrvRPIPercentComplete.3.1 = Gauge32: 0
//if ($entry['cpqDaLogDrvRPIPercentComplete'] < 4294967295) {
$options = ['limit_low' => 15, 'limit_low_warn' => 50];
discover_sensor_ng($device, 'progress', $mib, 'cpqDaLogDrvPercentRebuild', $oid, $index, $descr, 1, $value, $options);
//}
// CPQIDA-MIB::cpqDaLogDrvRPIPercentComplete.3.1 = Gauge32: 0
//if ($entry['cpqDaLogDrvRPIPercentComplete'] < 4294967295) {
$descr = $name . ' Undergoing Parity Initialization';
$oid = ".1.3.6.1.4.1.232.3.2.3.1.1.23." . $index;
$value = $entry['cpqDaLogDrvRPIPercentComplete'];
$options = [ 'limit_low' => 15, 'limit_low_warn' => 50 ];
discover_sensor_ng($device, 'progress', $mib, 'cpqDaLogDrvRPIPercentComplete', $oid, $index, NULL, $descr, 1, $value, $options);
//}
$options = ['limit_low' => 15, 'limit_low_warn' => 50];
discover_sensor_ng($device, 'progress', $mib, 'cpqDaLogDrvRPIPercentComplete', $oid, $index, $descr, 1, $value, $options);
//}
}
// EOF

View File

@ -6,7 +6,7 @@
*
* @package observium
* @subpackage discovery
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2022 Observium Limited
* @copyright (C) Adam Armstrong
*
*/
@ -15,98 +15,109 @@ $hpups_array = snmpwalk_cache_oid($device, 'upsInput', $hpups_array, 'CPQPOWER-M
$hpups_array = snmpwalk_cache_oid($device, 'upsOutput', $hpups_array, 'CPQPOWER-MIB');
$hpups_array = snmpwalk_cache_oid($device, 'upsBypass', $hpups_array, 'CPQPOWER-MIB');
foreach (array_slice(array_keys($hpups_array),1) as $phase) {
# Skip garbage output:
# upsOutput.6.0 = 0
# upsOutput.7.0 = 0
# upsOutput.8.0 = 0
if (!isset($hpups_array[$phase]['upsInputPhase'])) { break; }
foreach (array_slice(array_keys($hpups_array), 1) as $phase) {
# Skip garbage output:
# upsOutput.6.0 = 0
# upsOutput.7.0 = 0
# upsOutput.8.0 = 0
if (!isset($hpups_array[$phase]['upsInputPhase'])) {
break;
}
# Input
$index = $hpups_array[$phase]['upsInputPhase'];
$descr = 'Input'; if ($hpups_array[0]['upsInputNumPhases'] > 1) { $descr .= " Phase $index"; }
# Input
$index = $hpups_array[$phase]['upsInputPhase'];
$descr = 'Input';
if ($hpups_array[0]['upsInputNumPhases'] > 1) {
$descr .= " Phase $index";
}
## Input voltage
$oid = ".1.3.6.1.4.1.232.165.3.3.4.1.2.$index"; # CPQPOWER-MIB:upsInputVoltage.$index
$value = $hpups_array[$phase]['upsInputVoltage'];
## Input voltage
$oid = ".1.3.6.1.4.1.232.165.3.3.4.1.2.$index"; # CPQPOWER-MIB:upsInputVoltage.$index
$value = $hpups_array[$phase]['upsInputVoltage'];
$options = [ 'rename_rrd' => "CPQPOWER-MIB-upsInputEntry.$index" ];
discover_sensor_ng($device, 'voltage', $mib, 'upsInputVoltage', $oid, $index, NULL, $descr, 1, $value, $options);
$options = ['rename_rrd' => "CPQPOWER-MIB-upsInputEntry.$index"];
discover_sensor_ng($device, 'voltage', $mib, 'upsInputVoltage', $oid, $index, $descr, 1, $value, $options);
## Input current
$oid = ".1.3.6.1.4.1.232.165.3.3.4.1.3.$index"; # CPQPOWER-MIB:upsInputCurrent.$index
$value = $hpups_array[$phase]['upsInputCurrent'];
## Input current
$oid = ".1.3.6.1.4.1.232.165.3.3.4.1.3.$index"; # CPQPOWER-MIB:upsInputCurrent.$index
$value = $hpups_array[$phase]['upsInputCurrent'];
if ($value < 10000) { # upsInputCurrent.1 = 136137420 ? really? You're nuts.
$options = [ 'rename_rrd' => "CPQPOWER-MIB-upsInputEntry.$index" ];
discover_sensor_ng($device, 'current', $mib, 'upsInputCurrent', $oid, $index, NULL, $descr, 1, $value, $options);
}
if ($value < 10000) { # upsInputCurrent.1 = 136137420 ? really? You're nuts.
$options = ['rename_rrd' => "CPQPOWER-MIB-upsInputEntry.$index"];
discover_sensor_ng($device, 'current', $mib, 'upsInputCurrent', $oid, $index, $descr, 1, $value, $options);
}
## Input power
$oid = ".1.3.6.1.4.1.232.165.3.3.4.1.4.$index"; # CPQPOWER-MIB:upsInputWatts.$index
$value = $hpups_array[$phase]['upsInputWatts'];
$options = [ 'rename_rrd' => "CPQPOWER-MIB-upsInputEntry.$index" ];
discover_sensor_ng($device, 'power', $mib, 'upsInputWatts', $oid, $index, NULL, $descr, 1, $value, $options);
## Input power
$oid = ".1.3.6.1.4.1.232.165.3.3.4.1.4.$index"; # CPQPOWER-MIB:upsInputWatts.$index
$value = $hpups_array[$phase]['upsInputWatts'];
$options = ['rename_rrd' => "CPQPOWER-MIB-upsInputEntry.$index"];
discover_sensor_ng($device, 'power', $mib, 'upsInputWatts', $oid, $index, $descr, 1, $value, $options);
# Output
$index = $hpups_array[$phase]['upsOutputPhase'];
$descr = 'Output'; if ($hpups_array[0]['upsOutputNumPhases'] > 1) { $descr .= " Phase $index"; }
# Output
$index = $hpups_array[$phase]['upsOutputPhase'];
$descr = 'Output';
if ($hpups_array[0]['upsOutputNumPhases'] > 1) {
$descr .= " Phase $index";
}
## Output voltage
$oid = ".1.3.6.1.4.1.232.165.3.4.4.1.2.$index"; # CPQPOWER-MIB:upsOutputVoltage.$index
$value = $hpups_array[$phase]['upsOutputVoltage'];
$options = [ 'rename_rrd' => "CPQPOWER-MIB-upsOutputEntry.$index" ];
discover_sensor_ng($device, 'voltage', $mib, 'upsOutputVoltage', $oid, $index, NULL, $descr, 1, $value, $options);
## Output voltage
$oid = ".1.3.6.1.4.1.232.165.3.4.4.1.2.$index"; # CPQPOWER-MIB:upsOutputVoltage.$index
$value = $hpups_array[$phase]['upsOutputVoltage'];
$options = ['rename_rrd' => "CPQPOWER-MIB-upsOutputEntry.$index"];
discover_sensor_ng($device, 'voltage', $mib, 'upsOutputVoltage', $oid, $index, $descr, 1, $value, $options);
## Output current
$oid = ".1.3.6.1.4.1.232.165.3.4.4.1.3.$index"; # CPQPOWER-MIB:upsOutputCurrent.$index
$value = $hpups_array[$phase]['upsOutputCurrent'];
$options = [ 'rename_rrd' => "CPQPOWER-MIB-upsOutputEntry.$index" ];
discover_sensor_ng($device, 'current', $mib, 'upsOutputCurrent', $oid, $index, NULL, $descr, 1, $value, $options);
## Output current
$oid = ".1.3.6.1.4.1.232.165.3.4.4.1.3.$index"; # CPQPOWER-MIB:upsOutputCurrent.$index
$value = $hpups_array[$phase]['upsOutputCurrent'];
$options = ['rename_rrd' => "CPQPOWER-MIB-upsOutputEntry.$index"];
discover_sensor_ng($device, 'current', $mib, 'upsOutputCurrent', $oid, $index, $descr, 1, $value, $options);
## Output power
$oid = ".1.3.6.1.4.1.232.165.3.4.4.1.4.$index"; # CPQPOWER-MIB:upsOutputWatts.$index
$value = $hpups_array[$phase]['upsOutputWatts'];
$options = [ 'rename_rrd' => "CPQPOWER-MIB-upsOutputEntry.$index" ];
discover_sensor_ng($device, 'power', $mib, 'upsOutputWatts', $oid, $index, NULL, $descr, 1, $value, $options);
## Output power
$oid = ".1.3.6.1.4.1.232.165.3.4.4.1.4.$index"; # CPQPOWER-MIB:upsOutputWatts.$index
$value = $hpups_array[$phase]['upsOutputWatts'];
$options = ['rename_rrd' => "CPQPOWER-MIB-upsOutputEntry.$index"];
discover_sensor_ng($device, 'power', $mib, 'upsOutputWatts', $oid, $index, $descr, 1, $value, $options);
## Output Load
$oid = '.1.3.6.1.4.1.232.165.3.4.1.0'; # CPQPOWER-MIB:upsOutputLoad.$index
$descr = 'Output Load';
$value = $hpups_array[$phase]['upsOutputLoad'];
$options = [ 'rename_rrd' => "CPQPOWER-MIB-upsOutputLoad.0" ];
discover_sensor_ng($device, 'capacity', $mib, 'upsOutputLoad', $oid, '0', NULL, $descr, 1, $value, $options); // FIXME load?
## Output Load
$oid = '.1.3.6.1.4.1.232.165.3.4.1.0'; # CPQPOWER-MIB:upsOutputLoad.$index
$descr = 'Output Load';
$value = $hpups_array[$phase]['upsOutputLoad'];
$options = ['rename_rrd' => "CPQPOWER-MIB-upsOutputLoad.0"];
discover_sensor_ng($device, 'capacity', $mib, 'upsOutputLoad', $oid, '0', $descr, 1, $value, $options); // FIXME load?
# Bypass
$index = $hpups_array[$phase]['upsBypassPhase'];
$descr = 'Bypass'; if ($hpups_array[0]['upsBypassNumPhases'] > 1) { $descr .= " Phase $index"; }
# Bypass
$index = $hpups_array[$phase]['upsBypassPhase'];
$descr = 'Bypass';
if ($hpups_array[0]['upsBypassNumPhases'] > 1) {
$descr .= " Phase $index";
}
## Bypass voltage
$oid = ".1.3.6.1.4.1.232.165.3.5.3.1.2.$index"; # CPQPOWER-MIB:upsBypassVoltage.$index
$value = $hpups_array[$phase]['upsBypassVoltage'];
$options = [ 'rename_rrd' => "CPQPOWER-MIB-upsBypassEntry.$index" ];
discover_sensor_ng($device, 'voltage', $mib, 'upsBypassVoltage', $oid, $index, NULL, $descr, 1, $value, $options);
## Bypass voltage
$oid = ".1.3.6.1.4.1.232.165.3.5.3.1.2.$index"; # CPQPOWER-MIB:upsBypassVoltage.$index
$value = $hpups_array[$phase]['upsBypassVoltage'];
$options = ['rename_rrd' => "CPQPOWER-MIB-upsBypassEntry.$index"];
discover_sensor_ng($device, 'voltage', $mib, 'upsBypassVoltage', $oid, $index, $descr, 1, $value, $options);
}
$scale = 0.1;
## Input frequency
$oid = '.1.3.6.1.4.1.232.165.3.3.1.0'; # CPQPOWER-MIB:upsInputFrequency.0
$oid = '.1.3.6.1.4.1.232.165.3.3.1.0'; # CPQPOWER-MIB:upsInputFrequency.0
$value = $hpups_array[0]['upsInputFrequency'];
$options = [ 'rename_rrd' => "CPQPOWER-MIB-upsInputFrequency.0" ];
discover_sensor_ng($device, 'frequency', $mib, 'upsInputFrequency', $oid, '0', NULL, 'Input', $scale, $value, $options);
$options = ['rename_rrd' => "CPQPOWER-MIB-upsInputFrequency.0"];
discover_sensor_ng($device, 'frequency', $mib, 'upsInputFrequency', $oid, '0', 'Input', $scale, $value, $options);
## Output Frequency
$oid = '.1.3.6.1.4.1.232.165.3.4.2.0'; # CPQPOWER-MIB:upsOutputFrequency.0
$oid = '.1.3.6.1.4.1.232.165.3.4.2.0'; # CPQPOWER-MIB:upsOutputFrequency.0
$value = $hpups_array[0]['upsOutputFrequency'];
$options = [ 'rename_rrd' => "CPQPOWER-MIB-upsOutputFrequency.0" ];
discover_sensor_ng($device, 'frequency', $mib, 'upsOutputFrequency', $oid, '0', NULL, 'Output', $scale, $value, $options);
$options = ['rename_rrd' => "CPQPOWER-MIB-upsOutputFrequency.0"];
discover_sensor_ng($device, 'frequency', $mib, 'upsOutputFrequency', $oid, '0', 'Output', $scale, $value, $options);
## Bypass Frequency
$oid = '.1.3.6.1.4.1.232.165.3.5.1.0'; # CPQPOWER-MIB:upsBypassFrequency.0
$value = $hpups_array[0]['upsBypassFrequency'];
$options = [ 'rename_rrd' => "CPQPOWER-MIB-upsBypassFrequency.0" ];
discover_sensor_ng($device, 'frequency', $mib, 'upsBypassFrequency', $oid, '0', NULL, 'Bypass', $scale, $value, $options);
$oid = '.1.3.6.1.4.1.232.165.3.5.1.0'; # CPQPOWER-MIB:upsBypassFrequency.0
$value = $hpups_array[0]['upsBypassFrequency'];
$options = ['rename_rrd' => "CPQPOWER-MIB-upsBypassFrequency.0"];
discover_sensor_ng($device, 'frequency', $mib, 'upsBypassFrequency', $oid, '0', 'Bypass', $scale, $value, $options);
unset($hpups_array);
@ -132,37 +143,37 @@ unset($hpups_array);
$hppdu_array = snmpwalk_cache_oid($device, 'pduIdentTable', [], 'CPQPOWER-MIB');
$hppdu_array = snmpwalk_cache_oid($device, 'pduOutputTable', $hppdu_array, 'CPQPOWER-MIB');
foreach ($hppdu_array as $index => $entry) {
// Monitor PDU Status
$oid = ".1.3.6.1.4.1.232.165.2.1.2.1.8.$index";
$descr = $entry['pduName'].' Status';
if (!empty($entry['pduStatus'])) {
discover_status_ng($device, $mib, 'pduStatus', $oid, $index, 'cpqpower-pdu-status', $descr, $entry['pduStatus'], array('entPhysicalClass' => 'power', 'rename_rrd' => 'cpqpower-pdu-status-%index%'));
}
// Monitor PDU Status
$oid = ".1.3.6.1.4.1.232.165.2.1.2.1.8.$index";
$descr = $entry['pduName'] . ' Status';
if (!empty($entry['pduStatus'])) {
discover_status_ng($device, $mib, 'pduStatus', $oid, $index, 'cpqpower-pdu-status', $descr, $entry['pduStatus'], ['entPhysicalClass' => 'power', 'rename_rrd' => 'cpqpower-pdu-status-%index%']);
}
// Monitor PDU Output load
$oid = ".1.3.6.1.4.1.232.165.2.3.1.1.2.$index";
$descr = $entry['pduName'].' Load';
$limits = [];
if (!empty($entry['pduOutputLoad']) && $entry['pduOutputLoad'] != '-1') {
$options = [ 'rename_rrd' => "CPQPOWER-MIB-%index%" ];
discover_sensor_ng($device, 'capacity', $mib, 'pduOutputLoad', $oid, $index, NULL, $descr, 1, $entry['pduOutputLoad'], $options);
// Monitor PDU Output load
$oid = ".1.3.6.1.4.1.232.165.2.3.1.1.2.$index";
$descr = $entry['pduName'] . ' Load';
$limits = [];
if (!empty($entry['pduOutputLoad']) && $entry['pduOutputLoad'] != '-1') {
$options = ['rename_rrd' => "CPQPOWER-MIB-%index%"];
discover_sensor_ng($device, 'capacity', $mib, 'pduOutputLoad', $oid, $index, $descr, 1, $entry['pduOutputLoad'], $options);
// Find power limit by measure the reported output power divided by the reported load of the PDU
$pdu_maxload = 100 * float_div($entry['pduOutputPower'], $entry['pduOutputLoad']);
$pdu_warnload = 0.8 * $pdu_maxload;
$limits = array('limit_high' => round($pdu_maxload, 2),
'limit_high_warn' => round($pdu_warnload, 2));
}
// Find power limit by measure the reported output power divided by the reported load of the PDU
$pdu_maxload = 100 * float_div($entry['pduOutputPower'], $entry['pduOutputLoad']);
$pdu_warnload = 0.8 * $pdu_maxload;
$limits = ['limit_high' => round($pdu_maxload, 2),
'limit_high_warn' => round($pdu_warnload, 2)];
}
// Monitor PDU Power
$oid = ".1.3.6.1.4.1.232.165.2.3.1.1.4.$index";
$descr = $entry['pduName'].' Output Power';
// Monitor PDU Power
$oid = ".1.3.6.1.4.1.232.165.2.3.1.1.4.$index";
$descr = $entry['pduName'] . ' Output Power';
if (!empty($entry['pduOutputPower']) && $entry['pduOutputPower'] != '-1') {
$options = $limits;
$options['rename_rrd'] = "CPQPOWER-MIB-%index%";
discover_sensor_ng($device, 'power', $mib, 'pduOutputPower', $oid, $index, NULL, $descr, 1, $entry['pduOutputPower'], $options);
}
if (!empty($entry['pduOutputPower']) && $entry['pduOutputPower'] != '-1') {
$options = $limits;
$options['rename_rrd'] = "CPQPOWER-MIB-%index%";
discover_sensor_ng($device, 'power', $mib, 'pduOutputPower', $oid, $index, $descr, 1, $entry['pduOutputPower'], $options);
}
}
//CPQPOWER-MIB::breakerIndex.1.1 = INTEGER: 1
@ -177,36 +188,38 @@ foreach ($hppdu_array as $index => $entry) {
//CPQPOWER-MIB::breakerStatus.2.6 = INTEGER: 0
$hppdu_breaker_array = snmpwalk_cache_oid($device, 'pduOutputBreakerTable', [], 'CPQPOWER-MIB');
foreach ($hppdu_breaker_array as $index => $entry) {
if ($entry['breakerVoltage'] <= 0) { continue; }
if ($entry['breakerVoltage'] <= 0) {
continue;
}
list($breaker_output, $breaker_unit) = explode('.', $index, 2);
$breaker_descr = 'Breaker ' . $hppdu_array[$breaker_output]['pduName'] . ' Unit ' . $breaker_unit;
[$breaker_output, $breaker_unit] = explode('.', $index, 2);
$breaker_descr = 'Breaker ' . $hppdu_array[$breaker_output]['pduName'] . ' Unit ' . $breaker_unit;
// Find powerlimit by measure the reported output power devivded by the reported load of the PDU
//$breaker_maxload = 100 * ($entry['breakerCurrent'] / $entry['breakerPercentLoad']);
$breaker_maxload = float_div($entry['breakerCurrent'], $entry['breakerPercentLoad']); // breakerCurrent already scaled by 100
$breaker_warnload = 0.8 * $breaker_maxload;
$limits = array('limit_high' => round($breaker_maxload, 2),
'limit_high_warn' => round($breaker_warnload, 2));
$descr = $breaker_descr . ' Current';
$oid = ".1.3.6.1.4.1.232.165.2.3.2.1.3.$index";
$options = $limits;
$options['rename_rrd'] = "CPQPOWER-MIB-%index%";
discover_sensor_ng($device, 'current', $mib, 'breakerCurrent', $oid, $index, NULL, $descr, 0.01, $entry['breakerCurrent'], $options);
// Find powerlimit by measure the reported output power devivded by the reported load of the PDU
//$breaker_maxload = 100 * ($entry['breakerCurrent'] / $entry['breakerPercentLoad']);
$breaker_maxload = float_div($entry['breakerCurrent'], $entry['breakerPercentLoad']); // breakerCurrent already scaled by 100
$breaker_warnload = 0.8 * $breaker_maxload;
$limits = ['limit_high' => round($breaker_maxload, 2),
'limit_high_warn' => round($breaker_warnload, 2)];
$descr = $breaker_descr . ' Current';
$oid = ".1.3.6.1.4.1.232.165.2.3.2.1.3.$index";
$options = $limits;
$options['rename_rrd'] = "CPQPOWER-MIB-%index%";
discover_sensor_ng($device, 'current', $mib, 'breakerCurrent', $oid, $index, $descr, 0.01, $entry['breakerCurrent'], $options);
$descr = $breaker_descr . ' Voltage';
$oid = ".1.3.6.1.4.1.232.165.2.3.2.1.2.$index";
$options = [ 'rename_rrd' => "CPQPOWER-MIB-%index%" ];
discover_sensor_ng($device, 'voltage', $mib, 'breakerVoltage', $oid, $index, NULL, $descr, 1, $entry['breakerVoltage'], $options);
$descr = $breaker_descr . ' Voltage';
$oid = ".1.3.6.1.4.1.232.165.2.3.2.1.2.$index";
$options = ['rename_rrd' => "CPQPOWER-MIB-%index%"];
discover_sensor_ng($device, 'voltage', $mib, 'breakerVoltage', $oid, $index, $descr, 1, $entry['breakerVoltage'], $options);
$descr = $breaker_descr . ' Load';
$oid = ".1.3.6.1.4.1.232.165.2.3.2.1.4.$index";
$options = [ 'rename_rrd' => "CPQPOWER-MIB-%index%" ];
discover_sensor_ng($device, 'capacity', $mib, 'breakerPercentLoad', $oid, $index, NULL, $descr, 1, $entry['breakerPercentLoad'], $options);
$descr = $breaker_descr . ' Load';
$oid = ".1.3.6.1.4.1.232.165.2.3.2.1.4.$index";
$options = ['rename_rrd' => "CPQPOWER-MIB-%index%"];
discover_sensor_ng($device, 'capacity', $mib, 'breakerPercentLoad', $oid, $index, $descr, 1, $entry['breakerPercentLoad'], $options);
$descr = $breaker_descr . ' Status';
$oid = ".1.3.6.1.4.1.232.165.2.3.2.1.5.$index";
discover_status_ng($device, $mib, 'breakerStatus', $oid, $index, 'cpqpower-pdu-breaker-status', $descr, $entry['breakerStatus'], array('entPhysicalClass' => 'power', 'rename_rrd' => 'cpqpower-pdu-breaker-status-%index%'));
$descr = $breaker_descr . ' Status';
$oid = ".1.3.6.1.4.1.232.165.2.3.2.1.5.$index";
discover_status_ng($device, $mib, 'breakerStatus', $oid, $index, 'cpqpower-pdu-breaker-status', $descr, $entry['breakerStatus'], ['entPhysicalClass' => 'power', 'rename_rrd' => 'cpqpower-pdu-breaker-status-%index%']);
}
unset($hpups_array, $hppdu_breaker_array);

View File

@ -1,5 +1,4 @@
<?php
/**
* Observium
*
@ -7,13 +6,13 @@
*
* @package observium
* @subpackage discovery
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2019 Observium Limited
* @copyright (C) Adam Armstrong
*
*/
$cpqrack = snmpwalk_cache_oid($device, 'cpqRackCommonEnclosureHasPowerSupplies', array(), 'CPQRACK-MIB');
$cpqrack = snmpwalk_cache_oid($device, 'cpqRackCommonEnclosureHasTempSensors', $cpqrack, 'CPQRACK-MIB');
$cpqrack = snmpwalk_cache_oid($device, 'cpqRackCommonEnclosureHasFans', $cpqrack, 'CPQRACK-MIB');
$cpqrack = snmpwalk_cache_oid($device, 'cpqRackCommonEnclosureHasPowerSupplies', [], 'CPQRACK-MIB');
$cpqrack = snmpwalk_cache_oid($device, 'cpqRackCommonEnclosureHasTempSensors', $cpqrack, 'CPQRACK-MIB');
$cpqrack = snmpwalk_cache_oid($device, 'cpqRackCommonEnclosureHasFans', $cpqrack, 'CPQRACK-MIB');
//print_vars($cpqrack);
// Rack Blade (useful for inventory or so)
@ -21,139 +20,124 @@ $cpqrack = snmpwalk_cache_oid($device, 'cpqRackCommonEnclosureHasFans',
//print_vars($oids);
// Power Supplies
$oids = snmp_cache_table($device, 'cpqRackPowerSupplyTable', NULL, 'CPQRACK-MIB');
$oids = snmp_cache_table($device, 'cpqRackPowerSupplyTable', [], 'CPQRACK-MIB');
foreach ($oids as $index => $entry)
{
$rack = $entry['cpqRackPowerSupplyRack'];
if ($cpqrack[$rack]['cpqRackCommonEnclosureHasPowerSupplies'] == 'false' ||
$entry['cpqRackPowerSupplyPresent'] != 'present' ||
$entry['cpqRackPowerSupplyMaxPwrOutput'] <= 0)
{
continue;
}
$chassis = $entry['cpqRackPowerSupplyChassis'];
$name = ($entry['cpqRackPowerSupplyEnclosureName'] ? $entry['cpqRackPowerSupplyEnclosureName'] : $entry['cpqRackPowerSupplyIndex']);
$descr = "$name - Rack $rack, Chassis $chassis, ".$entry['cpqRackPowerSupplyMaxPwrOutput']."W";
foreach ($oids as $index => $entry) {
$rack = $entry['cpqRackPowerSupplyRack'];
if ($cpqrack[$rack]['cpqRackCommonEnclosureHasPowerSupplies'] == 'false' ||
$entry['cpqRackPowerSupplyPresent'] != 'present' ||
$entry['cpqRackPowerSupplyMaxPwrOutput'] <= 0) {
continue;
}
$chassis = $entry['cpqRackPowerSupplyChassis'];
$name = ($entry['cpqRackPowerSupplyEnclosureName'] ? $entry['cpqRackPowerSupplyEnclosureName'] : $entry['cpqRackPowerSupplyIndex']);
$descr = "$name - Rack $rack, Chassis $chassis, " . $entry['cpqRackPowerSupplyMaxPwrOutput'] . "W";
// Power Output
$oid_name = 'cpqRackPowerSupplyCurPwrOutput';
$oid = '.1.3.6.1.4.1.232.22.2.5.1.1.1.10.'.$index;
$type = 'CPQRACK-MIB' . '-' . $oid_name;
$value = $entry[$oid_name];
// Power Output
$oid_name = 'cpqRackPowerSupplyCurPwrOutput';
$oid = '.1.3.6.1.4.1.232.22.2.5.1.1.1.10.' . $index;
$value = $entry[$oid_name];
if ($value > 0)
{
discover_sensor_ng($device, 'power', 'CPQRACK-MIB', $oid_name, $oid, $index, $type, 'Power Supply Output ' . $descr, 1, $value);
}
if ($value > 0) {
discover_sensor_ng($device, 'power', 'CPQRACK-MIB', $oid_name, $oid, $index, 'Power Supply Output ' . $descr, 1, $value);
}
// Intake Temperature
$oid_name = 'cpqRackPowerSupplyIntakeTemp';
$oid = '.1.3.6.1.4.1.232.22.2.5.1.1.1.12.'.$index;
$type = 'CPQRACK-MIB' . '-' . $oid_name;
$value = $entry[$oid_name];
// Intake Temperature
$oid_name = 'cpqRackPowerSupplyIntakeTemp';
$oid = '.1.3.6.1.4.1.232.22.2.5.1.1.1.12.' . $index;
$value = $entry[$oid_name];
if ($value > 0)
{
discover_sensor_ng($device, 'temperature', 'CPQRACK-MIB', $oid_name, $oid, $index, $type, 'Power Supply Intake ' . $descr, 1, $value);
}
if ($value > 0) {
discover_sensor_ng($device, 'temperature', 'CPQRACK-MIB', $oid_name, $oid, $index, 'Power Supply Intake ' . $descr, 1, $value);
}
// Exhaust Temperature
$oid_name = 'cpqRackPowerSupplyExhaustTemp';
$oid = '.1.3.6.1.4.1.232.22.2.5.1.1.1.13.'.$index;
$type = 'CPQRACK-MIB' . '-' . $oid_name;
$value = $entry[$oid_name];
// Exhaust Temperature
$oid_name = 'cpqRackPowerSupplyExhaustTemp';
$oid = '.1.3.6.1.4.1.232.22.2.5.1.1.1.13.' . $index;
$value = $entry[$oid_name];
if ($value > 0)
{
discover_sensor_ng($device, 'temperature', 'CPQRACK-MIB', $oid_name, $oid, $index, $type, 'Power Supply Exhaust ' . $descr, 1, $value);
}
if ($value > 0) {
discover_sensor_ng($device, 'temperature', 'CPQRACK-MIB', $oid_name, $oid, $index, 'Power Supply Exhaust ' . $descr, 1, $value);
}
// Status
$oid = '.1.3.6.1.4.1.232.22.2.5.1.1.1.14.'.$index;
$value = $entry['cpqRackPowerSupplyStatus'];
// Status
$oid = '.1.3.6.1.4.1.232.22.2.5.1.1.1.14.' . $index;
$value = $entry['cpqRackPowerSupplyStatus'];
discover_status_ng($device, $mib, 'cpqRackPowerSupplyStatus', $oid, $index, 'cpqRackPowerSupplyStatus', 'Power Supply Status ' . $descr, $value, array('entPhysicalClass' => 'powersupply'));
discover_status_ng($device, $mib, 'cpqRackPowerSupplyStatus', $oid, $index, 'cpqRackPowerSupplyStatus', 'Power Supply Status ' . $descr, $value, ['entPhysicalClass' => 'powersupply']);
// InputLine
$oid = '.1.3.6.1.4.1.232.22.2.5.1.1.1.15.'.$index;
$value = $entry['cpqRackPowerSupplyInputLineStatus'];
// InputLine
$oid = '.1.3.6.1.4.1.232.22.2.5.1.1.1.15.' . $index;
$value = $entry['cpqRackPowerSupplyInputLineStatus'];
discover_status_ng($device, $mib, 'cpqRackPowerSupplyInputLineStatus', $oid, $index, 'cpqRackPowerSupplyInputLineStatus', 'Power Supply InputLine ' . $descr, $value, array('entPhysicalClass' => 'powersupply'));
discover_status_ng($device, $mib, 'cpqRackPowerSupplyInputLineStatus', $oid, $index, 'cpqRackPowerSupplyInputLineStatus', 'Power Supply InputLine ' . $descr, $value, ['entPhysicalClass' => 'powersupply']);
// Condition
$oid = '.1.3.6.1.4.1.232.22.2.5.1.1.1.17.'.$index;
$value = $entry['cpqRackPowerSupplyCondition'];
// Condition
$oid = '.1.3.6.1.4.1.232.22.2.5.1.1.1.17.' . $index;
$value = $entry['cpqRackPowerSupplyCondition'];
discover_status_ng($device, $mib, 'cpqRackPowerSupplyCondition', $oid, $index, 'cpqRackCommonEnclosureCondition', 'Power Supply ' . $descr, $value, array('entPhysicalClass' => 'powersupply'));
discover_status_ng($device, $mib, 'cpqRackPowerSupplyCondition', $oid, $index, 'cpqRackCommonEnclosureCondition', 'Power Supply ' . $descr, $value, ['entPhysicalClass' => 'powersupply']);
}
// Rack Power
$oids = snmpwalk_cache_oid($device, 'cpqRackPowerEnclosureTable', array(), 'CPQRACK-MIB');
$oids = snmpwalk_cache_oid($device, 'cpqRackPowerEnclosureTable', [], 'CPQRACK-MIB');
//print_vars($oids);
foreach ($oids as $index => $entry)
{
$rack = $entry['cpqRackPowerEnclosureRack'];
if ($entry['cpqRackPowerEnclosurePwrFeedMax'] <= 0)
{
continue;
}
$name = ($entry['cpqRackPowerEnclosureName'] ? $entry['cpqRackPowerEnclosureName'] : $entry['cpqRackPowerEnclosureIndex']);
$descr = "Power $name - Rack $rack, ".$entry['cpqRackPowerEnclosurePwrFeedMax']."W";
$oid = '.1.3.6.1.4.1.232.22.2.3.3.1.1.9.'.$index;
$value = $entry['cpqRackPowerEnclosureCondition'];
foreach ($oids as $index => $entry) {
$rack = $entry['cpqRackPowerEnclosureRack'];
if ($entry['cpqRackPowerEnclosurePwrFeedMax'] <= 0) {
continue;
}
$name = ($entry['cpqRackPowerEnclosureName'] ? $entry['cpqRackPowerEnclosureName'] : $entry['cpqRackPowerEnclosureIndex']);
$descr = "Power $name - Rack $rack, " . $entry['cpqRackPowerEnclosurePwrFeedMax'] . "W";
$oid = '.1.3.6.1.4.1.232.22.2.3.3.1.1.9.' . $index;
$value = $entry['cpqRackPowerEnclosureCondition'];
discover_status_ng($device, $mib, 'cpqRackPowerEnclosureCondition', $oid, $index, 'cpqRackCommonEnclosureCondition', $descr, $value, array('entPhysicalClass' => 'power'));
discover_status_ng($device, $mib, 'cpqRackPowerEnclosureCondition', $oid, $index, 'cpqRackCommonEnclosureCondition', $descr, $value, ['entPhysicalClass' => 'power']);
}
// Temperatures
$oids = snmpwalk_cache_oid($device, 'cpqRackCommonEnclosureTempTable', array(), 'CPQRACK-MIB');
$oids = snmpwalk_cache_oid($device, 'cpqRackCommonEnclosureTempTable', [], 'CPQRACK-MIB');
//print_vars($oids);
foreach ($oids as $index => $entry)
{
$rack = $entry['cpqRackCommonEnclosureTempRack'];
if ($cpqrack[$rack]['cpqRackCommonEnclosureHasTempSensors'] == 'false' ||
$entry['cpqRackCommonEnclosureTempCurrent'] <= 0)
{
continue;
}
$chassis = $entry['cpqRackCommonEnclosureTempChassis'];
$name = ($entry['cpqRackCommonEnclosureTempLocation'] ? $entry['cpqRackCommonEnclosureTempLocation'] : 'Sensor ' . $entry['cpqRackCommonEnclosureTempSensorIndex']);
$descr = "$name - Rack $rack, Chassis $chassis";
foreach ($oids as $index => $entry) {
$rack = $entry['cpqRackCommonEnclosureTempRack'];
if ($cpqrack[$rack]['cpqRackCommonEnclosureHasTempSensors'] == 'false' ||
$entry['cpqRackCommonEnclosureTempCurrent'] <= 0) {
continue;
}
$chassis = $entry['cpqRackCommonEnclosureTempChassis'];
$name = ($entry['cpqRackCommonEnclosureTempLocation'] ? $entry['cpqRackCommonEnclosureTempLocation'] : 'Sensor ' . $entry['cpqRackCommonEnclosureTempSensorIndex']);
$descr = "$name - Rack $rack, Chassis $chassis";
$oid_name = 'cpqRackCommonEnclosureTempCurrent';
$oid = '.1.3.6.1.4.1.232.22.2.3.1.2.1.6.'.$index;
$type = 'CPQRACK-MIB' . '-' . $oid_name;
$value = $entry[$oid_name];
$limits = array('limit_high' => $entry['cpqRackCommonEnclosureTempThreshold']);
$oid_name = 'cpqRackCommonEnclosureTempCurrent';
$oid = '.1.3.6.1.4.1.232.22.2.3.1.2.1.6.' . $index;
$value = $entry[$oid_name];
$limits = ['limit_high' => $entry['cpqRackCommonEnclosureTempThreshold']];
discover_sensor_ng($device, 'temperature', 'CPQRACK-MIB', $oid_name, $oid, $index, $type, $descr, 1, $value, $limits);
discover_sensor_ng($device, 'temperature', 'CPQRACK-MIB', $oid_name, $oid, $index, $descr, 1, $value, $limits);
// State
$oid = '.1.3.6.1.4.1.232.22.2.3.1.2.1.8.'.$index;
$value = $entry['cpqRackCommonEnclosureTempCondition'];
// State
$oid = '.1.3.6.1.4.1.232.22.2.3.1.2.1.8.' . $index;
$value = $entry['cpqRackCommonEnclosureTempCondition'];
//discover_status($device, $oid, 'cpqRackCommonEnclosureTempCondition.'.$index, 'cpqRackCommonEnclosureCondition', $descr, $value, array('entPhysicalClass' => 'chassis'));
//discover_status($device, $oid, 'cpqRackCommonEnclosureTempCondition.'.$index, 'cpqRackCommonEnclosureCondition', $descr, $value, array('entPhysicalClass' => 'chassis'));
}
// Fans
$oids = snmpwalk_cache_oid($device, 'cpqRackCommonEnclosureFanTable', array(), 'CPQRACK-MIB');
$oids = snmpwalk_cache_oid($device, 'cpqRackCommonEnclosureFanTable', [], 'CPQRACK-MIB');
//print_vars($oids);
foreach ($oids as $index => $entry)
{
$rack = $entry['cpqRackCommonEnclosureFanRack'];
if ($cpqrack[$rack]['cpqRackCommonEnclosureHasFans'] == 'false' ||
$entry['cpqRackCommonEnclosureFanPresent'] != 'present')
{
continue;
}
$chassis = $entry['cpqRackCommonEnclosureFanChassis'];
$name = ($entry['cpqRackCommonEnclosureFanLocation'] ? $entry['cpqRackCommonEnclosureFanLocation'] : $entry['cpqRackCommonEnclosureFanIndex']);
$descr = "Fan $name - Rack $rack, Chassis $chassis";
$oid = '.1.3.6.1.4.1.232.22.2.3.1.3.1.11.'.$index;
$value = $entry['cpqRackCommonEnclosureFanCondition'];
foreach ($oids as $index => $entry) {
$rack = $entry['cpqRackCommonEnclosureFanRack'];
if ($cpqrack[$rack]['cpqRackCommonEnclosureHasFans'] == 'false' ||
$entry['cpqRackCommonEnclosureFanPresent'] != 'present') {
continue;
}
$chassis = $entry['cpqRackCommonEnclosureFanChassis'];
$name = ($entry['cpqRackCommonEnclosureFanLocation'] ? $entry['cpqRackCommonEnclosureFanLocation'] : $entry['cpqRackCommonEnclosureFanIndex']);
$descr = "Fan $name - Rack $rack, Chassis $chassis";
$oid = '.1.3.6.1.4.1.232.22.2.3.1.3.1.11.' . $index;
$value = $entry['cpqRackCommonEnclosureFanCondition'];
discover_status_ng($device, $mib, 'cpqRackCommonEnclosureFanCondition', $oid, $index, 'cpqRackCommonEnclosureCondition', $descr, $value, array('entPhysicalClass' => 'fan'));
discover_status_ng($device, $mib, 'cpqRackCommonEnclosureFanCondition', $oid, $index, 'cpqRackCommonEnclosureCondition', $descr, $value, ['entPhysicalClass' => 'fan']);
}
// EOF

View File

@ -5,9 +5,9 @@
*
* This file is part of Observium.
*
* @package observium
* @subpackage discovery
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2019 Observium Limited
* @package observium
* @subpackage discovery
* @copyright (C) Adam Armstrong
*
*/
@ -44,37 +44,36 @@ CYAN-CEM-MIB::cyanCemIntakeTempWarnLowThres.1.33 = INTEGER: -40000
*/
$entries = snmpwalk_cache_oid($device, 'cyanCemTable', array(), 'CYAN-CEM-MIB');
$entries = snmpwalk_cache_oid($device, 'cyanCemTable', [], 'CYAN-CEM-MIB');
foreach ($entries as $index => $entry)
{
foreach ($entries as $index => $entry) {
$descr = $entry['cyanCemDescription'] . ' ' . $entry['cyanCemIdentifier'];
$descr = $entry['cyanCemDescription'] . ' ' . $entry['cyanCemIdentifier'];
discover_sensor('current', $device, ".1.3.6.1.4.1.28533.5.30.50.1.1.1.11.$index", $index, 'cyanCemCurrent', $descr, 0.01, $entry['cyanCemCurrent']);
discover_sensor('current', $device, ".1.3.6.1.4.1.28533.5.30.50.1.1.1.11.$index", $index, 'cyanCemCurrent', $descr, 0.01, $entry['cyanCemCurrent']);
$options = array();
$options['limit_high'] = $entry['cyanCemIntakeTempAlarmHighThres'] * 0.001;
$options['limit_low'] = $entry['cyanCemIntakeTempAlarmLowThres'] * 0.001;
$options['warn_high'] = $entry['cyanCemIntakeTempWarnHighThres'] * 0.001;
$options['warn_low'] = $entry['cyanCemIntakeTempWarnLowThres'] * 0.001;
$options = [];
$options['limit_high'] = $entry['cyanCemIntakeTempAlarmHighThres'] * 0.001;
$options['limit_low'] = $entry['cyanCemIntakeTempAlarmLowThres'] * 0.001;
$options['warn_high'] = $entry['cyanCemIntakeTempWarnHighThres'] * 0.001;
$options['warn_low'] = $entry['cyanCemIntakeTempWarnLowThres'] * 0.001;
discover_sensor('temperature', $device, ".1.3.6.1.4.1.28533.5.30.50.1.1.1.20.$index", $index, 'cyanCemIntakeAirTemp', $descr. ' Intake', 0.001, $entry['cyanCemIntakeAirTemp'], $options);
discover_sensor('temperature', $device, ".1.3.6.1.4.1.28533.5.30.50.1.1.1.20.$index", $index, 'cyanCemIntakeAirTemp', $descr . ' Intake', 0.001, $entry['cyanCemIntakeAirTemp'], $options);
$options = array();
$options['limit_high'] = $entry['cyanCemExhaustTempAlarmHighThres'] * 0.001;
$options['limit_low'] = $entry['cyanCemExhaustTempAlarmLowThres'] * 0.001;
$options['warn_high'] = $entry['cyanCemExhaustTempWarnHighThres'] * 0.001;
$options['warn_low'] = $entry['cyanCemExhaustTempWarnLowThres'] * 0.001;
$options = [];
$options['limit_high'] = $entry['cyanCemExhaustTempAlarmHighThres'] * 0.001;
$options['limit_low'] = $entry['cyanCemExhaustTempAlarmLowThres'] * 0.001;
$options['warn_high'] = $entry['cyanCemExhaustTempWarnHighThres'] * 0.001;
$options['warn_low'] = $entry['cyanCemExhaustTempWarnLowThres'] * 0.001;
discover_sensor('temperature', $device, ".1.3.6.1.4.1.28533.5.30.50.1.1.1.13.$index", $index, 'cyanCemExhaustAirTemp', $descr. ' Exhaust', 0.001, $entry['cyanCemExhaustAirTemp'], $options);
discover_sensor('temperature', $device, ".1.3.6.1.4.1.28533.5.30.50.1.1.1.13.$index", $index, 'cyanCemExhaustAirTemp', $descr . ' Exhaust', 0.001, $entry['cyanCemExhaustAirTemp'], $options);
$options = array();
$options['limit_high'] = $entry['cyanCemOvervoltageThreshold'] * 0.001;
$options['limit_low'] = $entry['cyanCemUndervoltageThreshold'] * 0.001;
$options = [];
$options['limit_high'] = $entry['cyanCemOvervoltageThreshold'] * 0.001;
$options['limit_low'] = $entry['cyanCemUndervoltageThreshold'] * 0.001;
discover_sensor('voltage', $device, ".1.3.6.1.4.1.28533.5.30.50.1.1.1.43.$index", $index, 'cyanCemPwrFeedAVoltage', $descr.' Feed A', 0.001, $entry['cyanCemPwrFeedAVoltage'], $options);
discover_sensor('voltage', $device, ".1.3.6.1.4.1.28533.5.30.50.1.1.1.45.$index", $index, 'cyanCemPwrFeedBVoltage', $descr.' Feed B', 0.001, $entry['cyanCemPwrFeedBVoltage'], $options);
discover_sensor('voltage', $device, ".1.3.6.1.4.1.28533.5.30.50.1.1.1.43.$index", $index, 'cyanCemPwrFeedAVoltage', $descr . ' Feed A', 0.001, $entry['cyanCemPwrFeedAVoltage'], $options);
discover_sensor('voltage', $device, ".1.3.6.1.4.1.28533.5.30.50.1.1.1.45.$index", $index, 'cyanCemPwrFeedBVoltage', $descr . ' Feed B', 0.001, $entry['cyanCemPwrFeedBVoltage'], $options);
}

View File

@ -5,9 +5,9 @@
*
* This file is part of Observium.
*
* @package observium
* @subpackage discovery
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2019 Observium Limited
* @package observium
* @subpackage discovery
* @copyright (C) Adam Armstrong
*
*/
@ -18,12 +18,11 @@ cyanXcvrTxPwrLoAlrmThres.1.1.1 = -3000
cyanXcvrTxPwrLoWarnThres.1.1.1 = -2000
*/
$oids = array ('cyanXcvrTxPwrHiAlrmThres', 'cyanXcvrTxPwrHiWarnThres', 'cyanXcvrTxPwrLoAlrmThres', 'cyanXcvrTxPwrLoWarnThres');
$oids = ['cyanXcvrTxPwrHiAlrmThres', 'cyanXcvrTxPwrHiWarnThres', 'cyanXcvrTxPwrLoAlrmThres', 'cyanXcvrTxPwrLoWarnThres'];
$thresholds = array();
foreach ($oids as $oid)
{
$thresholds = snmpwalk_cache_oid($device, $oid, $thresholds, 'CYAN-XCVR-MIB:CYAN-GEPORT-MIB:CYAN-TENGPORT-MIB');
$thresholds = [];
foreach ($oids as $oid) {
$thresholds = snmpwalk_cache_oid($device, $oid, $thresholds, 'CYAN-XCVR-MIB:CYAN-GEPORT-MIB:CYAN-TENGPORT-MIB');
}
/*
@ -42,54 +41,56 @@ cyanGEPortTxPwr.1.1.24.1 = -5224
cyanGEPortTxStatus.1.1.24.1 = on
*/
$data = array();
$oids = array('cyanGEPortRxPwr', 'cyanGEPortTxPwr');
foreach ($oids as $oid)
{
$data = snmpwalk_cache_oid($device, $oid, $data, 'CYAN-GEPORT-MIB');
$data = [];
$oids = ['cyanGEPortRxPwr', 'cyanGEPortTxPwr'];
foreach ($oids as $oid) {
$data = snmpwalk_cache_oid($device, $oid, $data, 'CYAN-GEPORT-MIB');
}
// Try to identify which IF-MIB port is being referred to, and populate the 'measured_entity' if we can.
$ifNames = snmpwalk_cache_oid($device, 'ifName', array(), 'IF-MIB');
foreach ($ifNames as $ifIndex => $entry)
{
$ifNames = snmpwalk_cache_oid($device, 'ifName', [], 'IF-MIB');
foreach ($ifNames as $ifIndex => $entry) {
list(, $cyan_index) = explode("-", $entry['ifName'], 2);
[, $cyan_index] = explode("-", $entry['ifName'], 2);
if ($port = get_port_by_ifIndex($device['device_id'], $ifIndex))
{
$port_translates[$cyan_index]['measured_entity'] = $port['port_id'];
}
if ($port = get_port_by_ifIndex($device['device_id'], $ifIndex)) {
$port_translates[$cyan_index]['measured_entity'] = $port['port_id'];
}
}
foreach ($data as $index => $entry)
{
foreach ($data as $index => $entry) {
list($shelf_id, $mod_id, $xcvr_id, $port_id) = explode(".", $index);
[$shelf_id, $mod_id, $xcvr_id, $port_id] = explode(".", $index);
$descr = "Transceiver ".$shelf_id."-".$mod_id."-".$xcvr_id." (".$port_id.")";
$xcvr_string = $shelf_id."-".$mod_id."-".$xcvr_id;
$descr = "Transceiver " . $shelf_id . "-" . $mod_id . "-" . $xcvr_id . " (" . $port_id . ")";
$xcvr_string = $shelf_id . "-" . $mod_id . "-" . $xcvr_id;
$options = array();
if (isset($port_translates[$xcvr_string]['measured_entity'])) { $options['measured_entity'] = $port_translates[$xcvr_string]['measured_entity']; $options['measured_class'] = 'port'; }
$options = [];
if (isset($port_translates[$xcvr_string]['measured_entity'])) {
$options['measured_entity'] = $port_translates[$xcvr_string]['measured_entity'];
$options['measured_class'] = 'port';
}
// $options['limit_high'] = $entry['cyanXcvrTxBiasHiAlrmThres'] * 0.001;
// $options['limit_low'] = $entry['cyanXcvrTxBiasLoAlrmThres'] * 0.001;
// $options['warn_high'] = $entry['cyanXcvrTxBiasHiWarnThres'] * 0.001;
// $options['warn_low'] = $entry['cyanXcvrTxBiasHiWarnThres'] * 0.001;
discover_sensor('dbm', $device, ".1.3.6.1.4.1.28533.5.30.160.1.1.1.16." . $index, $index, 'cyanGEPortTxPwr', $descr. " RX Power", 0.001, $entry['cyanGEPortTxPwr'], $options);
discover_sensor('dbm', $device, ".1.3.6.1.4.1.28533.5.30.160.1.1.1.16." . $index, $index, 'cyanGEPortTxPwr', $descr . " RX Power", 0.001, $entry['cyanGEPortTxPwr'], $options);
$options = array();
if (isset($port_translates[$xcvr_string]['measured_entity'])) { $options['measured_entity'] = $port_translates[$xcvr_string]['measured_entity']; $options['measured_class'] = 'port'; }
$options = [];
if (isset($port_translates[$xcvr_string]['measured_entity'])) {
$options['measured_entity'] = $port_translates[$xcvr_string]['measured_entity'];
$options['measured_class'] = 'port';
}
// $options['limit_high'] = $entry['cyanXcvrVccVoltHiAlrmThres'] * 0.001;
// $options['limit_low'] = $entry['cyanXcvrVccVoltLoAlrmThres'] * 0.001;
// $options['warn_high'] = $entry['cyanXcvrVccVoltHiWarnThres'] * 0.001;
// $options['warn_low'] = $entry['cyanXcvrVccVoltHiWarnThres'] * 0.001;
discover_sensor('dbm', $device, ".1.3.6.1.4.1.28533.5.30.160.1.1.1.13." . $index, $index, 'cyanGEPortRxPwr', $descr . " TX Power", 0.001, $entry['cyanGEPortRxPwr'], $options);
discover_sensor('dbm', $device, ".1.3.6.1.4.1.28533.5.30.160.1.1.1.13." . $index, $index, 'cyanGEPortRxPwr', $descr . " TX Power", 0.001, $entry['cyanGEPortRxPwr'], $options);
}

View File

@ -5,9 +5,9 @@
*
* This file is part of Observium.
*
* @package observium
* @subpackage discovery
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2019 Observium Limited
* @package observium
* @subpackage discovery
* @copyright (C) Adam Armstrong
*
*/
@ -18,12 +18,11 @@ cyanXcvrTxPwrLoAlrmThres.1.1.1 = -3000
cyanXcvrTxPwrLoWarnThres.1.1.1 = -2000
*/
$oids = array ('cyanXcvrTxPwrHiAlrmThres', 'cyanXcvrTxPwrHiWarnThres', 'cyanXcvrTxPwrLoAlrmThres', 'cyanXcvrTxPwrLoWarnThres');
$oids = ['cyanXcvrTxPwrHiAlrmThres', 'cyanXcvrTxPwrHiWarnThres', 'cyanXcvrTxPwrLoAlrmThres', 'cyanXcvrTxPwrLoWarnThres'];
$thresholds = array();
foreach ($oids as $oid)
{
$thresholds = snmpwalk_cache_oid($device, $oid, $thresholds, 'CYAN-XCVR-MIB:CYAN-GEPORT-MIB:CYAN-TENGPORT-MIB');
$thresholds = [];
foreach ($oids as $oid) {
$thresholds = snmpwalk_cache_oid($device, $oid, $thresholds, 'CYAN-XCVR-MIB:CYAN-GEPORT-MIB:CYAN-TENGPORT-MIB');
}
/*
@ -44,54 +43,56 @@ cyanTENGPortTxPwr.1.1.1.1 = 0
cyanTENGPortTxStatus.1.1.1.1 = on
*/
$data = array();
$oids = array('cyanTENGPortRxPwr', 'cyanTENGPortTxPwr');
foreach ($oids as $oid)
{
$data = snmpwalk_cache_oid($device, $oid, $data, 'CYAN-TENGPORT-MIB');
$data = [];
$oids = ['cyanTENGPortRxPwr', 'cyanTENGPortTxPwr'];
foreach ($oids as $oid) {
$data = snmpwalk_cache_oid($device, $oid, $data, 'CYAN-TENGPORT-MIB');
}
// Try to identify which IF-MIB port is being referred to, and populate the 'measured_entity' if we can.
$ifNames = snmpwalk_cache_oid($device, 'ifName', array(), 'IF-MIB');
foreach ($ifNames as $ifIndex => $entry)
{
$ifNames = snmpwalk_cache_oid($device, 'ifName', [], 'IF-MIB');
foreach ($ifNames as $ifIndex => $entry) {
list(, $cyan_index) = explode("-", $entry['ifName'], 2);
[, $cyan_index] = explode("-", $entry['ifName'], 2);
if ($port = get_port_by_ifIndex($device['device_id'], $ifIndex))
{
$port_translates[$cyan_index]['measured_entity'] = $port['port_id'];
}
if ($port = get_port_by_ifIndex($device['device_id'], $ifIndex)) {
$port_translates[$cyan_index]['measured_entity'] = $port['port_id'];
}
}
foreach ($data as $index => $entry)
{
foreach ($data as $index => $entry) {
list($shelf_id, $mod_id, $xcvr_id, $port_id) = explode(".", $index);
[$shelf_id, $mod_id, $xcvr_id, $port_id] = explode(".", $index);
$descr = "Transceiver ".$shelf_id."-".$mod_id."-".$xcvr_id." (".$port_id.")";
$xcvr_string = $shelf_id."-".$mod_id."-".$xcvr_id;
$descr = "Transceiver " . $shelf_id . "-" . $mod_id . "-" . $xcvr_id . " (" . $port_id . ")";
$xcvr_string = $shelf_id . "-" . $mod_id . "-" . $xcvr_id;
$options = array();
if (isset($port_translates[$xcvr_string]['measured_entity'])) { $options['measured_entity'] = $port_translates[$xcvr_string]['measured_entity']; $options['measured_class'] = 'port'; }
$options = [];
if (isset($port_translates[$xcvr_string]['measured_entity'])) {
$options['measured_entity'] = $port_translates[$xcvr_string]['measured_entity'];
$options['measured_class'] = 'port';
}
// $options['limit_high'] = $entry['cyanXcvrTxBiasHiAlrmThres'] * 0.001;
// $options['limit_low'] = $entry['cyanXcvrTxBiasLoAlrmThres'] * 0.001;
// $options['warn_high'] = $entry['cyanXcvrTxBiasHiWarnThres'] * 0.001;
// $options['warn_low'] = $entry['cyanXcvrTxBiasHiWarnThres'] * 0.001;
discover_sensor('dbm', $device, ".1.3.6.1.4.1.28533.5.30.150.1.1.1.18." . $index, $index, 'cyanTENGPortTxPwr', $descr. " TX Power", 0.001, $entry['cyanTENGPortTxPwr'], $options);
discover_sensor('dbm', $device, ".1.3.6.1.4.1.28533.5.30.150.1.1.1.18." . $index, $index, 'cyanTENGPortTxPwr', $descr . " TX Power", 0.001, $entry['cyanTENGPortTxPwr'], $options);
$options = array();
if (isset($port_translates[$xcvr_string]['measured_entity'])) { $options['measured_entity'] = $port_translates[$xcvr_string]['measured_entity']; $options['measured_class'] = 'port'; }
$options = [];
if (isset($port_translates[$xcvr_string]['measured_entity'])) {
$options['measured_entity'] = $port_translates[$xcvr_string]['measured_entity'];
$options['measured_class'] = 'port';
}
// $options['limit_high'] = $entry['cyanXcvrVccVoltHiAlrmThres'] * 0.001;
// $options['limit_low'] = $entry['cyanXcvrVccVoltLoAlrmThres'] * 0.001;
// $options['warn_high'] = $entry['cyanXcvrVccVoltHiWarnThres'] * 0.001;
// $options['warn_low'] = $entry['cyanXcvrVccVoltHiWarnThres'] * 0.001;
discover_sensor('dbm', $device, ".1.3.6.1.4.1.28533.5.30.150.1.1.1.14." . $index, $index, 'cyanTENGPortRxPwr', $descr . " RX Power", 0.001, $entry['cyanTENGPortRxPwr'], $options);
discover_sensor('dbm', $device, ".1.3.6.1.4.1.28533.5.30.150.1.1.1.14." . $index, $index, 'cyanTENGPortRxPwr', $descr . " RX Power", 0.001, $entry['cyanTENGPortRxPwr'], $options);
}

View File

@ -5,9 +5,9 @@
*
* This file is part of Observium.
*
* @package observium
* @subpackage discovery
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2019 Observium Limited
* @package observium
* @subpackage discovery
* @copyright (C) Adam Armstrong
*
*/
@ -33,62 +33,67 @@ cyanXcvrVccVoltLoWarnThres.1.1.1 = 3134
cyanXcvrVccVoltage.1.1.1 = 3324
*/
$oids = array ('cyanXcvrTempHiAlrmThres', 'cyanXcvrTempHiWarnThres', 'cyanXcvrTempLoAlrmThres', 'cyanXcvrTempLoWarnThres', 'cyanXcvrTemperature', 'cyanXcvrTxBiasCurrent', 'cyanXcvrTxBiasHiAlrmThres', 'cyanXcvrTxBiasHiWarnThres', 'cyanXcvrTxBiasLoAlrmThres', 'cyanXcvrTxBiasLoWarnThres', 'cyanXcvrVccVoltHiAlrmThres', 'cyanXcvrVccVoltHiWarnThres', 'cyanXcvrVccVoltLoAlrmThres', 'cyanXcvrVccVoltLoWarnThres', 'cyanXcvrVccVoltage', 'cyanXcvrTxPwrHiAlrmThres', 'cyanXcvrTxPwrHiWarnThres', 'cyanXcvrTxPwrLoAlrmThres', 'cyanXcvrTxPwrLoWarnThres');
$oids = ['cyanXcvrTempHiAlrmThres', 'cyanXcvrTempHiWarnThres', 'cyanXcvrTempLoAlrmThres', 'cyanXcvrTempLoWarnThres', 'cyanXcvrTemperature', 'cyanXcvrTxBiasCurrent', 'cyanXcvrTxBiasHiAlrmThres', 'cyanXcvrTxBiasHiWarnThres', 'cyanXcvrTxBiasLoAlrmThres', 'cyanXcvrTxBiasLoWarnThres', 'cyanXcvrVccVoltHiAlrmThres', 'cyanXcvrVccVoltHiWarnThres', 'cyanXcvrVccVoltLoAlrmThres', 'cyanXcvrVccVoltLoWarnThres', 'cyanXcvrVccVoltage', 'cyanXcvrTxPwrHiAlrmThres', 'cyanXcvrTxPwrHiWarnThres', 'cyanXcvrTxPwrLoAlrmThres', 'cyanXcvrTxPwrLoWarnThres'];
$data = array();
foreach ($oids as $oid)
{
$data = snmpwalk_cache_oid($device, $oid, $data, 'CYAN-XCVR-MIB:CYAN-GEPORT-MIB:CYAN-TENGPORT-MIB');
$data = [];
foreach ($oids as $oid) {
$data = snmpwalk_cache_oid($device, $oid, $data, 'CYAN-XCVR-MIB:CYAN-GEPORT-MIB:CYAN-TENGPORT-MIB');
}
// Try to identify which IF-MIB port is being referred to, and populate the 'measured_entity' if we can.
$ifNames = snmpwalk_cache_oid($device, 'ifName', array(), 'IF-MIB');
foreach ($ifNames as $ifIndex => $entry)
{
$ifNames = snmpwalk_cache_oid($device, 'ifName', [], 'IF-MIB');
foreach ($ifNames as $ifIndex => $entry) {
list(, $cyan_index) = explode("-", $entry['ifName'], 2);
$cyan_index = str_replace("-", ".", $cyan_index);
[, $cyan_index] = explode("-", $entry['ifName'], 2);
$cyan_index = str_replace("-", ".", $cyan_index);
if (is_array($data[$cyan_index]))
{
$port = get_port_by_ifIndex($device['device_id'], $ifIndex);
$data[$cyan_index]['measured_entity'] = $port['port_id'];
}
if (is_array($data[$cyan_index])) {
$port = get_port_by_ifIndex($device['device_id'], $ifIndex);
$data[$cyan_index]['measured_entity'] = $port['port_id'];
}
}
foreach ($data as $index => $entry)
{
foreach ($data as $index => $entry) {
$descr = "Transceiver " . str_replace(".", "-", $index);
$descr = "Transceiver " . str_replace(".", "-", $index);
$options = array();
if (isset($entry['measured_entity'])) { $options['measured_entity'] = $entry['measured_entity']; $options['measured_class'] = 'port'; }
$options['limit_high'] = $entry['cyanXcvrTxBiasHiAlrmThres'] * 0.001;
$options['limit_low'] = $entry['cyanXcvrTxBiasLoAlrmThres'] * 0.001;
$options['warn_high'] = $entry['cyanXcvrTxBiasHiWarnThres'] * 0.001;
$options['warn_low'] = $entry['cyanXcvrTxBiasHiWarnThres'] * 0.001;
$options = [];
if (isset($entry['measured_entity'])) {
$options['measured_entity'] = $entry['measured_entity'];
$options['measured_class'] = 'port';
}
$options['limit_high'] = $entry['cyanXcvrTxBiasHiAlrmThres'] * 0.001;
$options['limit_low'] = $entry['cyanXcvrTxBiasLoAlrmThres'] * 0.001;
$options['warn_high'] = $entry['cyanXcvrTxBiasHiWarnThres'] * 0.001;
$options['warn_low'] = $entry['cyanXcvrTxBiasHiWarnThres'] * 0.001;
discover_sensor('current', $device, ".1.3.6.1.4.1.28533.5.30.140.1.1.1.43." . $index, $index, 'cyanXcvrTxBiasCurrent', $descr. " TX Bias", 0.001, $entry['cyanXcvrTxBiasCurrent'], $options);
discover_sensor('current', $device, ".1.3.6.1.4.1.28533.5.30.140.1.1.1.43." . $index, $index, 'cyanXcvrTxBiasCurrent', $descr . " TX Bias", 0.001, $entry['cyanXcvrTxBiasCurrent'], $options);
$options = array();
if (isset($entry['measured_entity'])) { $options['measured_entity'] = $entry['measured_entity']; $options['measured_class'] = 'port'; }
$options['limit_high'] = $entry['cyanXcvrTempHiAlrmThres'] * 0.001;
$options['limit_low'] = $entry['cyanXcvrTempLoAlrmThres'] * 0.001;
$options['warn_high'] = $entry['cyanXcvrTempHiWarnThres'] * 0.001;
$options['warn_low'] = $entry['cyanXcvrTempHiWarnThres'] * 0.001;
$options = [];
if (isset($entry['measured_entity'])) {
$options['measured_entity'] = $entry['measured_entity'];
$options['measured_class'] = 'port';
}
$options['limit_high'] = $entry['cyanXcvrTempHiAlrmThres'] * 0.001;
$options['limit_low'] = $entry['cyanXcvrTempLoAlrmThres'] * 0.001;
$options['warn_high'] = $entry['cyanXcvrTempHiWarnThres'] * 0.001;
$options['warn_low'] = $entry['cyanXcvrTempHiWarnThres'] * 0.001;
discover_sensor('temperature', $device, ".1.3.6.1.4.1.28533.5.30.140.1.1.1.42." . $index, $index, 'cyanXcvrTemperature', $descr, 0.001, $entry['cyanXcvrTemperature'], $options);
discover_sensor('temperature', $device, ".1.3.6.1.4.1.28533.5.30.140.1.1.1.42." . $index, $index, 'cyanXcvrTemperature', $descr, 0.001, $entry['cyanXcvrTemperature'], $options);
$options = array();
if (isset($entry['measured_entity'])) { $options['measured_entity'] = $entry['measured_entity']; $options['measured_class'] = 'port'; }
$options['limit_high'] = $entry['cyanXcvrVccVoltHiAlrmThres'] * 0.001;
$options['limit_low'] = $entry['cyanXcvrVccVoltLoAlrmThres'] * 0.001;
$options['warn_high'] = $entry['cyanXcvrVccVoltHiWarnThres'] * 0.001;
$options['warn_low'] = $entry['cyanXcvrVccVoltHiWarnThres'] * 0.001;
$options = [];
if (isset($entry['measured_entity'])) {
$options['measured_entity'] = $entry['measured_entity'];
$options['measured_class'] = 'port';
}
$options['limit_high'] = $entry['cyanXcvrVccVoltHiAlrmThres'] * 0.001;
$options['limit_low'] = $entry['cyanXcvrVccVoltLoAlrmThres'] * 0.001;
$options['warn_high'] = $entry['cyanXcvrVccVoltHiWarnThres'] * 0.001;
$options['warn_low'] = $entry['cyanXcvrVccVoltHiWarnThres'] * 0.001;
discover_sensor('voltage', $device, ".1.3.6.1.4.1.28533.5.30.140.1.1.1.56." . $index, $index, 'cyanXcvrVccVoltage', $descr . " Vcc", 0.001, $entry['cyanXcvrVccVoltage'], $options);
discover_sensor('voltage', $device, ".1.3.6.1.4.1.28533.5.30.140.1.1.1.56." . $index, $index, 'cyanXcvrVccVoltage', $descr . " Vcc", 0.001, $entry['cyanXcvrVccVoltage'], $options);
}

View File

@ -6,7 +6,7 @@
*
* @package observium
* @subpackage discovery
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2022 Observium Limited
* @copyright (C) Adam Armstrong
*
*/
@ -79,7 +79,9 @@ DDM-MGMT-MIB::swDdmPortShutdown.1 = INTEGER: none(3)
$oids = snmpwalk_cache_oid($device, 'swDdmStatusTable', [], $mib);
print_debug_vars($oids);
if (!snmp_status()) { return; }
if (!snmp_status()) {
return;
}
// oid exists on D-Link
//// -- DGS-3627G 1A1G with firmware 3.03.B04
@ -94,122 +96,134 @@ if (!snmp_status()) { return; }
//DDM-MGMT-MIB::swDdmPowerUnit.0 = INTEGER: dbm(2)
$power_unit = snmp_get_oid($device, 'swDdmPowerUnit.0', $mib);
if (!snmp_status()) { $power_unit = 'mw'; }
if (!snmp_status()) {
$power_unit = 'mw';
}
$oids_limit = snmpwalk_cache_twopart_oid($device, 'swDdmThresholdMgmtEntry', [], $mib);
print_debug_vars($oids_limit);
foreach ($oids as $index => $entry) {
$entry['index'] = $index;
$match = [ 'measured_match' => [ 'entity_type' => 'port', 'field' => 'ifIndex', 'match' => '%index%' ] ];
$options = entity_measured_match_definition($device, $match, $entry);
$entry['index'] = $index;
$match = ['measured_match' => ['entity_type' => 'port', 'field' => 'ifIndex', 'match' => '%index%']];
$options = entity_measured_match_definition($device, $match, $entry);
$name = $options['port_label'];
$name = $options['port_label'];
// Temperature
$descr = $name . ' Temperature';
$class = 'temperature';
$oid_name = 'swDdmTemperature';
$oid_num = '.1.3.6.1.4.1.171.12.72.2.1.1.1.2.'.$index;
$scale = 1;
$value = $entry[$oid_name];
// Temperature
$descr = $name . ' Temperature';
$class = 'temperature';
$oid_name = 'swDdmTemperature';
$oid_num = '.1.3.6.1.4.1.171.12.72.2.1.1.1.2.' . $index;
$scale = 1;
$value = $entry[$oid_name];
$limits = [];
$limit_type = 'temperature';
$limits_oids = [ 'limit_high' => 'swDdmHighAlarm', 'limit_high_warn' => 'swDdmHighWarning',
'limit_low' => 'swDdmLowAlarm', 'limit_low_warn' => 'swDdmLowWarning' ];
foreach ($limits_oids as $limit => $limit_oid) {
// Prevent php8 fatal errors
if (!is_numeric($oids_limit[$index][$limit_type][$limit_oid])) { continue; }
$limits = [];
$limit_type = 'temperature';
$limits_oids = ['limit_high' => 'swDdmHighAlarm', 'limit_high_warn' => 'swDdmHighWarning',
'limit_low' => 'swDdmLowAlarm', 'limit_low_warn' => 'swDdmLowWarning'];
foreach ($limits_oids as $limit => $limit_oid) {
// Prevent php8 fatal errors
if (!is_numeric($oids_limit[$index][$limit_type][$limit_oid])) {
continue;
}
$limits[$limit] = $oids_limit[$index][$limit_type][$limit_oid] * $scale;
}
$limits[$limit] = $oids_limit[$index][$limit_type][$limit_oid] * $scale;
}
discover_sensor_ng($device, $class, $mib, $oid_name, $oid_num, $index, NULL, $descr, $scale, $value, array_merge($options, $limits));
discover_sensor_ng($device, $class, $mib, $oid_name, $oid_num, $index, $descr, $scale, $value, array_merge($options, $limits));
// Voltage
$descr = $name . ' Voltage';
$class = 'voltage';
$oid_name = 'swDdmVoltage';
$oid_num = '.1.3.6.1.4.1.171.12.72.2.1.1.1.3.'.$index;
$scale = 1;
$value = $entry[$oid_name];
// Voltage
$descr = $name . ' Voltage';
$class = 'voltage';
$oid_name = 'swDdmVoltage';
$oid_num = '.1.3.6.1.4.1.171.12.72.2.1.1.1.3.' . $index;
$scale = 1;
$value = $entry[$oid_name];
$limits = [];
$limit_type = 'voltage';
$limits_oids = [ 'limit_high' => 'swDdmHighAlarm', 'limit_high_warn' => 'swDdmHighWarning',
'limit_low' => 'swDdmLowAlarm', 'limit_low_warn' => 'swDdmLowWarning' ];
foreach ($limits_oids as $limit => $limit_oid) {
// Prevent php8 fatal errors
if (!is_numeric($oids_limit[$index][$limit_type][$limit_oid])) { continue; }
$limits = [];
$limit_type = 'voltage';
$limits_oids = ['limit_high' => 'swDdmHighAlarm', 'limit_high_warn' => 'swDdmHighWarning',
'limit_low' => 'swDdmLowAlarm', 'limit_low_warn' => 'swDdmLowWarning'];
foreach ($limits_oids as $limit => $limit_oid) {
// Prevent php8 fatal errors
if (!is_numeric($oids_limit[$index][$limit_type][$limit_oid])) {
continue;
}
$limits[$limit] = $oids_limit[$index][$limit_type][$limit_oid] * $scale;
}
$limits[$limit] = $oids_limit[$index][$limit_type][$limit_oid] * $scale;
}
discover_sensor_ng($device, $class, $mib, $oid_name, $oid_num, $index, NULL, $descr, $scale, $value, array_merge($options, $limits));
discover_sensor_ng($device, $class, $mib, $oid_name, $oid_num, $index, $descr, $scale, $value, array_merge($options, $limits));
// Tx Bias
$descr = $name . ' Tx Bias';
$class = 'current';
$oid_name = 'swDdmBiasCurrent';
$oid_num = '.1.3.6.1.4.1.171.12.72.2.1.1.1.4.'.$index;
$scale = 0.001;
$value = $entry[$oid_name];
// Tx Bias
$descr = $name . ' Tx Bias';
$class = 'current';
$oid_name = 'swDdmBiasCurrent';
$oid_num = '.1.3.6.1.4.1.171.12.72.2.1.1.1.4.' . $index;
$scale = 0.001;
$value = $entry[$oid_name];
$limits = [];
$limit_type = 'bias';
$limits_oids = [ 'limit_high' => 'swDdmHighAlarm', 'limit_high_warn' => 'swDdmHighWarning',
'limit_low' => 'swDdmLowAlarm', 'limit_low_warn' => 'swDdmLowWarning' ];
foreach ($limits_oids as $limit => $limit_oid) {
// Prevent php8 fatal errors
if (!is_numeric($oids_limit[$index][$limit_type][$limit_oid])) { continue; }
$limits = [];
$limit_type = 'bias';
$limits_oids = ['limit_high' => 'swDdmHighAlarm', 'limit_high_warn' => 'swDdmHighWarning',
'limit_low' => 'swDdmLowAlarm', 'limit_low_warn' => 'swDdmLowWarning'];
foreach ($limits_oids as $limit => $limit_oid) {
// Prevent php8 fatal errors
if (!is_numeric($oids_limit[$index][$limit_type][$limit_oid])) {
continue;
}
$limits[$limit] = $oids_limit[$index][$limit_type][$limit_oid] * $scale;
}
$limits[$limit] = $oids_limit[$index][$limit_type][$limit_oid] * $scale;
}
discover_sensor_ng($device, $class, $mib, $oid_name, $oid_num, $index, NULL, $descr, $scale, $value, array_merge($options, $limits));
discover_sensor_ng($device, $class, $mib, $oid_name, $oid_num, $index, $descr, $scale, $value, array_merge($options, $limits));
// Tx Power
$descr = $name . ' Tx Power';
$class = $power_unit === 'mw' ? 'power' : 'dbm';
$oid_name = 'swDdmTxPower';
$oid_num = '.1.3.6.1.4.1.171.12.72.2.1.1.1.5.'.$index;
$scale = $power_unit === 'mw' ? 0.001 : 1;
$value = $entry[$oid_name];
// Tx Power
$descr = $name . ' Tx Power';
$class = $power_unit === 'mw' ? 'power' : 'dbm';
$oid_name = 'swDdmTxPower';
$oid_num = '.1.3.6.1.4.1.171.12.72.2.1.1.1.5.' . $index;
$scale = $power_unit === 'mw' ? 0.001 : 1;
$value = $entry[$oid_name];
$limits = [];
$limit_type = 'txPower';
$limits_oids = [ 'limit_high' => 'swDdmHighAlarm', 'limit_high_warn' => 'swDdmHighWarning',
'limit_low' => 'swDdmLowAlarm', 'limit_low_warn' => 'swDdmLowWarning' ];
foreach ($limits_oids as $limit => $limit_oid) {
// Prevent php8 fatal errors
if (!is_numeric($oids_limit[$index][$limit_type][$limit_oid])) { continue; }
$limits = [];
$limit_type = 'txPower';
$limits_oids = ['limit_high' => 'swDdmHighAlarm', 'limit_high_warn' => 'swDdmHighWarning',
'limit_low' => 'swDdmLowAlarm', 'limit_low_warn' => 'swDdmLowWarning'];
foreach ($limits_oids as $limit => $limit_oid) {
// Prevent php8 fatal errors
if (!is_numeric($oids_limit[$index][$limit_type][$limit_oid])) {
continue;
}
$limits[$limit] = $oids_limit[$index][$limit_type][$limit_oid] * $scale;
}
$limits[$limit] = $oids_limit[$index][$limit_type][$limit_oid] * $scale;
}
discover_sensor_ng($device, $class, $mib, $oid_name, $oid_num, $index, NULL, $descr, $scale, $value, array_merge($options, $limits));
discover_sensor_ng($device, $class, $mib, $oid_name, $oid_num, $index, $descr, $scale, $value, array_merge($options, $limits));
// Rx Power
$descr = $name . ' Rx Power';
$class = $power_unit === 'mw' ? 'power' : 'dbm';
$oid_name = 'swDdmRxPower';
$oid_num = '.1.3.6.1.4.1.171.12.72.2.1.1.1.6.'.$index;
$scale = $power_unit === 'mw' ? 0.001 : 1;
$value = $entry[$oid_name];
// Rx Power
$descr = $name . ' Rx Power';
$class = $power_unit === 'mw' ? 'power' : 'dbm';
$oid_name = 'swDdmRxPower';
$oid_num = '.1.3.6.1.4.1.171.12.72.2.1.1.1.6.' . $index;
$scale = $power_unit === 'mw' ? 0.001 : 1;
$value = $entry[$oid_name];
$limits = [];
$limit_type = 'rxPower';
$limits_oids = [ 'limit_high' => 'swDdmHighAlarm', 'limit_high_warn' => 'swDdmHighWarning',
'limit_low' => 'swDdmLowAlarm', 'limit_low_warn' => 'swDdmLowWarning' ];
foreach ($limits_oids as $limit => $limit_oid) {
// Prevent php8 fatal errors
if (!is_numeric($oids_limit[$index][$limit_type][$limit_oid])) { continue; }
$limits = [];
$limit_type = 'rxPower';
$limits_oids = ['limit_high' => 'swDdmHighAlarm', 'limit_high_warn' => 'swDdmHighWarning',
'limit_low' => 'swDdmLowAlarm', 'limit_low_warn' => 'swDdmLowWarning'];
foreach ($limits_oids as $limit => $limit_oid) {
// Prevent php8 fatal errors
if (!is_numeric($oids_limit[$index][$limit_type][$limit_oid])) {
continue;
}
$limits[$limit] = $oids_limit[$index][$limit_type][$limit_oid] * $scale;
}
$limits[$limit] = $oids_limit[$index][$limit_type][$limit_oid] * $scale;
}
discover_sensor_ng($device, $class, $mib, $oid_name, $oid_num, $index, NULL, $descr, $scale, $value, array_merge($options, $limits));
discover_sensor_ng($device, $class, $mib, $oid_name, $oid_num, $index, $descr, $scale, $value, array_merge($options, $limits));
}
// EOF

View File

@ -6,7 +6,7 @@
*
* @package observium
* @subpackage discovery
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2021 Observium Limited
* @copyright (C) Adam Armstrong
*
*/
@ -17,72 +17,66 @@
echo("DELL-NETWORKING-CHASSIS-MIB ");
$units = array();
$units = [];
$oids = snmpwalk_cache_oid($device, "dellNetStackUnitTemp", array(), "DELL-NETWORKING-CHASSIS-MIB");
$oids = snmpwalk_cache_oid($device, "dellNetStackUnitStatus", $oids, "DELL-NETWORKING-CHASSIS-MIB");
$oids = snmpwalk_cache_oid($device, "dellNetStackUnitTemp", [], "DELL-NETWORKING-CHASSIS-MIB");
$oids = snmpwalk_cache_oid($device, "dellNetStackUnitStatus", $oids, "DELL-NETWORKING-CHASSIS-MIB");
foreach ($oids as $index => $entry)
{
foreach ($oids as $index => $entry) {
$descr = "Unit " . strval($index - 1);
$units[$index] = $descr; // Store Unit name for other sensors
$descr = "Unit " . (string)($index - 1);
$units[$index] = $descr; // Store Unit name for other sensors
$oid_name = 'dellNetStackUnitTemp';
$oid_num = ".1.3.6.1.4.1.6027.3.26.1.3.4.1.13.{$index}";
$type = $mib . '-' . $oid_name;
$scale = 1;
$value = $entry[$oid_name];
$oid_name = 'dellNetStackUnitTemp';
$oid_num = ".1.3.6.1.4.1.6027.3.26.1.3.4.1.13.{$index}";
$scale = 1;
$value = $entry[$oid_name];
discover_sensor_ng($device,'temperature', $mib, $oid_name, $oid_num, $index, NULL, $descr, $scale, $value);
discover_sensor_ng($device, 'temperature', $mib, $oid_name, $oid_num, $index, $descr, $scale, $value);
$oid_name = 'dellNetStackUnitStatus';
$oid_num = ".1.3.6.1.4.1.6027.3.26.1.3.4.1.8.{$index}";
$type = 'dellNetStackUnitStatus';
$value = $entry[$oid_name];
$oid_name = 'dellNetStackUnitStatus';
$oid_num = ".1.3.6.1.4.1.6027.3.26.1.3.4.1.8.{$index}";
$type = 'dellNetStackUnitStatus';
$value = $entry[$oid_name];
discover_status_ng($device, $mib, $oid_name, $oid_num, $index, $type, $descr . ' Status', $value, array('entPhysicalClass' => 'device'));
discover_status_ng($device, $mib, $oid_name, $oid_num, $index, $type, $descr . ' Status', $value, ['entPhysicalClass' => 'device']);
}
$oids = snmpwalk_cache_oid($device, "dellNetFanTrayOperStatus", array(), "DELL-NETWORKING-CHASSIS-MIB", NULL, OBS_SNMP_ALL_NUMERIC_INDEX);
$oids = snmpwalk_cache_oid($device, "dellNetFanTrayOperStatus", [], "DELL-NETWORKING-CHASSIS-MIB", NULL, OBS_SNMP_ALL_NUMERIC_INDEX);
$oids = snmpwalk_cache_oid($device, "dellNetPowerSupplyOperStatus", $oids, "DELL-NETWORKING-CHASSIS-MIB", NULL, OBS_SNMP_ALL_NUMERIC_INDEX);
$oids = snmpwalk_cache_oid($device, "dellNetPowerSupplyUsage", $oids, "DELL-NETWORKING-CHASSIS-MIB", NULL, OBS_SNMP_ALL_NUMERIC_INDEX);
$oids = snmpwalk_cache_oid($device, "dellNetPowerSupplyUsage", $oids, "DELL-NETWORKING-CHASSIS-MIB", NULL, OBS_SNMP_ALL_NUMERIC_INDEX);
foreach ($oids as $index => $entry)
{
list($type, $unit, $tray) = explode('.', $index);
if (!isset($units[$unit]))
{
// Skip inactive Units
continue;
}
foreach ($oids as $index => $entry) {
[$type, $unit, $tray] = explode('.', $index);
if (!isset($units[$unit])) {
// Skip inactive Units
continue;
}
$descr = $units[$unit];
$descr = $units[$unit];
$oid_name = 'dellNetFanTrayOperStatus';
$oid_num = ".1.3.6.1.4.1.6027.3.26.1.4.7.1.4.{$index}";
$type = 'dellNetOperStatus';
$value = $entry[$oid_name];
$oid_name = 'dellNetFanTrayOperStatus';
$oid_num = ".1.3.6.1.4.1.6027.3.26.1.4.7.1.4.{$index}";
$type = 'dellNetOperStatus';
$value = $entry[$oid_name];
discover_status_ng($device, $mib, $oid_name, $oid_num, $index, $type, $descr . ' Fan '. $tray, $value, array('entPhysicalClass' => 'fan'));
discover_status_ng($device, $mib, $oid_name, $oid_num, $index, $type, $descr . ' Fan ' . $tray, $value, ['entPhysicalClass' => 'fan']);
$oid_name = 'dellNetPowerSupplyOperStatus';
$oid_num = ".1.3.6.1.4.1.6027.3.26.1.4.6.1.4.{$index}";
$type = 'dellNetOperStatus';
$value = $entry[$oid_name];
$oid_name = 'dellNetPowerSupplyOperStatus';
$oid_num = ".1.3.6.1.4.1.6027.3.26.1.4.6.1.4.{$index}";
$type = 'dellNetOperStatus';
$value = $entry[$oid_name];
discover_status_ng($device, $mib, $oid_name, $oid_num, $index, $type, $descr . ' PowerSupply '. $tray, $value, array('entPhysicalClass' => 'powersupply'));
discover_status_ng($device, $mib, $oid_name, $oid_num, $index, $type, $descr . ' PowerSupply ' . $tray, $value, ['entPhysicalClass' => 'powersupply']);
$oid_name = 'dellNetPowerSupplyUsage';
$oid_num = ".1.3.6.1.4.1.6027.3.26.1.4.6.1.10.{$index}";
$type = $mib . '-' . $oid_name;
$scale = 1;
$value = $entry[$oid_name];
$oid_name = 'dellNetPowerSupplyUsage';
$oid_num = ".1.3.6.1.4.1.6027.3.26.1.4.6.1.10.{$index}";
$scale = 1;
$value = $entry[$oid_name];
if ($value > 0)
{
discover_sensor_ng($device,'power', $mib, $oid_name, $oid_num, $index, NULL, $descr . ' PowerSupply '. $tray, $scale, $value);
}
if ($value > 0) {
discover_sensor_ng($device, 'power', $mib, $oid_name, $oid_num, $index, $descr . ' PowerSupply ' . $tray, $scale, $value);
}
}
// DOM sensors
@ -97,66 +91,59 @@ foreach ($oids as $index => $entry)
//DELL-NETWORKING-CHASSIS-MIB::dellNetSysIfXfpTxPower.2097284 = INTEGER: -5.36 dB
//DELL-NETWORKING-CHASSIS-MIB::dellNetSysIfXfpTxPower.2097412 = INTEGER: .00 dB
$oids = snmpwalk_cache_oid($device, "dellNetSysIfXfpRecvTemp", array(), "DELL-NETWORKING-CHASSIS-MIB");
if (safe_count($oids))
{
$oids = snmpwalk_cache_oid($device, "dellNetSysIfXfpRecvPower", $oids, "DELL-NETWORKING-CHASSIS-MIB");
$oids = snmpwalk_cache_oid($device, "dellNetSysIfXfpTxPower", $oids, "DELL-NETWORKING-CHASSIS-MIB");
if (OBS_DEBUG > 1) { print_vars($oids); }
foreach ($oids as $index => $entry)
{
if (($entry['dellNetSysIfXfpRecvPower'] === '655.35' && $entry['dellNetSysIfXfpTxPower'] === '655.35' && $entry['dellNetSysIfXfpRecvTemp'] === '65535') ||
($entry['dellNetSysIfXfpRecvPower'] === '.00' && $entry['dellNetSysIfXfpTxPower'] === '.00' && $entry['dellNetSysIfXfpRecvTemp'] === '0') ||
($entry['dellNetSysIfXfpRecvPower'] === '.00' && !is_numeric($entry['dellNetSysIfXfpTxPower']) && !is_numeric($entry['dellNetSysIfXfpRecvTemp'])))
{
continue;
$oids = snmpwalk_cache_oid($device, "dellNetSysIfXfpRecvTemp", [], "DELL-NETWORKING-CHASSIS-MIB");
if (safe_count($oids)) {
$oids = snmpwalk_cache_oid($device, "dellNetSysIfXfpRecvPower", $oids, "DELL-NETWORKING-CHASSIS-MIB");
$oids = snmpwalk_cache_oid($device, "dellNetSysIfXfpTxPower", $oids, "DELL-NETWORKING-CHASSIS-MIB");
if (OBS_DEBUG > 1) {
print_vars($oids);
}
$port = get_port_by_index_cache($device['device_id'], $index);
$options = array('entPhysicalIndex' => $index,
'measured_class' => 'port',
'measured_entity' => $port['port_id']);
foreach ($oids as $index => $entry) {
if (($entry['dellNetSysIfXfpRecvPower'] === '655.35' && $entry['dellNetSysIfXfpTxPower'] === '655.35' && $entry['dellNetSysIfXfpRecvTemp'] === '65535') ||
($entry['dellNetSysIfXfpRecvPower'] === '.00' && $entry['dellNetSysIfXfpTxPower'] === '.00' && $entry['dellNetSysIfXfpRecvTemp'] === '0') ||
($entry['dellNetSysIfXfpRecvPower'] === '.00' && !is_numeric($entry['dellNetSysIfXfpTxPower']) && !is_numeric($entry['dellNetSysIfXfpRecvTemp']))) {
continue;
}
if (is_numeric($entry['dellNetSysIfXfpRecvPower']))
{
$descr = $port['ifDescr'] . " RX Power";
$port = get_port_by_index_cache($device['device_id'], $index);
$options = ['entPhysicalIndex' => $index,
'measured_class' => 'port',
'measured_entity' => $port['port_id']];
$oid_name = 'dellNetSysIfXfpRecvPower';
$oid_num = ".1.3.6.1.4.1.6027.3.26.1.4.10.1.5.{$index}";
$type = $mib . '-' . $oid_name;
$scale = 0.01;
$value = $entry[$oid_name] * 100; // Yes, multiple here, because here used inside-mib convert
if (is_numeric($entry['dellNetSysIfXfpRecvPower'])) {
$descr = $port['ifDescr'] . " RX Power";
discover_sensor_ng($device,'dbm', $mib, $oid_num, $oid_num, $index, NULL, $descr, $scale, $value, $options);
$oid_name = 'dellNetSysIfXfpRecvPower';
$oid_num = ".1.3.6.1.4.1.6027.3.26.1.4.10.1.5.{$index}";
$scale = 0.01;
$value = $entry[$oid_name] * 100; // Yes, multiple here, because here used inside-mib convert
discover_sensor_ng($device, 'dbm', $mib, $oid_num, $oid_num, $index, $descr, $scale, $value, $options);
}
if (is_numeric($entry['dellNetSysIfXfpTxPower'])) {
$descr = $port['ifDescr'] . " TX Power";
$oid_name = 'dellNetSysIfXfpTxPower';
$oid_num = ".1.3.6.1.4.1.6027.3.26.1.4.10.1.7.{$index}";
$scale = 0.01;
$value = $entry[$oid_name] * 100; // Yes, multiple here, because here used inside-mib convert
discover_sensor_ng($device, 'dbm', $mib, $oid_name, $oid_num, $index, $descr, $scale, $value, $options);
}
if (is_numeric($entry['dellNetSysIfXfpRecvTemp'])) {
$descr = $port['ifDescr'] . " DOM";
$oid_name = 'dellNetSysIfXfpRecvTemp';
$oid_num = ".1.3.6.1.4.1.6027.3.26.1.4.10.1.6.{$index}";
$scale = 1;
$value = $entry[$oid_name] * 100; // Yes, multiple here, because here used inside-mib convert
discover_sensor_ng($device, 'temperature', $mib, $oid_name, $oid_num, $index, $descr, $scale, $value, $options);
}
}
if (is_numeric($entry['dellNetSysIfXfpTxPower']))
{
$descr = $port['ifDescr'] . " TX Power";
$oid_name = 'dellNetSysIfXfpTxPower';
$oid_num = ".1.3.6.1.4.1.6027.3.26.1.4.10.1.7.{$index}";
$type = $mib . '-' . $oid_name;
$scale = 0.01;
$value = $entry[$oid_name] * 100; // Yes, multiple here, because here used inside-mib convert
discover_sensor_ng($device,'dbm', $mib, $oid_name, $oid_num, $index, NULL, $descr, $scale, $value, $options);
}
if (is_numeric($entry['dellNetSysIfXfpRecvTemp']))
{
$descr = $port['ifDescr'] . " DOM";
$oid_name = 'dellNetSysIfXfpRecvTemp';
$oid_num = ".1.3.6.1.4.1.6027.3.26.1.4.10.1.6.{$index}";
$type = $mib . '-' . $oid_name;
$scale = 1;
$value = $entry[$oid_name] * 100; // Yes, multiple here, because here used inside-mib convert
discover_sensor_ng($device,'temperature', $mib, $oid_name, $oid_num, $index, NULL, $descr, $scale, $value, $options);
}
}
}
// EOF

View File

@ -1,5 +1,4 @@
<?php
/**
* Observium
*
@ -7,59 +6,56 @@
*
* @package observium
* @subpackage discovery
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2019 Observium Limited
* @copyright (C) Adam Armstrong
*
*/
// table: CMC power information
$oids = snmpwalk_cache_oid($device, 'drsCMCPowerTable', array(), $mib);
$oids = snmpwalk_cache_oid($device, 'drsCMCPowerTable', [], $mib);
foreach ($oids as $index => $entry) {
$options = [ 'rename_rrd' => "dell-rac-$index" ];
foreach ($oids as $index => $entry)
{
$descr = "Chassis ".$entry['drsChassisIndex'];
$oid = ".1.3.6.1.4.1.674.10892.2.4.1.1.14.$index";
$object = 'drsAmpsReading';
discover_sensor_ng($device, 'current', $mib, $object, $oid, $index, 'dell-rac', $descr, 1, $entry[$object]);
$descr = "Chassis " . $entry['drsChassisIndex'];
$oid = ".1.3.6.1.4.1.674.10892.2.4.1.1.14.$index";
$object = 'drsAmpsReading';
discover_sensor_ng($device, 'current', $mib, $object, $oid, $index, $descr, 1, $entry[$object], $options);
$limits = array('limit_high' => $entry['drsMaxPowerSpecification']);
$oid = ".1.3.6.1.4.1.674.10892.2.4.1.1.13.$index";
$object = 'drsWattsReading';
discover_sensor_ng($device, 'power', $mib, $object, $oid, $index, 'dell-rac', $descr, 1, $entry[$object]);
$limits = [ 'limit_high' => $entry['drsMaxPowerSpecification'] ];
$oid = ".1.3.6.1.4.1.674.10892.2.4.1.1.13.$index";
$object = 'drsWattsReading';
discover_sensor_ng($device, 'power', $mib, $object, $oid, $index, $descr, 1, $entry[$object], array_merge($options, $limits));
}
unset($oids);
// table: CMC PSU info
$oids = snmpwalk_cache_oid($device, 'drsCMCPSUTable', array(), $mib);
$oids = snmpwalk_cache_oid($device, 'drsCMCPSUTable', [], $mib);
foreach ($oids as $index => $entry) {
$options = [ 'rename_rrd' => "dell-rac-$index" ];
foreach ($oids as $index => $entry)
{
$descr = 'Chassis '.$entry['drsPSUChassisIndex'].' '.$entry['drsPSULocation'];
$oid = ".1.3.6.1.4.1.674.10892.2.4.2.1.6.$index";
$object = 'drsPSUAmpsReading';
discover_sensor_ng($device, 'current', $mib, $object, $oid, $index, 'dell-rac', $descr, 1, $entry[$object]);
$descr = 'Chassis ' . $entry['drsPSUChassisIndex'] . ' ' . $entry['drsPSULocation'];
$oid = ".1.3.6.1.4.1.674.10892.2.4.2.1.6.$index";
$object = 'drsPSUAmpsReading';
discover_sensor_ng($device, 'current', $mib, $object, $oid, $index, $descr, 1, $entry[$object], $options);
$oid = ".1.3.6.1.4.1.674.10892.2.4.2.1.5.$index";
$limits = array();
$oid = ".1.3.6.1.4.1.674.10892.2.4.2.1.5.$index";
$limits = [];
## FIXME this type of inventing/calculating should be done in the Observium voltage function instead!
if ($entry['drsPSUVoltsReading'] > 360 and $entry['drsPSUVoltsReading'] < 440)
{
// european 400V +/- 10%
$limits = array('limit_high' => 440, 'limit_low' => 360);
}
if ($entry['drsPSUVoltsReading'] > 207 and $entry['drsPSUVoltsReading'] < 253)
{
// european 230V +/- 10%
$limits = array('limit_high' => 253, 'limit_low' => 207);
}
if ($entry['drsPSUVoltsReading'] > 99 and $entry['drsPSUVoltsReading'] < 121)
{
// american 110V +/- 10%
$limits = array('limit_high' => 99, 'limit_low' => 121);
}
$object = 'drsPSUVoltsReading';
discover_sensor_ng($device, 'voltage', $mib, $object, $oid, $index, 'dell-rac', $descr, 1, $entry[$object]);
## FIXME this type of inventing/calculating should be done in the Observium voltage function instead!
if ($entry['drsPSUVoltsReading'] > 360 && $entry['drsPSUVoltsReading'] < 440) {
// european 400V +/- 10%
$limits = ['limit_high' => 440, 'limit_low' => 360];
}
if ($entry['drsPSUVoltsReading'] > 207 && $entry['drsPSUVoltsReading'] < 253) {
// european 230V +/- 10%
$limits = ['limit_high' => 253, 'limit_low' => 207];
}
if ($entry['drsPSUVoltsReading'] > 99 && $entry['drsPSUVoltsReading'] < 121) {
// american 110V +/- 10%
$limits = ['limit_high' => 99, 'limit_low' => 121];
}
$object = 'drsPSUVoltsReading';
discover_sensor_ng($device, 'voltage', $mib, $object, $oid, $index, $descr, 1, $entry[$object], array_merge($options, $limits));
}
// EOF

View File

@ -4,22 +4,22 @@
*
* This file is part of Observium.
*
* @package observium
* @subpackage discovery
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2021 Observium Limited
* @package observium
* @subpackage discovery
* @copyright (C) Adam Armstrong
*
*/
if (safe_count($valid['status']['DNOS-BOXSERVICES-PRIVATE-MIB'])) {
// Exit from discovery, since already added valid statuses by DNOS-BOXSERVICES-PRIVATE-MIB
echo 'Skipped by DNOS-BOXSERVICES-PRIVATE-MIB';
return;
// Exit from discovery, since already added valid statuses by DNOS-BOXSERVICES-PRIVATE-MIB
echo 'Skipped by DNOS-BOXSERVICES-PRIVATE-MIB';
return;
}
if (safe_count($valid['status']['fastpath-boxservices-private-temp-state'])) {
// Exit from discovery, since already added valid statuses by OLD-DNOS-BOXSERVICES-PRIVATE-MIB
echo 'Skipped by OLD-DNOS-BOXSERVICES-PRIVATE-MIB';
return;
// Exit from discovery, since already added valid statuses by OLD-DNOS-BOXSERVICES-PRIVATE-MIB
echo 'Skipped by OLD-DNOS-BOXSERVICES-PRIVATE-MIB';
return;
}
// Dell-Vendor-MIB::envMonFanStatusDescr.67109249 = STRING: fan1
@ -27,26 +27,26 @@ if (safe_count($valid['status']['fastpath-boxservices-private-temp-state'])) {
// Dell-Vendor-MIB::envMonFanState.67109249 = INTEGER: normal(1)
// Dell-Vendor-MIB::envMonFanState.67109250 = INTEGER: normal(1)
$oids = snmpwalk_cache_oid($device, 'envMonFanStatusTable', array(), 'Dell-Vendor-MIB');
$oids = snmpwalk_cache_oid($device, 'envMonFanStatusTable', [], 'Dell-Vendor-MIB');
foreach ($oids as $index => $entry) {
$descr = str_replace('_', ' ', $entry['envMonFanStatusDescr']);
$descr = preg_replace('/fan(\d+)/i', "Fan $1", $descr);
$descr = preg_replace('/unit(\d+)/i', "Unit $1", $descr);
if (!str_contains($descr, 'Fan')) {
$descr = nicecase($descr);
}
$oid = ".1.3.6.1.4.1.674.10895.3000.1.2.110.7.1.1.3.".$index;
$value = $entry['envMonFanState'];
$descr = str_replace('_', ' ', $entry['envMonFanStatusDescr']);
$descr = preg_replace('/fan(\d+)/i', "Fan $1", $descr);
$descr = preg_replace('/unit(\d+)/i', "Unit $1", $descr);
if (!str_contains($descr, 'Fan')) {
$descr = nicecase($descr);
}
$oid = ".1.3.6.1.4.1.674.10895.3000.1.2.110.7.1.1.3." . $index;
$value = $entry['envMonFanState'];
$query = "SELECT sensor_id FROM `sensors` WHERE `device_id` = ? AND `sensor_class` = 'fanspeed'";
$query .= " AND `sensor_type` IN ('radlan-hwenvironment-state','fastpath-boxservices-private-state')";
$query .= " AND (`sensor_index` IN (?) OR `sensor_descr` = ?)";
$query = "SELECT sensor_id FROM `sensors` WHERE `device_id` = ? AND `sensor_class` = 'fanspeed'";
$query .= " AND `sensor_type` IN ('radlan-hwenvironment-state','fastpath-boxservices-private-state')";
$query .= " AND (`sensor_index` IN (?) OR `sensor_descr` = ?)";
if ($entry['envMonFanState'] !== 'notPresent' &&
!safe_count(dbFetchRows($query, array($device['device_id'], 'rlEnvMonFanState.'.$index, $descr)))) {
discover_status_ng($device, $mib, 'envMonFanState', $oid, $index, 'dell-vendor-state', $descr, $value, array('entPhysicalClass' => 'fan'));
}
if ($entry['envMonFanState'] !== 'notPresent' &&
!safe_count(dbFetchRows($query, [$device['device_id'], 'rlEnvMonFanState.' . $index, $descr]))) {
discover_status_ng($device, $mib, 'envMonFanState', $oid, $index, 'dell-vendor-state', $descr, $value, ['entPhysicalClass' => 'fan']);
}
}
// Dell-Vendor-MIB::envMonSupplyStatusDescr.67109185 = STRING: ps1
@ -56,25 +56,25 @@ foreach ($oids as $index => $entry) {
// Dell-Vendor-MIB::envMonSupplySource.67109185 = INTEGER: ac(2)
// Dell-Vendor-MIB::envMonSupplySource.67109186 = INTEGER: unknown(1)
$oids = snmpwalk_cache_oid($device, 'envMonSupplyStatusTable', array(), 'Dell-Vendor-MIB');
$oids = snmpwalk_cache_oid($device, 'envMonSupplyStatusTable', [], 'Dell-Vendor-MIB');
foreach ($oids as $index => $entry) {
$descr = str_replace('_', ' ', $entry['envMonSupplyStatusDescr']);
$descr = preg_replace('/ps(\d+)/i', "Power Supply $1", $descr);
$descr = preg_replace('/unit(\d+)/i', "Unit $1", $descr);
if (!str_contains($descr, 'Supply')) {
$descr = nicecase($descr) . ' Power Supply';
}
if (in_array($entry['envMonSupplySource'], [ 'ac', 'dc' ])) {
$descr .= ' ' . strtoupper($entry['envMonSupplySource']);
}
$oid = ".1.3.6.1.4.1.674.10895.3000.1.2.110.7.2.1.3.".$index;
$value = $entry['envMonSupplyState'];
$descr = str_replace('_', ' ', $entry['envMonSupplyStatusDescr']);
$descr = preg_replace('/ps(\d+)/i', "Power Supply $1", $descr);
$descr = preg_replace('/unit(\d+)/i', "Unit $1", $descr);
if (!str_contains($descr, 'Supply')) {
$descr = nicecase($descr) . ' Power Supply';
}
if (in_array($entry['envMonSupplySource'], ['ac', 'dc'])) {
$descr .= ' ' . strtoupper($entry['envMonSupplySource']);
}
$oid = ".1.3.6.1.4.1.674.10895.3000.1.2.110.7.2.1.3." . $index;
$value = $entry['envMonSupplyState'];
if ($entry['envMonSupplyState'] !== 'notPresent') {
// FIXME Is it possible to add stack member number to description?
discover_status_ng($device, $mib, 'envMonSupplyState', $oid, $index, 'dell-vendor-state', $descr, $value, array('entPhysicalClass' => 'powerSupply'));
}
if ($entry['envMonSupplyState'] !== 'notPresent') {
// FIXME Is it possible to add stack member number to description?
discover_status_ng($device, $mib, 'envMonSupplyState', $oid, $index, 'dell-vendor-state', $descr, $value, ['entPhysicalClass' => 'powerSupply']);
}
}
// EOF

View File

@ -6,7 +6,7 @@
*
* @package observium
* @subpackage discovery
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2021 Observium Limited
* @copyright (C) Adam Armstrong
*
*/
@ -59,96 +59,109 @@
$oids = snmpwalk_cache_oid($device, 'ddmStatusTable', [], $mib);
print_debug_vars($oids);
if (!snmp_status()) { return; }
if (!snmp_status()) {
return;
}
// DES-1210-28ME-B2::ddmPowerUnit.0 = INTEGER: mw(0)
$power_unit = snmp_get_oid($device, 'ddmPowerUnit.0', $mib);
$oids = snmpwalk_cache_oid($device, 'sfpVendorPn', $oids, $mib);
$oids = snmpwalk_cache_oid($device, 'sfpVendorName', $oids, $mib);
$oids = snmpwalk_cache_oid($device, 'sfpVendorPn', $oids, $mib);
$oids_limit = snmpwalk_cache_twopart_oid($device, 'ddmThresholdMgmtEntry', [], $mib);
foreach ($oids as $index => $entry) {
$entry['index'] = $index;
$match = [ 'measured_match' => [ 'entity_type' => 'port', 'field' => 'ifIndex', 'match' => '%index%' ] ];
$options = entity_measured_match_definition($device, $match, $entry);
$entry['index'] = $index;
$match = [ 'measured_match' => [ 'entity_type' => 'port', 'field' => 'ifIndex', 'match' => '%index%' ] ];
$options = entity_measured_match_definition($device, $match, $entry);
$name = $options['port_label'];
$name = $options['port_label'];
$part_name = ' (' . trim($entry['sfpVendorName'] . ' ' . $entry['sfpVendorPn']) . ')';
// Temperature
$descr = $name . ' Temperature';
$class = 'temperature';
$oid_name = 'ddmTemperature';
$oid_num = '.1.3.6.1.4.1.171.10.75.15.2.105.2.1.1.1.2.'.$index;
$scale = 1;
$value = $entry[$oid_name];
$limits = [
'limit_high' => $oids_limit[$index]['temperature']['ddmHighAlarm'],
'limit_low' => $oids_limit[$index]['temperature']['ddmLowAlarm'],
'limit_high_warn' => $oids_limit[$index]['temperature']['ddmHighWarning'],
'limit_low_warn' => $oids_limit[$index]['temperature']['ddmLowWarning']
];
discover_sensor_ng($device, $class, $mib, $oid_name, $oid_num, $index, NULL, $descr, $scale, $value, array_merge($options, $limits));
// Temperature
$descr = $name . ' Temperature' . $part_name;
$class = 'temperature';
$oid_name = 'ddmTemperature';
//$oid_num = '.1.3.6.1.4.1.171.10.75.15.2.105.2.1.1.1.2.' . $index;
$oid_num = snmp_translate($oid_name, $mib) . '.' . $index;
$scale = 1;
$value = $entry[$oid_name];
$limits = [
'limit_high' => $oids_limit[$index]['temperature']['ddmHighAlarm'],
'limit_low' => $oids_limit[$index]['temperature']['ddmLowAlarm'],
'limit_high_warn' => $oids_limit[$index]['temperature']['ddmHighWarning'],
'limit_low_warn' => $oids_limit[$index]['temperature']['ddmLowWarning']
];
if (empty(snmp_fix_numeric($value))) {
// DGS-1210-28XME-BX::ddmTemperature.26 = STRING:
// DGS-1210-28XME-BX::ddmTemperature.28 = STRING: +0.000
continue;
}
discover_sensor_ng($device, $class, $mib, $oid_name, $oid_num, $index, $descr, $scale, $value, array_merge($options, $limits));
// Voltage
$descr = $name . ' Voltage';
$class = 'voltage';
$oid_name = 'ddmVoltage';
$oid_num = '.1.3.6.1.4.1.171.10.75.15.2.105.2.1.1.1.3.'.$index;
$scale = 1;
$value = $entry[$oid_name];
$limits = [
'limit_high' => $oids_limit[$index]['voltage']['ddmHighAlarm'],
'limit_low' => $oids_limit[$index]['voltage']['ddmLowAlarm'],
'limit_high_warn' => $oids_limit[$index]['voltage']['ddmHighWarning'],
'limit_low_warn' => $oids_limit[$index]['voltage']['ddmLowWarning']
];
discover_sensor_ng($device, $class, $mib, $oid_name, $oid_num, $index, NULL, $descr, $scale, $value, array_merge($options, $limits));
// Voltage
$descr = $name . ' Voltage' . $part_name;
$class = 'voltage';
$oid_name = 'ddmVoltage';
//$oid_num = '.1.3.6.1.4.1.171.10.75.15.2.105.2.1.1.1.3.' . $index;
$oid_num = snmp_translate($oid_name, $mib) . '.' . $index;
$scale = 1;
$value = $entry[$oid_name];
$limits = [
'limit_high' => $oids_limit[$index]['voltage']['ddmHighAlarm'],
'limit_low' => $oids_limit[$index]['voltage']['ddmLowAlarm'],
'limit_high_warn' => $oids_limit[$index]['voltage']['ddmHighWarning'],
'limit_low_warn' => $oids_limit[$index]['voltage']['ddmLowWarning']
];
discover_sensor_ng($device, $class, $mib, $oid_name, $oid_num, $index, $descr, $scale, $value, array_merge($options, $limits));
// Tx Bias
$descr = $name . ' Tx Bias';
$class = 'current';
$oid_name = 'ddmBiasCurrent';
$oid_num = '.1.3.6.1.4.1.171.10.75.15.2.105.2.1.1.1.4.'.$index;
$scale = 0.001;
$value = $entry[$oid_name];
$limits = [
'limit_high' => $oids_limit[$index]['bias']['ddmHighAlarm'] * $scale,
'limit_low' => $oids_limit[$index]['bias']['ddmLowAlarm'] * $scale,
'limit_high_warn' => $oids_limit[$index]['bias']['ddmHighWarning'] * $scale,
'limit_low_warn' => $oids_limit[$index]['bias']['ddmLowWarning'] * $scale
];
discover_sensor_ng($device, $class, $mib, $oid_name, $oid_num, $index, NULL, $descr, $scale, $value, array_merge($options, $limits));
// Tx Bias
$descr = $name . ' Tx Bias' . $part_name;
$class = 'current';
$oid_name = 'ddmBiasCurrent';
$oid_num = '.1.3.6.1.4.1.171.10.75.15.2.105.2.1.1.1.4.' . $index;
$scale = 0.001;
$value = $entry[$oid_name];
$limits = [
'limit_high' => $oids_limit[$index]['bias']['ddmHighAlarm'] * $scale,
'limit_low' => $oids_limit[$index]['bias']['ddmLowAlarm'] * $scale,
'limit_high_warn' => $oids_limit[$index]['bias']['ddmHighWarning'] * $scale,
'limit_low_warn' => $oids_limit[$index]['bias']['ddmLowWarning'] * $scale
];
discover_sensor_ng($device, $class, $mib, $oid_name, $oid_num, $index, $descr, $scale, $value, array_merge($options, $limits));
// Tx Power
$descr = $name . ' Tx Power';
$class = $power_unit === 'mw' ? 'power' : 'dbm';
$oid_name = 'ddmTxPower';
$oid_num = '.1.3.6.1.4.1.171.10.75.15.2.105.2.1.1.1.5.'.$index;
$scale = $power_unit === 'mw' ? 0.001 : 1;
$value = $entry[$oid_name];
$limits = [
'limit_high' => $oids_limit[$index]['txPower']['ddmHighAlarm'] * $scale,
'limit_low' => $oids_limit[$index]['txPower']['ddmLowAlarm'] * $scale,
'limit_high_warn' => $oids_limit[$index]['txPower']['ddmHighWarning'] * $scale,
'limit_low_warn' => $oids_limit[$index]['txPower']['ddmLowWarning'] * $scale
];
discover_sensor_ng($device, $class, $mib, $oid_name, $oid_num, $index, NULL, $descr, $scale, $value, array_merge($options, $limits));
// Tx Power
$descr = $name . ' Tx Power' . $part_name;
$class = $power_unit === 'mw' ? 'power' : 'dbm';
$oid_name = 'ddmTxPower';
//$oid_num = '.1.3.6.1.4.1.171.10.75.15.2.105.2.1.1.1.5.' . $index;
$oid_num = snmp_translate($oid_name, $mib) . '.' . $index;
$scale = $power_unit === 'mw' ? 0.001 : 1;
$value = $entry[$oid_name];
$limits = [
'limit_high' => $oids_limit[$index]['txPower']['ddmHighAlarm'] * $scale,
'limit_low' => $oids_limit[$index]['txPower']['ddmLowAlarm'] * $scale,
'limit_high_warn' => $oids_limit[$index]['txPower']['ddmHighWarning'] * $scale,
'limit_low_warn' => $oids_limit[$index]['txPower']['ddmLowWarning'] * $scale
];
discover_sensor_ng($device, $class, $mib, $oid_name, $oid_num, $index, $descr, $scale, $value, array_merge($options, $limits));
// Rx Power
$descr = $name . ' Rx Power';
$class = $power_unit === 'mw' ? 'power' : 'dbm';
$oid_name = 'ddmRxPower';
$oid_num = '.1.3.6.1.4.1.171.10.75.15.2.105.2.1.1.1.6.'.$index;
$scale = $power_unit === 'mw' ? 0.001 : 1;
$value = $entry[$oid_name];
$limits = [
'limit_high' => $oids_limit[$index]['rxPower']['ddmHighAlarm'] * $scale,
'limit_low' => $oids_limit[$index]['rxPower']['ddmLowAlarm'] * $scale,
'limit_high_warn' => $oids_limit[$index]['rxPower']['ddmHighWarning'] * $scale,
'limit_low_warn' => $oids_limit[$index]['rxPower']['ddmLowWarning'] * $scale
];
discover_sensor_ng($device, $class, $mib, $oid_name, $oid_num, $index, NULL, $descr, $scale, $value, array_merge($options, $limits));
// Rx Power
$descr = $name . ' Rx Power' . $part_name;
$class = $power_unit === 'mw' ? 'power' : 'dbm';
$oid_name = 'ddmRxPower';
//$oid_num = '.1.3.6.1.4.1.171.10.75.15.2.105.2.1.1.1.6.' . $index;
$oid_num = snmp_translate($oid_name, $mib) . '.' . $index;
$scale = $power_unit === 'mw' ? 0.001 : 1;
$value = $entry[$oid_name];
$limits = [
'limit_high' => $oids_limit[$index]['rxPower']['ddmHighAlarm'] * $scale,
'limit_low' => $oids_limit[$index]['rxPower']['ddmLowAlarm'] * $scale,
'limit_high_warn' => $oids_limit[$index]['rxPower']['ddmHighWarning'] * $scale,
'limit_low_warn' => $oids_limit[$index]['rxPower']['ddmLowWarning'] * $scale
];
discover_sensor_ng($device, $class, $mib, $oid_name, $oid_num, $index, $descr, $scale, $value, array_merge($options, $limits));
}
// EOF

View File

@ -1,107 +0,0 @@
<?php
/**
* Observium
*
* This file is part of Observium.
*
* @package observium
* @subpackage discovery
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2019 Observium Limited
*
*/
$oids = snmpwalk_cache_oid($device, 'nbsDevPSTable', array(), 'DEV-CFG-MIB');
print_debug_vars($oids);
foreach ($oids as $index => $entry)
{
if ($entry['nbsDevPSAdminStatus'] == 'notActive') // && $entry['nbsDevPSRedundantMode'] == 'none')
{
// skip non redundant and non active
continue;
}
$descr = strlen($entry['nbsDevPSDescription']) ? $entry['nbsDevPSDescription'] : 'Power Supply ' . $index;
$oid_name = 'nbsDevPSOperStatus';
$oid_num = '.1.3.6.1.4.1.629.1.50.11.1.8.2.1.5.'.$index;
$type = 'nbsDevOperStatus';
$value = $entry[$oid_name];
discover_status_ng($device, $mib, $oid_name, $oid_num, $index, $type, $descr, $value, array('entPhysicalClass' => 'powerSupply'));
}
$oids = snmpwalk_cache_oid($device, 'nbsDevFANTable', array(), 'DEV-CFG-MIB');
print_debug_vars($oids);
foreach ($oids as $index => $entry)
{
if ($entry['nbsDevFANAdminStatus'] == 'notActive') // && $entry['nbsDevFANType'] == 'none')
{
// skip non redundant and non active
continue;
}
$descr = strlen($entry['nbsDevFANDescription']) ? $entry['nbsDevFANDescription'] : 'Fan ' . $index;
$oid_name = 'nbsDevFANOperStatus';
$oid_num = '.1.3.6.1.4.1.629.1.50.11.1.11.2.1.5.'.$index;
$type = 'nbsDevOperStatus';
$value = $entry[$oid_name];
discover_status_ng($device, $mib, $oid_name, $oid_num, $index, $type, $descr, $value, array('entPhysicalClass' => 'fan'));
}
// Yah, wee have too old MRV mibs, that why here used "known" numeric oids
// .1.3.6.1.4.1.629.1.50.11.1.13.1.0 - nbsDevPhParamCpuTempC.0
// .1.3.6.1.4.1.629.1.50.11.1.13.2.0 - nbsDevPhParamDevAmbientTempC.0
// .1.3.6.1.4.1.629.1.50.11.1.13.3.0 - nbsDevPhParamPackProcTempC.0
$oids = snmp_get_multi_oid($device, array('.1.3.6.1.4.1.629.1.50.11.1.13.1.0',
'.1.3.6.1.4.1.629.1.50.11.1.13.2.0',
'.1.3.6.1.4.1.629.1.50.11.1.13.3.0'), array(), 'DEV-CFG-MIB', NULL, OBS_SNMP_ALL_NUMERIC);
print_debug_vars($oids);
// nbsDevPhParamCpuTempC
$index = 0;
$descr = 'CPU Temperature';
$oid_name = 'nbsDevPhParamCpuTempC';
$oid_num = ".1.3.6.1.4.1.629.1.50.11.1.13.1.{$index}";
$type = $mib . '-' . $oid_name;
$scale = 1;
$value = $oids[$oid_num];
if ($value != 0)
{
discover_sensor_ng($device, 'temperature', $mib, $oid_name, $oid_num, $index, NULL, $descr, $scale, $value);
}
/* All this skipped anyway, since data too same
// DEV-CFG-MIB::nbDevGen.13.1.0 = Gauge32: 40
// DEV-CFG-MIB::nbDevGen.13.2.0 = Gauge32: 40
// DEV-CFG-MIB::nbDevGen.13.3.0 = Gauge32: 40
// nbsDevPhParamDevAmbientTempC
$index = 0;
$descr = 'Device Temperature';
$oid_name = 'nbsDevPhParamDevAmbientTempC';
$oid_num = ".1.3.6.1.4.1.629.1.50.11.1.13.2.{$index}";
$type = $mib . '-' . $oid_name;
$scale = 1;
$value = $oids[$oid_num];
if ($value != 0)
{
discover_sensor('temperature', $device, $oid_num, $index, $type, $descr, $scale, $value);
}
// nbsDevPhParamPackProcTempC
$index = 0;
$descr = 'CPU Temperature';
$oid_name = 'nbsDevPhParamPackProcTempC';
$oid_num = ".1.3.6.1.4.1.629.1.50.11.1.13.3.{$index}";
$type = $mib . '-' . $oid_name;
$scale = 1;
$value = $oids[$oid_num];
if ($value != 0)
{
discover_sensor('temperature', $device, $oid_num, $index, $type, $descr, $scale, $value);
}
*/
// EOF

View File

@ -0,0 +1,62 @@
<?php
/**
* Observium
*
* This file is part of Observium.
*
* @package observium
* @subpackage discovery
* @copyright (C) Adam Armstrong
*
*/
// DGS-1210-28XME-BX::sfpPortIndex.27 = INTEGER: 27
// DGS-1210-28XME-BX::sfpConnectorType.27 = STRING: SFP - LC
// DGS-1210-28XME-BX::sfpTranceiverCode.27 = STRING: Single Mode
// DGS-1210-28XME-BX::sfpBaudRate.27 = STRING: 10G
// DGS-1210-28XME-BX::sfpVendorName.27 = STRING: OEM
// DGS-1210-28XME-BX::sfpVendorOui.27 = STRING: 0:1f:22
// DGS-1210-28XME-BX::sfpVendorPn.27 = STRING: OPL-SFP+W23-20
// DGS-1210-28XME-BX::sfpVendorRev.27 = STRING: 10
// DGS-1210-28XME-BX::sfpWavelength.27 = STRING: 1310
// DGS-1210-28XME-BX::sfpVendorSn.27 = STRING: X6040223042
// DGS-1210-28XME-BX::sfpDateCode.27 = STRING: 210409
// DGS-1210-28XME-BX::ddmActionPort.27 = INTEGER: 27
// DGS-1210-28XME-BX::ddmActionState.27 = INTEGER: enable(1)
// DGS-1210-28XME-BX::ddmActionShutdown.27 = INTEGER: none(0)
// DGS-1210-28XME-BX::ddmHighAlarm.27.temperature = STRING: 95.000
// DGS-1210-28XME-BX::ddmHighAlarm.27.voltage = STRING: 3.80
// DGS-1210-28XME-BX::ddmHighAlarm.27.bias = STRING: 20.0
// DGS-1210-28XME-BX::ddmHighAlarm.27.txPower = STRING: 2.0140
// DGS-1210-28XME-BX::ddmHighAlarm.27.rxPower = STRING: 1.0034
// DGS-1210-28XME-BX::ddmLowAlarm.27.temperature = STRING: -25.000
// DGS-1210-28XME-BX::ddmLowAlarm.27.voltage = STRING: 2.80
// DGS-1210-28XME-BX::ddmLowAlarm.27.bias = STRING: 0.5
// DGS-1210-28XME-BX::ddmLowAlarm.27.txPower = STRING: -7.9615
// DGS-1210-28XME-BX::ddmLowAlarm.27.rxPower = STRING: -20.0436
// DGS-1210-28XME-BX::ddmHighWarning.27.temperature = STRING: 90.000
// DGS-1210-28XME-BX::ddmHighWarning.27.voltage = STRING: 3.70
// DGS-1210-28XME-BX::ddmHighWarning.27.bias = STRING: 18.0
// DGS-1210-28XME-BX::ddmHighWarning.27.txPower = STRING: 1.0034
// DGS-1210-28XME-BX::ddmHighWarning.27.rxPower = STRING: 0.0000
// DGS-1210-28XME-BX::ddmLowWarning.27.temperature = STRING: -20.000
// DGS-1210-28XME-BX::ddmLowWarning.27.voltage = STRING: 2.90
// DGS-1210-28XME-BX::ddmLowWarning.27.bias = STRING: 1.0
// DGS-1210-28XME-BX::ddmLowWarning.27.txPower = STRING: -6.9897
// DGS-1210-28XME-BX::ddmLowWarning.27.rxPower = STRING: -18.9963
// DGS-1210-28XME-BX::ddmStatusPort.27 = INTEGER: 27
// DGS-1210-28XME-BX::ddmTemperature.27 = STRING: +63.738
// DGS-1210-28XME-BX::ddmVoltage.27 = STRING: 3.33
// DGS-1210-28XME-BX::ddmBiasCurrent.27 = STRING: 20.5
// DGS-1210-28XME-BX::ddmTxPower.27 = STRING: -2.0391
// DGS-1210-28XME-BX::ddmRxPower.27 = STRING: -11.5181
include __DIR__ . '/des-1210-28me-b2.inc.php';
// EOF

View File

@ -1,137 +0,0 @@
<?php
/**
* Observium
*
* This file is part of Observium.
*
* @package observium
* @subpackage discovery
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2019 Observium Limited
*
*/
// FIXME migrate to definitions
$cache_discovery['DKSF-48-4-X-X-1']['smoke'] = snmpwalk_cache_oid($device, 'npSmokeTable', array(), 'DKSF-48-4-X-X-1');
foreach ($cache_discovery['DKSF-48-4-X-X-1']['smoke'] as $index => $entry)
{
if ($entry['npSmokePower'] == 'off') { continue; }
$oid = '.1.3.6.1.4.1.25728.8200.1.1.2.'.$index;
$descr = ($entry['npSmokeMemo'] ? $entry['npSmokeMemo'] : 'Smoke '.$index);
$value = $entry['npSmokeStatus'];
if ($value)
{
discover_status($device, $oid, 'npSmokeStatus.'.$index, 'dskf-mib-smoke-state', $descr, $value, array('entPhysicalClass' => 'other'));
}
}
/*
$cache_discovery['DKSF-48-4-X-X-1']['loop'] = snmpwalk_cache_oid($device, 'npCurLoopTable', array(), 'DKSF-48-4-X-X-1');
foreach ($cache_discovery['DKSF-48-4-X-X-1']['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('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('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;
$value = $entry['npCurLoopR'];
if ($value && $value < 99999)
{
discover_sensor('resistance', $device, $oid, 'npCurLoopR.'.$index, 'dskf-mib-loop', $descr, 1, $value);
}
}
*/
$cache_discovery['DKSF-48-4-X-X-1']['temphum'] = snmpwalk_cache_oid($device, 'npRelHumidity', array(), 'DKSF-48-4-X-X-1');
foreach ($cache_discovery['DKSF-48-4-X-X-1']['temphum'] as $index => $entry)
{
// Temperature
$descr = 'Temperature '.$index;
$value = $entry['npRelHumSensorValueT100'];
if ($value && $entry['npRelHumSensorStatus'] != 'error')
{
$oid = '.1.3.6.1.4.1.25728.8400.2.9.'.$index;
discover_sensor('temperature', $device, $oid, "npRelHumSensorValueT100.$index", 'dskf-mib', $descr, 0.01, $value);
}
// Humidity
$descr = 'Humidity '.$index;
$value = $entry['npRelHumSensorValueH'];
if ($value >= 0 && $entry['npRelHumSensorStatusH'] != 'sensorFailed')
{
$oid = '.1.3.6.1.4.1.25728.8400.2.2.'.$index;
$limits = array('limit_high' => $entry['npRelHumSafeRangeHigh'], 'limit_low' => $entry['npRelHumSafeRangeLow']);
discover_sensor('humidity', $device, $oid, "npRelHumSensorValueH.$index", 'dskf-mib', $descr, 1, $value, $limits);
}
}
/* Moved to DEF
$cache_discovery['DKSF-48-4-X-X-1']['thermo'] = snmpwalk_cache_oid($device, 'npThermoTable', array(), 'DKSF-48-4-X-X-1');
foreach ($cache_discovery['DKSF-48-4-X-X-1']['thermo'] as $index => $entry)
{
// Temperature
$descr = ($entry['npThermoMemo'] ? $entry['npThermoMemo'] : 'Thermo '.$index);
$value = $entry['npThermoValue'];
if ($value && $entry['npThermoStatus'] != 'failed')
{
$oid = '.1.3.6.1.4.1.25728.8800.1.1.2.'.$index;
$limits = array('limit_high' => $entry['npThermoHigh'], 'limit_low' => $entry['npThermoLow']);
discover_sensor('temperature', $device, $oid, "npThermoValue.$index", 'dskf-mib', $descr, 1, $value, $limits);
}
}
*/
$cache_discovery['DKSF-48-4-X-X-1']['io'] = snmpwalk_cache_oid($device, 'npIoTable', array(), 'DKSF-48-4-X-X-1');
foreach ($cache_discovery['DKSF-48-4-X-X-1']['io'] as $index => $entry)
{
if ($entry['npIoLevelIn'] == '0') { continue; }
$descr = ($entry['npIoMemo'] ? $entry['npIoMemo'] : 'Pulse Counter '.$index);
$descr .= ' (' . $entry['npIoSinglePulseDuration'] . 'ms)';
$oid_name = 'npIoPulseCounter';
$value = $entry['npIoPulseCounter'];
$oid = '.1.3.6.1.4.1.25728.8900.1.1.9.'.$index;
//discover_sensor('counter', $device, $oid, "npIoPulseCounter.$index", 'dskf-mib', $descr, 1, $value);
discover_counter($device, 'counter', $mib, $oid_name, $oid, $index, $descr, 1, $value);
}
print_debug_vars($cache_discovery['DKSF-48-4-X-X-1']);
unset($cache_discovery['DKSF-48-4-X-X-1']);
// EOF

View File

@ -5,72 +5,69 @@
*
* This file is part of Observium.
*
* @package observium
* @subpackage discovery
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2019 Observium Limited
* @package observium
* @subpackage discovery
* @copyright (C) Adam Armstrong
*
*/
// FIXME. I complete not sure that this work correctly
// FIXME migrate to definitions
$cache_discovery['DKSF-50-11-X-X-X']['smoke'] = snmpwalk_cache_oid($device, 'npSmokeTable', array(), 'DKSF-50-11-X-X-X');
foreach ($cache_discovery['DKSF-50-11-X-X-X']['smoke'] as $index => $entry)
{
if ($entry['npSmokePower'] == 'off') { continue; }
$cache_discovery['DKSF-50-11-X-X-X']['smoke'] = snmpwalk_cache_oid($device, 'npSmokeTable', [], 'DKSF-50-11-X-X-X');
foreach ($cache_discovery['DKSF-50-11-X-X-X']['smoke'] as $index => $entry) {
if ($entry['npSmokePower'] == 'off') {
continue;
}
$oid = '.1.3.6.1.4.1.25728.8200.1.1.2.'.$index;
$descr = ($entry['npSmokeMemo'] ? $entry['npSmokeMemo'] : 'Smoke '.$index);
$value = $entry['npSmokeStatus'];
$oid = '.1.3.6.1.4.1.25728.8200.1.1.2.' . $index;
$descr = ($entry['npSmokeMemo'] ? $entry['npSmokeMemo'] : 'Smoke ' . $index);
$value = $entry['npSmokeStatus'];
if ($value)
{
discover_status($device, $oid, 'npSmokeStatus.'.$index, 'dskf-mib-smoke-state', $descr, $value, array('entPhysicalClass' => 'other'));
}
if ($value) {
discover_status($device, $oid, 'npSmokeStatus.' . $index, 'dskf-mib-smoke-state', $descr, $value, ['entPhysicalClass' => 'other']);
}
}
$cache_discovery['DKSF-50-11-X-X-X']['loop'] = snmpwalk_cache_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; }
$cache_discovery['DKSF-50-11-X-X-X']['loop'] = snmpwalk_cache_oid($device, 'npCurLoopTable', [], '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;
$descr = 'Analog Smoke ' . $index;
// Loop state
$oid = '.1.3.6.1.4.1.25728.8300.1.1.2.'.$index;
$value = $entry['npCurLoopStatus'];
// 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'));
}
if ($value) {
discover_status($device, $oid, 'npCurLoopStatus.' . $index, 'dskf-mib-loop-state', $descr, $value, ['entPhysicalClass' => 'other']);
}
// Loop current
$oid = '.1.3.6.1.4.1.25728.8300.1.1.3.'.$index;
$value = $entry['npCurLoopI'];
// Loop current
$oid = '.1.3.6.1.4.1.25728.8300.1.1.3.' . $index;
$value = $entry['npCurLoopI'];
if ($value)
{
discover_sensor('current', $device, $oid, 'npCurLoopI.'.$index, 'dskf-mib-loop', $descr, 0.001, $value);
}
if ($value) {
discover_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'];
// Loop voltage
$oid = '.1.3.6.1.4.1.25728.8300.1.1.4.' . $index;
$value = $entry['npCurLoopV'];
if ($value)
{
discover_sensor('voltage', $device, $oid, 'npCurLoopV.'.$index, 'dskf-mib-loop', $descr, 0.001, $value);
}
if ($value) {
discover_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;
$value = $entry['npCurLoopR'];
// Loop resistance
$oid = '.1.3.6.1.4.1.25728.8300.1.1.5.' . $index;
$value = $entry['npCurLoopR'];
if ($value && $value < 99999)
{
discover_sensor('resistance', $device, $oid, 'npCurLoopR.'.$index, 'dskf-mib-loop', $descr, 1, $value);
}
if ($value && $value < 99999) {
discover_sensor('resistance', $device, $oid, 'npCurLoopR.' . $index, 'dskf-mib-loop', $descr, 1, $value);
}
}
/* Moved to DEF
@ -116,18 +113,19 @@ foreach ($cache_discovery['DKSF-50-11-X-X-X']['thermo'] as $index => $entry)
}
*/
$cache_discovery['DKSF-50-11-X-X-X']['io'] = snmpwalk_cache_oid($device, 'npIoTable', array(), 'DKSF-50-11-X-X-X');
foreach ($cache_discovery['DKSF-50-11-X-X-X']['io'] as $index => $entry)
{
if ($entry['npIoLevelIn'] == '0') { continue; }
$cache_discovery['DKSF-50-11-X-X-X']['io'] = snmpwalk_cache_oid($device, 'npIoTable', [], 'DKSF-50-11-X-X-X');
foreach ($cache_discovery['DKSF-50-11-X-X-X']['io'] as $index => $entry) {
if ($entry['npIoLevelIn'] == '0') {
continue;
}
$descr = ($entry['npIoMemo'] ? $entry['npIoMemo'] : 'Pulse Counter '.$index);
$descr .= ' (' . $entry['npIoSinglePulseDuration'] . 'ms)';
$oid_name = 'npIoPulseCounter';
$value = $entry['npIoPulseCounter'];
$oid = '.1.3.6.1.4.1.25728.8900.1.1.9.'.$index;
//discover_sensor('counter', $device, $oid, "npIoPulseCounter.$index", 'dskf-mib', $descr, 1, $value);
discover_counter($device, 'counter', $mib, $oid_name, $oid, $index, $descr, 1, $value);
$descr = ($entry['npIoMemo'] ? $entry['npIoMemo'] : 'Pulse Counter ' . $index);
$descr .= ' (' . $entry['npIoSinglePulseDuration'] . 'ms)';
$oid_name = 'npIoPulseCounter';
$value = $entry['npIoPulseCounter'];
$oid = '.1.3.6.1.4.1.25728.8900.1.1.9.' . $index;
//discover_sensor('counter', $device, $oid, "npIoPulseCounter.$index", 'dskf-mib', $descr, 1, $value);
discover_counter($device, 'counter', $mib, $oid_name, $oid, $index, $descr, 1, $value);
}
print_debug_vars($cache_discovery['DKSF-50-11-X-X-X']);

View File

@ -5,9 +5,9 @@
*
* This file is part of Observium.
*
* @package observium
* @subpackage discovery
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2019 Observium Limited
* @package observium
* @subpackage discovery
* @copyright (C) Adam Armstrong
*
*/
@ -30,84 +30,77 @@ foreach ($cache_discovery['DKSF-60-4-X-X-X']['pwr'] as $index => $entry)
}
*/
$cache_discovery['DKSF-60-4-X-X-X']['loop'] = snmpwalk_cache_oid($device, 'npCurLoopTable', array(), 'DKSF-60-4-X-X-X');
foreach ($cache_discovery['DKSF-60-4-X-X-X']['loop'] as $index => $entry)
{
if ($entry['npCurLoopPower'] == 'off' || $entry['npCurLoopStatus'] == 'notPowered') { continue; }
$cache_discovery['DKSF-60-4-X-X-X']['loop'] = snmpwalk_cache_oid($device, 'npCurLoopTable', [], 'DKSF-60-4-X-X-X');
foreach ($cache_discovery['DKSF-60-4-X-X-X']['loop'] as $index => $entry) {
if ($entry['npCurLoopPower'] == 'off' || $entry['npCurLoopStatus'] == 'notPowered') {
continue;
}
$descr = 'Analog Smoke '.$index;
$descr = 'Analog Smoke ' . $index;
// Loop state
$oid = '.1.3.6.1.4.1.25728.8300.1.1.2.'.$index;
$value = $entry['npCurLoopStatus'];
// 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'));
}
if ($value) {
discover_status($device, $oid, 'npCurLoopStatus.' . $index, 'dskf-mib-loop-state', $descr, $value, ['entPhysicalClass' => 'other']);
}
// Loop current
$oid = '.1.3.6.1.4.1.25728.8300.1.1.3.'.$index;
$value = $entry['npCurLoopI'];
// Loop current
$oid = '.1.3.6.1.4.1.25728.8300.1.1.3.' . $index;
$value = $entry['npCurLoopI'];
if ($value)
{
discover_sensor('current', $device, $oid, 'npCurLoopI.'.$index, 'dskf-mib-loop', $descr, 0.001, $value);
}
if ($value) {
discover_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'];
// Loop voltage
$oid = '.1.3.6.1.4.1.25728.8300.1.1.4.' . $index;
$value = $entry['npCurLoopV'];
if ($value)
{
discover_sensor('voltage', $device, $oid, 'npCurLoopV.'.$index, 'dskf-mib-loop', $descr, 0.001, $value);
}
if ($value) {
discover_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;
$value = $entry['npCurLoopR'];
// Loop resistance
$oid = '.1.3.6.1.4.1.25728.8300.1.1.5.' . $index;
$value = $entry['npCurLoopR'];
if ($value && $value < 99999)
{
discover_sensor('resistance', $device, $oid, 'npCurLoopR.'.$index, 'dskf-mib-loop', $descr, 1, $value);
}
if ($value && $value < 99999) {
discover_sensor('resistance', $device, $oid, 'npCurLoopR.' . $index, 'dskf-mib-loop', $descr, 1, $value);
}
}
//DKSF-60-4-X-X-X::npRelHumSensorValueH.0 = INTEGER: 0
//DKSF-60-4-X-X-X::npRelHumSensorStatus.0 = INTEGER: ok(1)
//DKSF-60-4-X-X-X::npRelHumSensorValueT.0 = INTEGER: 0
$cache_discovery['DKSF-60-4-X-X-X']['temphum'] = snmpwalk_cache_oid($device, 'npRelHumSensorValueH', array(), 'DKSF-60-4-X-X-X');
$cache_discovery['DKSF-60-4-X-X-X']['temphum'] = snmpwalk_cache_oid($device, 'npRelHumSensorValueH', [], 'DKSF-60-4-X-X-X');
$cache_discovery['DKSF-60-4-X-X-X']['temphum'] = snmpwalk_cache_oid($device, 'npRelHumSensorValueT', $cache_discovery['DKSF-60-4-X-X-X']['temphum'], 'DKSF-60-4-X-X-X');
$cache_discovery['DKSF-60-4-X-X-X']['temphum'] = snmpwalk_cache_oid($device, 'npRelHumSensorStatus', $cache_discovery['DKSF-60-4-X-X-X']['temphum'], 'DKSF-60-4-X-X-X');
foreach ($cache_discovery['DKSF-60-4-X-X-X']['temphum'] as $index => $entry)
{
// Temperature
$descr = 'Temperature '.$index;
foreach ($cache_discovery['DKSF-60-4-X-X-X']['temphum'] as $index => $entry) {
// Temperature
$descr = 'Temperature ' . $index;
$value = $entry['npRelHumSensorValueT'];
if ($value)
{
$oid = '.1.3.6.1.4.1.25728.8400.2.4.'.$index;
discover_sensor('temperature', $device, $oid, "npRelHumSensorValueT.$index", 'dskf-mib', $descr, 1, $value);
}
$value = $entry['npRelHumSensorValueT'];
if ($value) {
$oid = '.1.3.6.1.4.1.25728.8400.2.4.' . $index;
discover_sensor('temperature', $device, $oid, "npRelHumSensorValueT.$index", 'dskf-mib', $descr, 1, $value);
}
// Humidity
$descr = 'Humidity '.$index;
// Humidity
$descr = 'Humidity ' . $index;
$value = $entry['npRelHumSensorValueH'];
if ($value)
{
$oid = '.1.3.6.1.4.1.25728.8400.2.2.'.$index;
discover_sensor('humidity', $device, $oid, "npRelHumSensorValueH.$index", 'dskf-mib', $descr, 1, $value);
}
$value = $entry['npRelHumSensorStatus'];
if ($value)
{
$oid = '.1.3.6.1.4.1.25728.8400.2.3.'.$index;
discover_status($device, $oid, 'npRelHumSensorStatus.'.$index, 'dskf-mib-hum-state', $descr, $value, array('entPhysicalClass' => 'humidity'));
}
$value = $entry['npRelHumSensorValueH'];
if ($value) {
$oid = '.1.3.6.1.4.1.25728.8400.2.2.' . $index;
discover_sensor('humidity', $device, $oid, "npRelHumSensorValueH.$index", 'dskf-mib', $descr, 1, $value);
}
$value = $entry['npRelHumSensorStatus'];
if ($value) {
$oid = '.1.3.6.1.4.1.25728.8400.2.3.' . $index;
discover_status($device, $oid, 'npRelHumSensorStatus.' . $index, 'dskf-mib-hum-state', $descr, $value, ['entPhysicalClass' => 'humidity']);
}
}
/* Moved to DEF
@ -127,18 +120,19 @@ foreach ($cache_discovery['DKSF-60-4-X-X-X']['thermo'] as $index => $entry)
}
*/
$cache_discovery['DKSF-60-4-X-X-X']['io'] = snmpwalk_cache_oid($device, 'npIoTable', array(), 'DKSF-60-4-X-X-X');
foreach ($cache_discovery['DKSF-60-4-X-X-X']['io'] as $index => $entry)
{
if ($entry['npIoLevelIn'] == '0') { continue; }
$cache_discovery['DKSF-60-4-X-X-X']['io'] = snmpwalk_cache_oid($device, 'npIoTable', [], 'DKSF-60-4-X-X-X');
foreach ($cache_discovery['DKSF-60-4-X-X-X']['io'] as $index => $entry) {
if ($entry['npIoLevelIn'] == '0') {
continue;
}
$descr = ($entry['npIoMemo'] ? $entry['npIoMemo'] : 'Pulse Counter '.$index);
$descr .= ' (' . $entry['npIoSinglePulseDuration'] . 'ms)';
$oid_name = 'npIoPulseCounter';
$value = $entry['npIoPulseCounter'];
$oid = '.1.3.6.1.4.1.25728.8900.1.1.9.'.$index;
//discover_sensor('counter', $device, $oid, "npIoPulseCounter.$index", 'dskf-mib', $descr, 1, $value);
discover_counter($device, 'counter', $mib, $oid_name, $oid, $index, $descr, 1, $value);
$descr = ($entry['npIoMemo'] ? $entry['npIoMemo'] : 'Pulse Counter ' . $index);
$descr .= ' (' . $entry['npIoSinglePulseDuration'] . 'ms)';
$oid_name = 'npIoPulseCounter';
$value = $entry['npIoPulseCounter'];
$oid = '.1.3.6.1.4.1.25728.8900.1.1.9.' . $index;
//discover_sensor('counter', $device, $oid, "npIoPulseCounter.$index", 'dskf-mib', $descr, 1, $value);
discover_counter($device, 'counter', $mib, $oid_name, $oid, $index, $descr, 1, $value);
}
print_debug_vars($cache_discovery['DKSF-60-4-X-X-X']);

View File

@ -4,9 +4,9 @@
*
* This file is part of Observium.
*
* @package observium
* @subpackage discovery
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2022 Observium Limited
* @package observium
* @subpackage discovery
* @copyright (C) Adam Armstrong
*
*/
@ -29,48 +29,45 @@ foreach ($cache_discovery['DKSF-70-MIB']['smoke'] as $index => $entry)
}
*/
$cache_discovery['DKSF-70-MIB']['loop'] = snmpwalk_cache_oid($device, 'npCurLoopTable', array(), 'DKSF-70-MIB');
foreach ($cache_discovery['DKSF-70-MIB']['loop'] as $index => $entry)
{
if ($entry['npCurLoopPower'] == 'off' || $entry['npCurLoopStatus'] == 'notPowered') { continue; }
$cache_discovery['DKSF-70-MIB']['loop'] = snmpwalk_cache_oid($device, 'npCurLoopTable', [], 'DKSF-70-MIB');
foreach ($cache_discovery['DKSF-70-MIB']['loop'] as $index => $entry) {
if ($entry['npCurLoopPower'] == 'off' || $entry['npCurLoopStatus'] == 'notPowered') {
continue;
}
$descr = 'Analog Smoke '.$index;
$descr = 'Analog Smoke ' . $index;
// Loop state
$oid = '.1.3.6.1.4.1.25728.8300.1.1.2.'.$index;
$value = $entry['npCurLoopStatus'];
// 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'));
}
if ($value) {
discover_status($device, $oid, 'npCurLoopStatus.' . $index, 'dskf-mib-loop-state', $descr, $value, ['entPhysicalClass' => 'other']);
}
// Loop current
$oid = '.1.3.6.1.4.1.25728.8300.1.1.3.'.$index;
$value = $entry['npCurLoopI'];
// Loop current
$oid = '.1.3.6.1.4.1.25728.8300.1.1.3.' . $index;
$value = $entry['npCurLoopI'];
if ($value)
{
discover_sensor('current', $device, $oid, 'npCurLoopI.'.$index, 'dskf-mib-loop', $descr, 0.001, $value);
}
if ($value) {
discover_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'];
// Loop voltage
$oid = '.1.3.6.1.4.1.25728.8300.1.1.4.' . $index;
$value = $entry['npCurLoopV'];
if ($value)
{
discover_sensor('voltage', $device, $oid, 'npCurLoopV.'.$index, 'dskf-mib-loop', $descr, 0.001, $value);
}
if ($value) {
discover_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;
$value = $entry['npCurLoopR'];
// Loop resistance
$oid = '.1.3.6.1.4.1.25728.8300.1.1.5.' . $index;
$value = $entry['npCurLoopR'];
if ($value && $value < 99999)
{
discover_sensor('resistance', $device, $oid, 'npCurLoopR.'.$index, 'dskf-mib-loop', $descr, 1, $value);
}
if ($value && $value < 99999) {
discover_sensor('resistance', $device, $oid, 'npCurLoopR.' . $index, 'dskf-mib-loop', $descr, 1, $value);
}
}
/* Moved to DEF
@ -116,18 +113,19 @@ foreach ($cache_discovery['DKSF-70-MIB']['thermo'] as $index => $entry)
}
*/
$cache_discovery['DKSF-70-MIB']['io'] = snmpwalk_cache_oid($device, 'npIoTable', array(), 'DKSF-70-MIB');
foreach ($cache_discovery['DKSF-70-MIB']['io'] as $index => $entry)
{
if ($entry['npIoLevelIn'] == '0') { continue; }
$cache_discovery['DKSF-70-MIB']['io'] = snmpwalk_cache_oid($device, 'npIoTable', [], 'DKSF-70-MIB');
foreach ($cache_discovery['DKSF-70-MIB']['io'] as $index => $entry) {
if ($entry['npIoLevelIn'] == '0') {
continue;
}
$descr = ($entry['npIoMemo'] ? $entry['npIoMemo'] : 'Pulse Counter '.$index);
$descr .= ' (' . $entry['npIoSinglePulseDuration'] . 'ms)';
$oid_name = 'npIoPulseCounter';
$value = $entry['npIoPulseCounter'];
$oid = '.1.3.6.1.4.1.25728.8900.1.1.9.'.$index;
//discover_sensor('counter', $device, $oid, "npIoPulseCounter.$index", 'dskf-mib', $descr, 1, $value);
discover_counter($device, 'counter', $mib, $oid_name, $oid, $index, $descr, 1, $value);
$descr = ($entry['npIoMemo'] ? $entry['npIoMemo'] : 'Pulse Counter ' . $index);
$descr .= ' (' . $entry['npIoSinglePulseDuration'] . 'ms)';
$oid_name = 'npIoPulseCounter';
$value = $entry['npIoPulseCounter'];
$oid = '.1.3.6.1.4.1.25728.8900.1.1.9.' . $index;
//discover_sensor('counter', $device, $oid, "npIoPulseCounter.$index", 'dskf-mib', $descr, 1, $value);
discover_counter($device, 'counter', $mib, $oid_name, $oid, $index, $descr, 1, $value);
}
print_debug_vars($cache_discovery['DKSF-70-MIB']);

View File

@ -0,0 +1,134 @@
<?php
/**
* Observium
*
* This file is part of Observium.
*
* @package observium
* @subpackage discovery
* @copyright (C) Adam Armstrong
*
*/
// FIXME migrate to definitions
$cache_discovery['DKSF-PWR-OLD-MIB']['smoke'] = snmpwalk_cache_oid($device, 'npSmokeTable', [], 'DKSF-PWR-OLD-MIB');
foreach ($cache_discovery['DKSF-PWR-OLD-MIB']['smoke'] as $index => $entry) {
if ($entry['npSmokePower'] === 'off') {
continue;
}
$oid = '.1.3.6.1.4.1.25728.8200.1.1.2.' . $index;
$descr = $entry['npSmokeMemo'] ?: 'Smoke ' . $index;
$value = $entry['npSmokeStatus'];
if ($value) {
discover_status($device, $oid, 'npSmokeStatus.' . $index, 'dskf-mib-smoke-state', $descr, $value, [ 'entPhysicalClass' => 'other' ]);
}
}
/*
$cache_discovery['DKSF-PWR-OLD-MIB']['loop'] = snmpwalk_cache_oid($device, 'npCurLoopTable', array(), 'DKSF-PWR-OLD-MIB');
foreach ($cache_discovery['DKSF-PWR-OLD-MIB']['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('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('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;
$value = $entry['npCurLoopR'];
if ($value && $value < 99999)
{
discover_sensor('resistance', $device, $oid, 'npCurLoopR.'.$index, 'dskf-mib-loop', $descr, 1, $value);
}
}
*/
$cache_discovery['DKSF-PWR-OLD-MIB']['temphum'] = snmpwalk_cache_oid($device, 'npRelHumidity', [], 'DKSF-PWR-OLD-MIB');
foreach ($cache_discovery['DKSF-PWR-OLD-MIB']['temphum'] as $index => $entry) {
// Temperature
$descr = 'Temperature ' . $index;
$value = $entry['npRelHumSensorValueT100'];
if ($value && $entry['npRelHumSensorStatus'] != 'error') {
$oid = '.1.3.6.1.4.1.25728.8400.2.9.' . $index;
discover_sensor('temperature', $device, $oid, "npRelHumSensorValueT100.$index", 'dskf-mib', $descr, 0.01, $value);
}
// Humidity
$descr = 'Humidity ' . $index;
$value = $entry['npRelHumSensorValueH'];
if ($value >= 0 && $entry['npRelHumSensorStatusH'] != 'sensorFailed') {
$oid = '.1.3.6.1.4.1.25728.8400.2.2.' . $index;
$limits = [ 'limit_high' => $entry['npRelHumSafeRangeHigh'], 'limit_low' => $entry['npRelHumSafeRangeLow'] ];
discover_sensor('humidity', $device, $oid, "npRelHumSensorValueH.$index", 'dskf-mib', $descr, 1, $value, $limits);
}
}
/* Moved to DEF
$cache_discovery['DKSF-PWR-OLD-MIB']['thermo'] = snmpwalk_cache_oid($device, 'npThermoTable', array(), 'DKSF-PWR-OLD-MIB');
foreach ($cache_discovery['DKSF-PWR-OLD-MIB']['thermo'] as $index => $entry)
{
// Temperature
$descr = ($entry['npThermoMemo'] ? $entry['npThermoMemo'] : 'Thermo '.$index);
$value = $entry['npThermoValue'];
if ($value && $entry['npThermoStatus'] != 'failed')
{
$oid = '.1.3.6.1.4.1.25728.8800.1.1.2.'.$index;
$limits = array('limit_high' => $entry['npThermoHigh'], 'limit_low' => $entry['npThermoLow']);
discover_sensor('temperature', $device, $oid, "npThermoValue.$index", 'dskf-mib', $descr, 1, $value, $limits);
}
}
*/
$cache_discovery['DKSF-PWR-OLD-MIB']['io'] = snmpwalk_cache_oid($device, 'npIoTable', [], 'DKSF-PWR-OLD-MIB');
foreach ($cache_discovery['DKSF-PWR-OLD-MIB']['io'] as $index => $entry) {
if ($entry['npIoLevelIn'] == '0') {
continue;
}
$descr = $entry['npIoMemo'] ?: 'Pulse Counter ' . $index;
$descr .= ' (' . $entry['npIoSinglePulseDuration'] . 'ms)';
$oid_name = 'npIoPulseCounter';
$value = $entry['npIoPulseCounter'];
$oid = '.1.3.6.1.4.1.25728.8900.1.1.9.' . $index;
//discover_sensor('counter', $device, $oid, "npIoPulseCounter.$index", 'dskf-mib', $descr, 1, $value);
discover_counter($device, 'counter', $mib, $oid_name, $oid, $index, $descr, 1, $value);
}
print_debug_vars($cache_discovery['DKSF-PWR-OLD-MIB']);
unset($cache_discovery['DKSF-PWR-OLD-MIB']);
// EOF

View File

@ -6,7 +6,7 @@
*
* @package observium
* @subpackage discovery
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2021 Observium Limited
* @copyright (C) Adam Armstrong
*
*/
@ -29,15 +29,16 @@
// DNOS-BOXSERVICES-PRIVATE-MIB::boxServicesTempSensorTemperature.2.0 = INTEGER: 33
// DNOS-BOXSERVICES-PRIVATE-MIB::boxServicesTempSensorTemperature.2.1 = INTEGER: 28
$oid = 'boxServicesTempSensorsTable';
$oids = snmpwalk_cache_oid($device, $oid, array(), $mib);
$oid = 'boxServicesTempSensorsTable';
$oids = snmpwalk_cache_oid($device, $oid, [], $mib);
// By first detect if device used old FAST-BOXSERVICES-PRIVATE-MIB, it use single key in boxServicesTempSensorsTable
$index = explode('.', key($oids));
if (safe_count($oids) && count($index) === 1) {
print_debug('Device must use OLD-DNOS-BOXSERVICES-PRIVATE-MIB');
return; // Exit from mib discovery
if (safe_count($oids)) {
$index = explode('.', key($oids));
if (count($index) === 1) {
print_debug('Device must use OLD-DNOS-BOXSERVICES-PRIVATE-MIB');
return; // Exit from mib discovery
}
}
// DNOS-BOXSERVICES-PRIVATE-MIB::boxServicesNormalTempRangeMin.0 = INTEGER: 0
@ -46,32 +47,30 @@ if (safe_count($oids) && count($index) === 1) {
$boxServicesNormalTempRangeMin = snmp_get_oid($device, 'boxServicesNormalTempRangeMin.0', $mib);
$boxServicesNormalTempRangeMax = snmp_get_oid($device, 'boxServicesNormalTempRangeMax.0', $mib);
foreach ($oids as $index => $entry)
{
list($unit, $iter) = explode('.', $index);
foreach ($oids as $index => $entry) {
[$unit, $iter] = explode('.', $index);
// Temperature
$value = $entry['boxServicesTempSensorTemperature'];
$descr = "Unit $unit Sensor " . ($iter + 1);
// Temperature
$value = $entry['boxServicesTempSensorTemperature'];
$descr = "Unit $unit Sensor " . ($iter + 1);
$sensor_oid = ".1.3.6.1.4.1.674.10895.5000.2.6132.1.1.43.1.8.1.5.$index";
$options = array(
'limit_low' => $boxServicesNormalTempRangeMin,
'limit_high' => $boxServicesNormalTempRangeMax,
'entPhysicalClass' => 'temperature');
$sensor_oid = ".1.3.6.1.4.1.674.10895.5000.2.6132.1.1.43.1.8.1.5.$index";
$options = [
'limit_low' => $boxServicesNormalTempRangeMin,
'limit_high' => $boxServicesNormalTempRangeMax,
'entPhysicalClass' => 'temperature'];
$options['rename_rrd'] = "$mib-boxServicesTempSensorTemperature.$index";
discover_sensor_ng($device, 'temperature', $mib, 'boxServicesTempSensorTemperature', $sensor_oid, $index, NULL,
$descr, 1, $value, $options);
$options['rename_rrd'] = "$mib-boxServicesTempSensorTemperature.$index";
discover_sensor_ng($device, 'temperature', $mib, 'boxServicesTempSensorTemperature', $sensor_oid, $index, $descr, 1, $value, $options);
// State
$descr = "Unit $unit Temperature Sensor " . ($iter + 1);
$value = $entry['boxServicesTempSensorState'];
$status_oid = ".1.3.6.1.4.1.674.10895.5000.2.6132.1.1.43.1.8.1.4.$index";
$options = array('entPhysicalClass' => 'temperature');
// State
$descr = "Unit $unit Temperature Sensor " . ($iter + 1);
$value = $entry['boxServicesTempSensorState'];
$status_oid = ".1.3.6.1.4.1.674.10895.5000.2.6132.1.1.43.1.8.1.4.$index";
$options = ['entPhysicalClass' => 'temperature'];
$options['rename_rrd'] = 'dnos-boxservices-temp-state-boxServicesFanItemState.%index%';
discover_status_ng($device, $mib, 'boxServicesTempSensorState', $status_oid, $index, 'dnos-boxservices-temp-state', $descr, $value, $options);
$options['rename_rrd'] = 'dnos-boxservices-temp-state-boxServicesFanItemState.%index%';
discover_status_ng($device, $mib, 'boxServicesTempSensorState', $status_oid, $index, 'dnos-boxservices-temp-state', $descr, $value, $options);
}
@ -84,19 +83,18 @@ foreach ($oids as $index => $entry)
// boxServicesTempUnitState.2 = normal
// boxServicesTempUnitState.3 = normal
$oid = 'boxServicesTempUnitState';
$oids = snmpwalk_cache_oid($device, $oid, array(), $mib);
$oid = 'boxServicesTempUnitState';
$oids = snmpwalk_cache_oid($device, $oid, [], $mib);
foreach ($oids as $index => $entry)
{
$descr = "Unit $index Temperature";
foreach ($oids as $index => $entry) {
$descr = "Unit $index Temperature";
$value = $entry['boxServicesTempUnitState'];
$value = $entry['boxServicesTempUnitState'];
$status_oid = ".1.3.6.1.4.1.674.10895.5000.2.6132.1.1.43.1.15.1.2.$index";
$options = array('entPhysicalClass' => 'temperature');
$status_oid = ".1.3.6.1.4.1.674.10895.5000.2.6132.1.1.43.1.15.1.2.$index";
$options = ['entPhysicalClass' => 'temperature'];
discover_status_ng($device, $mib, 'boxServicesTempUnitState', $status_oid, $index, 'dnos-boxservices-temp-state', $descr, $value, $options);
discover_status_ng($device, $mib, 'boxServicesTempUnitState', $status_oid, $index, 'dnos-boxservices-temp-state', $descr, $value, $options);
}
@ -113,63 +111,57 @@ foreach ($oids as $index => $entry)
// DNOS-BOXSERVICES-PRIVATE-MIB::boxServicesFanDutyLevel.0 = INTEGER: 0
// DNOS-BOXSERVICES-PRIVATE-MIB::boxServicesFanDutyLevel.1 = INTEGER: 0
$oid = 'boxServicesFansTable';
$oids = snmpwalk_cache_oid($device, $oid, array(), $mib);
$oid = 'boxServicesFansTable';
$oids = snmpwalk_cache_oid($device, $oid, [], $mib);
$show_numbers = safe_count($oids) > 1;
foreach ($oids as $index => $entry)
{
if ($entry['boxServicesFanItemState'] == 'notpresent')
{
continue;
}
foreach ($oids as $index => $entry) {
if ($entry['boxServicesFanItemState'] == 'notpresent') {
continue;
}
// State Sensor
$value = $entry['boxServicesFanItemState'];
//$descr = nicecase(rewrite_entity_name($entry['boxServicesFanItemType'])) .' Fan';
//if ($show_numbers) { $descr .= ' '. ($index+1); }
// State Sensor
$value = $entry['boxServicesFanItemState'];
//$descr = nicecase(rewrite_entity_name($entry['boxServicesFanItemType'])) .' Fan';
//if ($show_numbers) { $descr .= ' '. ($index+1); }
list($unit, $iter) = explode('.', $index);
$descr = "Unit $unit Fan " . ($iter + 1) . ' (' . nicecase(rewrite_entity_name($entry['boxServicesFanItemType'])) . ')';
[$unit, $iter] = explode('.', $index);
$descr = "Unit $unit Fan " . ($iter + 1) . ' (' . nicecase(rewrite_entity_name($entry['boxServicesFanItemType'])) . ')';
$status_oid = ".1.3.6.1.4.1.674.10895.5000.2.6132.1.1.43.1.6.1.3.$index";
$options = array('entPhysicalClass' => 'fan');
$status_oid = ".1.3.6.1.4.1.674.10895.5000.2.6132.1.1.43.1.6.1.3.$index";
$options = ['entPhysicalClass' => 'fan'];
discover_status_ng($device, $mib, 'boxServicesFanItemState', $status_oid, $index, 'dnos-boxservices-state', $descr, $value, $options);
discover_status_ng($device, $mib, 'boxServicesFanItemState', $status_oid, $index, 'dnos-boxservices-state', $descr, $value, $options);
if ($entry['boxServicesFanSpeed'] != 0)
{
$options['rename_rrd'] = "fastpath-boxservices-private-mib-boxServicesFanSpeed.$index";
discover_sensor_ng(
$device,
'fanspeed',
$mib,
'boxServicesFanSpeed',
".1.3.6.1.4.1.674.10895.5000.2.6132.1.1.43.1.6.1.4.$index",
$index,
NULL,
$descr,
1,
$entry['boxServicesFanSpeed'],
$options);
}
if ($entry['boxServicesFanSpeed'] != 0) {
$options['rename_rrd'] = "fastpath-boxservices-private-mib-boxServicesFanSpeed.$index";
discover_sensor_ng(
$device,
'fanspeed',
$mib,
'boxServicesFanSpeed',
".1.3.6.1.4.1.674.10895.5000.2.6132.1.1.43.1.6.1.4.$index",
$index,
$descr,
1,
$entry['boxServicesFanSpeed'],
$options);
}
if ($entry['boxServicesFanDutyLevel'] != 0)
{
$options['rename_rrd'] = "fastpath-boxservices-private-mib-boxServicesFanDutyLevel.$index";
discover_sensor_ng(
$device,
'load',
$mib,
'boxServicesFanDutyLevel',
".1.3.6.1.4.1.674.10895.5000.2.6132.1.1.43.1.6.1.5.$index",
$index,
NULL,
$descr,
1,
$entry['boxServicesFanDutyLevel'],
$options);
}
if ($entry['boxServicesFanDutyLevel'] != 0) {
$options['rename_rrd'] = "fastpath-boxservices-private-mib-boxServicesFanDutyLevel.$index";
discover_sensor_ng(
$device,
'load',
$mib,
'boxServicesFanDutyLevel',
".1.3.6.1.4.1.674.10895.5000.2.6132.1.1.43.1.6.1.5.$index",
$index,
$descr,
1,
$entry['boxServicesFanDutyLevel'],
$options);
}
}
@ -182,34 +174,32 @@ foreach ($oids as $index => $entry)
// DNOS-BOXSERVICES-PRIVATE-MIB::boxServicesPowSupplyItemState.0 = INTEGER: operational(2)
// DNOS-BOXSERVICES-PRIVATE-MIB::boxServicesPowSupplyItemState.1 = INTEGER: notpresent(1)
$oid = 'boxServicesPowSuppliesTable';
$oids = snmpwalk_cache_oid($device, $oid, array(), $mib);
$oid = 'boxServicesPowSuppliesTable';
$oids = snmpwalk_cache_oid($device, $oid, [], $mib);
$show_numbers = safe_count($oids) > 1;
foreach ($oids as $index => $entry)
{
if ($entry['boxServicesPowSupplyItemState'] === 'notpresent' ||
($entry['boxServicesPowSupplyItemType'] == 0 && $entry['boxServicesPowSupplyItemState'] === 'failed')) // This sensor not really exist)
{
continue;
}
foreach ($oids as $index => $entry) {
if ($entry['boxServicesPowSupplyItemState'] === 'notpresent' ||
($entry['boxServicesPowSupplyItemType'] == 0 && $entry['boxServicesPowSupplyItemState'] === 'failed')) // This sensor not really exist)
{
continue;
}
// State Sensor
$value = $entry['boxServicesPowSupplyItemState'];
$descr = nicecase(rewrite_entity_name($entry['boxServicesPowSupplyItemType'])) . ' PSU';
if ($show_numbers)
{
$descr .= ' ' . ($index + 1);
}
// State Sensor
$value = $entry['boxServicesPowSupplyItemState'];
$descr = nicecase(rewrite_entity_name($entry['boxServicesPowSupplyItemType'])) . ' PSU';
if ($show_numbers) {
$descr .= ' ' . ($index + 1);
}
list($unit, $iter) = explode('.', $index);
$descr = "Unit $unit PSU " . ($iter + 1) . ' (' . nicecase(rewrite_entity_name($entry['boxServicesPowSupplyItemType'])) . ')';
[$unit, $iter] = explode('.', $index);
$descr = "Unit $unit PSU " . ($iter + 1) . ' (' . nicecase(rewrite_entity_name($entry['boxServicesPowSupplyItemType'])) . ')';
$status_oid = ".1.3.6.1.4.1.674.10895.5000.2.6132.1.1.43.1.7.1.3.$index";
$options = array('entPhysicalClass' => 'power');
$status_oid = ".1.3.6.1.4.1.674.10895.5000.2.6132.1.1.43.1.7.1.3.$index";
$options = ['entPhysicalClass' => 'power'];
//discover_status($device, $sensor_oid, "boxServicesPowSupplyItemState.$index", 'dnos-boxservices-state', $descr, $value, $options);
discover_status_ng($device, $mib, 'boxServicesPowSupplyItemState', $status_oid, $index, 'dnos-boxservices-state', $descr, $value, $options);
//discover_status($device, $sensor_oid, "boxServicesPowSupplyItemState.$index", 'dnos-boxservices-state', $descr, $value, $options);
discover_status_ng($device, $mib, 'boxServicesPowSupplyItemState', $status_oid, $index, 'dnos-boxservices-state', $descr, $value, $options);
}
@ -244,9 +234,14 @@ foreach ($oids as $index => $entry)
// DNOS-BOXSERVICES-PRIVATE-MIB::boxsPwrUsageHistoryStackPowerConsumption.3.60 = INTEGER: 94224
//$oid = 'boxsUnitPwrUsageHistoryTable';
/**
* This is a History table, on next polling index will be changed.
* See: https://jira.observium.org/browse/OBS-4891
$oid = 'boxsPwrUsageHistoryUnitPowerConsumption';
$oids = snmpwalk_cache_oid($device, $oid, array(), $mib);
$oids = snmpwalk_cache_oid($device, $oid, [], $mib);
// This may not hold up in the long run, but...
// Assume:
@ -259,27 +254,25 @@ $oids = snmpwalk_cache_oid($device, $oid, array(), $mib);
// 1. Move array pointer to end of array. (ex. key = "3.60")
// 2. Pull the samples per unit off the key/index. (ex. "60")
end($oids);
list(, $samples_per_unit) = explode('.', key($oids));
[, $samples_per_unit] = explode('.', key($oids));
foreach ($oids as $index => $entry)
{
list($unit, $sample) = explode('.', $index);
if (intval($sample) != $samples_per_unit)
{
continue;
}
foreach ($oids as $index => $entry) {
[ $unit, $sample ] = explode('.', $index);
if ((int)$sample != $samples_per_unit) {
continue;
}
$descr = "Unit $unit Power Usage";
$value = $entry['boxsPwrUsageHistoryUnitPowerConsumption'];
$descr = "Unit $unit Power Usage";
$value = $entry['boxsPwrUsageHistoryUnitPowerConsumption'];
$sensor_oid = ".1.3.6.1.4.1.674.10895.5000.2.6132.1.1.43.1.9.1.4.$index";
$options = array('entPhysicalClass' => 'power');
$sensor_oid = ".1.3.6.1.4.1.674.10895.5000.2.6132.1.1.43.1.9.1.4.$index";
$options = ['entPhysicalClass' => 'power'];
if (is_numeric($value) && $value)
{
$options['rename_rrd'] = "$mib-boxsPwrUsageHistoryUnitPowerConsumption.$unit";
discover_sensor_ng($device,'power', $mib, 'boxsPwrUsageHistoryUnitPowerConsumption', $sensor_oid, $index, NULL, $descr, 0.001, $value, $options);
}
if (is_numeric($value) && $value) {
$options['rename_rrd'] = "$mib-boxsPwrUsageHistoryUnitPowerConsumption.$unit";
discover_sensor_ng($device, 'power', $mib, 'boxsPwrUsageHistoryUnitPowerConsumption', $sensor_oid, $index, $descr, 0.001, $value, $options);
}
}
*/
// EOF

View File

@ -5,9 +5,9 @@
*
* This file is part of Observium.
*
* @package observium
* @subpackage discovery
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2019 Observium Limited
* @package observium
* @subpackage discovery
* @copyright (C) Adam Armstrong
*
*/
@ -28,35 +28,34 @@ DPS-MIB-V38::thresholds.1 = noAlarms
DPS-MIB-V38::thresholds.5 = noAlarms
DPS-MIB-V38::thresholds.17 = noAlarms
*/
$oids = snmpwalk_cache_oid($device, "analogChannels", array(), "DPS-MIB-V38");
$oids = snmpwalk_cache_oid($device, "analogChannels", [], "DPS-MIB-V38");
foreach ($oids as $index => $entry)
{
foreach ($oids as $index => $entry) {
if ($entry['enabled'] == "disabled") { continue; }
$descr = $entry['description'];
$oid_name = 'value';
$oid_num = '.1.3.6.1.4.1.2682.1.2.6.1.4.'.$index;
$type = $mib . '-' . $oid_name;
// Detect class by description
foreach (array('temperature', 'humidity', 'voltage', 'current', 'power') as $class)
{
if (str_icontains_array($descr, $class))
{
discover_sensor($class, $device, $oid_num, $index, $type, $descr, 1, $value);
break; // stop foreach
if ($entry['enabled'] == "disabled") {
continue;
}
}
// Statuses
$oid_name = 'thresholds';
$oid_num = '.1.3.6.1.4.1.2682.1.2.6.1.5.'.$index;
$type = 'dpsThresholds';
$value = $entry[$oid_name];
$descr = $entry['description'];
$oid_name = 'value';
$oid_num = '.1.3.6.1.4.1.2682.1.2.6.1.4.' . $index;
$type = $mib . '-' . $oid_name;
discover_status_ng($device, $mib, 'thresholds', $oid_num, $index, $type, $descr, $value, array('entPhysicalClass' => 'other'));
// Detect class by description
foreach (['temperature', 'humidity', 'voltage', 'current', 'power'] as $class) {
if (str_icontains_array($descr, $class)) {
discover_sensor($class, $device, $oid_num, $index, $type, $descr, 1, $value);
break; // stop foreach
}
}
// Statuses
$oid_name = 'thresholds';
$oid_num = '.1.3.6.1.4.1.2682.1.2.6.1.5.' . $index;
$type = 'dpsThresholds';
$value = $entry[$oid_name];
discover_status_ng($device, $mib, 'thresholds', $oid_num, $index, $type, $descr, $value, ['entPhysicalClass' => 'other']);
}

View File

@ -6,189 +6,245 @@
*
* @package observium
* @subpackage discovery
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2022 Observium Limited
* @copyright (C) Adam Armstrong
*
*/
/// 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');
$inputs = snmpwalk_cache_twopart_oid($device, 'inputTable', [], 'EATON-EPDU-MIB');
$inputs = snmpwalk_cache_twopart_oid($device, 'inputTotal', $inputs, 'EATON-EPDU-MIB');
foreach ($inputs AS $unit_id => $unit_data)
{
//echo "Unit $unit_id".PHP_EOL;
$inputs_o = snmpwalk_cache_threepart_oid($device, 'inputVoltageTable', [], '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 ($unit_data AS $input_id => $input_data)
{
//echo " Input $input_id".PHP_EOL;
foreach ($inputs as $unit_id => $unit_data) {
//echo "Unit $unit_id".PHP_EOL;
$input_oid = $unit_id.".".$input_id;
foreach ($unit_data as $input_id => $input_data) {
//echo " Input $input_id".PHP_EOL;
if (isset($input_data['inputFrequency']))
{
discover_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']);
}
$input_index = $unit_id . "." . $input_id;
$descr = "Unit $unit_id Input $input_id";
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'];
discover_sensor('apower', $device, $oid, "inputTotalVA.$input_oid", 'eaton-epdu-mib', $descr, 1, $value);
}
if (isset($input_data['inputTotalWatts']) && is_numeric($input_data['inputTotalWatts']))
{
$descr = "Unit $unit_id Input $input_id";
$oid = ".1.3.6.1.4.1.534.6.6.7.3.5.1.4.".$input_oid;
$value = $input_data['inputTotalWatts'];
discover_sensor('power', $device, $oid, "inputTotalWatts.$input_oid", 'eaton-epdu-mib', $descr, 1, $value);
}
if (isset($input_data['inputTotalPowerFactor']) && is_numeric($input_data['inputTotalPowerFactor']))
{
$descr = "Unit $unit_id Input $input_id";
$oid = ".1.3.6.1.4.1.534.6.6.7.3.5.1.7.".$input_oid;
$value = $input_data['inputTotalPowerFactor'];
discover_sensor('powerfactor', $device, $oid, "inputTotalPowerFactor.$input_oid", 'eaton-epdu-mib', $descr, 0.001, $value);
}
if (isset($input_data['inputTotalVAR']) && is_numeric($input_data['inputTotalVAR']))
{
$descr = "Unit $unit_id Input $input_id";
$oid = ".1.3.6.1.4.1.534.6.6.7.3.5.1.8.".$input_oid;
$value = $input_data['inputTotalVAR'];
discover_sensor('rpower', $device, $oid, "inputTotalVAR.$input_oid", 'eaton-epdu-mib', $descr, 1, $value);
}
if (is_array($inputs_o[$unit_id][$input_id])) {
foreach ($inputs_o[$unit_id][$input_id] AS $id => $entry)
{
//print_r($entry);
$entry_oid = $input_oid . "." . $id;
if (isset($entry['inputVoltage']) && is_numeric($entry['inputVoltage']))
{
$descr = "Unit $unit_id Input $input_id ".$entry['inputVoltageMeasType'];
$oid = ".1.3.6.1.4.1.534.6.6.7.3.2.1.3.".$entry_oid;
$status_oid = ".1.3.6.1.4.1.534.6.6.7.3.2.1.4.".$entry_oid;
$status_descr = $descr . " Voltage";
$value = $entry['inputVoltage'];
$status_value = $entry['inputVoltageThStatus'];
$limits = array('limit_low' => $entry['inputVoltageThLowerCritical']*0.001, 'limit_low_warn' => $entry['inputVoltageThLowerWarning']*0.001,
'limit_high' => $entry['inputVoltageThUpperCritical']*0.001, 'limit_high_warn' => $entry['inputVoltageThUpperWarning']*0.001);
discover_sensor('voltage', $device, $oid, "inputVoltage.$entry_oid", 'eaton-epdu-mib', $descr, 0.001, $value, $limits);
discover_status($device, $status_oid, "inputVoltageThStatus.".$entry_oid, 'inputVoltageThStatus', $status_descr, $status_value, array('entPhysicalClass' => 'input'));
if (isset($input_data['inputFrequency'])) {
$oid_num = ".1.3.6.1.4.1.534.6.6.7.3.1.1.3." . $input_index;
discover_sensor('frequency', $device, $oid_num, "inputFrequency.$input_index", 'eaton-epdu-mib', "$descr Frequency", 0.1, $input_data['inputFrequency']);
}
if (isset($entry['inputCurrent']) && is_numeric($entry['inputCurrent']))
{
$descr = "Unit $unit_id Input $input_id ".$entry['inputCurrentMeasType'] . " (".$entry['inputCurrentCapacity']*0.001."A)";
$oid = ".1.3.6.1.4.1.534.6.6.7.3.3.1.4.".$entry_oid;
$value = $entry['inputCurrent'];
$status_oid = ".1.3.6.1.4.1.534.6.6.7.3.3.1.5.".$entry_oid;
$status_value = $entry['inputCurrentThStatus'];
$status_descr = $descr . " Current";
$limits = array('limit_low' => $entry['inputCurrentThLowerCritical']*0.001, 'limit_low_warn' => $entry['inputCurrentThLowerWarning']*0.001,
'limit_high' => $entry['inputCurrentThUpperCritical']*0.001, 'limit_high_warn' => $entry['inputCurrentThUpperWarning']*0.001);
discover_sensor('current', $device, $oid, "inputCurrent.$entry_oid", 'eaton-epdu-mib', $descr, 0.001, $value, $limits);
discover_status($device, $status_oid, "inputCurrentThStatus.".$entry_oid, 'inputCurrentThStatus', $status_descr, $status_value, array('entPhysicalClass' => 'input'));
if (isset($input_data['inputFrequencyStatus'])) {
discover_status($device, ".1.3.6.1.4.1.534.6.6.7.3.1.1.4." . $input_index, "inputFrequencyStatus." . $input_index, 'inputFrequencyStatus', "$descr Frequency Status", $input_data['inputFrequencyStatus'], ['entPhysicalClass' => 'input']);
}
if (isset($entry['inputVA']) && is_numeric($entry['inputVA']))
{
$descr = "Unit $unit_id Input $input_id ".$entry['inputPowerMeasType'];
$oid = ".1.3.6.1.4.1.534.6.6.7.3.4.1.3.".$entry_oid;
$value = $entry['inputVA'];
discover_sensor('apower', $device, $oid, "inputVA.$entry_oid", 'eaton-epdu-mib', $descr, 1, $value);
if (isset($input_data['inputTotalVA']) && is_numeric($input_data['inputTotalVA'])) {
$oid = ".1.3.6.1.4.1.534.6.6.7.3.5.1.3." . $input_index;
$value = $input_data['inputTotalVA'];
discover_sensor('apower', $device, $oid, "inputTotalVA.$input_index", 'eaton-epdu-mib', "$descr Total", 1, $value);
}
if (isset($entry['inputWatts']) && is_numeric($entry['inputWatts']))
{
$descr = "Unit $unit_id Input $input_id ".$entry['inputPowerMeasType'];
$oid = ".1.3.6.1.4.1.534.6.6.7.3.4.1.4.".$entry_oid;
$value = $entry['inputWatts'];
discover_sensor('power', $device, $oid, "inputWatts.$entry_oid", 'eaton-epdu-mib', $descr, 1, $value);
if (isset($input_data['inputTotalWatts']) && is_numeric($input_data['inputTotalWatts'])) {
$oid = ".1.3.6.1.4.1.534.6.6.7.3.5.1.4." . $input_index;
$value = $input_data['inputTotalWatts'];
discover_sensor('power', $device, $oid, "inputTotalWatts.$input_index", 'eaton-epdu-mib', "$descr Total", 1, $value);
}
if (isset($entry['inputPowerFactor']) && is_numeric($entry['inputPowerFactor']))
{
$descr = "Unit $unit_id Input $input_id ".$entry['inputPowerMeasType'];
$oid = ".1.3.6.1.4.1.534.6.6.7.3.4.1.7.".$entry_oid;
$value = $entry['inputPowerFactor'];
discover_sensor('powerfactor', $device, $oid, "inputPowerFactor.$entry_oid", 'eaton-epdu-mib', $descr, 0.001, $value);
if (isset($input_data['inputTotalWh']) && is_numeric($input_data['inputTotalWh'])) {
$oid_num = ".1.3.6.1.4.1.534.6.6.7.3.5.1.5." . $input_index;
$oid_name = 'inputTotalWh';
$value = $input_data[$oid_name];
discover_counter($device, 'energy', $mib, $oid_name, $oid_num, $input_index, "$descr Total", 1, $value);
}
if (isset($entry['inputVAR']) && is_numeric($entry['inputVAR']))
{
$descr = "Unit $unit_id Input $input_id ".$entry['inputPowerMeasType'];
$oid = ".1.3.6.1.4.1.534.6.6.7.3.4.1.8.".$entry_oid;
$value = $entry['inputVAR'];
discover_sensor('rpower', $device, $oid, "inputVAR.$entry_oid", 'eaton-epdu-mib', $descr, 1, $value);
if (isset($input_data['inputTotalPowerFactor']) && is_numeric($input_data['inputTotalPowerFactor'])) {
$oid = ".1.3.6.1.4.1.534.6.6.7.3.5.1.7." . $input_index;
$value = $input_data['inputTotalPowerFactor'];
discover_sensor('powerfactor', $device, $oid, "inputTotalPowerFactor.$input_index", 'eaton-epdu-mib', "$descr Total", 0.001, $value);
}
}
if (isset($input_data['inputTotalVAR']) && is_numeric($input_data['inputTotalVAR'])) {
$oid = ".1.3.6.1.4.1.534.6.6.7.3.5.1.8." . $input_index;
$value = $input_data['inputTotalVAR'];
discover_sensor('rpower', $device, $oid, "inputTotalVAR.$input_index", 'eaton-epdu-mib', "$descr Total", 1, $value);
}
if (is_array($inputs_o[$unit_id][$input_id])) {
$num_phase = safe_count($inputs_o[$unit_id][$input_id]);
foreach ($inputs_o[$unit_id][$input_id] as $id => $entry) {
//print_r($entry);
$entry_oid = $input_index . "." . $id;
if ($num_phase > 1) {
$options = [
'measured_entity_label' => "Unit $unit_id Input $input_id " . $entry['inputPowerMeasType'],
'measured_class' => 'phase'
];
} else {
$options = [];
}
if (isset($entry['inputVoltage']) && is_numeric($entry['inputVoltage'])) {
$descr = "Unit $unit_id Input $input_id " . $entry['inputVoltageMeasType'];
$oid = ".1.3.6.1.4.1.534.6.6.7.3.2.1.3." . $entry_oid;
$status_oid = ".1.3.6.1.4.1.534.6.6.7.3.2.1.4." . $entry_oid;
$status_descr = $descr . " Voltage";
$value = $entry['inputVoltage'];
$status_value = $entry['inputVoltageThStatus'];
$limits = ['limit_low' => $entry['inputVoltageThLowerCritical'] * 0.001, 'limit_low_warn' => $entry['inputVoltageThLowerWarning'] * 0.001,
'limit_high' => $entry['inputVoltageThUpperCritical'] * 0.001, 'limit_high_warn' => $entry['inputVoltageThUpperWarning'] * 0.001];
discover_sensor('voltage', $device, $oid, "inputVoltage.$entry_oid", 'eaton-epdu-mib', $descr, 0.001, $value, array_merge($options, $limits));
discover_status($device, $status_oid, "inputVoltageThStatus." . $entry_oid, 'inputVoltageThStatus', $status_descr, $status_value, ['entPhysicalClass' => 'input']);
}
if (isset($entry['inputCurrent']) && is_numeric($entry['inputCurrent'])) {
$descr = "Unit $unit_id Input $input_id " . $entry['inputCurrentMeasType'] . " (" . $entry['inputCurrentCapacity'] * 0.001 . "A)";
$oid = ".1.3.6.1.4.1.534.6.6.7.3.3.1.4." . $entry_oid;
$value = $entry['inputCurrent'];
$status_oid = ".1.3.6.1.4.1.534.6.6.7.3.3.1.5." . $entry_oid;
$status_value = $entry['inputCurrentThStatus'];
$status_descr = $descr . " Current";
$limits = ['limit_low' => $entry['inputCurrentThLowerCritical'] * 0.001, 'limit_low_warn' => $entry['inputCurrentThLowerWarning'] * 0.001,
'limit_high' => $entry['inputCurrentThUpperCritical'] * 0.001, 'limit_high_warn' => $entry['inputCurrentThUpperWarning'] * 0.001];
discover_sensor('current', $device, $oid, "inputCurrent.$entry_oid", 'eaton-epdu-mib', $descr, 0.001, $value, array_merge($options, $limits));
discover_status($device, $status_oid, "inputCurrentThStatus." . $entry_oid, 'inputCurrentThStatus', $status_descr, $status_value, ['entPhysicalClass' => 'input']);
}
if (isset($entry['inputVA']) && is_numeric($entry['inputVA'])) {
$descr = "Unit $unit_id Input $input_id " . $entry['inputPowerMeasType'];
$oid = ".1.3.6.1.4.1.534.6.6.7.3.4.1.3." . $entry_oid;
$value = $entry['inputVA'];
discover_sensor('apower', $device, $oid, "inputVA.$entry_oid", 'eaton-epdu-mib', $descr, 1, $value, $options);
}
if (isset($entry['inputWatts']) && is_numeric($entry['inputWatts'])) {
$descr = "Unit $unit_id Input $input_id " . $entry['inputPowerMeasType'];
$oid = ".1.3.6.1.4.1.534.6.6.7.3.4.1.4." . $entry_oid;
$value = $entry['inputWatts'];
discover_sensor('power', $device, $oid, "inputWatts.$entry_oid", 'eaton-epdu-mib', $descr, 1, $value, $options);
}
if (isset($entry['inputWh']) && is_numeric($entry['inputWh'])) {
$oid_num = ".1.3.6.1.4.1.534.6.6.7.3.4.1.5." . $entry_oid;
$oid_name = 'inputWh';
$value = $entry[$oid_name];
discover_counter($device, 'energy', $mib, $oid_name, $oid_num, $entry_oid, $descr, 1, $value, $options);
}
if (isset($entry['inputPowerFactor']) && is_numeric($entry['inputPowerFactor'])) {
$descr = "Unit $unit_id Input $input_id " . $entry['inputPowerMeasType'];
$oid = ".1.3.6.1.4.1.534.6.6.7.3.4.1.7." . $entry_oid;
$value = $entry['inputPowerFactor'];
discover_sensor('powerfactor', $device, $oid, "inputPowerFactor.$entry_oid", 'eaton-epdu-mib', $descr, 0.001, $value, $options);
}
if (isset($entry['inputVAR']) && is_numeric($entry['inputVAR'])) {
$descr = "Unit $unit_id Input $input_id " . $entry['inputPowerMeasType'];
$oid = ".1.3.6.1.4.1.534.6.6.7.3.4.1.8." . $entry_oid;
$value = $entry['inputVAR'];
discover_sensor('rpower', $device, $oid, "inputVAR.$entry_oid", 'eaton-epdu-mib', $descr, 1, $value, $options);
}
}
}
}
}
}
// 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');
// EATON-EPDU-MIB::outletID.0.2 = STRING: 2
// EATON-EPDU-MIB::outletName.0.2 = STRING: "Outlet A2"
// EATON-EPDU-MIB::outletParentCount.0.2 = INTEGER: 1
// EATON-EPDU-MIB::outletType.0.2 = INTEGER: iecC13(1)
// EATON-EPDU-MIB::outletDesignator.0.2 = STRING: A2
// EATON-EPDU-MIB::outletPhaseID.0.2 = INTEGER: phase1toN(2)
// EATON-EPDU-MIB::outletCurrentCapacity.0.2 = INTEGER: 10000
// EATON-EPDU-MIB::outletCurrent.0.2 = INTEGER: 815
// EATON-EPDU-MIB::outletCurrentThStatus.0.2 = INTEGER: good(0)
// EATON-EPDU-MIB::outletCurrentThLowerWarning.0.2 = INTEGER: 0
// EATON-EPDU-MIB::outletCurrentThLowerCritical.0.2 = INTEGER: -1
// EATON-EPDU-MIB::outletCurrentThUpperWarning.0.2 = INTEGER: 8000
// EATON-EPDU-MIB::outletCurrentThUpperCritical.0.2 = INTEGER: 10000
// EATON-EPDU-MIB::outletCurrentCrestFactor.0.2 = INTEGER: 2355
// EATON-EPDU-MIB::outletCurrentPercentLoad.0.2 = INTEGER: -1
// EATON-EPDU-MIB::outletVA.0.2 = INTEGER: 199
// EATON-EPDU-MIB::outletWatts.0.2 = INTEGER: 177
// EATON-EPDU-MIB::outletWh.0.2 = Gauge32: 21931
// EATON-EPDU-MIB::outletWhTimer.0.2 = Wrong Type (should be Counter32): Gauge32: 1663159425
// EATON-EPDU-MIB::outletPowerFactor.0.2 = INTEGER: -892
// EATON-EPDU-MIB::outletVAR.0.2 = INTEGER: -90
// EATON-EPDU-MIB::outletControlStatus.0.2 = INTEGER: on(1)
// EATON-EPDU-MIB::outletControlOffCmd.0.2 = INTEGER: -1
// EATON-EPDU-MIB::outletControlOnCmd.0.2 = INTEGER: -1
// EATON-EPDU-MIB::outletControlRebootCmd.0.2 = INTEGER: -1
// EATON-EPDU-MIB::outletControlPowerOnState.0.2 = INTEGER: lastState(2)
// EATON-EPDU-MIB::outletControlSequenceDelay.0.2 = INTEGER: 2
// EATON-EPDU-MIB::outletControlRebootOffTime.0.2 = INTEGER: 10
// EATON-EPDU-MIB::outletControlSwitchable.0.2 = INTEGER: switchable(1)
// EATON-EPDU-MIB::outletControlShutoffDelay.0.2 = INTEGER: 120
// Power statistics currently not collected.
//$outlets = snmpwalk_cache_twopart_oid($device, 'outletCurrentTable', $outlets, 'EATON-EPDU-MIB');
$outlets = snmpwalk_cache_twopart_oid($device, 'outletTable', [], 'EATON-EPDU-MIB');
$outlets = snmpwalk_cache_twopart_oid($device, 'outletCurrentTable', $outlets, 'EATON-EPDU-MIB');
$outlets = snmpwalk_cache_twopart_oid($device, 'outletPowerTable', $outlets, 'EATON-EPDU-MIB');
foreach ($outlets as $unit_id => $unit_data) {
foreach ($unit_data as $outlet_id => $entry) {
$outlet_index = $unit_id.".".$outlet_id;
$outlet_descr = "Unit $unit_id ".$entry['outletName'] . " (".$entry['outletType'].")";
$outlet_capacity = $entry['outletCurrentCapacity'] * 0.001;
foreach ($unit_data as $outlet_id => $entry) {
$current_value = $entry['outletCurrent'];
$percent_value = $entry['outletCurrentPercentLoad'];
$status_value = $entry['outletCurrentThStatus'];
$crest_value = $entry['outletCurrentCrestFactor'];
$outlet_index = $unit_id . "." . $outlet_id;
$outlet_descr = "Unit $unit_id " . $entry['outletName'] . " (" . $entry['outletType'] . ")";
$outlet_capacity = $entry['outletCurrentCapacity'] * 0.001;
$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;
$status_value = $entry['outletCurrentThStatus'];
discover_status($device, $status_oid, "outletCurrentThStatus.".$outlet_index, 'outletCurrentThStatus', $outlet_descr, $status_value, [ 'entPhysicalClass' => 'outlet' ]);
$current_oid = '.1.3.6.1.4.1.534.6.6.7.6.4.1.3.' . $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;
$percent_oid = '.1.3.6.1.4.1.534.6.6.7.6.4.1.10.' . $outlet_index;
$limits = [
'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
];
$options = [
'measured_entity_label' => "Unit $unit_id " . $entry['outletName'],
'measured_class' => 'outlet',
'entPhysicalClass' => 'outlet'
];
discover_sensor('current', $device, $current_oid, "outletCurrent.$outlet_index", 'eaton-epdu-mib', $outlet_descr, 0.001, $current_value, $limits);
if ($percent_value >= 0) {
discover_sensor('load', $device, $percent_oid, "outletCurrentPercentLoad.$outlet_index", 'eaton-epdu-mib', $outlet_descr, 1, $percent_value);
discover_status($device, $status_oid, "outletCurrentThStatus." . $outlet_index, 'outletCurrentThStatus', $outlet_descr, $status_value, $options);
$limits = [
'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('current', $device, $current_oid, "outletCurrent.$outlet_index", 'eaton-epdu-mib', $outlet_descr, 0.001, $entry['outletCurrent'], array_merge($options, $limits));
if ($entry['outletCurrentPercentLoad'] >= 0) {
discover_sensor('load', $device, $percent_oid, "outletCurrentPercentLoad.$outlet_index", 'eaton-epdu-mib', $outlet_descr, 1, $entry['outletCurrentPercentLoad'], $options);
}
if ($entry['outletCurrentCrestFactor'] >= 0) {
discover_sensor('crestfactor', $device, $crest_oid, "outletCurrentCrestFactor.$outlet_index", 'eaton-epdu-mib', $outlet_descr, 0.001, $entry['outletCurrentCrestFactor'], $options);
}
if (isset($entry['outletVA']) && $entry['outletVA'] >= 0) {
$oid_num = ".1.3.6.1.4.1.534.6.6.7.6.5.1.2." . $outlet_index;
$oid_name = 'outletVA';
$value = $entry[$oid_name];
discover_sensor_ng($device, 'apower', $mib, $oid_name, $oid_num, $outlet_index, $outlet_descr, 1, $value, $options);
}
if (isset($entry['outletWatts']) && $entry['outletWatts'] >= 0) {
$oid_num = ".1.3.6.1.4.1.534.6.6.7.6.5.1.3." . $outlet_index;
$oid_name = 'outletWatts';
$value = $entry[$oid_name];
discover_sensor_ng($device, 'power', $mib, $oid_name, $oid_num, $outlet_index, $outlet_descr, 1, $value, $options);
}
}
if ($crest_value > 0) {
discover_sensor('crestfactor', $device, $crest_oid, "outletCurrentCrestFactor.$outlet_index", 'eaton-epdu-mib', $outlet_descr, 0.001, $crest_value);
}
}
}
//print_r($outlets);

View File

@ -6,7 +6,7 @@
*
* @package observium
* @subpackage discovery
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2020 Observium Limited
* @copyright (C) Adam Armstrong
*
*/
@ -41,107 +41,98 @@ EDGECORE-PHY-MIB::rlPhyTestGetStatus.9.rlPhyTestTableTxFault = INTEGER: success(
//$oid_base = $config['mibs'][$mib]['identity_num'];
$oid_base = '.1.3.6.1.4.1.259.10.1.14.89.90';
$oids = snmpwalk_cache_twopart_oid($device, 'rlPhyTestGetResult', [], $mib);
$oids = snmpwalk_cache_twopart_oid($device, 'rlPhyTestGetResult', [], $mib);
$new_oids = [];
foreach ($oids as $index => $entry)
{
// Skip all non-dom entries
if (!isset($entry['rlPhyTestTableTransceiverTemp']) || $entry['rlPhyTestTableTransceiverTemp']['rlPhyTestGetResult'] == 0) { continue; }
foreach ($oids as $index => $entry) {
// Skip all non-dom entries
if (!isset($entry['rlPhyTestTableTransceiverTemp']) || $entry['rlPhyTestTableTransceiverTemp']['rlPhyTestGetResult'] == 0) {
continue;
}
$new_oids[$index] = $entry;
$new_oids[$index] = $entry;
}
if (count($new_oids) === 0)
{
// Stop walk if not exist DOM sensors
return;
if (count($new_oids) === 0) {
// Stop walk if not exist DOM sensors
return;
}
// Get additional OIDs
$oids = snmpwalk_cache_twopart_oid($device, 'rlPhyTestGetUnits', $oids, $mib);
$oids = snmpwalk_cache_twopart_oid($device, 'rlPhyTestGetUnits', $oids, $mib);
$oids = snmpwalk_cache_twopart_oid($device, 'rlPhyTestGetStatus', $oids, $mib);
print_debug_vars($oids);
foreach ($new_oids as $ifIndex => $entry1)
{
foreach ($oids[$ifIndex] as $oid_name => $entry)
{
if (!in_array($entry['rlPhyTestGetStatus'], [ 'success', 'inProgress' ])) { continue; }
foreach ($new_oids as $ifIndex => $entry1) {
foreach ($oids[$ifIndex] as $oid_name => $entry) {
if (!in_array($entry['rlPhyTestGetStatus'], ['success', 'inProgress'])) {
continue;
}
switch ($entry['rlPhyTestGetUnits'])
{
case 'microVolt':
case 'microAmper':
case 'microOham':
case 'microWatt':
$scale = si_to_scale('micro');
break;
case 'milidbm':
$scale = si_to_scale('milli');
break;
case 'decidbm':
$scale = si_to_scale('deci');
break;
default:
$scale = 1;
if (str_starts_with($entry['rlPhyTestGetUnits'], 'micro')) {
$scale = si_to_scale('micro');
} elseif (str_starts_with($entry['rlPhyTestGetUnits'], 'mili')) {
$scale = si_to_scale('milli');
} elseif (str_starts_with($entry['rlPhyTestGetUnits'], 'deci')) {
$scale = si_to_scale('deci');
} else {
$scale = 1;
}
$entry['ifIndex'] = $ifIndex;
$match = ['measured_match' => ['entity_type' => 'port', 'field' => 'ifIndex', 'match' => '%ifIndex%']];
$options = entity_measured_match_definition($device, $match, $entry);
//print_debug_vars($options);
$name = $options['port_label'];
switch ($oid_name) {
case 'rlPhyTestTableTransceiverTemp':
$descr = $name . " Temperature";
$index = $ifIndex . '.5';
$oid = "$oid_base.1.2.1.3.$index";
$class = 'temperature';
break;
case 'rlPhyTestTableTransceiverSupply':
$descr = $name . " Voltage";
$index = $ifIndex . '.6';
$oid = "$oid_base.1.2.1.3.$index";
$class = 'voltage';
break;
case 'rlPhyTestTableTxBias':
$descr = $name . " Tx Bias";
$index = $ifIndex . '.7';
$oid = "$oid_base.1.2.1.3.$index";
$class = 'current';
break;
case 'rlPhyTestTableTxOutput':
$descr = $name . " TX Power";
$index = $ifIndex . '.8';
$oid = "$oid_base.1.2.1.3.$index";
$class = 'dbm';
break;
case 'rlPhyTestTableRxOpticalPower':
$descr = $name . " RX Power";
$index = $ifIndex . '.9';
$oid = "$oid_base.1.2.1.3.$index";
$class = 'dbm';
break;
default:
continue 2;
}
$value = $entry['rlPhyTestGetResult'];
discover_sensor_ng($device, $class, $mib, 'rlPhyTestGetResult', $oid, $index, $descr, $scale, $value, $options);
}
$entry['ifIndex'] = $ifIndex;
$match = [ 'measured_match' => [ 'entity_type' => 'port', 'field' => 'ifIndex', 'match' => '%ifIndex%' ] ];
$options = entity_measured_match_definition($device, $match, $entry);
//print_debug_vars($options);
$name = $options['port_label'];
switch ($oid_name)
{
case 'rlPhyTestTableTransceiverTemp':
$descr = $name . " Temperature";
$index = $ifIndex . '.5';
$oid = "$oid_base.1.2.1.3.$index";
$class = 'temperature';
break;
case 'rlPhyTestTableTransceiverSupply':
$descr = $name . " Voltage";
$index = $ifIndex . '.6';
$oid = "$oid_base.1.2.1.3.$index";
$class = 'voltage';
break;
case 'rlPhyTestTableTxBias':
$descr = $name . " Tx Bias";
$index = $ifIndex . '.7';
$oid = "$oid_base.1.2.1.3.$index";
$class = 'current';
break;
case 'rlPhyTestTableTxOutput':
$descr = $name . " TX Power";
$index = $ifIndex . '.8';
$oid = "$oid_base.1.2.1.3.$index";
$class = 'dbm';
break;
case 'rlPhyTestTableRxOpticalPower':
$descr = $name . " RX Power";
$index = $ifIndex . '.9';
$oid = "$oid_base.1.2.1.3.$index";
$class = 'dbm';
break;
default:
continue 2;
}
$value = $entry['rlPhyTestGetResult'];
discover_sensor_ng($device, $class, $mib, 'rlPhyTestGetResult', $oid, $index, NULL, $descr, $scale, $value, $options);
}
}
// EOF

View File

@ -6,7 +6,7 @@
*
* @package observium
* @subpackage discovery
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2020 Observium Limited
* @copyright (C) Adam Armstrong
*
*/
@ -24,14 +24,13 @@ EdgeSwitch-BOXSERVICES-PRIVATE-MIB::boxServicesTempUnitState.1 = INTEGER: normal
EdgeSwitch-BOXSERVICES-PRIVATE-MIB::boxServicesTempUnitTemperature.1 = INTEGER: 52
*/
$oids = snmpwalk_cache_oid($device, 'boxServicesTempSensorsTable', array(), 'EdgeSwitch-BOXSERVICES-PRIVATE-MIB');
$oids = snmpwalk_cache_oid($device, 'boxServicesTempSensorsTable', [], 'EdgeSwitch-BOXSERVICES-PRIVATE-MIB');
// By first detect if device used old FAST-BOXSERVICES-PRIVATE-MIB, it use single key in boxServicesTempSensorsTable
$first_key = current(array_keys($oids));
if (count(explode('.', $first_key)) === 1)
{
print_debug('Device must use old FASTPATH-BOXSERVICES-PRIVATE-MIB');
return;
if (count(explode('.', $first_key)) === 1) {
print_debug('Device must use old FASTPATH-BOXSERVICES-PRIVATE-MIB');
return;
}
// Retrieve temperature limits
@ -41,46 +40,41 @@ if (count(explode('.', $first_key)) === 1)
$boxServicesNormalTempRangeMin = snmp_get_oid($device, 'boxServicesNormalTempRangeMin.0', 'EdgeSwitch-BOXSERVICES-PRIVATE-MIB');
$boxServicesNormalTempRangeMax = snmp_get_oid($device, 'boxServicesNormalTempRangeMax.0', 'EdgeSwitch-BOXSERVICES-PRIVATE-MIB');
foreach ($oids as $index => $entry)
{
$boxServicesStackTempSensorsTable = TRUE;
foreach ($oids as $index => $entry) {
$boxServicesStackTempSensorsTable = TRUE;
$descr = 'Internal Sensor ' . $entry['boxServicesTempSensorIndex'];
if ($entry['boxServicesUnitIndex'] > 1)
{
$descr .= ' (Unit '.$entry['boxServicesUnitIndex'].')';
}
$oid = ".1.3.6.1.4.1.4413.1.1.43.1.8.1.5.$index";
$value = $entry['boxServicesTempSensorTemperature'];
$descr = 'Internal Sensor ' . $entry['boxServicesTempSensorIndex'];
if ($entry['boxServicesUnitIndex'] > 1) {
$descr .= ' (Unit ' . $entry['boxServicesUnitIndex'] . ')';
}
$oid = ".1.3.6.1.4.1.4413.1.1.43.1.8.1.5.$index";
$value = $entry['boxServicesTempSensorTemperature'];
$options = array(
'limit_low' => $boxServicesNormalTempRangeMin,
'limit_high' => $boxServicesNormalTempRangeMax,
'entPhysicalClass' => 'chassis',
);
$options = [
'limit_low' => $boxServicesNormalTempRangeMin,
'limit_high' => $boxServicesNormalTempRangeMax,
'entPhysicalClass' => 'chassis',
];
if ($value != 0)
{
$options['rename_rrd'] = "edgeswitch-boxservices-private-mib-boxServicesTempSensorTemperature.$index";
discover_sensor_ng($device, 'temperature', $mib, 'boxServicesTempSensorTemperature', $oid, $index, NULL, $descr, 1, $value, $options);
}
if ($value != 0) {
$options['rename_rrd'] = "edgeswitch-boxservices-private-mib-boxServicesTempSensorTemperature.$index";
discover_sensor_ng($device, 'temperature', $mib, 'boxServicesTempSensorTemperature', $oid, $index, $descr, 1, $value, $options);
}
}
// Statuses
$oids = snmpwalk_cache_oid($device, 'boxServicesTempUnitState', array(), 'EdgeSwitch-BOXSERVICES-PRIVATE-MIB');
$oids = snmpwalk_cache_oid($device, 'boxServicesTempUnitState', [], 'EdgeSwitch-BOXSERVICES-PRIVATE-MIB');
foreach ($oids as $index => $entry)
{
$oid = ".1.3.6.1.4.1.4413.1.1.43.1.15.1.2.$index";
$value = $entry['boxServicesTempUnitState'];
$descr = 'Temperature Status';
if (count($oids) > 1)
{
$descr .= ' (Unit '.$entry['index'].')';
}
foreach ($oids as $index => $entry) {
$oid = ".1.3.6.1.4.1.4413.1.1.43.1.15.1.2.$index";
$value = $entry['boxServicesTempUnitState'];
$descr = 'Temperature Status';
if (count($oids) > 1) {
$descr .= ' (Unit ' . $entry['index'] . ')';
}
discover_status_ng($device, $mib, 'boxServicesTempUnitState', $oid, $index, 'edgeswitch-boxServicesTempSensorState', $descr, $value, array('entPhysicalClass' => 'chassis', 'rename_rrd' => 'edgeswitch-boxServicesTempSensorState-%index%'));
discover_status_ng($device, $mib, 'boxServicesTempUnitState', $oid, $index, 'edgeswitch-boxServicesTempSensorState', $descr, $value, ['entPhysicalClass' => 'chassis', 'rename_rrd' => 'edgeswitch-boxServicesTempSensorState-%index%']);
}
//EdgeSwitch-BOXSERVICES-PRIVATE-MIB::boxServicesFansIndex.0 = INTEGER: 0
@ -96,43 +90,42 @@ foreach ($oids as $index => $entry)
// EdgeSwitch-BOXSERVICES-PRIVATE-MIB::boxServicesFanDutyLevel.1.0 = INTEGER: 56
// EdgeSwitch-BOXSERVICES-PRIVATE-MIB::boxServicesFanUnitIndex.1.0 = Gauge32: 1
$oids = snmpwalk_cache_oid($device, 'boxServicesFansTable', array(), 'EdgeSwitch-BOXSERVICES-PRIVATE-MIB');
$oids = snmpwalk_cache_oid($device, 'boxServicesFansTable', [], 'EdgeSwitch-BOXSERVICES-PRIVATE-MIB');
foreach ($oids as $index => $entry)
{
if ($entry['boxServicesFanItemState'] == 'notpresent') { continue; }
foreach ($oids as $index => $entry) {
if ($entry['boxServicesFanItemState'] == 'notpresent') {
continue;
}
$descr = ucfirst($entry['boxServicesFanItemType']) . ' Fan ' . $entry['boxServicesFansIndex'];
if ($entry['boxServicesFanUnitIndex'] > 1)
{
$descr .= ' (Unit '.$entry['boxServicesFanUnitIndex'].')';
}
$descr = ucfirst($entry['boxServicesFanItemType']) . ' Fan ' . $entry['boxServicesFansIndex'];
if ($entry['boxServicesFanUnitIndex'] > 1) {
$descr .= ' (Unit ' . $entry['boxServicesFanUnitIndex'] . ')';
}
$oid_name = 'boxServicesFanSpeed';
$oid_num = ".1.3.6.1.4.1.4413.1.1.43.1.6.1.4.{$index}";
$type = $mib . '-' . $oid_name;
$scale = 1;
$value = $entry[$oid_name];
if ($value != 0)
{
discover_sensor_ng($device, 'fanspeed', $mib, $oid_name, $oid_num, $index, NULL, $descr, $scale, $value);
$oid_name = 'boxServicesFanDutyLevel';
$oid_num = ".1.3.6.1.4.1.4413.1.1.43.1.6.1.5.{$index}";
$oid_name = 'boxServicesFanSpeed';
$oid_num = ".1.3.6.1.4.1.4413.1.1.43.1.6.1.4.{$index}";
$type = $mib . '-' . $oid_name;
$scale = 1;
$value = $entry[$oid_name];
discover_sensor_ng($device, 'load', $mib, $oid_name, $oid_num, $index, NULL, $descr, $scale, $value);
}
if ($value != 0) {
discover_sensor_ng($device, 'fanspeed', $mib, $oid_name, $oid_num, $index, $descr, $scale, $value);
$oid_name = 'boxServicesFanItemState';
$oid_num = ".1.3.6.1.4.1.4413.1.1.43.1.6.1.3.{$index}";
$type = 'edgeswitch-boxServicesItemState';
$value = $entry[$oid_name];
$oid_name = 'boxServicesFanDutyLevel';
$oid_num = ".1.3.6.1.4.1.4413.1.1.43.1.6.1.5.{$index}";
$type = $mib . '-' . $oid_name;
$scale = 1;
$value = $entry[$oid_name];
discover_status_ng($device, $mib, 'boxServicesFanItemState', $oid_num, $index, $type, $descr, $value, array('entPhysicalClass' => 'fan', 'rename_rrd' => 'edgeswitch-boxServicesItemState-boxServicesFanItemState.%index%'));
discover_sensor_ng($device, 'load', $mib, $oid_name, $oid_num, $index, $descr, $scale, $value);
}
$oid_name = 'boxServicesFanItemState';
$oid_num = ".1.3.6.1.4.1.4413.1.1.43.1.6.1.3.{$index}";
$type = 'edgeswitch-boxServicesItemState';
$value = $entry[$oid_name];
discover_status_ng($device, $mib, 'boxServicesFanItemState', $oid_num, $index, $type, $descr, $value, ['entPhysicalClass' => 'fan', 'rename_rrd' => 'edgeswitch-boxServicesItemState-boxServicesFanItemState.%index%']);
}
//EdgeSwitch-BOXSERVICES-PRIVATE-MIB::boxServicesPowSupplyIndex.0 = INTEGER: 0
@ -144,24 +137,23 @@ foreach ($oids as $index => $entry)
//EdgeSwitch-BOXSERVICES-PRIVATE-MIB::boxServicesPowSupplyItemState.1.0 = INTEGER: operational(2)
//EdgeSwitch-BOXSERVICES-PRIVATE-MIB::boxServicesPowerSuppUnitIndex.1.0 = Gauge32: 1
$oids = snmpwalk_cache_oid($device, 'boxServicesPowSuppliesTable', array(), 'EdgeSwitch-BOXSERVICES-PRIVATE-MIB');
$oids = snmpwalk_cache_oid($device, 'boxServicesPowSuppliesTable', [], 'EdgeSwitch-BOXSERVICES-PRIVATE-MIB');
foreach ($oids as $index => $entry)
{
if ($entry['boxServicesPowSupplyItemType'] == 0 && $entry['boxServicesPowSupplyItemState'] === 'failed') { continue; } // This sensor not really exist
foreach ($oids as $index => $entry) {
if ($entry['boxServicesPowSupplyItemType'] == 0 && $entry['boxServicesPowSupplyItemState'] === 'failed') {
continue;
} // This sensor not really exist
$descr = ucfirst($entry['boxServicesPowSupplyItemType']) . ' Power Supply ' . $entry['boxServicesPowSupplyIndex'];
if ($entry['boxServicesPowerSuppUnitIndex'] > 1)
{
$descr .= ' (Unit '.$entry['boxServicesPowerSuppUnitIndex'].')';
}
$oid = ".1.3.6.1.4.1.4413.1.1.43.1.7.1.3.$index";
$value = $entry['boxServicesPowSupplyItemState'];
$descr = ucfirst($entry['boxServicesPowSupplyItemType']) . ' Power Supply ' . $entry['boxServicesPowSupplyIndex'];
if ($entry['boxServicesPowerSuppUnitIndex'] > 1) {
$descr .= ' (Unit ' . $entry['boxServicesPowerSuppUnitIndex'] . ')';
}
$oid = ".1.3.6.1.4.1.4413.1.1.43.1.7.1.3.$index";
$value = $entry['boxServicesPowSupplyItemState'];
if ($value !== 'notpresent')
{
discover_status_ng($device, $mib, 'boxServicesPowSupplyItemState', $oid, $index, 'edgeswitch-boxServicesItemState', $descr, $value, array('entPhysicalClass' => 'powerSupply', 'rename_rrd' => 'edgeswitch-boxServicesItemState-boxServicesPowSupplyItemState.%index%'));
}
if ($value !== 'notpresent') {
discover_status_ng($device, $mib, 'boxServicesPowSupplyItemState', $oid, $index, 'edgeswitch-boxServicesItemState', $descr, $value, ['entPhysicalClass' => 'powerSupply', 'rename_rrd' => 'edgeswitch-boxServicesItemState-boxServicesPowSupplyItemState.%index%']);
}
}
// EOF

View File

@ -6,7 +6,7 @@
*
* @package observium
* @subpackage discovery
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2020 Observium Limited
* @copyright (C) Adam Armstrong
*
*/
@ -54,65 +54,57 @@ EGNITEPHYSENSOR-MIB::querxPhySensorName.4 = STRING: "Pressure"
*/
$egnitesensor = [
//'other' => '',
//'unknown' => '',
'voltsAC' => 'voltage',
'voltsDC' => 'voltage',
'amperes' => 'current',
'watts' => 'power',
'hertz' => 'frequency',
'celsius' => 'temperature',
'percentRH' => 'humidity',
'rpm' => 'fanspeed',
'cmm' => 'airflow',
//'truthvalue' => 'state' // Need example
//'other' => '',
//'unknown' => '',
'voltsAC' => 'voltage',
'voltsDC' => 'voltage',
'amperes' => 'current',
'watts' => 'power',
'hertz' => 'frequency',
'celsius' => 'temperature',
'percentRH' => 'humidity',
'rpm' => 'fanspeed',
'cmm' => 'airflow',
//'truthvalue' => 'state' // Need example
];
$oids = snmpwalk_cache_oid($device, 'querxPhySensorEntry', [], 'EGNITEPHYSENSOR-MIB');
print_debug_vars($oids);
foreach ($oids as $index => $entry)
{
if (in_array($entry['querxPhySensorOperStatus'], [ 'unavailable', 'nonoperational' ]))
{
continue;
}
$options = [];
$descr = $entry['querxPhySensorName'];
// Non common sensor classes:
if ($entry['querxPhySensorType'] == 'celsius' && str_icontains_array($descr, 'Dew'))
{
$class = 'dewpoint';
}
elseif ($entry['querxPhySensorType'] == 'other')
{
// Probably can be some other sensor classes
if (str_icontains_array($descr, 'Pressure') || str_ends($entry['querxPhySensorUnitsDisplay'], [ 'Pa', 'psi' ]))
{
$class = 'pressure';
//$options['sensor_unit'] = $entry['querxPhySensorUnitsDisplay'];
} else {
// Unknown, need examples
continue;
foreach ($oids as $index => $entry) {
if (in_array($entry['querxPhySensorOperStatus'], ['unavailable', 'nonoperational'])) {
continue;
}
}
elseif (isset($egnitesensor[$entry['querxPhySensorType']]))
{
$class = $egnitesensor[$entry['querxPhySensorType']];
} else {
// Skip unknown
continue;
}
$scale = si_to_scale($entry['querxPhySensorScale'], $entry['querxPhySensorPrecision']);
$options = [];
$descr = $entry['querxPhySensorName'];
$oid_name = 'querxPhySensorValue';
$oid_num = ".1.3.6.1.4.1.3444.1.14.1.2.1.5.$index";
//$type = $mib . '-' . $oid_name;
$value = $entry[$oid_name];
// Non common sensor classes:
if ($entry['querxPhySensorType'] == 'celsius' && str_icontains_array($descr, 'Dew')) {
$class = 'dewpoint';
} elseif ($entry['querxPhySensorType'] == 'other') {
// Probably can be some other sensor classes
if (str_icontains_array($descr, 'Pressure') || str_ends($entry['querxPhySensorUnitsDisplay'], ['Pa', 'psi'])) {
$class = 'pressure';
//$options['sensor_unit'] = $entry['querxPhySensorUnitsDisplay'];
} else {
// Unknown, need examples
continue;
}
} elseif (isset($egnitesensor[$entry['querxPhySensorType']])) {
$class = $egnitesensor[$entry['querxPhySensorType']];
} else {
// Skip unknown
continue;
}
discover_sensor_ng($device, $class, $mib, $oid_name, $oid_num, $index, NULL, $descr, $scale, $value, $options);
$scale = si_to_scale($entry['querxPhySensorScale'], $entry['querxPhySensorPrecision']);
$oid_name = 'querxPhySensorValue';
$oid_num = ".1.3.6.1.4.1.3444.1.14.1.2.1.5.$index";
//$type = $mib . '-' . $oid_name;
$value = $entry[$oid_name];
discover_sensor_ng($device, $class, $mib, $oid_name, $oid_num, $index, $descr, $scale, $value, $options);
}
// EOF

View File

@ -6,14 +6,14 @@
*
* @package observium
* @subpackage discovery
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2022 Observium Limited
* @copyright (C) Adam Armstrong
*
*/
// EGW4MIB::EGW4GatewaySensorDeviceCount.0 = INTEGER: 2
if (!snmp_get_oid($device, 'EGW4GatewaySensorDeviceCount.0', $mib)) {
return;
return;
}
// EGW4MIB::EGW4SensorInfoTranslatedFormatSensorDeviceID.856694 = Gauge32: 856694
@ -58,39 +58,39 @@ if (!snmp_get_oid($device, 'EGW4GatewaySensorDeviceCount.0', $mib)) {
$egw4 = snmpwalk_cache_oid($device, 'EGW4SensorInfoTranslatedFormatEntry', [], $mib);
$oids = snmpwalk_cache_twopart_oid($device, 'EGW4SensorInfoTranslatedFormatByDatumNumberEntry', [], $mib);
foreach ($oids as $egw4deviceid => $egw4device) {
if ($egw4[$egw4deviceid]['EGW4SensorInfoTranslatedFormatSensorDeviceActive'] !== 'Active') {
continue;
}
$name = $egw4[$egw4deviceid]['EGW4SensorInfoTranslatedFormatSensorDeviceType'];
$egw4count = count($egw4device);
foreach ($egw4device as $sensorid => $entry) {
//$entry = array_merge($entry, (array)$egw4[$egw4deviceid]);
$descr = $name;
if ($egw4count > 1) {
$descr .= " #$sensorid";
if ($egw4[$egw4deviceid]['EGW4SensorInfoTranslatedFormatSensorDeviceActive'] !== 'Active') {
continue;
}
$index = "$egw4deviceid.$sensorid";
$oid_name = 'EGW4SensorInfoTranslatedFormatByDatumNumberReadingValue';
$oid_num = '.1.3.6.1.4.1.41542.2.2.2.3.'.$index;
$value = $entry[$oid_name];
switch (strtolower($entry['EGW4SensorInfoTranslatedFormatByDatumNumberReadingUnits'])) {
case 'deg. c':
discover_sensor_ng($device, 'temperature', $mib, $oid_name, $oid_num, $index, NULL, $descr, 1, $value);
break;
case 'ph':
discover_sensor_ng($device, 'humidity', $mib, $oid_name, $oid_num, $index, NULL, $descr, 1, $value);
break;
case 'detected':
discover_status_ng($device, $mib, $oid_name, $oid_num, $index, 'EGW4SensorDetected', $descr, $value, [ 'entPhysicalClass' => 'sensor' ]);
break;
default:
print_warning("Unknown sensor Unit: ".$entry['EGW4SensorInfoTranslatedFormatByDatumNumberReadingUnits']);
print_debug_vars($egw4[$egw4deviceid]);
print_debug_vars($entry);
$name = $egw4[$egw4deviceid]['EGW4SensorInfoTranslatedFormatSensorDeviceType'];
$egw4count = count($egw4device);
foreach ($egw4device as $sensorid => $entry) {
//$entry = array_merge($entry, (array)$egw4[$egw4deviceid]);
$descr = $name;
if ($egw4count > 1) {
$descr .= " #$sensorid";
}
$index = "$egw4deviceid.$sensorid";
$oid_name = 'EGW4SensorInfoTranslatedFormatByDatumNumberReadingValue';
$oid_num = '.1.3.6.1.4.1.41542.2.2.2.3.' . $index;
$value = $entry[$oid_name];
switch (strtolower($entry['EGW4SensorInfoTranslatedFormatByDatumNumberReadingUnits'])) {
case 'deg. c':
discover_sensor_ng($device, 'temperature', $mib, $oid_name, $oid_num, $index, $descr, 1, $value);
break;
case 'ph':
discover_sensor_ng($device, 'humidity', $mib, $oid_name, $oid_num, $index, $descr, 1, $value);
break;
case 'detected':
discover_status_ng($device, $mib, $oid_name, $oid_num, $index, 'EGW4SensorDetected', $descr, $value, ['entPhysicalClass' => 'sensor']);
break;
default:
print_warning("Unknown sensor Unit: " . $entry['EGW4SensorInfoTranslatedFormatByDatumNumberReadingUnits']);
print_debug_vars($egw4[$egw4deviceid]);
print_debug_vars($entry);
}
}
}
}
// EOF

View File

@ -6,7 +6,7 @@
*
* @package observium
* @subpackage discovery
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2021 Observium Limited
* @copyright (C) Adam Armstrong
*
*/
@ -31,61 +31,61 @@
// Q1
$oid_descr = snmp_get_oid($device, 'pm200frs02Rinvsfp.0', 'EKINOPS-Pm200frs02-MIB');
if ($oid_descr && !str_contains($oid_descr, 'NOT EQUIPPED')) {
$index = '0';
$index = '0';
list($name, ) = explode("\n", $oid_descr);
list(, $ifAlias) = explode("(", $name);
$ifAlias = trim($ifAlias, " )");
[$name,] = explode("\n", $oid_descr);
[, $ifAlias] = explode("(", $name);
$ifAlias = trim($ifAlias, " )");
$match = [ 'measured_match' => [ 'entity_type' => 'port', 'field' => 'ifAlias', 'match' => $ifAlias ] ];
$options = entity_measured_match_definition($device, $match);
print_debug_vars($options);
$match = ['measured_match' => ['entity_type' => 'port', 'field' => 'ifAlias', 'match' => $ifAlias]];
$options = entity_measured_match_definition($device, $match);
print_debug_vars($options);
$descr = "Client Trscv Temperature ($ifAlias)";
$class = 'temperature';
$oid_name = 'pm200frs02Mesrtrscv1Temp';
$oid_num = '.1.3.6.1.4.1.20044.90.3.1.252.'.$index;
$scale = 0.00390625; // value/256
$value = snmp_get_oid($device, $oid_name.'.'.$index, 'EKINOPS-Pm200frs02-MIB');
discover_sensor_ng($device, $class, $mib, $oid_name, $oid_num, $index, NULL, $descr, $scale, $value, $options);
$descr = "Client Trscv Temperature ($ifAlias)";
$class = 'temperature';
$oid_name = 'pm200frs02Mesrtrscv1Temp';
$oid_num = '.1.3.6.1.4.1.20044.90.3.1.252.' . $index;
$scale = 0.00390625; // value/256
$value = snmp_get_oid($device, $oid_name . '.' . $index, 'EKINOPS-Pm200frs02-MIB');
discover_sensor_ng($device, $class, $mib, $oid_name, $oid_num, $index, $descr, $scale, $value, $options);
$descr = "Client Trscv Voltage ($ifAlias)";
$class = 'voltage';
$oid_name = 'pm200frs02Mesrtrscv1PowerSupply';
$oid_num = '.1.3.6.1.4.1.20044.90.3.1.254.'.$index;
$scale = 0.0001; // value/10000
$value = snmp_get_oid($device, $oid_name.'.'.$index, 'EKINOPS-Pm200frs02-MIB');
discover_sensor_ng($device, $class, $mib, $oid_name, $oid_num, $index, NULL, $descr, $scale, $value, $options);
$descr = "Client Trscv Voltage ($ifAlias)";
$class = 'voltage';
$oid_name = 'pm200frs02Mesrtrscv1PowerSupply';
$oid_num = '.1.3.6.1.4.1.20044.90.3.1.254.' . $index;
$scale = 0.0001; // value/10000
$value = snmp_get_oid($device, $oid_name . '.' . $index, 'EKINOPS-Pm200frs02-MIB');
discover_sensor_ng($device, $class, $mib, $oid_name, $oid_num, $index, $descr, $scale, $value, $options);
}
// Q2
$oid_descr = snmp_get_oid($device, 'pm200frs02Rinvsfp.1', 'EKINOPS-Pm200frs02-MIB');
if ($oid_descr && !str_contains($oid_descr, 'NOT EQUIPPED')) {
$index = '0';
$index = '0';
list($name, ) = explode("\n", $oid_descr);
list(, $ifAlias) = explode("(", $name);
$ifAlias = trim($ifAlias, " )");
[$name,] = explode("\n", $oid_descr);
[, $ifAlias] = explode("(", $name);
$ifAlias = trim($ifAlias, " )");
$match = [ 'measured_match' => [ 'entity_type' => 'port', 'field' => 'ifAlias', 'match' => $ifAlias ] ];
$options = entity_measured_match_definition($device, $match);
print_debug_vars($options);
$match = ['measured_match' => ['entity_type' => 'port', 'field' => 'ifAlias', 'match' => $ifAlias]];
$options = entity_measured_match_definition($device, $match);
print_debug_vars($options);
$descr = "Client Trscv Temperature ($ifAlias)";
$class = 'temperature';
$oid_name = 'pm200frs02Mesrtrscv2Temp';
$oid_num = '.1.3.6.1.4.1.20044.90.3.1.253.'.$index;
$scale = 0.00390625; // value/256
$value = snmp_get_oid($device, $oid_name.'.'.$index, 'EKINOPS-Pm200frs02-MIB');
discover_sensor_ng($device, $class, $mib, $oid_name, $oid_num, $index, NULL, $descr, $scale, $value, $options);
$descr = "Client Trscv Temperature ($ifAlias)";
$class = 'temperature';
$oid_name = 'pm200frs02Mesrtrscv2Temp';
$oid_num = '.1.3.6.1.4.1.20044.90.3.1.253.' . $index;
$scale = 0.00390625; // value/256
$value = snmp_get_oid($device, $oid_name . '.' . $index, 'EKINOPS-Pm200frs02-MIB');
discover_sensor_ng($device, $class, $mib, $oid_name, $oid_num, $index, $descr, $scale, $value, $options);
$descr = "Client Trscv Voltage ($ifAlias)";
$class = 'voltage';
$oid_name = 'pm200frs02Mesrtrscv2PowerSupply';
$oid_num = '.1.3.6.1.4.1.20044.90.3.1.255.'.$index;
$scale = 0.0001; // value/10000
$value = snmp_get_oid($device, $oid_name.'.'.$index, 'EKINOPS-Pm200frs02-MIB');
discover_sensor_ng($device, $class, $mib, $oid_name, $oid_num, $index, NULL, $descr, $scale, $value, $options);
$descr = "Client Trscv Voltage ($ifAlias)";
$class = 'voltage';
$oid_name = 'pm200frs02Mesrtrscv2PowerSupply';
$oid_num = '.1.3.6.1.4.1.20044.90.3.1.255.' . $index;
$scale = 0.0001; // value/10000
$value = snmp_get_oid($device, $oid_name . '.' . $index, 'EKINOPS-Pm200frs02-MIB');
discover_sensor_ng($device, $class, $mib, $oid_name, $oid_num, $index, $descr, $scale, $value, $options);
}
// EOF

View File

@ -1,5 +1,4 @@
<?php
/**
* Observium
*
@ -7,7 +6,7 @@
*
* @package observium
* @subpackage discovery
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2019 Observium Limited
* @copyright (C) Adam Armstrong
*
*/
@ -18,19 +17,17 @@
// .1.3.6.1.4.1.12148.9.6.2.0 = 235
// .1.3.6.1.4.1.12148.9.6.3.0 = 237
$list[] = array('oid' => '.1.3.6.1.4.1.12148.9.6.1.0', 'descr' => 'AC Voltage 1', 'index' => '1', 'type' => 'acVoltage');
$list[] = array('oid' => '.1.3.6.1.4.1.12148.9.6.2.0', 'descr' => 'AC Voltage 2', 'index' => '2', 'type' => 'acVoltage');
$list[] = array('oid' => '.1.3.6.1.4.1.12148.9.6.3.0', 'descr' => 'AC Voltage 3', 'index' => '3', 'type' => 'acVoltage');
$list[] = ['oid' => '.1.3.6.1.4.1.12148.9.6.1.0', 'descr' => 'AC Voltage 1', 'index' => '1', 'type' => 'acVoltage'];
$list[] = ['oid' => '.1.3.6.1.4.1.12148.9.6.2.0', 'descr' => 'AC Voltage 2', 'index' => '2', 'type' => 'acVoltage'];
$list[] = ['oid' => '.1.3.6.1.4.1.12148.9.6.3.0', 'descr' => 'AC Voltage 3', 'index' => '3', 'type' => 'acVoltage'];
foreach ($list as $entry)
{
foreach ($list as $entry) {
$value = snmp_get_oid($device, $entry['oid'], 'ELTEK-DISTRIBUTED-MIB');
$value = snmp_get_oid($device, $entry['oid'], 'ELTEK-DISTRIBUTED-MIB');
if (is_numeric($value))
{
discover_sensor('voltage', $device, $entry['oid'], $entry['index'], 'eltek-distributed-mib_acVoltage', $entry['descr'], 1, $value);
}
if (is_numeric($value)) {
discover_sensor('voltage', $device, $entry['oid'], $entry['index'], 'eltek-distributed-mib_acVoltage', $entry['descr'], 1, $value);
}
}
@ -54,18 +51,16 @@ foreach ($list as $entry)
//.1.3.6.1.4.1.12148.9.5.5.2.1.8.1 = 1051711xxxx
//.1.3.6.1.4.1.12148.9.5.5.2.1.9.1 = 2.1
$oids = snmpwalk_cache_oid($device, 'rectifierStatusTable', array(), 'ELTEK-DISTRIBUTED-MIB');
foreach ($oids as $index => $entry)
{
if ($entry['rectifierStatusStatus'] != 'notPresent')
{
$descr = 'Rectifier '.$entry['rectifierStatusID']. ' ('.$entry['rectifierStatusType'].')';
discover_sensor('voltage', $device, '.1.3.6.1.4.1.12148.9.5.5.2.1.4.'.$index, $index, 'eltek-distributed-mib_rectifierStatusOutputVoltage', $descr, 0.01, $entry['rectifierStatusOutputVoltage']);
discover_sensor('current', $device, '.1.3.6.1.4.1.12148.9.5.5.2.1.3.'.$index, $index, 'eltek-distributed-mib_rectifierStatusOutputCurrent', $descr, 0.1, $entry['rectifierStatusOutputCurrent']);
discover_sensor('temperature', $device, '.1.3.6.1.4.1.12148.9.5.5.2.1.5.'.$index, $index, 'eltek-distributed-mib_rectifierStatusTemp', $descr, 1, $entry['rectifierStatusTemp']);
$oids = snmpwalk_cache_oid($device, 'rectifierStatusTable', [], 'ELTEK-DISTRIBUTED-MIB');
foreach ($oids as $index => $entry) {
if ($entry['rectifierStatusStatus'] != 'notPresent') {
$descr = 'Rectifier ' . $entry['rectifierStatusID'] . ' (' . $entry['rectifierStatusType'] . ')';
discover_sensor('voltage', $device, '.1.3.6.1.4.1.12148.9.5.5.2.1.4.' . $index, $index, 'eltek-distributed-mib_rectifierStatusOutputVoltage', $descr, 0.01, $entry['rectifierStatusOutputVoltage']);
discover_sensor('current', $device, '.1.3.6.1.4.1.12148.9.5.5.2.1.3.' . $index, $index, 'eltek-distributed-mib_rectifierStatusOutputCurrent', $descr, 0.1, $entry['rectifierStatusOutputCurrent']);
discover_sensor('temperature', $device, '.1.3.6.1.4.1.12148.9.5.5.2.1.5.' . $index, $index, 'eltek-distributed-mib_rectifierStatusTemp', $descr, 1, $entry['rectifierStatusTemp']);
discover_status($device, '.1.3.6.1.4.1.12148.9.5.5.2.1.2.'.$index, 'rectifierStatusStatus.'.$index, 'eltek-distributed-mib_rectifierStatusStatus', $descr, $entry['rectifierStatusStatus']);
}
discover_status($device, '.1.3.6.1.4.1.12148.9.5.5.2.1.2.' . $index, 'rectifierStatusStatus.' . $index, 'eltek-distributed-mib_rectifierStatusStatus', $descr, $entry['rectifierStatusStatus']);
}
}
// Note that the units measured may be in Amperes or in Deciamperes depending on global system settings,
@ -78,22 +73,21 @@ foreach ($oids as $index => $entry)
// ELTEK-DISTRIBUTED-MIB::batteryChargeCurrentLimitValue.0 = INTEGER: 350 Amperes or DeciAmperes
$limit = snmp_get_oid($device, 'batteryChargeCurrentLimitValue.0', 'ELTEK-DISTRIBUTED-MIB');
$value = snmp_get_oid($device, 'batteryCurrent.0', 'ELTEK-DISTRIBUTED-MIB');
$value = snmp_get_oid($device, 'batteryCurrent.0', 'ELTEK-DISTRIBUTED-MIB');
$oid = '.1.3.6.1.4.1.12148.9.3.3.0';
$oid_name = 'batteryCurrent';
$descr = 'Battery Current';
if ($limit > 100)
{
// Hack for detect scale, not sure if always correct
$scale = 0.1;
$limit *= $scale;
if ($limit > 100) {
// Hack for detect scale, not sure if always correct
$scale = 0.1;
$limit *= $scale;
} else {
$scale = 1;
$scale = 1;
}
$options = ['limit_high' => $limit];
discover_sensor_ng($device, 'current', $mib, $oid_name, $oid, '0', NULL, $descr, $scale, $value, $options);
discover_sensor_ng($device, 'current', $mib, $oid_name, $oid, '0', $descr, $scale, $value, $options);
// EOF

View File

@ -0,0 +1,176 @@
<?php
/**
* Observium
*
* This file is part of Observium.
*
* @package observium
* @subpackage discovery
* @copyright (C) Adam Armstrong
*
*/
// ELTEX-PHY-MIB::eltexPhyTransceiverInfoConnectorType.9 = INTEGER: lc(7)
// ELTEX-PHY-MIB::eltexPhyTransceiverInfoType.9 = INTEGER: sfp-sfpplus(3)
// ELTEX-PHY-MIB::eltexPhyTransceiverInfoComplianceCode.9 = STRING: "1000BASE-LX"
// ELTEX-PHY-MIB::eltexPhyTransceiverInfoWaveLength.9 = INTEGER: 1310
// ELTEX-PHY-MIB::eltexPhyTransceiverInfoVendorName.9 = STRING: "OEM"
// ELTEX-PHY-MIB::eltexPhyTransceiverInfoSerialNumber.9 = STRING: "SDB8951885"
// ELTEX-PHY-MIB::eltexPhyTransceiverInfoFiberDiameter.9 = INTEGER: fiber9(1)
// ELTEX-PHY-MIB::eltexPhyTransceiverInfoTransferDistance.9 = INTEGER: 10000
// ELTEX-PHY-MIB::eltexPhyTransceiverInfoDiagnosticSupported.9 = INTEGER: true(1)
// ELTEX-PHY-MIB::eltexPhyTransceiverInfoPartNumber.9 = STRING: "SFP-1.25G-1310D"
// ELTEX-PHY-MIB::eltexPhyTransceiverInfoVendorRevision.9 = STRING: "A0"
// ELTEX-PHY-MIB::eltexPhyTransceiverDiagnosticUnits.9.temperature.1 = STRING: Degrees
// ELTEX-PHY-MIB::eltexPhyTransceiverDiagnosticUnits.9.supplyVoltage.1 = STRING: Volts
// ELTEX-PHY-MIB::eltexPhyTransceiverDiagnosticUnits.9.txBiasCurrent.1 = STRING: milliAmperes
// ELTEX-PHY-MIB::eltexPhyTransceiverDiagnosticUnits.9.txOpticalPower.1 = STRING: milliDecibel-milliWatts
// ELTEX-PHY-MIB::eltexPhyTransceiverDiagnosticUnits.9.rxOpticalPower.1 = STRING: milliDecibel-milliWatts
// ELTEX-PHY-MIB::eltexPhyTransceiverDiagnosticUnits.9.lossOfSignal.1 = STRING: Boolean
// ELTEX-PHY-MIB::eltexPhyTransceiverDiagnosticHighAlarmThreshold.9.temperature.1 = INTEGER: 110
// ELTEX-PHY-MIB::eltexPhyTransceiverDiagnosticHighAlarmThreshold.9.supplyVoltage.1 = INTEGER: 3600
// ELTEX-PHY-MIB::eltexPhyTransceiverDiagnosticHighAlarmThreshold.9.txBiasCurrent.1 = INTEGER: 80000
// ELTEX-PHY-MIB::eltexPhyTransceiverDiagnosticHighAlarmThreshold.9.txOpticalPower.1 = INTEGER: 15849
// ELTEX-PHY-MIB::eltexPhyTransceiverDiagnosticHighAlarmThreshold.9.rxOpticalPower.1 = INTEGER: 6310
// ELTEX-PHY-MIB::eltexPhyTransceiverDiagnosticHighAlarmThreshold.9.lossOfSignal.1 = INTEGER: 0
// ELTEX-PHY-MIB::eltexPhyTransceiverDiagnosticHighWarningThreshold.9.temperature.1 = INTEGER: 95
// ELTEX-PHY-MIB::eltexPhyTransceiverDiagnosticHighWarningThreshold.9.supplyVoltage.1 = INTEGER: 3500
// ELTEX-PHY-MIB::eltexPhyTransceiverDiagnosticHighWarningThreshold.9.txBiasCurrent.1 = INTEGER: 70000
// ELTEX-PHY-MIB::eltexPhyTransceiverDiagnosticHighWarningThreshold.9.txOpticalPower.1 = INTEGER: 12589
// ELTEX-PHY-MIB::eltexPhyTransceiverDiagnosticHighWarningThreshold.9.rxOpticalPower.1 = INTEGER: 5012
// ELTEX-PHY-MIB::eltexPhyTransceiverDiagnosticHighWarningThreshold.9.lossOfSignal.1 = INTEGER: 0
// ELTEX-PHY-MIB::eltexPhyTransceiverDiagnosticLowWarningThreshold.9.temperature.1 = INTEGER: -42
// ELTEX-PHY-MIB::eltexPhyTransceiverDiagnosticLowWarningThreshold.9.supplyVoltage.1 = INTEGER: 3050
// ELTEX-PHY-MIB::eltexPhyTransceiverDiagnosticLowWarningThreshold.9.txBiasCurrent.1 = INTEGER: 3000
// ELTEX-PHY-MIB::eltexPhyTransceiverDiagnosticLowWarningThreshold.9.txOpticalPower.1 = INTEGER: 794
// ELTEX-PHY-MIB::eltexPhyTransceiverDiagnosticLowWarningThreshold.9.rxOpticalPower.1 = INTEGER: 32
// ELTEX-PHY-MIB::eltexPhyTransceiverDiagnosticLowWarningThreshold.9.lossOfSignal.1 = INTEGER: 0
// ELTEX-PHY-MIB::eltexPhyTransceiverDiagnosticLowAlarmThreshold.9.temperature.1 = INTEGER: -45
// ELTEX-PHY-MIB::eltexPhyTransceiverDiagnosticLowAlarmThreshold.9.supplyVoltage.1 = INTEGER: 3000
// ELTEX-PHY-MIB::eltexPhyTransceiverDiagnosticLowAlarmThreshold.9.txBiasCurrent.1 = INTEGER: 2000
// ELTEX-PHY-MIB::eltexPhyTransceiverDiagnosticLowAlarmThreshold.9.txOpticalPower.1 = INTEGER: 631
// ELTEX-PHY-MIB::eltexPhyTransceiverDiagnosticLowAlarmThreshold.9.rxOpticalPower.1 = INTEGER: 25
// ELTEX-PHY-MIB::eltexPhyTransceiverDiagnosticLowAlarmThreshold.9.lossOfSignal.1 = INTEGER: 0
// ELTEX-PHY-MIB::eltexPhyTransceiverDiagnosticCurrentValue.9.temperature.1 = INTEGER: 25
// ELTEX-PHY-MIB::eltexPhyTransceiverDiagnosticCurrentValue.9.supplyVoltage.1 = INTEGER: 3
// ELTEX-PHY-MIB::eltexPhyTransceiverDiagnosticCurrentValue.9.txBiasCurrent.1 = INTEGER: 22
// ELTEX-PHY-MIB::eltexPhyTransceiverDiagnosticCurrentValue.9.txOpticalPower.1 = INTEGER: -7552
// ELTEX-PHY-MIB::eltexPhyTransceiverDiagnosticCurrentValue.9.rxOpticalPower.1 = INTEGER: -9147
// ELTEX-PHY-MIB::eltexPhyTransceiverDiagnosticCurrentValue.9.lossOfSignal.1 = INTEGER: 0
$dom_info = snmpwalk_cache_oid($device, 'eltexPhyTransceiverInfoTable', [], 'ELTEX-PHY-MIB');
if (!snmp_status()) {
return;
}
$oids = snmpwalk_cache_threepart_oid($device, 'eltexPhyTransceiverDiagnosticTable', [], 'ELTEX-PHY-MIB');
foreach ($dom_info as $ifIndex => $info) {
if ($info['eltexPhyTransceiverInfoConnectorType'] === 'unknown' ||
$info['eltexPhyTransceiverInfoType'] === 'unknown' || !isset($oids[$ifIndex])) {
print_debug("DOM sensors for ifIndex $ifIndex not exist.");
continue;
}
foreach ($oids[$ifIndex] as $phyTransceiverDiagnosticType => $entries) {
$multilane = safe_count($entries) > 1;
foreach ($entries as $lane => $entry) {
// scale (all possible units unknown)
if (str_starts_with($entry['eltexPhyTransceiverDiagnosticUnits'], 'milli')) {
$scale = si_to_scale('milli');
} elseif (str_starts_with($entry['eltexPhyTransceiverDiagnosticUnits'], 'micro')) {
$scale = si_to_scale('micro');
} elseif (str_starts_with($entry['eltexPhyTransceiverDiagnosticUnits'], 'deci')) {
$scale = si_to_scale('deci');
} else {
$scale = 1;
}
$entry['ifIndex'] = $ifIndex;
$match = [ 'measured_match' => [ 'entity_type' => 'port', 'field' => 'ifIndex', 'match' => '%ifIndex%' ] ];
$options = entity_measured_match_definition($device, $match, $entry);
//print_debug_vars($options);
$name = $options['port_label'];
if ($multilane) {
$name .= " Lane " . $lane;
}
switch ($phyTransceiverDiagnosticType) {
case 'temperature':
$descr = $name . " Temperature";
$index = $ifIndex . '.1.' . $lane;
$class = 'temperature';
// Limits
$options['limit_high'] = $entry['eltexPhyTransceiverDiagnosticHighAlarmThreshold'];
$options['limit_high_warn'] = $entry['eltexPhyTransceiverDiagnosticHighWarningThreshold'];
$options['limit_low'] = $entry['eltexPhyTransceiverDiagnosticLowAlarmThreshold'];
$options['limit_low_warn'] = $entry['eltexPhyTransceiverDiagnosticLowWarningThreshold'];
break;
case 'supplyVoltage':
$descr = $name . " Voltage";
$index = $ifIndex . '.2.' . $lane;
$class = 'voltage';
// Limits
$options['limit_high'] = $entry['eltexPhyTransceiverDiagnosticHighAlarmThreshold'] * 0.001;
$options['limit_high_warn'] = $entry['eltexPhyTransceiverDiagnosticHighWarningThreshold'] * 0.001;
$options['limit_low'] = $entry['eltexPhyTransceiverDiagnosticLowAlarmThreshold'] * 0.001;
$options['limit_low_warn'] = $entry['eltexPhyTransceiverDiagnosticLowWarningThreshold'] * 0.001;
break;
case 'txBiasCurrent':
$descr = $name . " Tx Bias";
$index = $ifIndex . '.3.' . $lane;
$class = 'current';
// Limits
$options['limit_high'] = $entry['eltexPhyTransceiverDiagnosticHighAlarmThreshold'] * 0.000001;
$options['limit_high_warn'] = $entry['eltexPhyTransceiverDiagnosticHighWarningThreshold'] * 0.000001;
$options['limit_low'] = $entry['eltexPhyTransceiverDiagnosticLowAlarmThreshold'] * 0.000001;
$options['limit_low_warn'] = $entry['eltexPhyTransceiverDiagnosticLowWarningThreshold'] * 0.000001;
break;
case 'txOpticalPower':
$descr = $name . " TX Power";
$index = $ifIndex . '.4.' . $lane;
$class = 'dbm';
// Limits
$options['limit_unit'] = 'W'; // need unit conversion
$options['limit_high'] = $entry['eltexPhyTransceiverDiagnosticHighAlarmThreshold'] * 0.000001;
$options['limit_high_warn'] = $entry['eltexPhyTransceiverDiagnosticHighWarningThreshold'] * 0.000001;
$options['limit_low'] = $entry['eltexPhyTransceiverDiagnosticLowAlarmThreshold'] * 0.000001;
$options['limit_low_warn'] = $entry['eltexPhyTransceiverDiagnosticLowWarningThreshold'] * 0.000001;
break;
case 'rxOpticalPower':
$descr = $name . " RX Power";
$index = $ifIndex . '.5.' . $lane;
$class = 'dbm';
// Limits
$options['limit_unit'] = 'W'; // need unit conversion
$options['limit_high'] = $entry['eltexPhyTransceiverDiagnosticHighAlarmThreshold'] * 0.000001;
$options['limit_high_warn'] = $entry['eltexPhyTransceiverDiagnosticHighWarningThreshold'] * 0.000001;
$options['limit_low'] = $entry['eltexPhyTransceiverDiagnosticLowAlarmThreshold'] * 0.000001;
$options['limit_low_warn'] = $entry['eltexPhyTransceiverDiagnosticLowWarningThreshold'] * 0.000001;
break;
default:
continue 2;
}
$descr .= ' ('.$info['eltexPhyTransceiverInfoVendorName'].' '.$info['eltexPhyTransceiverInfoPartNumber'].')';
$oid_name = 'eltexPhyTransceiverDiagnosticCurrentValue';
$oid_num = '.1.3.6.1.4.1.35265.52.1.1.3.2.1.8.' . $index;
$value = $entry[$oid_name];
discover_sensor_ng($device, $class, 'ELTEX-PHY-MIB', $oid_name, $oid_num, $index, $descr, $scale, $value, $options);
}
}
}
// EOF

View File

@ -1,5 +1,4 @@
<?php
/**
* Observium
*
@ -7,186 +6,173 @@
*
* @package observium
* @subpackage discovery
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2019 Observium Limited
* @copyright (C) Adam Armstrong
*
*/
/*
*/
// SensorTypeEnumeration
$oid_types = array(
'rmsCurrent',
'peakCurrent',
'unbalancedCurrent',
'rmsVoltage',
'activePower',
'apparentPower',
'powerFactor',
//'activeEnergy', // currently not supported
//'apparentEnergy', // currently not supported
'temperature',
'humidity',
'airFlow',
'airPressure',
'onOff',
/*
trip(15),
*/
'vibration',
'waterDetection',
'smokeDetection',
'binary',
/*
contact(20),
*/
'fanSpeed',
'absoluteHumidity',
/*
other(30),
none(31),
*/
'illuminance',
'doorContact',
'tamperDetection',
'motionDetection',
);
$oid_types = [
'rmsCurrent',
'peakCurrent',
'unbalancedCurrent',
'rmsVoltage',
'activePower',
'apparentPower',
'powerFactor',
'activeEnergy',
'apparentEnergy',
'temperature',
'humidity',
'airFlow',
'airPressure',
'onOff',
//'trip',
'vibration',
'waterDetection',
'smokeDetection',
'binary',
//'contact',
'fanSpeed',
'absoluteHumidity',
/*
other(30),
none(31),
*/
'illuminance',
'doorContact',
'tamperDetection',
'motionDetection',
];
// SensorUnitsEnumeration
$oid_units = array(
/*
none(-1),
other(0),
*/
'volt' => array('type' => 'voltage'),
'amp' => array('type' => 'current'),
'watt' => array('type' => 'power'),
'voltamp' => array('type' => 'apower'),
/*
wattHour(5),
voltampHour(6),
*/
'degreeC' => array('type' => 'temperature', 'unit' => 'C'),
'hertz' => array('type' => 'frequency'),
'percent' => array('type' => 'humidity'),
'meterpersec' => array('type' => 'velocity'),
'pascal' => array('type' => 'pressure'),
'psi' => array('type' => 'pressure', 'unit' => 'psi'),
/*
g(13),
*/
'degreeF' => array('type' => 'temperature', 'unit' => 'F'),
/*
feet(15),
inches(16),
cm(17),
meters(18),
*/
'rpm' => array('type' => 'fanspeed'),
/*
degrees(20),
*/
'lux' => array('type' => 'illuminance'),
/*
grampercubicmeter(22),
*/
'voltampReactive' => array('type' => 'rpower'),
);
$oid_units = [
/*
none(-1),
other(0),
*/
'volt' => [ 'class' => 'voltage' ],
'amp' => [ 'class' => 'current' ],
'watt' => [ 'class' => 'power' ],
'voltamp' => [ 'class' => 'apower' ],
'wattHour' => [ 'counter' => 'energy' ],
'voltampHour' => [ 'counter' => 'aenergy' ],
'degreeC' => [ 'class' => 'temperature', 'unit' => 'C' ],
'hertz' => [ 'class' => 'frequency' ],
'percent' => [ 'class' => 'humidity' ],
'meterpersec' => [ 'class' => 'velocity' ],
'pascal' => [ 'class' => 'pressure' ],
'psi' => [ 'class' => 'pressure', 'unit' => 'psi' ],
/*
g(13),
*/
'degreeF' => [ 'class' => 'temperature', 'unit' => 'F' ],
/*
feet(15),
inches(16),
cm(17),
meters(18),
*/
'rpm' => [ 'class' => 'fanspeed' ],
/*
degrees(20),
*/
'lux' => [ 'class' => 'illuminance' ],
/*
grampercubicmeter(22),
*/
'voltampReactive' => [ 'class' => 'rpower' ],
];
$oids = snmpwalk_cache_oid($device, 'externalSensorConfigurationEntry', array(), $mib);
$oids = snmpwalk_cache_oid($device, 'externalSensorMeasurementsEntry', $oids, $mib);
if (OBS_DEBUG > 1)
{
print_vars($oids);
$oids = snmpwalk_cache_oid($device, 'externalSensorConfigurationEntry', [], $mib);
$oids = snmpwalk_cache_oid($device, 'externalSensorMeasurementsEntry', $oids, $mib);
if (OBS_DEBUG > 1) {
print_vars($oids);
}
foreach ($oids as $index => $entry)
{
if (!in_array($entry['externalSensorType'], $oid_types) || $entry['measurementsExternalSensorIsAvailable'] == 'false')
{
continue;
}
$descr = $entry['externalSensorName'];
if ($entry['externalSensorPort'])
{
$descr .= ' - ' . $entry['externalSensorPort'];
}
$scale = si_to_scale($entry['externalSensorDecimalDigits'] * -1);
$oid_name = 'measurementsExternalSensorValue';
$oid_num = '.1.3.6.1.4.1.13742.8.2.1.1.1.3.'.$index;
$type = $mib . '-' . $oid_name;
$value = $entry[$oid_name];
// Limits (based on enabled thresholds)
// SYNTAX BITS {
// lowerCritical(0),
// lowerWarning(1),
// upperWarning(2),
// upperCritical(3),
// }
$options = array();
$limits_flags = base_convert(str_replace(' ', '', $entry['externalSensorEnabledThresholds']), 16, 10);
if (is_flag_set(bindec(10000000), $limits_flags)) // 0b 1000 0000
{
$options['limit_low'] = $entry['externalSensorLowerCriticalThreshold'] * $scale;
}
if (is_flag_set(bindec(1000000), $limits_flags)) // 0b 0100 0000
{
$options['limit_low_warn'] = $entry['externalSensorLowerWarningThreshold'] * $scale;
}
if (is_flag_set(bindec(100000), $limits_flags)) // 0b 0010 0000
{
$options['limit_high_warn'] = $entry['externalSensorUpperWarningThreshold'] * $scale;
}
if (is_flag_set(bindec(10000), $limits_flags)) // 0b 0001 0000
{
$options['limit_high'] = $entry['externalSensorUpperCriticalThreshold'] * $scale;
}
// Detect type & unit
$unit = array();
if (isset($oid_units[$entry['externalSensorUnits']]))
{
$unit = $oid_units[$entry['externalSensorUnits']];
} else {
// Other sensors based on SensorTypeEnumeration
switch ($entry['externalSensorType'])
{
case 'powerFactor':
$unit = array('type' => 'powerfactor');
break;
// Status sensors
case 'onOff':
case 'waterDetection':
case 'smokeDetection':
case 'binary':
case 'doorContact':
case 'tamperDetection':
case 'motionDetection':
$oid_name = 'measurementsExternalSensorState';
$oid_num = '.1.3.6.1.4.1.13742.8.2.1.1.1.2.'.$index;
$type = 'emdSensorStateEnumeration';
$value = $entry[$oid_name];
discover_status($device, $oid_num, $oid_name.'.'.$index, $type, $descr, $value, array('entPhysicalClass' => 'other'));
break;
}
}
if (isset($unit['type']))
{
if (isset($unit['unit']))
{
$options['sensor_unit'] = $unit['unit'];
foreach ($oids as $index => $entry) {
if (!in_array($entry['externalSensorType'], $oid_types) || $entry['measurementsExternalSensorIsAvailable'] == 'false') {
continue;
}
discover_sensor_ng($device, $unit['type'], $mib, $oid_name, $oid_num, $index, NULL, $descr, $scale, $value, $options);
}
$descr = $entry['externalSensorName'];
if ($entry['externalSensorPort']) {
$descr .= ' - ' . $entry['externalSensorPort'];
}
$scale = si_to_scale($entry['externalSensorDecimalDigits'] * -1);
$oid_name = 'measurementsExternalSensorValue';
$oid_num = '.1.3.6.1.4.1.13742.8.2.1.1.1.3.' . $index;
$value = $entry[$oid_name];
// Limits (based on enabled thresholds)
// SYNTAX BITS {
// lowerCritical(0),
// lowerWarning(1),
// upperWarning(2),
// upperCritical(3),
// }
$options = [];
$limits_flags = base_convert(str_replace(' ', '', $entry['externalSensorEnabledThresholds']), 16, 10);
if (is_flag_set(bindec(10000000), $limits_flags)) // 0b 1000 0000
{
$options['limit_low'] = $entry['externalSensorLowerCriticalThreshold'] * $scale;
}
if (is_flag_set(bindec(1000000), $limits_flags)) // 0b 0100 0000
{
$options['limit_low_warn'] = $entry['externalSensorLowerWarningThreshold'] * $scale;
}
if (is_flag_set(bindec(100000), $limits_flags)) // 0b 0010 0000
{
$options['limit_high_warn'] = $entry['externalSensorUpperWarningThreshold'] * $scale;
}
if (is_flag_set(bindec(10000), $limits_flags)) // 0b 0001 0000
{
$options['limit_high'] = $entry['externalSensorUpperCriticalThreshold'] * $scale;
}
// Detect type & unit
$unit = [];
if (isset($oid_units[$entry['externalSensorUnits']])) {
$unit = $oid_units[$entry['externalSensorUnits']];
} else {
// Other sensors based on SensorTypeEnumeration
switch ($entry['externalSensorType']) {
case 'powerFactor':
$unit = [ 'class' => 'powerfactor' ];
break;
// Status sensors
case 'onOff':
case 'waterDetection':
case 'smokeDetection':
case 'binary':
case 'doorContact':
case 'tamperDetection':
case 'motionDetection':
$oid_name = 'measurementsExternalSensorState';
$oid_num = '.1.3.6.1.4.1.13742.8.2.1.1.1.2.' . $index;
$type = 'emdSensorStateEnumeration';
$value = $entry[$oid_name];
discover_status($device, $oid_num, $oid_name . '.' . $index, $type, $descr, $value, [ 'entPhysicalClass' => 'other' ]);
continue 2;
}
}
if (isset($unit['class'])) {
if (isset($unit['unit'])) {
$options['sensor_unit'] = $unit['unit'];
}
discover_sensor_ng($device, $unit['class'], $mib, $oid_name, $oid_num, $index, $descr, $scale, $value, $options);
} elseif (isset($unit['counter'])) {
if (isset($unit['unit'])) {
$options['counter_unit'] = $unit['unit'];
}
discover_counter($device, $unit['counter'], $mib, $oid_name, $oid_num, $index, $descr, $scale, $value, $options);
}
}
// EOF

View File

@ -6,7 +6,7 @@
*
* @package observium
* @subpackage discovery
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2022 Observium Limited
* @copyright (C) Adam Armstrong
*
*/
@ -40,74 +40,74 @@ $scale_current = 0.01;
$oids = snmpwalk_cache_oid($device, 'pduUnitStatusEntry', [], $mib);
$oids = snmpwalk_cache_oid($device, 'pduUnitConfigLowerCriticalThreshold', $oids, $mib);
$oids = snmpwalk_cache_oid($device, 'pduUnitConfigLowerWarningThreshold', $oids, $mib);
$oids = snmpwalk_cache_oid($device, 'pduUnitConfigLowerWarningThreshold', $oids, $mib);
$oids = snmpwalk_cache_oid($device, 'pduUnitConfigUpperCriticalThreshold', $oids, $mib);
$oids = snmpwalk_cache_oid($device, 'pduUnitConfigUpperWarningThreshold', $oids, $mib);
$oids = snmpwalk_cache_oid($device, 'pduUnitConfigEnabledThresholds', $oids, $mib);
$oids = snmpwalk_cache_oid($device, 'pduUnitConfigUpperWarningThreshold', $oids, $mib);
$oids = snmpwalk_cache_oid($device, 'pduUnitConfigEnabledThresholds', $oids, $mib);
print_debug_vars($oids);
foreach ($oids as $index => $entry) {
$name = "Unit $index";
$name = "Unit $index";
// pduUnitStatusLoadState
$descr = "$name Load";
$oid_name = 'pduUnitStatusLoadState';
$oid_num = '.1.3.6.1.4.1.38446.1.2.4.1.3.'.$index;
$value = $entry[$oid_name];
$old_rrd = 'pduUnitStatusState-'.$oid_name.'.'.$index;
// pduUnitStatusLoadState
$descr = "$name Load";
$oid_name = 'pduUnitStatusLoadState';
$oid_num = '.1.3.6.1.4.1.38446.1.2.4.1.3.' . $index;
$value = $entry[$oid_name];
$old_rrd = 'pduUnitStatusState-' . $oid_name . '.' . $index;
discover_status_ng($device, $mib, $oid_name, $oid_num, $index, 'pduUnitStatusState', $descr, $value, [ 'entPhysicalClass' => 'other', 'rename_rrd' => $old_rrd ]);
discover_status_ng($device, $mib, $oid_name, $oid_num, $index, 'pduUnitStatusState', $descr, $value, ['entPhysicalClass' => 'other', 'rename_rrd' => $old_rrd]);
// pduUnitStatusActivePower
// pduUnitStatusActivePower
// Limits (based on enabled thresholds)
// SYNTAX BITS {
// lowerCritical (0),
// lowerWarning (1),
// upperWarning (2),
// upperCritical (3)
// }
$options = [];
$limits_flags = base_convert(str_replace(' ', '', $entry['pduUnitConfigEnabledThresholds']), 16, 10);
if (is_flag_set(bindec(10000000), $limits_flags)) { // 0b 1000 0000
$options['limit_low'] = $entry['pduUnitConfigLowerCriticalThreshold'] * $scale;
}
if (is_flag_set(bindec(1000000), $limits_flags)) { // 0b 0100 0000
$options['limit_low_warn'] = $entry['pduUnitConfigLowerWarningThreshold'] * $scale;
}
if (is_flag_set(bindec(100000), $limits_flags)) { // 0b 0010 0000
$options['limit_high_warn'] = $entry['pduUnitConfigUpperWarningThreshold'] * $scale;
}
if (is_flag_set(bindec(10000), $limits_flags)) { // 0b 0001 0000
$options['limit_high'] = $entry['pduUnitConfigUpperCriticalThreshold'] * $scale;
}
// Limits (based on enabled thresholds)
// SYNTAX BITS {
// lowerCritical (0),
// lowerWarning (1),
// upperWarning (2),
// upperCritical (3)
// }
$options = [];
$limits_flags = base_convert(str_replace(' ', '', $entry['pduUnitConfigEnabledThresholds']), 16, 10);
if (is_flag_set(bindec(10000000), $limits_flags)) { // 0b 1000 0000
$options['limit_low'] = $entry['pduUnitConfigLowerCriticalThreshold'] * $scale;
}
if (is_flag_set(bindec(1000000), $limits_flags)) { // 0b 0100 0000
$options['limit_low_warn'] = $entry['pduUnitConfigLowerWarningThreshold'] * $scale;
}
if (is_flag_set(bindec(100000), $limits_flags)) { // 0b 0010 0000
$options['limit_high_warn'] = $entry['pduUnitConfigUpperWarningThreshold'] * $scale;
}
if (is_flag_set(bindec(10000), $limits_flags)) { // 0b 0001 0000
$options['limit_high'] = $entry['pduUnitConfigUpperCriticalThreshold'] * $scale;
}
$descr = "$name Active Power";
$oid_name = 'pduUnitStatusActivePower';
$oid_num = ".1.3.6.1.4.1.38446.1.2.4.1.4.$index";
$value = $entry[$oid_name];
$options['rename_rrd'] = 'ENLOGIC-PDU-MIB-'.$oid_name.'-'.$index;
$descr = "$name Active Power";
$oid_name = 'pduUnitStatusActivePower';
$oid_num = ".1.3.6.1.4.1.38446.1.2.4.1.4.$index";
$value = $entry[$oid_name];
$options['rename_rrd'] = 'ENLOGIC-PDU-MIB-' . $oid_name . '-' . $index;
discover_sensor_ng($device, 'power', $mib, $oid_name, $oid_num, $index, NULL, $descr, $scale, $value, $options);
discover_sensor_ng($device, 'power', $mib, $oid_name, $oid_num, $index, $descr, $scale, $value, $options);
// pduUnitStatusApparentPower
$descr = "$name Apparent Power";
$oid_name = 'pduUnitStatusApparentPower';
$oid_num = ".1.3.6.1.4.1.38446.1.2.4.1.5.$index";
$value = $entry[$oid_name];
$options = [ 'rename_rrd' => 'ENLOGIC-PDU-MIB-'.$oid_name.'-'.$index ];
// pduUnitStatusApparentPower
$descr = "$name Apparent Power";
$oid_name = 'pduUnitStatusApparentPower';
$oid_num = ".1.3.6.1.4.1.38446.1.2.4.1.5.$index";
$value = $entry[$oid_name];
$options = ['rename_rrd' => 'ENLOGIC-PDU-MIB-' . $oid_name . '-' . $index];
discover_sensor_ng($device, 'apower', $mib, $oid_name, $oid_num, $index, NULL, $descr, $scale, $value, $options);
discover_sensor_ng($device, 'apower', $mib, $oid_name, $oid_num, $index, $descr, $scale, $value, $options);
// pduUnitStatusEnergy (tenths of kilowatt-hours)
$descr = "$name Energy";
$oid_name = 'pduUnitStatusEnergy';
$oid_num = ".1.3.6.1.4.1.38446.1.2.4.1.9.$index";
$value = $entry[$oid_name];
// pduUnitStatusEnergy (tenths of kilowatt-hours)
$descr = "$name Energy";
$oid_name = 'pduUnitStatusEnergy';
$oid_num = ".1.3.6.1.4.1.38446.1.2.4.1.9.$index";
$value = $entry[$oid_name];
if ($value > 0) {
discover_counter($device, 'energy', $mib, $oid_name, $oid_num, $index, $descr, 1, $value);
}
if ($value > 0) {
discover_counter($device, 'energy', $mib, $oid_name, $oid_num, $index, $descr, 1, $value);
}
}
// ENLOGIC-PDU2-MIB::pduUnitPropertiesName.1 = STRING: a.4bh36.vlt.pdu
@ -125,307 +125,315 @@ foreach ($oids as $index => $entry) {
// ENLOGIC-PDU2-MIB::pduUnitPropertiesOrientation.1 = INTEGER: vertical(2)
// ENLOGIC-PDU2-MIB::pduUnitPropertiesOutletLayout.1 = INTEGER: seqPhaseToNuetral(1)
// ENLOGIC-PDU2-MIB::pduUnitPropertiesDaisyChainMemberType.1 = INTEGER: standalone(1)
$units = snmpwalk_cache_oid($device, 'pduUnitPropertiesInputPhaseCount', [], $mib); // The total number of phases on the PDU
$units = snmpwalk_cache_oid($device, 'pduUnitPropertiesCircuitBreakerCount', $units, $mib); // The total number of circuit breaker on the PDU
$units = snmpwalk_cache_oid($device, 'pduUnitPropertiesInputPhaseCount', [], $mib); // The total number of phases on the PDU
$units = snmpwalk_cache_oid($device, 'pduUnitPropertiesCircuitBreakerCount', $units, $mib); // The total number of circuit breaker on the PDU
$units = snmpwalk_cache_oid($device, 'pduUnitPropertiesConnExternalSensorCount', $units, $mib); // The current number of external sensors connected to the PDU
print_debug_vars($units);
$oids = snmpwalk_cache_twopart_oid($device, 'pduInputPhaseStatusEntry', [], $mib);
$oids = snmpwalk_cache_twopart_oid($device, 'pduInputPhaseConfigCurrentLowerCriticalThreshold', $oids, $mib);
$oids = snmpwalk_cache_twopart_oid($device, 'pduInputPhaseConfigCurrentLowerWarningThreshold', $oids, $mib);
$oids = snmpwalk_cache_twopart_oid($device, 'pduInputPhaseConfigCurrentLowerWarningThreshold', $oids, $mib);
$oids = snmpwalk_cache_twopart_oid($device, 'pduInputPhaseConfigCurrentUpperCriticalThreshold', $oids, $mib);
$oids = snmpwalk_cache_twopart_oid($device, 'pduInputPhaseConfigCurrentUpperWarningThreshold', $oids, $mib);
$oids = snmpwalk_cache_twopart_oid($device, 'pduInputPhaseConfigCurrentEnabledThresholds', $oids, $mib);
$oids = snmpwalk_cache_twopart_oid($device, 'pduInputPhaseConfigCurrentUpperWarningThreshold', $oids, $mib);
$oids = snmpwalk_cache_twopart_oid($device, 'pduInputPhaseConfigCurrentEnabledThresholds', $oids, $mib);
$oids = snmpwalk_cache_twopart_oid($device, 'pduInputPhaseConfigVoltageLowerCriticalThreshold', $oids, $mib);
$oids = snmpwalk_cache_twopart_oid($device, 'pduInputPhaseConfigVoltageLowerWarningThreshold', $oids, $mib);
$oids = snmpwalk_cache_twopart_oid($device, 'pduInputPhaseConfigVoltageLowerWarningThreshold', $oids, $mib);
$oids = snmpwalk_cache_twopart_oid($device, 'pduInputPhaseConfigVoltageUpperCriticalThreshold', $oids, $mib);
$oids = snmpwalk_cache_twopart_oid($device, 'pduInputPhaseConfigVoltageUpperWarningThreshold', $oids, $mib);
$oids = snmpwalk_cache_twopart_oid($device, 'pduInputPhaseConfigVoltageEnabledThresholds', $oids, $mib);
$oids = snmpwalk_cache_twopart_oid($device, 'pduInputPhaseConfigVoltageUpperWarningThreshold', $oids, $mib);
$oids = snmpwalk_cache_twopart_oid($device, 'pduInputPhaseConfigVoltageEnabledThresholds', $oids, $mib);
print_debug_vars($oids);
foreach ($oids as $unit => $entry1) {
foreach ($entry1 as $phase => $entry) {
if ($entry['pduInputPhaseStatusCount'] < 1) { continue; } // Skip not exist phases
foreach ($entry1 as $phase => $entry) {
if ($entry['pduInputPhaseStatusCount'] < 1) {
continue;
} // Skip not exist phases
$name = "Unit $unit, Phase $phase Input";
$index = $unit . '.' . $phase;
$name = "Unit $unit, Phase $phase Input";
$index = $unit . '.' . $phase;
// pduInputPhaseStatusCurrentState
$descr = "$name Current";
$oid_name = 'pduInputPhaseStatusCurrentState';
$oid_num = '.1.3.6.1.4.1.38446.1.3.4.1.3.'.$index;
$value = $entry[$oid_name];
$old_rrd = 'pduUnitStatusState-'.$oid_name.'.'.$index;
// pduInputPhaseStatusCurrentState
$descr = "$name Current";
$oid_name = 'pduInputPhaseStatusCurrentState';
$oid_num = '.1.3.6.1.4.1.38446.1.3.4.1.3.' . $index;
$value = $entry[$oid_name];
$old_rrd = 'pduUnitStatusState-' . $oid_name . '.' . $index;
discover_status_ng($device, $mib, $oid_name, $oid_num, $index, 'pduUnitStatusState', $descr, $value, [ 'entPhysicalClass' => 'other', 'rename_rrd' => $old_rrd ]);
discover_status_ng($device, $mib, $oid_name, $oid_num, $index, 'pduUnitStatusState', $descr, $value, ['entPhysicalClass' => 'other', 'rename_rrd' => $old_rrd]);
// pduInputPhaseStatusVoltageState
$descr = "$name Voltage";
$oid_name = 'pduInputPhaseStatusVoltageState';
$oid_num = '.1.3.6.1.4.1.38446.1.3.4.1.4.'.$index;
$value = $entry[$oid_name];
$old_rrd = 'pduUnitStatusState-'.$oid_name.'.'.$index;
// pduInputPhaseStatusVoltageState
$descr = "$name Voltage";
$oid_name = 'pduInputPhaseStatusVoltageState';
$oid_num = '.1.3.6.1.4.1.38446.1.3.4.1.4.' . $index;
$value = $entry[$oid_name];
$old_rrd = 'pduUnitStatusState-' . $oid_name . '.' . $index;
discover_status_ng($device, $mib, $oid_name, $oid_num, $index, 'pduUnitStatusState', $descr, $value, [ 'entPhysicalClass' => 'other', 'rename_rrd' => $old_rrd ]);
discover_status_ng($device, $mib, $oid_name, $oid_num, $index, 'pduUnitStatusState', $descr, $value, ['entPhysicalClass' => 'other', 'rename_rrd' => $old_rrd]);
// pduInputPhaseStatusCurrent
// pduInputPhaseStatusCurrent
// Limits (based on enabled thresholds)
// SYNTAX BITS {
// lowerCritical (0),
// lowerWarning (1),
// upperWarning (2),
// upperCritical (3)
// }
$options = [];
$limits_flags = base_convert(str_replace(' ', '', $entry['pduInputPhaseConfigCurrentEnabledThresholds']), 16, 10);
if (is_flag_set(bindec(10000000), $limits_flags)) { // 0b 1000 0000
$options['limit_low'] = $entry['pduInputPhaseConfigCurrentLowerCriticalThreshold'] * $scale_current;
// Limits (based on enabled thresholds)
// SYNTAX BITS {
// lowerCritical (0),
// lowerWarning (1),
// upperWarning (2),
// upperCritical (3)
// }
$options = [];
$limits_flags = base_convert(str_replace(' ', '', $entry['pduInputPhaseConfigCurrentEnabledThresholds']), 16, 10);
if (is_flag_set(bindec(10000000), $limits_flags)) { // 0b 1000 0000
$options['limit_low'] = $entry['pduInputPhaseConfigCurrentLowerCriticalThreshold'] * $scale_current;
}
if (is_flag_set(bindec(1000000), $limits_flags)) { // 0b 0100 0000
$options['limit_low_warn'] = $entry['pduInputPhaseConfigCurrentLowerWarningThreshold'] * $scale_current;
}
if (is_flag_set(bindec(100000), $limits_flags)) { // 0b 0010 0000
$options['limit_high_warn'] = $entry['pduInputPhaseConfigCurrentUpperWarningThreshold'] * $scale_current;
}
if (is_flag_set(bindec(10000), $limits_flags)) { // 0b 0001 0000
$options['limit_high'] = $entry['pduInputPhaseConfigCurrentUpperCriticalThreshold'] * $scale_current;
}
$descr = "$name Current";
$oid_name = 'pduInputPhaseStatusCurrent';
$oid_num = ".1.3.6.1.4.1.38446.1.3.4.1.5.$index";
$value = $entry[$oid_name];
$options['rename_rrd'] = 'ENLOGIC-PDU-MIB-' . $oid_name . '-' . $index;
discover_sensor_ng($device, 'current', $mib, $oid_name, $oid_num, $index, $descr, $scale_current, $value, $options);
// pduInputPhaseStatusVoltage
// Limits (based on enabled thresholds)
// SYNTAX BITS {
// lowerCritical (0),
// lowerWarning (1),
// upperWarning (2),
// upperCritical (3)
// }
$options = [];
$limits_flags = base_convert(str_replace(' ', '', $entry['pduInputPhaseConfigVoltageEnabledThresholds']), 16, 10);
if (is_flag_set(bindec(10000000), $limits_flags)) { // 0b 1000 0000
$options['limit_low'] = $entry['pduInputPhaseConfigVoltageLowerCriticalThreshold'] * $scale;
}
if (is_flag_set(bindec(1000000), $limits_flags)) { // 0b 0100 0000
$options['limit_low_warn'] = $entry['pduInputPhaseConfigVoltageLowerWarningThreshold'] * $scale;
}
if (is_flag_set(bindec(100000), $limits_flags)) { // 0b 0010 0000
$options['limit_high_warn'] = $entry['pduInputPhaseConfigVoltageUpperWarningThreshold'] * $scale;
}
if (is_flag_set(bindec(10000), $limits_flags)) { // 0b 0001 0000
$options['limit_high'] = $entry['pduInputPhaseConfigVoltageUpperCriticalThreshold'] * $scale;
}
$descr = "$name Voltage";
$oid_name = 'pduInputPhaseStatusVoltage';
$oid_num = ".1.3.6.1.4.1.38446.1.3.4.1.6.$index";
$value = $entry[$oid_name];
$options['rename_rrd'] = 'ENLOGIC-PDU-MIB-' . $oid_name . '-' . $index;
discover_sensor_ng($device, 'voltage', $mib, $oid_name, $oid_num, $index, $descr, $scale, $value, $options);
// pduInputPhaseStatusActivePower
$descr = "$name Active Power";
$oid_name = 'pduInputPhaseStatusActivePower';
$oid_num = ".1.3.6.1.4.1.38446.1.3.4.1.7.$index";
$value = $entry[$oid_name];
$options = ['rename_rrd' => 'ENLOGIC-PDU-MIB-' . $oid_name . '-' . $index];
discover_sensor_ng($device, 'power', $mib, $oid_name, $oid_num, $index, $descr, $scale, $value, $options);
// pduInputPhaseStatusApparentPower
$descr = "$name Apparent Power";
$oid_name = 'pduInputPhaseStatusApparentPower';
$oid_num = ".1.3.6.1.4.1.38446.1.3.4.1.8.$index";
$value = $entry[$oid_name];
$options = ['rename_rrd' => 'ENLOGIC-PDU-MIB-' . $oid_name . '-' . $index];
discover_sensor_ng($device, 'apower', $mib, $oid_name, $oid_num, $index, $descr, $scale, $value, $options);
// pduInputPhaseStatusPowerFactor
$descr = "$name Power Factor";
$oid_name = 'pduInputPhaseStatusPowerFactor';
$oid_num = ".1.3.6.1.4.1.38446.1.3.4.1.9.$index";
$value = $entry[$oid_name];
$options = ['rename_rrd' => 'ENLOGIC-PDU-MIB-' . $oid_name . '-' . $index];
discover_sensor_ng($device, 'powerfactor', $mib, $oid_name, $oid_num, $index, $descr, $scale, $value, $options);
}
if (is_flag_set(bindec(1000000), $limits_flags)) { // 0b 0100 0000
$options['limit_low_warn'] = $entry['pduInputPhaseConfigCurrentLowerWarningThreshold'] * $scale_current;
}
if (is_flag_set(bindec(100000), $limits_flags)) { // 0b 0010 0000
$options['limit_high_warn'] = $entry['pduInputPhaseConfigCurrentUpperWarningThreshold'] * $scale_current;
}
if (is_flag_set(bindec(10000), $limits_flags)) { // 0b 0001 0000
$options['limit_high'] = $entry['pduInputPhaseConfigCurrentUpperCriticalThreshold'] * $scale_current;
}
$descr = "$name Current";
$oid_name = 'pduInputPhaseStatusCurrent';
$oid_num = ".1.3.6.1.4.1.38446.1.3.4.1.5.$index";
$value = $entry[$oid_name];
$options['rename_rrd'] = 'ENLOGIC-PDU-MIB-'.$oid_name.'-'.$index;
discover_sensor_ng($device, 'current', $mib, $oid_name, $oid_num, $index, NULL, $descr, $scale_current, $value, $options);
// pduInputPhaseStatusVoltage
// Limits (based on enabled thresholds)
// SYNTAX BITS {
// lowerCritical (0),
// lowerWarning (1),
// upperWarning (2),
// upperCritical (3)
// }
$options = [];
$limits_flags = base_convert(str_replace(' ', '', $entry['pduInputPhaseConfigVoltageEnabledThresholds']), 16, 10);
if (is_flag_set(bindec(10000000), $limits_flags)) { // 0b 1000 0000
$options['limit_low'] = $entry['pduInputPhaseConfigVoltageLowerCriticalThreshold'] * $scale;
}
if (is_flag_set(bindec(1000000), $limits_flags)) { // 0b 0100 0000
$options['limit_low_warn'] = $entry['pduInputPhaseConfigVoltageLowerWarningThreshold'] * $scale;
}
if (is_flag_set(bindec(100000), $limits_flags)) { // 0b 0010 0000
$options['limit_high_warn'] = $entry['pduInputPhaseConfigVoltageUpperWarningThreshold'] * $scale;
}
if (is_flag_set(bindec(10000), $limits_flags)) { // 0b 0001 0000
$options['limit_high'] = $entry['pduInputPhaseConfigVoltageUpperCriticalThreshold'] * $scale;
}
$descr = "$name Voltage";
$oid_name = 'pduInputPhaseStatusVoltage';
$oid_num = ".1.3.6.1.4.1.38446.1.3.4.1.6.$index";
$value = $entry[$oid_name];
$options['rename_rrd'] = 'ENLOGIC-PDU-MIB-'.$oid_name.'-'.$index;
discover_sensor_ng($device, 'voltage', $mib, $oid_name, $oid_num, $index, NULL, $descr, $scale, $value, $options);
// pduInputPhaseStatusActivePower
$descr = "$name Active Power";
$oid_name = 'pduInputPhaseStatusActivePower';
$oid_num = ".1.3.6.1.4.1.38446.1.3.4.1.7.$index";
$value = $entry[$oid_name];
$options = [ 'rename_rrd' => 'ENLOGIC-PDU-MIB-'.$oid_name.'-'.$index ];
discover_sensor_ng($device, 'power', $mib, $oid_name, $oid_num, $index, NULL, $descr, $scale, $value, $options);
// pduInputPhaseStatusApparentPower
$descr = "$name Apparent Power";
$oid_name = 'pduInputPhaseStatusApparentPower';
$oid_num = ".1.3.6.1.4.1.38446.1.3.4.1.8.$index";
$value = $entry[$oid_name];
$options = [ 'rename_rrd' => 'ENLOGIC-PDU-MIB-'.$oid_name.'-'.$index ];
discover_sensor_ng($device, 'apower', $mib, $oid_name, $oid_num, $index, NULL, $descr, $scale, $value, $options);
// pduInputPhaseStatusPowerFactor
$descr = "$name Power Factor";
$oid_name = 'pduInputPhaseStatusPowerFactor';
$oid_num = ".1.3.6.1.4.1.38446.1.3.4.1.9.$index";
$value = $entry[$oid_name];
$options = [ 'rename_rrd' => 'ENLOGIC-PDU-MIB-'.$oid_name.'-'.$index ];
discover_sensor_ng($device, 'powerfactor', $mib, $oid_name, $oid_num, $index, NULL, $descr, $scale, $value, $options);
}
}
$oids = snmpwalk_cache_twopart_oid($device, 'pduCircuitBreakerStatusEntry', [], $mib);
$oids = snmpwalk_cache_twopart_oid($device, 'pduCircuitBreakerConfigLowerCriticalThreshold', $oids, $mib);
$oids = snmpwalk_cache_twopart_oid($device, 'pduCircuitBreakerConfigLowerWarningThreshold', $oids, $mib);
$oids = snmpwalk_cache_twopart_oid($device, 'pduCircuitBreakerConfigLowerWarningThreshold', $oids, $mib);
$oids = snmpwalk_cache_twopart_oid($device, 'pduCircuitBreakerConfigUpperCriticalThreshold', $oids, $mib);
$oids = snmpwalk_cache_twopart_oid($device, 'pduCircuitBreakerConfigUpperWarningThreshold', $oids, $mib);
$oids = snmpwalk_cache_twopart_oid($device, 'pduCircuitBreakerConfigEnabledThresholds', $oids, $mib);
$oids = snmpwalk_cache_twopart_oid($device, 'pduCircuitBreakerConfigUpperWarningThreshold', $oids, $mib);
$oids = snmpwalk_cache_twopart_oid($device, 'pduCircuitBreakerConfigEnabledThresholds', $oids, $mib);
print_debug_vars($oids);
foreach ($oids as $unit => $entry1) {
foreach ($entry1 as $i => $entry) {
if ($entry['pduCircuitBreakerStatusCount'] < 1) { continue; } // Skip not exist Circuit Breaker
foreach ($entry1 as $i => $entry) {
if ($entry['pduCircuitBreakerStatusCount'] < 1) {
continue;
} // Skip not exist Circuit Breaker
$name = "Unit $unit, Circuit Breaker $i";
$index = $unit . '.' . $i;
$name = "Unit $unit, Circuit Breaker $i";
$index = $unit . '.' . $i;
// pduCircuitBreakerStatusLoadState
$descr = "$name Load";
$oid_name = 'pduCircuitBreakerStatusLoadState';
$oid_num = '.1.3.6.1.4.1.38446.1.4.4.1.4.'.$index;
$value = $entry[$oid_name];
$old_rrd = 'pduUnitStatusState-'.$oid_name.'.'.$index;
// pduCircuitBreakerStatusLoadState
$descr = "$name Load";
$oid_name = 'pduCircuitBreakerStatusLoadState';
$oid_num = '.1.3.6.1.4.1.38446.1.4.4.1.4.' . $index;
$value = $entry[$oid_name];
$old_rrd = 'pduUnitStatusState-' . $oid_name . '.' . $index;
discover_status_ng($device, $mib, $oid_name, $oid_num, $index, 'pduUnitStatusState', $descr, $value, [ 'entPhysicalClass' => 'other', 'rename_rrd' => $old_rrd ]);
discover_status_ng($device, $mib, $oid_name, $oid_num, $index, 'pduUnitStatusState', $descr, $value, ['entPhysicalClass' => 'other', 'rename_rrd' => $old_rrd]);
// pduCircuitBreakerStatusCurrent
// pduCircuitBreakerStatusCurrent
// Limits (based on enabled thresholds)
// SYNTAX BITS {
// lowerCritical (0),
// lowerWarning (1),
// upperWarning (2),
// upperCritical (3)
// }
$options = [];
$limits_flags = base_convert(str_replace(' ', '', $entry['pduCircuitBreakerConfigEnabledThresholds']), 16, 10);
if (is_flag_set(bindec(10000000), $limits_flags)) { // 0b 1000 0000
$options['limit_low'] = $entry['pduCircuitBreakerConfigLowerCriticalThreshold'] * $scale_current;
// Limits (based on enabled thresholds)
// SYNTAX BITS {
// lowerCritical (0),
// lowerWarning (1),
// upperWarning (2),
// upperCritical (3)
// }
$options = [];
$limits_flags = base_convert(str_replace(' ', '', $entry['pduCircuitBreakerConfigEnabledThresholds']), 16, 10);
if (is_flag_set(bindec(10000000), $limits_flags)) { // 0b 1000 0000
$options['limit_low'] = $entry['pduCircuitBreakerConfigLowerCriticalThreshold'] * $scale_current;
}
if (is_flag_set(bindec(1000000), $limits_flags)) { // 0b 0100 0000
$options['limit_low_warn'] = $entry['pduCircuitBreakerConfigLowerWarningThreshold'] * $scale_current;
}
if (is_flag_set(bindec(100000), $limits_flags)) { // 0b 0010 0000
$options['limit_high_warn'] = $entry['pduCircuitBreakerConfigUpperWarningThreshold'] * $scale_current;
}
if (is_flag_set(bindec(10000), $limits_flags)) { // 0b 0001 0000
$options['limit_high'] = $entry['pduCircuitBreakerConfigUpperCriticalThreshold'] * $scale_current;
}
$descr = "$name Current";
$oid_name = 'pduCircuitBreakerStatusCurrent';
$oid_num = ".1.3.6.1.4.1.38446.1.4.4.1.5.$index";
$value = $entry[$oid_name];
$options['rename_rrd'] = 'ENLOGIC-PDU-MIB-' . $oid_name . '-' . $index;
discover_sensor_ng($device, 'current', $mib, $oid_name, $oid_num, $index, $descr, $scale_current, $value, $options);
}
if (is_flag_set(bindec(1000000), $limits_flags)) { // 0b 0100 0000
$options['limit_low_warn'] = $entry['pduCircuitBreakerConfigLowerWarningThreshold'] * $scale_current;
}
if (is_flag_set(bindec(100000), $limits_flags)) { // 0b 0010 0000
$options['limit_high_warn'] = $entry['pduCircuitBreakerConfigUpperWarningThreshold'] * $scale_current;
}
if (is_flag_set(bindec(10000), $limits_flags)) { // 0b 0001 0000
$options['limit_high'] = $entry['pduCircuitBreakerConfigUpperCriticalThreshold'] * $scale_current;
}
$descr = "$name Current";
$oid_name = 'pduCircuitBreakerStatusCurrent';
$oid_num = ".1.3.6.1.4.1.38446.1.4.4.1.5.$index";
$value = $entry[$oid_name];
$options['rename_rrd'] = 'ENLOGIC-PDU-MIB-'.$oid_name.'-'.$index;
discover_sensor_ng($device, 'current', $mib, $oid_name, $oid_num, $index, NULL, $descr, $scale_current, $value, $options);
}
}
// NOTE, next part not tested, but should be working (mike)
$sensors_count = 0;
foreach ($units as $entry) {
$sensors_count += $entry['pduUnitPropertiesConnExternalSensorCount'];
$sensors_count += $entry['pduUnitPropertiesConnExternalSensorCount'];
}
if ($sensors_count == 0) { return; } // Skip next sensors discovery (not exist)
if ($sensors_count == 0) {
return;
} // Skip next sensors discovery (not exist)
$oids = snmpwalk_cache_twopart_oid($device, 'pduExternalSensorStatusEntry', [], $mib);
$oids = snmpwalk_cache_twopart_oid($device, 'pduExternalSensorNamePlateType', $oids, $mib);
$oids = snmpwalk_cache_twopart_oid($device, 'pduExternalSensorNamePlateType', $oids, $mib);
$oids = snmpwalk_cache_twopart_oid($device, 'pduExternalSensorNamePlateUnits', $oids, $mib);
$oids = snmpwalk_cache_twopart_oid($device, 'pduExternalSensorConfigLowerCriticalThreshold', $oids, $mib);
$oids = snmpwalk_cache_twopart_oid($device, 'pduExternalSensorConfigLowerWarningThreshold', $oids, $mib);
$oids = snmpwalk_cache_twopart_oid($device, 'pduExternalSensorConfigLowerWarningThreshold', $oids, $mib);
$oids = snmpwalk_cache_twopart_oid($device, 'pduExternalSensorConfigUpperCriticalThreshold', $oids, $mib);
$oids = snmpwalk_cache_twopart_oid($device, 'pduExternalSensorConfigUpperWarningThreshold', $oids, $mib);
$oids = snmpwalk_cache_twopart_oid($device, 'pduExternalSensorConfigEnabledThresholds', $oids, $mib);
$oids = snmpwalk_cache_twopart_oid($device, 'pduExternalSensorConfigUpperWarningThreshold', $oids, $mib);
$oids = snmpwalk_cache_twopart_oid($device, 'pduExternalSensorConfigEnabledThresholds', $oids, $mib);
print_debug_vars($oids);
foreach ($oids as $unit => $entry1) {
foreach ($entry1 as $i => $entry) {
if ($entry['pduExternalSensorStatusState'] === 'notPresent') { continue; } // Skip not exist Sensors
foreach ($entry1 as $i => $entry) {
if ($entry['pduExternalSensorStatusState'] === 'notPresent') {
continue;
} // Skip not exist Sensors
$name = "Unit $unit, Sensor ".$entry['pduExternalSensorStatusName'];
$index = $unit . '.' . $i;
$name = "Unit $unit, Sensor " . $entry['pduExternalSensorStatusName'];
$index = $unit . '.' . $i;
// pduExternalSensorStatusState
$descr = $name;
$oid_name = 'pduExternalSensorStatusState';
$oid_num = '.1.3.6.1.4.1.38446.1.6.4.1.5.'.$index;
$value = $entry[$oid_name];
$old_rrd = 'pduExternalSensorStatusState-'.$oid_name.'.'.$index;
// pduExternalSensorStatusState
$descr = $name;
$oid_name = 'pduExternalSensorStatusState';
$oid_num = '.1.3.6.1.4.1.38446.1.6.4.1.5.' . $index;
$value = $entry[$oid_name];
$old_rrd = 'pduExternalSensorStatusState-' . $oid_name . '.' . $index;
discover_status_ng($device, $mib, $oid_name, $oid_num, $index, 'pduExternalSensorStatusState', $descr, $value, [ 'entPhysicalClass' => 'other', 'rename_rrd' => $old_rrd ]);
discover_status_ng($device, $mib, $oid_name, $oid_num, $index, 'pduExternalSensorStatusState', $descr, $value, ['entPhysicalClass' => 'other', 'rename_rrd' => $old_rrd]);
// pduExternalSensorStatusValue
// pduExternalSensorStatusValue
$scale = 1;
// Limits (based on enabled thresholds)
// SYNTAX BITS {
// lowerCritical (0),
// lowerWarning (1),
// upperWarning (2),
// upperCritical (3)
// }
$options = [];
$limits_flags = base_convert(str_replace(' ', '', $entry['pduExternalSensorConfigEnabledThresholds']), 16, 10);
if (is_flag_set(bindec(10000000), $limits_flags)) { // 0b 1000 0000
$options['limit_low'] = $entry['pduExternalSensorConfigLowerCriticalThreshold'] * $scale;
$scale = 1;
// Limits (based on enabled thresholds)
// SYNTAX BITS {
// lowerCritical (0),
// lowerWarning (1),
// upperWarning (2),
// upperCritical (3)
// }
$options = [];
$limits_flags = base_convert(str_replace(' ', '', $entry['pduExternalSensorConfigEnabledThresholds']), 16, 10);
if (is_flag_set(bindec(10000000), $limits_flags)) { // 0b 1000 0000
$options['limit_low'] = $entry['pduExternalSensorConfigLowerCriticalThreshold'] * $scale;
}
if (is_flag_set(bindec(1000000), $limits_flags)) { // 0b 0100 0000
$options['limit_low_warn'] = $entry['pduExternalSensorConfigLowerWarningThreshold'] * $scale;
}
if (is_flag_set(bindec(100000), $limits_flags)) { // 0b 0010 0000
$options['limit_high_warn'] = $entry['pduExternalSensorConfigUpperWarningThreshold'] * $scale;
}
if (is_flag_set(bindec(10000), $limits_flags)) { // 0b 0001 0000
$options['limit_high'] = $entry['pduExternalSensorConfigUpperCriticalThreshold'] * $scale;
}
// Known sensor types
// SYNTAX INTEGER {
// temperature (1),
// humidity (2),
// doorSwitch (3),
// dryContact (4),
// spotFluid (5),
// ropeFluid (6),
// smoke (7),
// beacon (8),
// airVelocity (9),
// modbusAdapter (17),
// hidAdapter (18)
// }
switch ($entry['pduExternalSensorNamePlateType']) {
case 'temperature':
case 'humidity':
$sensor_class = $entry['pduExternalSensorNamePlateType'];
break;
case 'airVelocity':
$sensor_class = 'velocity';
break;
default:
continue 2;
}
if ($entry['pduExternalSensorNamePlateUnits'] === 'degreeF') {
$options['sensor_unit'] = 'F';
}
if (isset($entry['pduExternalSensorStatusHighPrecisionValue'])) { // && $entry['pduExternalSensorStatusHighPrecisionValue'] > 0)
$scale = 0.1;
$oid_name = 'pduExternalSensorStatusHighPrecisionValue';
$oid_num = ".1.3.6.1.4.1.38446.1.6.4.1.8.$index";
} else {
$oid_name = 'pduExternalSensorStatusValue';
$oid_num = ".1.3.6.1.4.1.38446.1.6.4.1.6.$index";
}
$value = $entry[$oid_name];
$options['rename_rrd'] = 'ENLOGIC-PDU-MIB-' . $oid_name . '-' . $index;
discover_sensor_ng($device, $sensor_class, $mib, $oid_name, $oid_num, $index, $descr, $scale, $value, $options);
}
if (is_flag_set(bindec(1000000), $limits_flags)) { // 0b 0100 0000
$options['limit_low_warn'] = $entry['pduExternalSensorConfigLowerWarningThreshold'] * $scale;
}
if (is_flag_set(bindec(100000), $limits_flags)) { // 0b 0010 0000
$options['limit_high_warn'] = $entry['pduExternalSensorConfigUpperWarningThreshold'] * $scale;
}
if (is_flag_set(bindec(10000), $limits_flags)) { // 0b 0001 0000
$options['limit_high'] = $entry['pduExternalSensorConfigUpperCriticalThreshold'] * $scale;
}
// Known sensor types
// SYNTAX INTEGER {
// temperature (1),
// humidity (2),
// doorSwitch (3),
// dryContact (4),
// spotFluid (5),
// ropeFluid (6),
// smoke (7),
// beacon (8),
// airVelocity (9),
// modbusAdapter (17),
// hidAdapter (18)
// }
switch ($entry['pduExternalSensorNamePlateType']) {
case 'temperature':
case 'humidity':
$sensor_class = $entry['pduExternalSensorNamePlateType'];
break;
case 'airVelocity':
$sensor_class = 'velocity';
break;
default:
continue 2;
}
if ($entry['pduExternalSensorNamePlateUnits'] === 'degreeF') {
$options['sensor_unit'] = 'F';
}
if (isset($entry['pduExternalSensorStatusHighPrecisionValue'])) { // && $entry['pduExternalSensorStatusHighPrecisionValue'] > 0)
$scale = 0.1;
$oid_name = 'pduExternalSensorStatusHighPrecisionValue';
$oid_num = ".1.3.6.1.4.1.38446.1.6.4.1.8.$index";
} else {
$oid_name = 'pduExternalSensorStatusValue';
$oid_num = ".1.3.6.1.4.1.38446.1.6.4.1.6.$index";
}
$value = $entry[$oid_name];
$options['rename_rrd'] = 'ENLOGIC-PDU-MIB-'.$oid_name.'-'.$index;
discover_sensor_ng($device, $sensor_class, $mib, $oid_name, $oid_num, $index, NULL, $descr, $scale, $value, $options);
}
}
// EOF

View File

@ -4,9 +4,9 @@
*
* This file is part of Observium.
*
* @package observium
* @subpackage discovery
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2020 Observium Limited
* @package observium
* @subpackage discovery
* @copyright (C) Adam Armstrong
*
*/

View File

@ -6,29 +6,32 @@
*
* @package observium
* @subpackage discovery
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2022 Observium Limited
* @copyright (C) Adam Armstrong
*
*/
$entity_array = snmpwalk_cache_oid($device, 'entPhySensorValue', $entity_array, 'ENTITY-MIB:ENTITY-SENSOR-MIB');
if (snmp_status()) {
$oids = [ 'entPhySensorType', 'entPhySensorScale', 'entPhySensorPrecision', 'entPhySensorOperStatus', 'entPhySensorUnitsDisplay' ];
foreach ($oids as $oid) {
$entity_array = snmpwalk_cache_oid($device, $oid, $entity_array, 'ENTITY-MIB:ENTITY-SENSOR-MIB');
}
if (!snmp_status()) {
return;
}
if (is_array($GLOBALS['cache']['snmp'][$mib][$device['device_id']])) {
$oids = [ 'entPhySensorType', 'entPhySensorScale', 'entPhySensorPrecision',
'entPhySensorOperStatus', 'entPhySensorUnitsDisplay' ];
foreach ($oids as $oid) {
$entity_array = snmpwalk_cache_oid($device, $oid, $entity_array, 'ENTITY-MIB:ENTITY-SENSOR-MIB');
}
if (is_array($GLOBALS['cache']['snmp'][$mib][$device['device_id']])) {
// If this already received in inventory module, skip walking
foreach ($GLOBALS['cache']['snmp'][$mib][$device['device_id']] as $index => $entry) {
if (isset($entity_array[$index]))
{
$entity_array[$index] = array_merge($entity_array[$index], $entry);
} else {
$entity_array[$index] = $entry;
}
if (isset($entity_array[$index])) {
$entity_array[$index] = array_merge($entity_array[$index], $entry);
} else {
$entity_array[$index] = $entry;
}
}
print_debug('ENTITY-MIB already cached');
} else {
} else {
$entity_mibs = snmp_mib_entity_vendortype($device, 'ENTITY-MIB');
$snmp_flags = OBS_SNMP_ALL;
@ -36,75 +39,78 @@ if (snmp_status()) {
$entity_array = snmpwalk_cache_oid($device, "entPhysicalDescr", $entity_array, $entity_mibs);
if (!snmp_status() && snmp_error_code() === OBS_SNMP_ERROR_OID_NOT_INCREASING) {
// Try refetch with NOINCREASE
$snmp_flags |= OBS_SNMP_NOINCREASE;
print_debug("WARNING! snmpwalk error 'OID not increasing' detected, try snmpwalk with -Cc option.");
// Try refetch with NOINCREASE
$snmp_flags |= OBS_SNMP_NOINCREASE;
print_debug("WARNING! snmpwalk error 'OID not increasing' detected, try snmpwalk with -Cc option.");
$entity_array = snmpwalk_cache_oid($device, "entPhysicalDescr", $entity_array, $entity_mibs, NULL, $snmp_flags);
$entity_array = snmpwalk_cache_oid($device, "entPhysicalDescr", $entity_array, $entity_mibs, NULL, $snmp_flags);
}
$oids = [ 'entPhysicalName', 'entPhysicalClass', 'entPhysicalContainedIn', 'entPhysicalParentRelPos' ];
$oids = ['entPhysicalName', 'entPhysicalClass', 'entPhysicalContainedIn', 'entPhysicalParentRelPos'];
if (is_device_mib($device, 'ARISTA-ENTITY-SENSOR-MIB')) {
$oids[] = 'entPhysicalAlias';
$oids[] = 'entPhysicalAlias';
}
if (snmp_status()) {
foreach ($oids as $oid) {
$entity_array = snmpwalk_cache_oid($device, $oid, $entity_array, $entity_mibs, NULL, $snmp_flags);
if (!snmp_status()) {
break;
foreach ($oids as $oid) {
$entity_array = snmpwalk_cache_oid($device, $oid, $entity_array, $entity_mibs, NULL, $snmp_flags);
if (!snmp_status()) {
break;
}
}
}
$entity_array = snmpwalk_cache_twopart_oid($device, 'entAliasMappingIdentifier', $entity_array, 'ENTITY-MIB:IF-MIB', NULL, $snmp_flags);
$GLOBALS['cache']['snmp']['ENTITY-MIB'][$device['device_id']] = $entity_array;
}
}
$entity_array = snmpwalk_cache_twopart_oid($device, 'entAliasMappingIdentifier', $entity_array, 'ENTITY-MIB:IF-MIB', NULL, $snmp_flags);
// Extra thresholds
if (is_device_mib($device, 'CISCO-ENTITY-SENSOR-EXT-MIB')) {
$oids_limits = [ 'ceSensorExtThresholdValue', 'ceSensorExtThresholdSeverity', 'ceSensorExtThresholdRelation' ];
$GLOBALS['cache']['snmp']['ENTITY-MIB'][$device['device_id']] = $entity_array;
}
}
// Extra thresholds
if (is_device_mib($device, 'CISCO-ENTITY-SENSOR-EXT-MIB')) {
$oids_limits = ['ceSensorExtThresholdValue', 'ceSensorExtThresholdSeverity', 'ceSensorExtThresholdRelation'];
$t_entity_array = [];
foreach ($oids_limits as $oid)
{
$t_entity_array = snmpwalk_cache_twopart_oid($device, $oid, $t_entity_array, 'CISCO-ENTITY-SENSOR-EXT-MIB');
if (!snmp_status()) { break; }
foreach ($oids_limits as $oid) {
$t_entity_array = snmpwalk_cache_twopart_oid($device, $oid, $t_entity_array, 'CISCO-ENTITY-SENSOR-EXT-MIB');
if (!snmp_status()) {
break;
}
}
} elseif (is_device_mib($device, 'ARISTA-ENTITY-SENSOR-MIB')) {
$oids_limits = [ 'aristaEntSensorThresholdLowWarning', 'aristaEntSensorThresholdLowCritical',
'aristaEntSensorThresholdHighWarning', 'aristaEntSensorThresholdHighCritical' ];
foreach ($oids_limits as $oid)
{
$entity_array = snmpwalk_cache_oid($device, $oid, $entity_array, 'ARISTA-ENTITY-SENSOR-MIB');
if (!snmp_status()) { break; }
} elseif (is_device_mib($device, 'ARISTA-ENTITY-SENSOR-MIB')) {
$oids_limits = ['aristaEntSensorThresholdLowWarning', 'aristaEntSensorThresholdLowCritical',
'aristaEntSensorThresholdHighWarning', 'aristaEntSensorThresholdHighCritical'];
foreach ($oids_limits as $oid) {
$entity_array = snmpwalk_cache_oid($device, $oid, $entity_array, 'ARISTA-ENTITY-SENSOR-MIB');
if (!snmp_status()) {
break;
}
}
} elseif (is_device_mib($device, 'ARUBAWIRED-POWERSUPPLY-MIB')) {
} elseif (is_device_mib($device, 'ARUBAWIRED-POWERSUPPLY-MIB')) {
$t_entity_array = snmpwalk_cache_oid($device, 'arubaWiredPSUName', [], 'ARUBAWIRED-POWERSUPPLY-MIB');
$t_entity_array = snmpwalk_cache_oid($device, 'arubaWiredPSUMaximumPower', $t_entity_array, 'ARUBAWIRED-POWERSUPPLY-MIB');
}
}
$entitysensor = [
'voltsDC' => 'voltage',
'voltsAC' => 'voltage',
'amperes' => 'current',
'watts' => 'power',
'hertz' => 'frequency',
'percentRH' => 'humidity',
'rpm' => 'fanspeed',
'celsius' => 'temperature',
'dBm' => 'dbm',
$entitysensor = [
'voltsDC' => 'voltage',
'voltsAC' => 'voltage',
'amperes' => 'current',
'watts' => 'power',
'hertz' => 'frequency',
'percentRH' => 'humidity',
'rpm' => 'fanspeed',
'celsius' => 'temperature',
'dBm' => 'dbm',
'truthvalue' => 'state'
];
];
/// DEVEL
//print_debug_vars($entity_array);
//if ($device['os'] === 'rittalpdu') { return; }
/// DEVEL
//print_debug_vars($entity_array);
//if ($device['os'] === 'rittalpdu') { return; }
foreach ($entity_array as $index => $entry) {
foreach ($entity_array as $index => $entry) {
// Sensor Type/Class
$type = NULL;
if (isset($entitysensor[$entry['entPhySensorType']])) {
$type = $entitysensor[$entry['entPhySensorType']];
$type = $entitysensor[$entry['entPhySensorType']];
} elseif ($entry['entPhySensorType'] === 'other' && !safe_empty($entry['entPhySensorUnitsDisplay'])) {
}
@ -115,201 +121,232 @@ if (snmp_status()) {
$entry['entPhySensorOperStatus'] !== 'unavailable' &&
$entry['entPhySensorOperStatus'] !== 'nonoperational') {
$ok = TRUE;
$options = [ 'entPhysicalIndex' => $index ];
$ok = TRUE;
$options = [ 'entPhysicalIndex' => $index ];
$oid = ".1.3.6.1.2.1.99.1.1.1.4.$index";
//$type = $entitysensor[$entry['entPhySensorType']];
$oid = ".1.3.6.1.2.1.99.1.1.1.4.$index";
//$type = $entitysensor[$entry['entPhySensorType']];
$descr = rewrite_entity_name($entry['entPhysicalDescr']);
if ($entry['entPhysicalDescr'] && $entry['entPhysicalName']) {
// Check if entPhysicalDescr equals entPhysicalName,
// Also compare like this: 'TenGigabitEthernet2/1 Bias Current' and 'Te2/1 Bias Current'
if (!str_contains($entry['entPhysicalDescr'], substr($entry['entPhysicalName'], 2))) {
$descr = rewrite_entity_name($entry['entPhysicalDescr']) . ' - ' . rewrite_entity_name($entry['entPhysicalName']);
}
} elseif (!$entry['entPhysicalDescr'] && $entry['entPhysicalName']) {
$descr = rewrite_entity_name($entry['entPhysicalName']);
} elseif (!$entry['entPhysicalDescr'] && !$entry['entPhysicalName']) {
// This is also trick for some retard devices like NetMan Plus
$descr = nicecase($type) . " $index";
}
// Scale & hardware specific fixes
if ($device['os'] === 'fortiswitch' && $entry['entPhySensorScale'] === 'units' &&
$entry['entPhySensorPrecision'] == '1') {
// https://jira.observium.org/browse/OBS-3658
$entry['entPhySensorPrecision'] = 0;
}
if ($device['os'] === 'asa' && $entry['entPhySensorScale'] === 'yocto' &&
$entry['entPhySensorPrecision'] == '0') {
// Hardcoded fix for Cisco ASA 9.1.5 (can be other) bug when all scales equals yocto (OBS-1110)
$scale = 1;
} elseif ($device['os'] === 'netman' && $type === 'temperature') {
$scale = 0.1;
} elseif (isset($entry['entPhySensorScale'])) {
$scale = si_to_scale($entry['entPhySensorScale'], $entry['entPhySensorPrecision']);
} else {
// Some devices not report scales, like NetMan Plus. But this is really HACK
// Heh, I not know why only ups.. I'm not sure that this for all ups.. just I see this only on NetMan Plus.
$scale = ($device['os_group'] === 'ups' && $type === 'temperature') ? 0.1 : 1;
}
$value = $entry['entPhySensorValue'];
if ($type === 'temperature') {
if (isset($valid['sensor'][$type]['ARUBAWIRED-TEMPSENSOR-MIB-arubaWiredTempSensorTemperature'])) {
// duplicate sensors
$ok = FALSE;
} elseif ($value * $scale > 200 || $value == 0) {
$ok = FALSE;
}
} elseif ($type === 'fanspeed') {
if (isset($valid['sensor'][$type]['ARUBAWIRED-FAN-MIB-arubaWiredFanRPM'])) {
// duplicate sensors
$ok = FALSE;
}
}
if ($value == -127 || $value == -1000000000) {
// Optic RX/TX watt sensors on Arista
$ok = FALSE;
} elseif ($value == 0 && safe_empty($entry['entPhysicalDescr']) && safe_empty($entry['entPhysicalName'])) {
$ok = FALSE;
}
// Now try to search port bounded with sensor by ENTITY-MIB
if ($ok && in_array($type, [ 'temperature', 'voltage', 'current', 'dbm', 'power' ])) {
$port = get_port_by_ent_index($device, $index);
$options['entPhysicalIndex'] = $index;
if (is_array($port)) {
$entry['ifDescr'] = $port['ifDescr'];
$options['measured_class'] = 'port';
$options['measured_entity'] = $port['port_id'];
$options['entPhysicalIndex_measured'] = $port['ifIndex'];
// Append port label for Extreme XOS, while it not have port information in descr
if ($device['os_group'] === 'extremeware' &&
!str_contains_array($descr, [ $port['port_label'], $port['port_label_short'] ])) {
$descr = $port['port_label'] . ' ' . $descr;
} elseif (isset($port['sensor_multilane']) && $port['sensor_multilane']) {
// Multilane sensors, some rewrites
list($match) = explode('/', $port['ifDescr']); // Ethernet56/1 -> Ethernet56
if (preg_match("! $match(\/(?<lane>\d))?!", $descr, $matches)) {
$descr = str_replace($matches[0], '', $descr);
$descr = $port['port_label'] . (isset($matches['lane']) ? ' Lane ' . $matches['lane'] : '') . ' ' . $descr;
$descr = rewrite_entity_name($entry['entPhysicalDescr']);
if ($entry['entPhysicalDescr'] && $entry['entPhysicalName']) {
// Check if entPhysicalDescr equals entPhysicalName,
// Also compare like this: 'TenGigabitEthernet2/1 Bias Current' and 'Te2/1 Bias Current'
if (!str_contains($entry['entPhysicalDescr'], substr($entry['entPhysicalName'], 2))) {
$descr = rewrite_entity_name($entry['entPhysicalDescr']) . ' - ' . rewrite_entity_name($entry['entPhysicalName']);
}
}
}
}
// Set thresholds for numeric sensors
$limits = [];
if (isset($entry['aristaEntSensorThresholdHighCritical'])) {
// ARISTA-ENTITY-SENSOR-MIB
foreach ([ 'limit_high' => 'aristaEntSensorThresholdHighCritical',
'limit_low' => 'aristaEntSensorThresholdLowCritical',
'limit_low_warn' => 'aristaEntSensorThresholdLowWarning',
'limit_high_warn' => 'aristaEntSensorThresholdHighWarning' ] as $limit => $limit_oid) {
if (abs($entry[$limit_oid]) != 1000000000) {
$limits[$limit] = $entry[$limit_oid] * $scale;
} else {
// The MIB can return -1000000000 or +1000000000, if there should be no threshold there.
$limits['limit_auto'] = FALSE;
}
}
} elseif ($type === 'power' && is_device_mib($device, 'ARUBAWIRED-POWERSUPPLY-MIB')) {
// ARUBAWIRED-POWERSUPPLY-MIB
foreach ($t_entity_array as $t_index => $t_entry) {
// ENTITY-SENSOR-MIB::entPhysicalName.7401 = STRING: Power sensor for power supply 1/2
// ARUBAWIRED-POWERSUPPLY-MIB::arubaWiredPSUName.1.2 = STRING: 1/2
if ($t_entry['arubaWiredPSUMaximumPower'] > 0 &&
str_ends($entry['entPhysicalName'], ' '.$t_entry['arubaWiredPSUName'])) {
$limits['limit_high'] = $t_entry['arubaWiredPSUMaximumPower'];
break;
}
}
} elseif (isset($t_entity_array[$index])) {
// CISCO-ENTITY-SENSOR-EXT-MIB
// Check thresholds for this entry
foreach ($t_entity_array[$index] as $t_index => $t_entry) {
if ($t_entry['ceSensorExtThresholdValue'] == "-32768") { continue; }
// CISCO-ENTITY-SENSOR-EXT-MIB::ceSensorExtThresholdSeverity.13.1 = INTEGER: critical(30)
// CISCO-ENTITY-SENSOR-EXT-MIB::ceSensorExtThresholdSeverity.14.1 = INTEGER: critical(30)
// CISCO-ENTITY-SENSOR-EXT-MIB::ceSensorExtThresholdRelation.13.1 = INTEGER: lessOrEqual(2)
// CISCO-ENTITY-SENSOR-EXT-MIB::ceSensorExtThresholdRelation.14.1 = INTEGER: greaterOrEqual(4)
// CISCO-ENTITY-SENSOR-EXT-MIB::ceSensorExtThresholdValue.13.1 = INTEGER: 2150
// CISCO-ENTITY-SENSOR-EXT-MIB::ceSensorExtThresholdValue.14.1 = INTEGER: 55
switch ($t_entry['ceSensorExtThresholdSeverity']) {
case 'critical':
// Prefer critical over major
if (in_array($t_entry['ceSensorExtThresholdRelation'], [ 'greaterOrEqual', 'greaterThan' ])) {
if (isset($limits['limit_high'])) { break; } // Use first threshold entry
$limits['limit_high'] = $t_entry['ceSensorExtThresholdValue'] * $scale;
} elseif (in_array($t_entry['ceSensorExtThresholdRelation'], [ 'lessOrEqual', 'lessThan' ])) {
if (isset($limits['limit_low'])) { break; } // Use first threshold entry
$limits['limit_low'] = $t_entry['ceSensorExtThresholdValue'] * $scale;
}
// FIXME. Not used: equalTo, notEqualTo
break;
case 'major':
// Prefer critical over major,
if (in_array($t_entry['ceSensorExtThresholdRelation'], [ 'greaterOrEqual', 'greaterThan' ])) {
if (isset($limits['limit_high_major'])) { break; } // Use first threshold entry
$limits['limit_high_major'] = $t_entry['ceSensorExtThresholdValue'] * $scale;
} elseif (in_array($t_entry['ceSensorExtThresholdRelation'], [ 'lessOrEqual', 'lessThan' ])) {
if (isset($limits['limit_low_major'])) { break; } // Use first threshold entry
$limits['limit_low_major'] = $t_entry['ceSensorExtThresholdValue'] * $scale;
}
break;
case 'minor':
if (in_array($t_entry['ceSensorExtThresholdRelation'], [ 'greaterOrEqual', 'greaterThan' ])) {
if (isset($limits['limit_high_warn'])) { break; } // Use first threshold entry
$limits['limit_high_warn'] = $t_entry['ceSensorExtThresholdValue'] * $scale;
} elseif (in_array($t_entry['ceSensorExtThresholdRelation'], [ 'lessOrEqual', 'lessThan' ])) {
if (isset($limits['limit_low_warn'])) { break; } // Use first threshold entry
$limits['limit_low_warn'] = $t_entry['ceSensorExtThresholdValue'] * $scale;
}
// FIXME. Not used: equalTo, notEqualTo
break;
case 'other':
// Probably here should be equalTo, notEqualTo.. never saw
break;
}
} elseif (!$entry['entPhysicalDescr'] && $entry['entPhysicalName']) {
$descr = rewrite_entity_name($entry['entPhysicalName']);
} elseif (!$entry['entPhysicalDescr'] && !$entry['entPhysicalName']) {
// This is also trick for some retard devices like NetMan Plus
$descr = nicecase($type) . " $index";
}
}
// Check to make sure we've not already seen this sensor via cisco's entity sensor mib
if ($type === 'state') {
//if (isset($valid['status']['CISCO-ENTITY-SENSOR-MIB']['cisco-entity-sensor'][$index]))
if (is_device_mib($device, 'CISCO-ENTITY-SENSOR-MIB')) { // Complete ignore truthvalue on Cisco devices
$ok = FALSE;
// Scale & hardware specific fixes
if ($device['os'] === 'fortiswitch' && $entry['entPhySensorScale'] === 'units' &&
$entry['entPhySensorPrecision'] == '1') {
// https://jira.observium.org/browse/OBS-3658
$entry['entPhySensorPrecision'] = 0;
}
} elseif (isset($valid['sensor'][$type]['CISCO-ENTITY-SENSOR-MIB-entSensorValue'][$index])) {
$ok = FALSE;
}
if ($ok) {
$options = array_merge($limits, $options);
if ($type === 'state') {
//truthvalue
discover_status_ng($device, $mib, 'entPhySensorValue', $oid, $index, 'entity-truthvalue', $descr, $value, $options);
if ($device['os'] === 'asa' && $entry['entPhySensorScale'] === 'yocto' &&
$entry['entPhySensorPrecision'] == '0') {
// Hardcoded fix for Cisco ASA 9.1.5 (can be other) bug when all scales equals yocto (OBS-1110)
$scale = 1;
} elseif ($device['os'] === 'netman' && $type === 'temperature') {
$scale = 0.1;
} elseif (isset($entry['entPhySensorScale'])) {
$scale = si_to_scale($entry['entPhySensorScale'], $entry['entPhySensorPrecision']);
} else {
$options['rename_rrd'] = 'entity-sensor-'.$index;
discover_sensor_ng($device, $type, $mib, 'entPhySensorValue', $oid, $index, NULL, $descr, $scale, $value, $options);
// Some devices not report scales, like NetMan Plus. But this is really HACK
// Heh, I not know why only ups.. I'm not sure that this for all ups.. just I see this only on NetMan Plus.
$scale = ($device['os_group'] === 'ups' && $type === 'temperature') ? 0.1 : 1;
}
$value = $entry['entPhySensorValue'];
if ($type === 'temperature') {
if (isset($valid['sensor'][$type]['ARUBAWIRED-TEMPSENSOR-MIB-arubaWiredTempSensorTemperature'])) {
// duplicate sensors
$ok = FALSE;
} elseif ($value * $scale > 200 || $value == 0) {
$ok = FALSE;
}
} elseif ($type === 'fanspeed') {
if (isset($valid['sensor'][$type]['ARUBAWIRED-FAN-MIB-arubaWiredFanRPM'])) {
// duplicate sensors
$ok = FALSE;
}
} elseif ($type === 'power') {
if (isset($valid['sensor'][$type]['ARUBAWIRED-POWERSUPPLY-MIB-arubaWiredPSUInstantaneousPower'])) {
// duplicate sensors
$ok = FALSE;
}
}
if ($value == -127 || $value == -1000000000) {
// Optic RX/TX watt sensors on Arista
$ok = FALSE;
} elseif ($value == 0 && safe_empty($entry['entPhysicalDescr']) && safe_empty($entry['entPhysicalName'])) {
$ok = FALSE;
}
// Now try to search port bounded with sensor by ENTITY-MIB
if ($ok && in_array($type, [ 'temperature', 'voltage', 'current', 'dbm', 'power' ])) {
$port = get_port_by_ent_index($device, $index);
$options['entPhysicalIndex'] = $index;
if (is_array($port)) {
$entry['ifDescr'] = $port['ifDescr'];
$options['measured_class'] = 'port';
$options['measured_entity'] = $port['port_id'];
$options['entPhysicalIndex_measured'] = $port['ifIndex'];
// Append port label for Extreme XOS, while it not have port information in descr
if ($device['os_group'] === 'extremeware' &&
!str_contains_array($descr, [ $port['port_label'], $port['port_label_short'] ])) {
$descr = $port['port_label'] . ' ' . $descr;
} elseif (isset($port['sensor_multilane']) && $port['sensor_multilane']) {
// Multilane sensors, some rewrites
$match = explode('/', $port['ifDescr'])[0]; // Ethernet56/1 -> Ethernet56
if (preg_match("! $match(\/(?<lane>\d))?!", $descr, $matches)) {
$descr = str_replace($matches[0], '', $descr);
$descr = $port['port_label'] . (isset($matches['lane']) ? ' Lane ' . $matches['lane'] : '') . ' ' . $descr;
} elseif (preg_match("! Eth\d+.+\)\/(?<lane>[1234])$!", $descr, $matches)) {
// SONiC OS
print_debug("Multi-lane matched lane " . $matches['lane']);
$descr = $port['port_label'] . (isset($matches['lane']) ? ' Lane ' . $matches['lane'] : '') . ' ' . $descr;
}
}
}
}
// Some other measure entities
if ($ok && !isset($options['measured_class'])) {
if (preg_match('/^(Voltage|Power|Current|Temperature|Temp)( for)? (?<psu>PSU ?\d+)$/', $descr, $matches)) {
$options['measured_class'] = 'powersupply';
$options['measured_entity_label'] = $matches['psu'];
}
}
// Set thresholds for numeric sensors
$limits = [];
if (isset($entry['aristaEntSensorThresholdHighCritical'])) {
// ARISTA-ENTITY-SENSOR-MIB
foreach (['limit_high' => 'aristaEntSensorThresholdHighCritical',
'limit_low' => 'aristaEntSensorThresholdLowCritical',
'limit_low_warn' => 'aristaEntSensorThresholdLowWarning',
'limit_high_warn' => 'aristaEntSensorThresholdHighWarning'] as $limit => $limit_oid) {
if (abs($entry[$limit_oid]) != 1000000000) {
$limits[$limit] = $entry[$limit_oid] * $scale;
} else {
// The MIB can return -1000000000 or +1000000000, if there should be no threshold there.
$limits['limit_auto'] = FALSE;
}
}
} elseif ($type === 'power' && is_device_mib($device, 'ARUBAWIRED-POWERSUPPLY-MIB')) {
// ARUBAWIRED-POWERSUPPLY-MIB
foreach ($t_entity_array as $t_index => $t_entry) {
// ENTITY-SENSOR-MIB::entPhysicalName.7401 = STRING: Power sensor for power supply 1/2
// ARUBAWIRED-POWERSUPPLY-MIB::arubaWiredPSUName.1.2 = STRING: 1/2
if ($t_entry['arubaWiredPSUMaximumPower'] > 0 &&
str_ends($entry['entPhysicalName'], ' ' . $t_entry['arubaWiredPSUName'])) {
$limits['limit_high'] = $t_entry['arubaWiredPSUMaximumPower'];
break;
}
}
} elseif (isset($t_entity_array[$index])) {
// CISCO-ENTITY-SENSOR-EXT-MIB
// Check thresholds for this entry
foreach ($t_entity_array[$index] as $t_index => $t_entry) {
if ($t_entry['ceSensorExtThresholdValue'] == "-32768") {
continue;
}
// CISCO-ENTITY-SENSOR-EXT-MIB::ceSensorExtThresholdSeverity.13.1 = INTEGER: critical(30)
// CISCO-ENTITY-SENSOR-EXT-MIB::ceSensorExtThresholdSeverity.14.1 = INTEGER: critical(30)
// CISCO-ENTITY-SENSOR-EXT-MIB::ceSensorExtThresholdRelation.13.1 = INTEGER: lessOrEqual(2)
// CISCO-ENTITY-SENSOR-EXT-MIB::ceSensorExtThresholdRelation.14.1 = INTEGER: greaterOrEqual(4)
// CISCO-ENTITY-SENSOR-EXT-MIB::ceSensorExtThresholdValue.13.1 = INTEGER: 2150
// CISCO-ENTITY-SENSOR-EXT-MIB::ceSensorExtThresholdValue.14.1 = INTEGER: 55
switch ($t_entry['ceSensorExtThresholdSeverity']) {
case 'critical':
// Prefer critical over major
if (in_array($t_entry['ceSensorExtThresholdRelation'], ['greaterOrEqual', 'greaterThan'])) {
if (isset($limits['limit_high'])) {
break;
} // Use first threshold entry
$limits['limit_high'] = $t_entry['ceSensorExtThresholdValue'] * $scale;
} elseif (in_array($t_entry['ceSensorExtThresholdRelation'], ['lessOrEqual', 'lessThan'])) {
if (isset($limits['limit_low'])) {
break;
} // Use first threshold entry
$limits['limit_low'] = $t_entry['ceSensorExtThresholdValue'] * $scale;
}
// FIXME. Not used: equalTo, notEqualTo
break;
case 'major':
// Prefer critical over major,
if (in_array($t_entry['ceSensorExtThresholdRelation'], ['greaterOrEqual', 'greaterThan'])) {
if (isset($limits['limit_high_major'])) {
break;
} // Use first threshold entry
$limits['limit_high_major'] = $t_entry['ceSensorExtThresholdValue'] * $scale;
} elseif (in_array($t_entry['ceSensorExtThresholdRelation'], ['lessOrEqual', 'lessThan'])) {
if (isset($limits['limit_low_major'])) {
break;
} // Use first threshold entry
$limits['limit_low_major'] = $t_entry['ceSensorExtThresholdValue'] * $scale;
}
break;
case 'minor':
if (in_array($t_entry['ceSensorExtThresholdRelation'], ['greaterOrEqual', 'greaterThan'])) {
if (isset($limits['limit_high_warn'])) {
break;
} // Use first threshold entry
$limits['limit_high_warn'] = $t_entry['ceSensorExtThresholdValue'] * $scale;
} elseif (in_array($t_entry['ceSensorExtThresholdRelation'], ['lessOrEqual', 'lessThan'])) {
if (isset($limits['limit_low_warn'])) {
break;
} // Use first threshold entry
$limits['limit_low_warn'] = $t_entry['ceSensorExtThresholdValue'] * $scale;
}
// FIXME. Not used: equalTo, notEqualTo
break;
case 'other':
// Probably here should be equalTo, notEqualTo.. never saw
break;
}
}
}
// Check to make sure we've not already seen this sensor via cisco's entity sensor mib
if ($type === 'state') {
//if (isset($valid['status']['CISCO-ENTITY-SENSOR-MIB']['cisco-entity-sensor'][$index]))
if (is_device_mib($device, 'CISCO-ENTITY-SENSOR-MIB')) { // Complete ignore truthvalue on Cisco devices
$ok = FALSE;
}
} elseif (isset($valid['sensor'][$type]['CISCO-ENTITY-SENSOR-MIB-entSensorValue'][$index])) {
$ok = FALSE;
}
if ($ok) {
$options = array_merge($limits, $options);
if ($type === 'state') {
//truthvalue
discover_status_ng($device, $mib, 'entPhySensorValue', $oid, $index, 'entity-truthvalue', $descr, $value, $options);
} else {
$options['rename_rrd'] = 'entity-sensor-' . $index;
discover_sensor_ng($device, $type, $mib, 'entPhySensorValue', $oid, $index, $descr, $scale, $value, $options);
}
}
}
} else {
print_debug("Skipped:");
print_debug_vars($entry);
print_debug("Skipped:");
print_debug_vars($entry);
}
}
}
unset($oids, $oids_arista, $entity_array, $index, $scale, $type, $value, $descr, $ok, $ifIndex, $sensor_port);

View File

@ -6,7 +6,7 @@
*
* @package observium
* @subpackage discovery
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2022 Observium Limited
* @copyright (C) Adam Armstrong
*
*/
@ -23,69 +23,70 @@
// EPPC-MIB::upsESystemInputWatts.1 = INTEGER: -1
$input_phases = snmp_get_oid($device, 'upsESystemInputNumPhases.0', $mib);
if ($input_phases > 0) {
echo('upsESystemInputTable ('.$input_phases.' phases)');
echo('upsESystemInputTable (' . $input_phases . ' phases)');
$scale = 0.1;
$ups_array = snmpwalk_cache_oid($device, 'upsESystemInputTable', [], $mib);
$input_voltage = snmp_get_oid($device, 'upsESystemConfigInputVoltage.0', $mib) * $scale;
if ($input_voltage > 0) {
$voltage_limits = [
'limit_high' => $input_voltage * 1.03, 'limit_high_warn' => $input_voltage * 1.01,
'limit_low' => $input_voltage * 0.97, 'limit_low_warn' => $input_voltage * 0.99
];
} else {
$voltage_limits = [];
}
$input_frequency = snmp_get_oid($device, 'upsESystemConfigInputFrequence.0', $mib) * $scale;
if ($input_frequency > 0) {
$frequency_limits = [
'limit_high' => $input_frequency * 1.10, 'limit_high_warn' => $input_frequency * 1.02,
'limit_low' => $input_frequency * 0.90, 'limit_low_warn' => $input_frequency * 0.98
];
} else {
$frequency_limits = [];
}
foreach ($ups_array as $phase => $entry) {
$descr = 'Input';
if ($input_phases > 1) {
$descr .= ' (Phase '.$phase.')';
$scale = 0.1;
$ups_array = snmpwalk_cache_oid($device, 'upsESystemInputTable', [], $mib);
$input_voltage = snmp_get_oid($device, 'upsESystemConfigInputVoltage.0', $mib) * $scale;
if ($input_voltage > 0) {
$voltage_limits = [
'limit_high' => sensor_limit_high('voltage', $input_voltage), 'limit_high_warn' => sensor_limit_high_warn('voltage', $input_voltage),
'limit_low' => sensor_limit_low('voltage', $input_voltage), 'limit_low_warn' => sensor_limit_low_warn('voltage', $input_voltage)
];
} else {
$voltage_limits = [];
}
$input_frequency = snmp_get_oid($device, 'upsESystemConfigInputFrequence.0', $mib) * $scale;
if ($input_frequency > 0) {
$frequency_limits = [
'limit_high' => sensor_limit_high('frequency', $input_frequency), 'limit_high_warn' => sensor_limit_high_warn('frequency', $input_frequency),
'limit_low' => sensor_limit_low('frequency', $input_frequency), 'limit_low_warn' => sensor_limit_low_warn('frequency', $input_frequency)
];
} else {
$frequency_limits = [];
}
$oid_name = 'upsESystemInputVoltage';
$oid_num = '.1.3.6.1.4.1.935.10.1.1.2.16.1.3.'.$phase;
$value = $entry[$oid_name];
foreach ($ups_array as $phase => $entry) {
$descr = 'Input';
if ($input_phases > 1) {
$descr .= ' (Phase ' . $phase . ')';
}
$options = $voltage_limits;
$options['rename_rrd'] = "eppc-mib-upsESystemInputVoltage.%index%";
//discover_sensor('voltage', $device, $oid, "upsESystemInputVoltage.$index", 'eppc-mib', $descr, 0.1, $value, $voltage_limits);
discover_sensor_ng($device, 'voltage', $mib, $oid_name, $oid_num, $phase, NULL, $descr, $scale, $value, $options);
$oid_name = 'upsESystemInputVoltage';
$oid_num = '.1.3.6.1.4.1.935.10.1.1.2.16.1.3.' . $phase;
$value = $entry[$oid_name];
$oid_name = 'upsESystemInputFrequency';
$oid_num = '.1.3.6.1.4.1.935.10.1.1.2.16.1.2.'.$phase;
$value = $entry[$oid_name];
$options = $voltage_limits;
$options['rename_rrd'] = "eppc-mib-upsESystemInputVoltage.%index%";
discover_sensor_ng($device, 'voltage', $mib, $oid_name, $oid_num, $phase, $descr, $scale, $value, $options);
$options = $frequency_limits;
$options['rename_rrd'] = "eppc-mib-upsESystemInputFrequency.%index%";
//discover_sensor('frequency', $device, $oid, "upsESystemInputFrequency.$index", 'eppc-mib', $descr, 0.1, $value, $limits);
discover_sensor_ng($device, 'frequency', $mib, $oid_name, $oid_num, $phase, NULL, $descr, $scale, $value, $options);
if ($entry['upsESystemInputFrequency'] > 0) {
$oid_name = 'upsESystemInputFrequency';
$oid_num = '.1.3.6.1.4.1.935.10.1.1.2.16.1.2.' . $phase;
$value = $entry[$oid_name];
if ($entry['upsESystemInputCurrent'] > 0) {
$oid_name = 'upsESystemInputCurrent';
$oid_num = '.1.3.6.1.4.1.935.10.1.1.2.16.1.4.'.$phase;
$value = $entry[$oid_name];
$options = $frequency_limits;
$options['rename_rrd'] = "eppc-mib-upsESystemInputFrequency.%index%";
discover_sensor_ng($device, 'current', $mib, $oid_name, $oid_num, $phase, NULL, $descr, $scale, $value);
discover_sensor_ng($device, 'frequency', $mib, $oid_name, $oid_num, $phase, $descr, $scale, $value, $options);
}
if ($entry['upsESystemInputCurrent'] > 0) {
$oid_name = 'upsESystemInputCurrent';
$oid_num = '.1.3.6.1.4.1.935.10.1.1.2.16.1.4.' . $phase;
$value = $entry[$oid_name];
discover_sensor_ng($device, 'current', $mib, $oid_name, $oid_num, $phase, $descr, $scale, $value);
}
if ($entry['upsESystemInputWatts'] > 0) {
$oid_name = 'upsESystemInputWatts';
$oid_num = '.1.3.6.1.4.1.935.10.1.1.2.16.1.5.' . $phase;
$value = $entry[$oid_name];
discover_sensor_ng($device, 'power', $mib, $oid_name, $oid_num, $phase, $descr, 1, $value);
}
}
if ($entry['upsESystemInputWatts'] > 0) {
$oid_name = 'upsESystemInputWatts';
$oid_num = '.1.3.6.1.4.1.935.10.1.1.2.16.1.5.'.$phase;
$value = $entry[$oid_name];
discover_sensor_ng($device, 'power', $mib, $oid_name, $oid_num, $phase, NULL, $descr, 1, $value);
}
}
}
# Output Sensors
@ -104,98 +105,95 @@ if ($input_phases > 0) {
$output_phases = snmp_get_oid($device, 'upsESystemOutputNumPhase.0', $mib);
if ($output_phases > 0) {
echo('upsESystemOutputTable (' . $output_phases . ' phases)');
echo('upsESystemOutputTable (' . $output_phases . ' phases)');
$scale = 0.1;
$ups_array = snmpwalk_cache_oid($device, 'upsESystemOutputTable', [], $mib);
$scale = 0.1;
$ups_array = snmpwalk_cache_oid($device, 'upsESystemOutputTable', [], $mib);
$output_voltage = snmp_get_oid($device, 'upsESystemConfigOutputVoltage.0', $mib) * $scale;
if ($output_voltage > 0) {
$voltage_limits = [
'limit_high' => $output_voltage * 1.03, 'limit_high_warn' => $output_voltage * 1.01,
'limit_low' => $output_voltage * 0.97, 'limit_low_warn' => $output_voltage * 0.99
];
} else {
// Keep input voltage limits
//$voltage_limits = [];
}
$output_frequency = snmp_get_oid($device, 'upsESystemConfigOutputFrequency.0', $mib) * $scale;
if ($output_frequency > 0) {
$frequency_limits = [
'limit_high' => $output_frequency * 1.10, 'limit_high_warn' => $output_frequency * 1.02,
'limit_low' => $output_frequency * 0.90, 'limit_low_warn' => $output_frequency * 0.98
];
} else {
// Keep input frequency limits
//$frequency_limits = [];
}
foreach ($ups_array as $phase => $entry) {
$descr = 'Output';
if ($input_phases > 1) {
$descr .= ' (Phase ' . $phase . ')';
$output_voltage = snmp_get_oid($device, 'upsESystemConfigOutputVoltage.0', $mib) * $scale;
if ($output_voltage > 0) {
$voltage_limits = [
'limit_high' => sensor_limit_high('voltage', $output_voltage), 'limit_high_warn' => sensor_limit_high_warn('voltage', $output_voltage),
'limit_low' => sensor_limit_low('voltage', $output_voltage), 'limit_low_warn' => sensor_limit_low_warn('voltage', $output_voltage)
];
} else {
// Keep input voltage limits
//$voltage_limits = [];
}
$oid_name = 'upsESystemOutputVoltage';
$oid_num = ".1.3.6.1.4.1.935.10.1.1.2.18.1.3.$index";
$value = $entry[$oid_name];
$options = $voltage_limits;
$options['rename_rrd'] = "eppc-mib-upsESystemOutputVoltage.%index%";
//discover_sensor('voltage', $device, $oid, "upsESystemOutputVoltage.$index", 'eppc-mib', $descr, 0.1, $value, $voltage_limits);
discover_sensor_ng($device, 'voltage', $mib, $oid_name, $oid_num, $phase, NULL, $descr, $scale, $value, $options);
$oid_name = 'upsESystemOutputFrequency';
$oid_num = ".1.3.6.1.4.1.935.10.1.1.2.18.1.2.$index";
$value = $entry[$oid_name];
$options = $frequency_limits;
$options['rename_rrd'] = "eppc-mib-upsESystemOutputFrequency.%index%";
//discover_sensor('frequency', $device, $oid, "upsESystemOutputFrequency.$index", 'eppc-mib', $descr, 0.1, $value, $limits);
discover_sensor_ng($device, 'frequency', $mib, $oid_name, $oid_num, $phase, NULL, $descr, $scale, $value, $options);
$oid_name = 'upsESystemOutputLoad';
$oid_num = ".1.3.6.1.4.1.935.10.1.1.2.18.1.7.$index";
$value = $entry[$oid_name];
$options = [ 'limit_high' => 90, 'limit_high_warn' => 75 ];
$options['rename_rrd'] = "eppc-mib-upsESystemOutputLoad.%index%";
//discover_sensor('load', $device, $oid, "upsESystemOutputLoad.$index", 'eppc-mib', $descr, 1, $value, $limits);
discover_sensor_ng($device, 'load', $mib, $oid_name, $oid_num, $phase, NULL, $descr, 1, $value, $options);
if ($entry['upsESystemOutputCurrent'] > 0) {
$oid_name = 'upsESystemOutputCurrent';
$oid_num = '.1.3.6.1.4.1.935.10.1.1.2.18.1.4.'.$phase;
$value = $entry[$oid_name];
discover_sensor_ng($device, 'current', $mib, $oid_name, $oid_num, $phase, NULL, $descr, $scale, $value);
$output_frequency = snmp_get_oid($device, 'upsESystemConfigOutputFrequency.0', $mib) * $scale;
if ($output_frequency > 0) {
$frequency_limits = [
'limit_high' => sensor_limit_high('frequency', $output_frequency), 'limit_high_warn' => sensor_limit_high_warn('frequency', $output_frequency),
'limit_low' => sensor_limit_low('frequency', $output_frequency), 'limit_low_warn' => sensor_limit_low_warn('frequency', $output_frequency)
];
} else {
// Keep input frequency limits
//$frequency_limits = [];
}
if ($entry['upsESystemOutputWatts'] > 0) {
$oid_name = 'upsESystemOutputWatts';
$oid_num = '.1.3.6.1.4.1.935.10.1.1.2.18.1.5.'.$phase;
$value = $entry[$oid_name];
foreach ($ups_array as $phase => $entry) {
$descr = 'Output';
if ($input_phases > 1) {
$descr .= ' (Phase ' . $phase . ')';
}
discover_sensor_ng($device, 'power', $mib, $oid_name, $oid_num, $phase, NULL, $descr, 1, $value);
$oid_name = 'upsESystemOutputVoltage';
$oid_num = '.1.3.6.1.4.1.935.10.1.1.2.18.1.3.' . $phase;
$value = $entry[$oid_name];
$options = $voltage_limits;
$options['rename_rrd'] = "eppc-mib-upsESystemOutputVoltage.%index%";
discover_sensor_ng($device, 'voltage', $mib, $oid_name, $oid_num, $phase, $descr, $scale, $value, $options);
$oid_name = 'upsESystemOutputFrequency';
$oid_num = '.1.3.6.1.4.1.935.10.1.1.2.18.1.2.' . $phase;
$value = $entry[$oid_name];
$options = $frequency_limits;
$options['rename_rrd'] = "eppc-mib-upsESystemOutputFrequency.%index%";
discover_sensor_ng($device, 'frequency', $mib, $oid_name, $oid_num, $phase, $descr, $scale, $value, $options);
$oid_name = 'upsESystemOutputLoad';
$oid_num = '.1.3.6.1.4.1.935.10.1.1.2.18.1.7.' . $phase;
$value = $entry[$oid_name];
$options = ['limit_high' => 90, 'limit_high_warn' => 75];
$options['rename_rrd'] = "eppc-mib-upsESystemOutputLoad.%index%";
discover_sensor_ng($device, 'load', $mib, $oid_name, $oid_num, $phase, $descr, 1, $value, $options);
if ($entry['upsESystemOutputCurrent'] > 0) {
$oid_name = 'upsESystemOutputCurrent';
$oid_num = '.1.3.6.1.4.1.935.10.1.1.2.18.1.4.' . $phase;
$value = $entry[$oid_name];
discover_sensor_ng($device, 'current', $mib, $oid_name, $oid_num, $phase, $descr, $scale, $value);
}
if ($entry['upsESystemOutputWatts'] > 0) {
$oid_name = 'upsESystemOutputWatts';
$oid_num = '.1.3.6.1.4.1.935.10.1.1.2.18.1.5.' . $phase;
$value = $entry[$oid_name];
discover_sensor_ng($device, 'power', $mib, $oid_name, $oid_num, $phase, $descr, 1, $value);
}
if ($entry['upsESystemOutputVA'] > 0) {
$oid_name = 'upsESystemOutputVA';
$oid_num = '.1.3.6.1.4.1.935.10.1.1.2.18.1.6.' . $phase;
$value = $entry[$oid_name];
discover_sensor_ng($device, 'apower', $mib, $oid_name, $oid_num, $phase, $descr, 1, $value);
}
}
if ($entry['upsESystemOutputVA'] > 0) {
$oid_name = 'upsESystemOutputVA';
$oid_num = '.1.3.6.1.4.1.935.10.1.1.2.18.1.6.'.$phase;
$value = $entry[$oid_name];
discover_sensor_ng($device, 'apower', $mib, $oid_name, $oid_num, $phase, NULL, $descr, 1, $value);
}
}
}
# bypass sensors
// EPPC-MIB::upsESystemBypassNumPhase.0 = INTEGER: -1
$bypass_phases = snmp_get_oid($device, 'upsESystemBypassNumPhase.0', $mib);
if ($bypass_phases > 0) {
echo('upsESystemBypassTable (' . $bypass_phases . ' phases)');
$ups_array = snmpwalk_cache_oid($device, 'upsESystemBypassTable', [], $mib);
echo('upsESystemBypassTable (' . $bypass_phases . ' phases)');
$ups_array = snmpwalk_cache_oid($device, 'upsESystemBypassTable', [], $mib);
}
/* FIXME Sensors below are a definite candidate for definition-based discovery

View File

@ -4,9 +4,9 @@
*
* This file is part of Observium.
*
* @package observium
* @subpackage discovery
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2020 Observium Limited
* @package observium
* @subpackage discovery
* @copyright (C) Adam Armstrong
*
*/
@ -18,116 +18,104 @@
// eqlMemberName.1.443914937 = hostname-1
// eqlMemberName.1.1664046123 = hostname-2
$eqlgrpmembers = snmpwalk_cache_oid($device, 'eqlMemberName', [], 'EQLMEMBER-MIB');
if (snmp_status())
{
$sysName = strtolower(snmp_cache_oid($device, 'sysName.0', 'SNMPv2-MIB'));
if (snmp_status()) {
$sysName = strtolower(snmp_cache_oid($device, 'sysName.0', 'SNMPv2-MIB'));
}
foreach ($eqlgrpmembers as $index => $entry)
{
// Find member id and name in results
if (!empty($entry['eqlMemberName']) && strtolower($entry['eqlMemberName']) == $sysName)
{
list(, $eqlgrpmemid) = explode('.', $index);
break;
}
foreach ($eqlgrpmembers as $index => $entry) {
// Find member id and name in results
if (!empty($entry['eqlMemberName']) && strtolower($entry['eqlMemberName']) == $sysName) {
[, $eqlgrpmemid] = explode('.', $index);
break;
}
}
if (!isset($eqlgrpmemid))
{
// Fall-back to old method.
$eqlgrpmemid = snmp_get_oid($device, 'eqliscsiLocalMemberId.0', 'EQLVOLUME-MIB');
if (!isset($eqlgrpmemid)) {
// Fall-back to old method.
$eqlgrpmemid = snmp_get_oid($device, 'eqliscsiLocalMemberId.0', 'EQLVOLUME-MIB');
}
if (is_numeric($eqlgrpmemid) && $eqlgrpmemid != $attribs['eqlgrpmemid'])
{
// Store member id when detected
set_dev_attrib($device, 'eqlgrpmemid', $eqlgrpmemid);
$attribs['eqlgrpmemid'] = $eqlgrpmemid;
print_debug("\neqlgrpmemid: $eqlgrpmemid");
if (is_numeric($eqlgrpmemid) && $eqlgrpmemid != $attribs['eqlgrpmemid']) {
// Store member id when detected
set_dev_attrib($device, 'eqlgrpmemid', $eqlgrpmemid);
$attribs['eqlgrpmemid'] = $eqlgrpmemid;
print_debug("\neqlgrpmemid: $eqlgrpmemid");
}
print_debug_vars($eqlgrpmemid, 1);
if (is_numeric($eqlgrpmemid))
{
$oids = snmpwalk_cache_oid($device, 'eqlMemberHealthDetailsFanTable', array(), 'EQLMEMBER-MIB');
if (is_numeric($eqlgrpmemid)) {
$oids = snmpwalk_cache_oid($device, 'eqlMemberHealthDetailsFanTable', [], 'EQLMEMBER-MIB');
// copy of eqlMemberHealthDetailsFanIndex
$sensorname = array(
'emm0fan0',
'emm0fan1',
'emm1fan0',
'emm1fan1',
'emm2fan0',
'emm2fan1',
'emm3fan0',
'emm3fan1'
);
$sensorid = array(1,2,3,4,5,6,7,8);
// copy of eqlMemberHealthDetailsFanIndex
$sensorname = [
'emm0fan0',
'emm0fan1',
'emm1fan0',
'emm1fan1',
'emm2fan0',
'emm2fan1',
'emm3fan0',
'emm3fan1'
];
$sensorid = [1, 2, 3, 4, 5, 6, 7, 8];
foreach ($oids as $index => $entry)
{
# EQLMEMBER-MIB returns sensors for all members. only process sensors that match our member id
if (strstr($index, $eqlgrpmemid))
{
$numindex = str_replace($sensorname, $sensorid, $index);
$entry['oid'] = ".1.3.6.1.4.1.12740.2.1.7.1.3.$numindex";
$limits = array('limit_high' => $entry['eqlMemberHealthDetailsFanHighCriticalThreshold'],
'limit_low' => $entry['eqlMemberHealthDetailsFanLowCriticalThreshold'],
'limit_high_warn' => $entry['eqlMemberHealthDetailsFanHighWarningThreshold'],
'limit_low_warn' => $entry['eqlMemberHealthDetailsFanLowWarningThreshold']);
if ($entry['eqlMemberHealthDetailsFanValue'] <> 0)
{
discover_sensor('fanspeed', $device, $entry['oid'], $numindex, 'equallogic',
$entry['eqlMemberHealthDetailsFanName'], 1, $entry['eqlMemberHealthDetailsFanValue'], $limits);
}
foreach ($oids as $index => $entry) {
# EQLMEMBER-MIB returns sensors for all members. only process sensors that match our member id
if (strstr($index, $eqlgrpmemid)) {
$numindex = str_replace($sensorname, $sensorid, $index);
$entry['oid'] = ".1.3.6.1.4.1.12740.2.1.7.1.3.$numindex";
$limits = ['limit_high' => $entry['eqlMemberHealthDetailsFanHighCriticalThreshold'],
'limit_low' => $entry['eqlMemberHealthDetailsFanLowCriticalThreshold'],
'limit_high_warn' => $entry['eqlMemberHealthDetailsFanHighWarningThreshold'],
'limit_low_warn' => $entry['eqlMemberHealthDetailsFanLowWarningThreshold']];
if ($entry['eqlMemberHealthDetailsFanValue'] <> 0) {
discover_sensor('fanspeed', $device, $entry['oid'], $numindex, 'equallogic',
$entry['eqlMemberHealthDetailsFanName'], 1, $entry['eqlMemberHealthDetailsFanValue'], $limits);
}
}
}
}
$oids = snmpwalk_cache_oid($device, 'eqlMemberHealthDetailsTemperatureTable', array(), 'EQLMEMBER-MIB');
$oids = snmpwalk_cache_oid($device, 'eqlMemberHealthDetailsTemperatureTable', [], 'EQLMEMBER-MIB');
// copy of eqlMemberHealthDetailsTempSensorIndex
$sensorname = array(
'integratedSystemTemperature',
'backplaneSensor0',
'backplaneSensor1',
'controlModule0processor',
'controlModule0chipset',
'controlModule1processor',
'controlModule1chipset',
'controlModule0sasController',
'controlModule0sasExpander',
'controlModule0sesEnclosure',
'controlModule1sasController',
'controlModule1sasExpander',
'controlModule1sesEnclosure',
'sesOpsPanel',
'cemi0',
'cemi1',
'controlModule0batteryThermistor',
'controlModule1batteryThermistor'
);
$sensorid = array(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18);
// copy of eqlMemberHealthDetailsTempSensorIndex
$sensorname = [
'integratedSystemTemperature',
'backplaneSensor0',
'backplaneSensor1',
'controlModule0processor',
'controlModule0chipset',
'controlModule1processor',
'controlModule1chipset',
'controlModule0sasController',
'controlModule0sasExpander',
'controlModule0sesEnclosure',
'controlModule1sasController',
'controlModule1sasExpander',
'controlModule1sesEnclosure',
'sesOpsPanel',
'cemi0',
'cemi1',
'controlModule0batteryThermistor',
'controlModule1batteryThermistor'
];
$sensorid = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18];
foreach ($oids as $index => $entry)
{
# EQLMEMBER-MIB returns sensors for all members. only process sensors that match our member id
if (strstr($index, $eqlgrpmemid))
{
$numindex = str_replace($sensorname, $sensorid, $index);
$entry['oid'] = ".1.3.6.1.4.1.12740.2.1.6.1.3.$numindex";
$limits = array('limit_high' => $entry['eqlMemberHealthDetailsTemperatureHighCriticalThreshold'],
'limit_low' => $entry['eqlMemberHealthDetailsTemperatureLowCriticalThreshold'],
'limit_high_warn' => $entry['eqlMemberHealthDetailsTemperatureHighWarningThreshold'],
'limit_low_warn' => $entry['eqlMemberHealthDetailsTemperatureLowWarningThreshold']);
if ($entry['eqlMemberHealthDetailsTemperatureValue'] <> 0)
{
discover_sensor('temperature', $device, $entry['oid'], $numindex, 'equallogic',
$entry['eqlMemberHealthDetailsTemperatureName'], 1, $entry['eqlMemberHealthDetailsTemperatureValue'], $limits);
}
foreach ($oids as $index => $entry) {
# EQLMEMBER-MIB returns sensors for all members. only process sensors that match our member id
if (strstr($index, $eqlgrpmemid)) {
$numindex = str_replace($sensorname, $sensorid, $index);
$entry['oid'] = ".1.3.6.1.4.1.12740.2.1.6.1.3.$numindex";
$limits = ['limit_high' => $entry['eqlMemberHealthDetailsTemperatureHighCriticalThreshold'],
'limit_low' => $entry['eqlMemberHealthDetailsTemperatureLowCriticalThreshold'],
'limit_high_warn' => $entry['eqlMemberHealthDetailsTemperatureHighWarningThreshold'],
'limit_low_warn' => $entry['eqlMemberHealthDetailsTemperatureLowWarningThreshold']];
if ($entry['eqlMemberHealthDetailsTemperatureValue'] <> 0) {
discover_sensor('temperature', $device, $entry['oid'], $numindex, 'equallogic',
$entry['eqlMemberHealthDetailsTemperatureName'], 1, $entry['eqlMemberHealthDetailsTemperatureValue'], $limits);
}
}
}
}
}
// EOF

View File

@ -5,9 +5,9 @@
*
* This file is part of Observium.
*
* @package observium
* @subpackage discovery
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2019 Observium Limited
* @package observium
* @subpackage discovery
* @copyright (C) Adam Armstrong
*
*/
@ -20,59 +20,57 @@
// pFirmwareID.1.0 = STRING: RTF0038
// pHardwareID.1.0 = STRING: RTH0050
$oids = snmpwalk_cache_twopart_oid($device, 'eMasterTable', array(), 'ES-RACKTIVITY-MIB');
$oids = snmpwalk_cache_twopart_oid($device, 'eMasterTable', [], 'ES-RACKTIVITY-MIB');
foreach ($oids as $modIndex => $module_entry)
{
foreach ($module_entry as $index => $entry)
{
$descr = $entry['mModuleName'];
foreach ($oids as $modIndex => $module_entry) {
foreach ($module_entry as $index => $entry) {
$descr = $entry['mModuleName'];
// mTemperature.1.0 = Gauge32: 310.2 K
// mMinTemperatureWarning.1.0 = Gauge32: 273.2 K
// mMaxTemperatureWarning.1.0 = Gauge32: 333.2 K
// mTemperature.1.0 = Gauge32: 310.2 K
// mMinTemperatureWarning.1.0 = Gauge32: 273.2 K
// mMaxTemperatureWarning.1.0 = Gauge32: 333.2 K
$value = $entry['mTemperature'];
$scale = 0.1;
$oid = ".1.3.6.1.4.1.34097.9.77.1.1.11.$modIndex.$index";
$value = $entry['mTemperature'];
$scale = 0.1;
$oid = ".1.3.6.1.4.1.34097.9.77.1.1.11.$modIndex.$index";
// FIXME, limits without scale?
$options = array('limit_high' => (isset($entry['mMaxTemperatureWarning']) ? $entry['mMaxTemperatureWarning'] : NULL),
'limit_low' => (isset($entry['mMinTemperatureWarning']) ? $entry['mMinTemperatureWarning'] : NULL),
'sensor_unit' => 'K',
);
// FIXME, limits without scale?
$options = ['limit_high' => (isset($entry['mMaxTemperatureWarning']) ? $entry['mMaxTemperatureWarning'] : NULL),
'limit_low' => (isset($entry['mMinTemperatureWarning']) ? $entry['mMinTemperatureWarning'] : NULL),
'sensor_unit' => 'K',
];
if ($value != 0)
{
discover_sensor('temperature', $device, $oid, "mTemperature.$modIndex.$index", 'es-racktivity-mib', $descr, $scale, $value / $scale, $options);
if ($value != 0) {
discover_sensor('temperature', $device, $oid, "mTemperature.$modIndex.$index", 'es-racktivity-mib', $descr, $scale, $value / $scale, $options);
}
}
}
}
$oids = snmpwalk_cache_twopart_oid($device, 'ePowerTable', array(), 'ES-RACKTIVITY-MIB');
$oids = snmpwalk_cache_twopart_oid($device, 'ePowerTable', [], 'ES-RACKTIVITY-MIB');
// mTemperature.1.0 = Gauge32: 310.2 K
// mMinTemperatureWarning.1.0 = Gauge32: 273.2 K
// mMaxTemperatureWarning.1.0 = Gauge32: 333.2 K
$value = $entry['mTemperature'];
$scale = 0.01;
$oid = ".1.3.6.1.4.1.34097.9.77.1.1.11.$modIndex.$index";
$value = $entry['mTemperature'];
$scale = 0.01;
$oid = ".1.3.6.1.4.1.34097.9.77.1.1.11.$modIndex.$index";
// FIXME, limits without scale?
$options = array('limit_high' => (isset($entry['mMaxTemperatureWarning']) ? $entry['mMaxTemperatureWarning'] : NULL),
'limit_low' => (isset($entry['mMinTemperatureWarning']) ? $entry['mMinTemperatureWarning'] : NULL),
'sensor_unit' => 'K',
);
$options = ['limit_high' => (isset($entry['mMaxTemperatureWarning']) ? $entry['mMaxTemperatureWarning'] : NULL),
'limit_low' => (isset($entry['mMinTemperatureWarning']) ? $entry['mMinTemperatureWarning'] : NULL),
'sensor_unit' => 'K',
];
if ($value != 0)
{
discover_sensor('temperature', $device, $oid, "mTemperature.$modIndex.$index", 'es-racktivity-mib', $descr, $scale, $value / $scale, $options);
if ($value != 0) {
discover_sensor('temperature', $device, $oid, "mTemperature.$modIndex.$index", 'es-racktivity-mib', $descr, $scale, $value / $scale, $options);
}
$oids = snmpwalk_cache_twopart_oid($device, 'ePowerTable', array(), 'ES-RACKTIVITY-MIB');
$oids = snmpwalk_cache_twopart_oid($device, 'ePowerTable', [], 'ES-RACKTIVITY-MIB');
if (OBS_DEBUG > 1) { print_vars($oids); }
if (OBS_DEBUG > 1) {
print_vars($oids);
}
// mGeneralModuleStatus.1.0 = Gauge32: 0
// mSpecificModuleStatus.1.0 = Gauge32: 255
@ -84,113 +82,105 @@ if (OBS_DEBUG > 1) { print_vars($oids); }
// FIXME - TODO
// 0 = Idle state; 1 = Disabled; 2 = Initialising; 3 = Initialising - No connection; 4 = Initialising - No key; 5 = Connection Ok; 6 = Connection Failed; 7 = Connection Failed - No key.
foreach ($oids as $modIndex => $module_entry)
{
foreach ($oids as $modIndex => $module_entry) {
foreach ($module_entry as $index => $entry)
{
// pExternalSensorLabel.1.0 = STRING: CurrentSensor1
$descr = $entry['pExternalSensorLabel'];
foreach ($module_entry as $index => $entry) {
// pExternalSensorLabel.1.0 = STRING: CurrentSensor1
$descr = $entry['pExternalSensorLabel'];
// pVoltage.1.0 = Gauge32: 231.04 V
// pMaxVoltageWarning.1.0 = Gauge32: 270.00 V
// pMinVoltageWarning.1.0 = Gauge32: 60.00 V
$value = $entry['pVoltage'];
$scale = 0.01;
$oid = ".1.3.6.1.4.1.34097.9.80.1.1.4.$modIndex.$index";
// pVoltage.1.0 = Gauge32: 231.04 V
// pMaxVoltageWarning.1.0 = Gauge32: 270.00 V
// pMinVoltageWarning.1.0 = Gauge32: 60.00 V
$value = $entry['pVoltage'];
$scale = 0.01;
$oid = ".1.3.6.1.4.1.34097.9.80.1.1.4.$modIndex.$index";
// FIXME, limits without scale?
$options = array('limit_high' => (isset($entry['pMaxVoltageWarning']) ? $entry['pMaxVoltageWarning'] : NULL),
'limit_low' => (isset($entry['pMinVoltageWarning']) ? $entry['pMinVoltageWarning'] : NULL),
);
// FIXME, limits without scale?
$options = ['limit_high' => (isset($entry['pMaxVoltageWarning']) ? $entry['pMaxVoltageWarning'] : NULL),
'limit_low' => (isset($entry['pMinVoltageWarning']) ? $entry['pMinVoltageWarning'] : NULL),
];
if ($value != 0)
{
discover_sensor('voltage', $device, $oid, "pVoltage.$modIndex.$index", 'es-racktivity-mib', $descr, $scale, $value / $scale, $options);
if ($value != 0) {
discover_sensor('voltage', $device, $oid, "pVoltage.$modIndex.$index", 'es-racktivity-mib', $descr, $scale, $value / $scale, $options);
}
// pTemperature.1.0 = Gauge32: 293.2 K
// pMinTemperatureWarning.1.0 = Gauge32: 273.2 K
// pMaxTemperatureWarning.1.0 = Gauge32: 333.2 K
$value = $entry['pTemperature'];
$scale = 0.1;
$oid = ".1.3.6.1.4.1.34097.9.80.1.1.11.$modIndex.$index";
// FIXME, limits without scale?
$options = ['limit_high' => (isset($entry['pMaxTemperatureWarning']) ? $entry['pMaxTemperatureWarning'] : NULL),
'limit_low' => (isset($entry['pMinTemperatureWarning']) ? $entry['pMinTemperatureWarning'] : NULL),
'sensor_unit' => 'K',
];
if ($value != 0) {
discover_sensor('temperature', $device, $oid, "pTemperature.$modIndex.$index", 'es-racktivity-mib', $descr, $scale, $value / $scale, $options);
}
// pBigCurrent.1.0 = Gauge32: 30370 A
// pMinBigCurrentWarning.1.0 = Gauge32: 0 A
// pMaxBigCurrentWarning.1.0 = Gauge32: 400000 A
$value = $entry['pBigCurrent'];
$scale = 0.0001;
$oid = ".1.3.6.1.4.1.34097.9.80.1.1.52.$modIndex.$index";
$options = ['limit_high' => (isset($entry['pMaxBigCurrentWarning']) ? $entry['pMaxBigCurrentWarning'] * $scale : NULL),
'limit_low' => (isset($entry['pMinBigCurrentWarning']) ? $entry['pMinBigCurrentWarning'] * $scale : NULL),
];
if ($value != 0) {
discover_sensor('current', $device, $oid, "pBigCurrent.$modIndex.$index", 'es-racktivity-mib', $descr, $scale, $value, $options);
}
// pBigPower.1.0 = Gauge32: 479.410 W
// pMaxBigPowerWarning.1.0 = Gauge32: 10000.000 W
$value = $entry['pBigPower'];
$scale = 0.001;
$oid = ".1.3.6.1.4.1.34097.9.80.1.1.53.$modIndex.$index";
// FIXME, limits without scale?
$options = ['limit_high' => (isset($entry['pMaxBigPowerWarning']) ? $entry['pMaxBigPowerWarning'] : NULL),
'limit_low' => (isset($entry['pMinBigPowerWarning']) ? $entry['pMinBigPowerWarning'] : NULL),
];
if ($value != 0) {
discover_sensor('power', $device, $oid, "pBigPower.$modIndex.$index", 'es-racktivity-mib', $descr, $scale, $value / $scale, $options);
}
// pActiveEnergy.1.0 = Gauge32: 181.180 kWh
// FUTUREME - Currently no kWh counters in Observium
// pApparentEnergy.1.0 = Gauge32: 748.406 kVAh
// FUTUREME - Currently no kVAh counters in Observium
// pFrequency.1.0 = Gauge32: 50.001 Hz
$value = $entry['pFrequency'];
$scale = 0.001;
$oid = ".1.3.6.1.4.1.34097.9.80.1.1.5.$modIndex.$index";
if ($value != 0) {
discover_sensor('frequency', $device, $oid, "pFrequency.$modIndex.$index", 'es-racktivity-mib', $descr, $scale, $value / $scale);
}
// pPowerFactor.1.0 = Gauge32: 68 %
// FUTUREME - Currently no power factor in Observium
// pTotalHarmonicDistortion.1.0 = Gauge32: 100.0 %
// FUTUREME - Currently no harmonic distortion in Observium
// pBigApparentPower.1.0 = Gauge32: 703.225 VA
$value = $entry['pBigApparentPower'];
$scale = 0.001;
$oid = ".1.3.6.1.4.1.34097.9.80.1.1.54.$modIndex.$index";
if ($value != 0) {
discover_sensor('apower', $device, $oid, "pBigApparentPower.$modIndex.$index", 'es-racktivity-mib', $descr, $scale, $value / $scale);
}
}
// pTemperature.1.0 = Gauge32: 293.2 K
// pMinTemperatureWarning.1.0 = Gauge32: 273.2 K
// pMaxTemperatureWarning.1.0 = Gauge32: 333.2 K
$value = $entry['pTemperature'];
$scale = 0.1;
$oid = ".1.3.6.1.4.1.34097.9.80.1.1.11.$modIndex.$index";
// FIXME, limits without scale?
$options = array('limit_high' => (isset($entry['pMaxTemperatureWarning']) ? $entry['pMaxTemperatureWarning'] : NULL),
'limit_low' => (isset($entry['pMinTemperatureWarning']) ? $entry['pMinTemperatureWarning'] : NULL),
'sensor_unit' => 'K',
);
if ($value != 0)
{
discover_sensor('temperature', $device, $oid, "pTemperature.$modIndex.$index", 'es-racktivity-mib', $descr, $scale, $value / $scale, $options);
}
// pBigCurrent.1.0 = Gauge32: 30370 A
// pMinBigCurrentWarning.1.0 = Gauge32: 0 A
// pMaxBigCurrentWarning.1.0 = Gauge32: 400000 A
$value = $entry['pBigCurrent'];
$scale = 0.0001;
$oid = ".1.3.6.1.4.1.34097.9.80.1.1.52.$modIndex.$index";
$options = array('limit_high' => (isset($entry['pMaxBigCurrentWarning']) ? $entry['pMaxBigCurrentWarning'] * $scale : NULL),
'limit_low' => (isset($entry['pMinBigCurrentWarning']) ? $entry['pMinBigCurrentWarning'] * $scale : NULL),
);
if ($value != 0)
{
discover_sensor('current', $device, $oid, "pBigCurrent.$modIndex.$index", 'es-racktivity-mib', $descr, $scale, $value, $options);
}
// pBigPower.1.0 = Gauge32: 479.410 W
// pMaxBigPowerWarning.1.0 = Gauge32: 10000.000 W
$value = $entry['pBigPower'];
$scale = 0.001;
$oid = ".1.3.6.1.4.1.34097.9.80.1.1.53.$modIndex.$index";
// FIXME, limits without scale?
$options = array('limit_high' => (isset($entry['pMaxBigPowerWarning']) ? $entry['pMaxBigPowerWarning'] : NULL),
'limit_low' => (isset($entry['pMinBigPowerWarning']) ? $entry['pMinBigPowerWarning'] : NULL),
);
if ($value != 0)
{
discover_sensor('power', $device, $oid, "pBigPower.$modIndex.$index", 'es-racktivity-mib', $descr, $scale, $value / $scale, $options);
}
// pActiveEnergy.1.0 = Gauge32: 181.180 kWh
// FUTUREME - Currently no kWh counters in Observium
// pApparentEnergy.1.0 = Gauge32: 748.406 kVAh
// FUTUREME - Currently no kVAh counters in Observium
// pFrequency.1.0 = Gauge32: 50.001 Hz
$value = $entry['pFrequency'];
$scale = 0.001;
$oid = ".1.3.6.1.4.1.34097.9.80.1.1.5.$modIndex.$index";
if ($value != 0)
{
discover_sensor('frequency', $device, $oid, "pFrequency.$modIndex.$index", 'es-racktivity-mib', $descr, $scale, $value / $scale);
}
// pPowerFactor.1.0 = Gauge32: 68 %
// FUTUREME - Currently no power factor in Observium
// pTotalHarmonicDistortion.1.0 = Gauge32: 100.0 %
// FUTUREME - Currently no harmonic distortion in Observium
// pBigApparentPower.1.0 = Gauge32: 703.225 VA
$value = $entry['pBigApparentPower'];
$scale = 0.001;
$oid = ".1.3.6.1.4.1.34097.9.80.1.1.54.$modIndex.$index";
if ($value != 0)
{
discover_sensor('apower', $device, $oid, "pBigApparentPower.$modIndex.$index", 'es-racktivity-mib', $descr, $scale, $value / $scale);
}
}
}
// EOF

View File

@ -5,9 +5,9 @@
*
* This file is part of Observium.
*
* @package observium
* @subpackage discovery
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2019 Observium Limited
* @package observium
* @subpackage discovery
* @copyright (C) Adam Armstrong
*
*/
@ -19,17 +19,15 @@
//ExaltComProducts::remTempAlarm.0 = INTEGER: almNORMAL(0)
//ExaltComProducts::remCurrentTemp.0 = INTEGER: 29 C
//ExaltComProducts::remCurrentTempS.0 = STRING: 29 dec C.
$discover['temp'] = snmp_get_multi_oid($device, 'locCurrentTemp.0 remCurrentTemp.0', array(), 'ExaltComProducts');
$discover['temp'] = snmp_get_multi_oid($device, 'locCurrentTemp.0 remCurrentTemp.0', [], 'ExaltComProducts');
if (is_numeric($discover['temp'][0]['locCurrentTemp']) && $discover['temp'][0]['locCurrentTemp'] > 0)
{
$oid = '.1.3.6.1.4.1.25651.1.2.4.2.3.1.3.0';
discover_sensor('temperature', $device, $oid, 'locCurrentTemp.0', 'exaltcomproducts', 'Temperature (Internal)', 1, $discover['temp'][0]['locCurrentTemp']);
if (is_numeric($discover['temp'][0]['locCurrentTemp']) && $discover['temp'][0]['locCurrentTemp'] > 0) {
$oid = '.1.3.6.1.4.1.25651.1.2.4.2.3.1.3.0';
discover_sensor('temperature', $device, $oid, 'locCurrentTemp.0', 'exaltcomproducts', 'Temperature (Internal)', 1, $discover['temp'][0]['locCurrentTemp']);
}
if (is_numeric($discover['temp'][0]['remCurrentTemp']) && $discover['temp'][0]['remCurrentTemp'] > 0)
{
$oid = '.1.3.6.1.4.1.25651.1.2.4.2.4.1.3.0';
discover_sensor('temperature', $device, $oid, 'remCurrentTemp.0', 'exaltcomproducts', 'Temperature (Far end radio)', 1, $discover['temp'][0]['remCurrentTemp']);
if (is_numeric($discover['temp'][0]['remCurrentTemp']) && $discover['temp'][0]['remCurrentTemp'] > 0) {
$oid = '.1.3.6.1.4.1.25651.1.2.4.2.4.1.3.0';
discover_sensor('temperature', $device, $oid, 'remCurrentTemp.0', 'exaltcomproducts', 'Temperature (Far end radio)', 1, $discover['temp'][0]['remCurrentTemp']);
}
//ExaltComProducts::locCurrentRSL.0 = INTEGER: -65 dBm
@ -44,21 +42,19 @@ if (is_numeric($discover['temp'][0]['remCurrentTemp']) && $discover['temp'][0]['
//ExaltComProducts::remMinRSLstr.0 = STRING: -82 (dBm).
//ExaltComProducts::remMaxRSL.0 = INTEGER: -62 dBm
//ExaltComProducts::remMaxRSLstr.0 = STRING: -62 (dBm). dBm
$discover['dbm'] = snmp_get_multi_oid($device, 'locCurrentRSL.0 locMinRSL.0 locMaxRSL.0 remCurrentRSL.0 remMinRSL.0 remMaxRSL.0', array(), 'ExaltComProducts');
$discover['dbm'] = snmp_get_multi_oid($device, 'locCurrentRSL.0 locMinRSL.0 locMaxRSL.0 remCurrentRSL.0 remMinRSL.0 remMaxRSL.0', [], 'ExaltComProducts');
if (is_numeric($discover['dbm'][0]['locCurrentRSL']))
{
$oid = '.1.3.6.1.4.1.25651.1.2.4.3.1.3.0';
$limits = array('limit_high' => $discover['dbm'][0]['locMaxRSL'],
'limit_low' => $discover['dbm'][0]['locMinRSL']);
discover_sensor('dbm', $device, $oid, 'locCurrentRSL.0', 'exaltcomproducts', 'Received Signal Level (Internal)', 1, $discover['dbm'][0]['locCurrentRSL'], $limits);
if (is_numeric($discover['dbm'][0]['locCurrentRSL'])) {
$oid = '.1.3.6.1.4.1.25651.1.2.4.3.1.3.0';
$limits = ['limit_high' => $discover['dbm'][0]['locMaxRSL'],
'limit_low' => $discover['dbm'][0]['locMinRSL']];
discover_sensor('dbm', $device, $oid, 'locCurrentRSL.0', 'exaltcomproducts', 'Received Signal Level (Internal)', 1, $discover['dbm'][0]['locCurrentRSL'], $limits);
}
if (is_numeric($discover['dbm'][0]['remCurrentRSL']))
{
$oid = '.1.3.6.1.4.1.25651.1.2.4.3.2.3.0';
$limits = array('limit_high' => $discover['dbm'][0]['remMaxRSL'],
'limit_low' => $discover['dbm'][0]['remMinRSL']);
discover_sensor('dbm', $device, $oid, 'remCurrentRSL.0', 'exaltcomproducts', 'Received Signal Level (Far end radio)', 1, $discover['dbm'][0]['remCurrentRSL'], $limits);
if (is_numeric($discover['dbm'][0]['remCurrentRSL'])) {
$oid = '.1.3.6.1.4.1.25651.1.2.4.3.2.3.0';
$limits = ['limit_high' => $discover['dbm'][0]['remMaxRSL'],
'limit_low' => $discover['dbm'][0]['remMinRSL']];
discover_sensor('dbm', $device, $oid, 'remCurrentRSL.0', 'exaltcomproducts', 'Received Signal Level (Far end radio)', 1, $discover['dbm'][0]['remCurrentRSL'], $limits);
}
//ExaltComProducts::locLinkState.0 = INTEGER: almNORMAL(0)
@ -71,35 +67,31 @@ if (is_numeric($discover['dbm'][0]['remCurrentRSL']))
//ExaltComProducts::remErrorDurationStr.0 = STRING: 3 seconds.
//ExaltComProducts::remUnavailDuration.0 = INTEGER: 0 Seconds
//ExaltComProducts::remUnavailDurationStr.0 = STRING: 0 seconds.
$discover['state'] = snmp_get_multi_oid($device, 'locLinkState.0 locErrorDuration.0 locUnavailDuration.0 remLinkState.0 remErrorDuration.0 remUnavailDuration.0', array(), 'ExaltComProducts');
$discover['state'] = snmp_get_multi_oid($device, 'locLinkState.0 locErrorDuration.0 locUnavailDuration.0 remLinkState.0 remErrorDuration.0 remUnavailDuration.0', [], 'ExaltComProducts');
$sensor_state_type = 'exaltcomproducts-state';
$options = array('entPhysicalClass' => 'linkstate');
if (!empty($discover['state'][0]['locLinkState']))
{
$oid = '.1.3.6.1.4.1.25651.1.2.4.2.3.1.1.0';
$value = $discover['state'][0]['locLinkState'];
discover_status($device, $oid, 'locLinkState.0', $sensor_state_type, 'Link Status (Internal)', $value, $options);
$options = ['entPhysicalClass' => 'linkstate'];
if (!empty($discover['state'][0]['locLinkState'])) {
$oid = '.1.3.6.1.4.1.25651.1.2.4.2.3.1.1.0';
$value = $discover['state'][0]['locLinkState'];
discover_status($device, $oid, 'locLinkState.0', $sensor_state_type, 'Link Status (Internal)', $value, $options);
}
if (!empty($discover['state'][0]['remLinkState']))
{
$oid = '.1.3.6.1.4.1.25651.1.2.4.2.4.1.1.0';
$value = $discover['state'][0]['remLinkState'];
discover_status($device, $oid, 'remLinkState.0', $sensor_state_type, 'Link Status (Far end radio)', $value, $options);
if (!empty($discover['state'][0]['remLinkState'])) {
$oid = '.1.3.6.1.4.1.25651.1.2.4.2.4.1.1.0';
$value = $discover['state'][0]['remLinkState'];
discover_status($device, $oid, 'remLinkState.0', $sensor_state_type, 'Link Status (Far end radio)', $value, $options);
}
if (is_numeric($discover['state'][0]['locErrorDuration']) && is_numeric($discover['state'][0]['locUnavailDuration']))
{
$oid = '.1.3.6.1.4.1.25651.1.2.4.3.1.5.0';
discover_status($device, $oid, 'locErrorDuration.0', 'exaltcomproducts', 'Errored Seconds (Internal)', $discover['state'][0]['locErrorDuration']);
$oid = '.1.3.6.1.4.1.25651.1.2.4.3.1.7.0';
discover_status($device, $oid, 'locUnavailDuration.0', 'exaltcomproducts', 'Unavailable Seconds (Internal)', $discover['state'][0]['locUnavailDuration']);
if (is_numeric($discover['state'][0]['locErrorDuration']) && is_numeric($discover['state'][0]['locUnavailDuration'])) {
$oid = '.1.3.6.1.4.1.25651.1.2.4.3.1.5.0';
discover_status($device, $oid, 'locErrorDuration.0', 'exaltcomproducts', 'Errored Seconds (Internal)', $discover['state'][0]['locErrorDuration']);
$oid = '.1.3.6.1.4.1.25651.1.2.4.3.1.7.0';
discover_status($device, $oid, 'locUnavailDuration.0', 'exaltcomproducts', 'Unavailable Seconds (Internal)', $discover['state'][0]['locUnavailDuration']);
}
if (is_numeric($discover['state'][0]['remErrorDuration']) && is_numeric($discover['state'][0]['remUnavailDuration']))
{
$oid = '.1.3.6.1.4.1.25651.1.2.4.3.2.5.0';
discover_status($device, $oid, 'remErrorDuration.0', 'exaltcomproducts', 'Errored Seconds (Far end radio)', $discover['state'][0]['remErrorDuration']);
$oid = '.1.3.6.1.4.1.25651.1.2.4.3.2.7.0';
discover_status($device, $oid, 'remUnavailDuration.0', 'exaltcomproducts', 'Unavailable Seconds (Far end radio)', $discover['state'][0]['remUnavailDuration']);
if (is_numeric($discover['state'][0]['remErrorDuration']) && is_numeric($discover['state'][0]['remUnavailDuration'])) {
$oid = '.1.3.6.1.4.1.25651.1.2.4.3.2.5.0';
discover_status($device, $oid, 'remErrorDuration.0', 'exaltcomproducts', 'Errored Seconds (Far end radio)', $discover['state'][0]['remErrorDuration']);
$oid = '.1.3.6.1.4.1.25651.1.2.4.3.2.7.0';
discover_status($device, $oid, 'remUnavailDuration.0', 'exaltcomproducts', 'Unavailable Seconds (Far end radio)', $discover['state'][0]['remUnavailDuration']);
}
unset($discover, $oid, $value, $sensor_state_type);

View File

@ -1,5 +1,4 @@
<?php
/**
* Observium
*
@ -7,15 +6,14 @@
*
* @package observium
* @subpackage discovery
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2019 Observium Limited
* @copyright (C) Adam Armstrong
*
*/
if (!isset($GLOBALS['cache']['entity-mib']))
{
$entity_array = snmpwalk_cache_oid($device, 'entPhysicalDescr', array(), 'ENTITY-MIB');
if (!isset($GLOBALS['cache']['entity-mib'])) {
$entity_array = snmpwalk_cache_oid($device, 'entPhysicalDescr', [], 'ENTITY-MIB');
} else {
$entity_array = $GLOBALS['cache']['entity-mib'];
$entity_array = $GLOBALS['cache']['entity-mib'];
}
//EXTREME-SYSTEM-MIB::extremeFanNumber.101 = INTEGER: 101
@ -27,32 +25,29 @@ if (!isset($GLOBALS['cache']['entity-mib']))
//EXTREME-SYSTEM-MIB::extremeFanSpeed.101 = INTEGER: 3233
//EXTREME-SYSTEM-MIB::extremeFanSpeed.302 = INTEGER: 7021
$oids['FanStatus'] = snmpwalk_cache_oid($device, 'extremeFanStatusTable', array(), $mib);
$oids['FanStatus'] = snmpwalk_cache_oid($device, 'extremeFanStatusTable', [], $mib);
//print_vars($oids);
foreach ($oids['FanStatus'] as $index => $entry)
{
if (empty($entity_array[$entry['extremeFanEntPhysicalIndex']]['entPhysicalDescr']))
{
$descr = 'Fan ' . $index;
} else {
$descr = $entity_array[$entry['extremeFanEntPhysicalIndex']]['entPhysicalDescr'];
}
foreach ($oids['FanStatus'] as $index => $entry) {
if (empty($entity_array[$entry['extremeFanEntPhysicalIndex']]['entPhysicalDescr'])) {
$descr = 'Fan ' . $index;
} else {
$descr = $entity_array[$entry['extremeFanEntPhysicalIndex']]['entPhysicalDescr'];
}
$oid_name = 'extremeFanSpeed';
$oid_num = ".1.3.6.1.4.1.1916.1.1.1.9.1.4.$index";
$type = $mib . '-' . $oid_name;
$value = $entry[$oid_name];
$options = array('entPhysicalIndex' => $entry['extremeFanEntPhysicalIndex']);
$oid_name = 'extremeFanSpeed';
$oid_num = ".1.3.6.1.4.1.1916.1.1.1.9.1.4.$index";
$value = $entry[$oid_name];
$options = [ 'entPhysicalIndex' => $entry['extremeFanEntPhysicalIndex'] ];
discover_sensor_ng($device,'fanspeed', $mib, $oid_name, $oid_num, $index, NULL, $descr, 1, $value, $options);
discover_sensor_ng($device, 'fanspeed', $mib, $oid_name, $oid_num, $index, $descr, 1, $value, $options);
// Fan Status
$oid_name = 'extremeFanOperational';
$oid_num = '.1.3.6.1.4.1.1916.1.1.1.9.1.2.'.$index;
$value = $entry[$oid_name];
// Fan Status
$oid_name = 'extremeFanOperational';
$oid_num = '.1.3.6.1.4.1.1916.1.1.1.9.1.2.' . $index;
$value = $entry[$oid_name];
discover_status($device, $oid_num, $oid_name.'.'.$index, 'extremeTruthValue', $descr, $value, array_merge($options, array('entPhysicalClass' => 'fan')));
discover_status($device, $oid_num, $oid_name . '.' . $index, 'extremeTruthValue', $descr, $value, array_merge($options, ['entPhysicalClass' => 'fan']));
}
@ -79,42 +74,37 @@ foreach ($oids['FanStatus'] as $index => $entry)
//EXTREME-SYSTEM-MIB::extremePowerSupplyInputPowerUsageUnitMultiplier.1 = INTEGER: milli(-3)
//EXTREME-SYSTEM-MIB::extremePowerSupplyInputPowerUsageUnitMultiplier.2 = INTEGER: milli(-3)
$oids['PowerSupply'] = snmpwalk_cache_oid($device, 'extremePowerSupplyTable', array(), $mib);
$oids['PowerSupply'] = snmpwalk_cache_oid($device, 'extremePowerSupplyTable', [], $mib);
//print_vars($oids);
foreach ($oids['PowerSupply'] as $index => &$entry)
{
if (empty($entity_array[$entry['extremePowerSupplyEntPhysicalIndex']]['entPhysicalDescr']))
{
$name = "Power Supply $index";
} else {
$name = $entity_array[$entry['extremePowerSupplyEntPhysicalIndex']]['entPhysicalDescr'];
if (!preg_match('/[0-9]/', $name))
{
// Append index if name not contain any number for identification
$name .= " $index";
foreach ($oids['PowerSupply'] as $index => &$entry) {
if (empty($entity_array[$entry['extremePowerSupplyEntPhysicalIndex']]['entPhysicalDescr'])) {
$name = "Power Supply $index";
} else {
$name = $entity_array[$entry['extremePowerSupplyEntPhysicalIndex']]['entPhysicalDescr'];
if (!preg_match('/[0-9]/', $name)) {
// Append index if name not contain any number for identification
$name .= " $index";
}
}
}
$entry['name'] = $name;
$options = array('entPhysicalIndex' => $entry['extremePowerSupplyEntPhysicalIndex']);
$entry['name'] = $name;
$options = ['entPhysicalIndex' => $entry['extremePowerSupplyEntPhysicalIndex']];
// Power Status
$descr = $name;
$oid_name = 'extremePowerSupplyStatus';
$oid_num = '.1.3.6.1.4.1.1916.1.1.1.27.1.2.'.$index;
$value = $entry[$oid_name];
// Power Status
$descr = $name;
$oid_name = 'extremePowerSupplyStatus';
$oid_num = '.1.3.6.1.4.1.1916.1.1.1.27.1.2.' . $index;
$value = $entry[$oid_name];
discover_status($device, $oid_num, $oid_name.'.'.$index, 'extremePowerSupplyStatus', $descr, $value, array_merge($options, array('entPhysicalClass' => 'powersupply')));
discover_status($device, $oid_num, $oid_name . '.' . $index, 'extremePowerSupplyStatus', $descr, $value, array_merge($options, ['entPhysicalClass' => 'powersupply']));
$oid_name = 'extremePowerSupplyInputPowerUsage';
$value = $entry[$oid_name];
if ($value > 0)
{
$oid_num = ".1.3.6.1.4.1.1916.1.1.1.27.1.9.$index";
$type = $mib . '-' . $oid_name;
$oid_name = 'extremePowerSupplyInputPowerUsage';
$value = $entry[$oid_name];
if ($value > 0) {
$oid_num = ".1.3.6.1.4.1.1916.1.1.1.27.1.9.$index";
discover_sensor_ng($device,'power', $mib, $oid_name, $oid_num, $index, NULL, $descr, si_to_scale($entry['extremePowerSupplyInputPowerUsageUnitMultiplier']), $value, $options);
}
discover_sensor_ng($device, 'power', $mib, $oid_name, $oid_num, $index, $descr, si_to_scale($entry['extremePowerSupplyInputPowerUsageUnitMultiplier']), $value, $options);
}
}
//EXTREME-SYSTEM-MIB::extremePowerSupplyIndex.1.1 = INTEGER: 1
@ -128,51 +118,44 @@ foreach ($oids['PowerSupply'] as $index => &$entry)
//EXTREME-SYSTEM-MIB::extremePowerSupplyOutputUnitMultiplier.1.1 = INTEGER: milli(-3)
//EXTREME-SYSTEM-MIB::extremePowerSupplyOutputUnitMultiplier.2.1 = INTEGER: milli(-3)
$oids['PowerSupplyOutput'] = snmpwalk_cache_twopart_oid($device, 'extremePowerSupplyOutputPowerTable', array(), $mib);
$oids['PowerSupplyOutput'] = snmpwalk_cache_twopart_oid($device, 'extremePowerSupplyOutputPowerTable', [], $mib);
//print_vars($oids);
foreach ($oids['PowerSupplyOutput'] as $extremePowerSupplyIndex => $entry1)
{
$supply_count = count($entry1);
$supply = $oids['PowerSupply'][$extremePowerSupplyIndex];
foreach ($entry1 as $extremePowerSupplyOutputSensorIdx => $entry)
{
$index = $extremePowerSupplyIndex . '.' . $extremePowerSupplyOutputSensorIdx;
$descr = $supply['name'] . ' Output';
if ($supply_count > 1)
{
$descr .= ' ' . $extremePowerSupplyOutputSensorIdx;
foreach ($oids['PowerSupplyOutput'] as $extremePowerSupplyIndex => $entry1) {
$supply_count = count($entry1);
$supply = $oids['PowerSupply'][$extremePowerSupplyIndex];
foreach ($entry1 as $extremePowerSupplyOutputSensorIdx => $entry) {
$index = $extremePowerSupplyIndex . '.' . $extremePowerSupplyOutputSensorIdx;
$descr = $supply['name'] . ' Output';
if ($supply_count > 1) {
$descr .= ' ' . $extremePowerSupplyOutputSensorIdx;
}
$options = ['entPhysicalIndex' => $supply['extremePowerSupplyEntPhysicalIndex']];
$scale = si_to_scale($entry['extremePowerSupplyOutputUnitMultiplier']);
$oid_name = 'extremePowerSupplyOutputVoltage';
$value = $entry[$oid_name];
if ($value > 0) {
$oid_num = ".1.3.6.1.4.1.1916.1.1.1.38.1.3.$index";
discover_sensor_ng($device, 'voltage', $mib, $oid_name, $oid_num, $index, $descr, $scale, $value, $options);
}
$oid_name = 'extremePowerSupplyOutputCurrent';
$value = $entry[$oid_name];
if ($value > 0) {
$oid_num = ".1.3.6.1.4.1.1916.1.1.1.38.1.4.$index";
discover_sensor_ng($device, 'current', $mib, $oid_name, $oid_num, $index, $descr, $scale, $value, $options);
}
}
$options = array('entPhysicalIndex' => $supply['extremePowerSupplyEntPhysicalIndex']);
$scale = si_to_scale($entry['extremePowerSupplyOutputUnitMultiplier']);
$oid_name = 'extremePowerSupplyOutputVoltage';
$value = $entry[$oid_name];
if ($value > 0)
{
$oid_num = ".1.3.6.1.4.1.1916.1.1.1.38.1.3.$index";
$type = $mib . '-' . $oid_name;
discover_sensor_ng($device,'voltage', $mib, $oid_name, $oid_num, $index, NULL, $descr, $scale, $value, $options);
}
$oid_name = 'extremePowerSupplyOutputCurrent';
$value = $entry[$oid_name];
if ($value > 0)
{
$oid_num = ".1.3.6.1.4.1.1916.1.1.1.38.1.4.$index";
$type = $mib . '-' . $oid_name;
discover_sensor_ng($device,'current', $mib, $oid_name, $oid_num, $index, NULL, $descr, $scale, $value, $options);
}
}
}
// FIXME, actual only for stacked devices, or it same as power supply power usage
//EXTREME-SYSTEM-MIB::extremeSystemPowerUsageValue.0 = INTEGER: 74800
//EXTREME-SYSTEM-MIB::extremeSystemPowerUsageUnitMultiplier.0 = INTEGER: milli(-3)
$oids['SystemPowerUsage'] = snmp_get_multi_oid($device, 'extremeSystemPowerUsageValue.0 extremeSystemPowerUsageUnitMultiplier.0', array(), $mib);
$oids['SystemPowerUsage'] = snmp_get_multi_oid($device, 'extremeSystemPowerUsageValue.0 extremeSystemPowerUsageUnitMultiplier.0', [], $mib);
//print_vars($oids);
$index = 0;
@ -182,12 +165,10 @@ $scale = si_to_scale($entry['extremeSystemPowerUsageUnitMultiplier']);
$oid_name = 'extremeSystemPowerUsageValue';
$value = $entry[$oid_name];
if ($value > 0)
{
$oid_num = ".1.3.6.1.4.1.1916.1.1.1.40.1.$index";
$type = $mib . '-' . $oid_name;
if ($value > 0) {
$oid_num = ".1.3.6.1.4.1.1916.1.1.1.40.1.$index";
discover_sensor_ng($device,'power', $mib, $oid_name, $oid_num, $index, NULL, $descr, $scale, $value);
discover_sensor_ng($device, 'power', $mib, $oid_name, $oid_num, $index, $descr, $scale, $value);
}
unset($oids);

View File

@ -4,9 +4,9 @@
*
* This file is part of Observium.
*
* @package observium
* @subpackage discovery
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2021 Observium Limited
* @package observium
* @subpackage discovery
* @copyright (C) Adam Armstrong
*
*/
@ -17,57 +17,53 @@
echo(" F10-S-SERIES-CHASSIS-MIB ");
$units = array();
$units = [];
$oids = snmpwalk_cache_oid($device, "chStackUnitStatus", $oids, "F10-S-SERIES-CHASSIS-MIB");
$oids = snmpwalk_cache_oid($device, "chStackUnitStatus", $oids, "F10-S-SERIES-CHASSIS-MIB");
//$oids = snmpwalk_cache_oid($device, "chStackUnitRowStatus", $oids, "F10-S-SERIES-CHASSIS-MIB"); // Ignore this Row, in some cases it return incorrect data
foreach ($oids as $index => $entry)
{
if (strlen($entry['chStackUnitRowStatus']) && $entry['chStackUnitRowStatus'] != 'active')
{
// Skip inactive Units
continue;
}
foreach ($oids as $index => $entry) {
if (strlen($entry['chStackUnitRowStatus']) && $entry['chStackUnitRowStatus'] != 'active') {
// Skip inactive Units
continue;
}
$descr = "Unit " . strval($index - 1);
$units[$index] = $descr; // Store Unit name for other sensors
$descr = "Unit " . strval($index - 1);
$units[$index] = $descr; // Store Unit name for other sensors
$oid_name = 'chStackUnitStatus';
$oid_num = '.1.3.6.1.4.1.6027.3.10.1.2.2.1.8.'.$index;
$type = 'chStackUnitStatus';
$value = $entry[$oid_name];
$oid_name = 'chStackUnitStatus';
$oid_num = '.1.3.6.1.4.1.6027.3.10.1.2.2.1.8.' . $index;
$type = 'chStackUnitStatus';
$value = $entry[$oid_name];
discover_status($device, $oid_num, $oid_name.'.'.$index, $type, $descr . ' Status', $value, array('entPhysicalClass' => 'device'));
discover_status($device, $oid_num, $oid_name . '.' . $index, $type, $descr . ' Status', $value, ['entPhysicalClass' => 'device']);
}
$oids = snmpwalk_cache_oid($device, "chSysFanTrayOperStatus", array(), "F10-S-SERIES-CHASSIS-MIB");
$oids = snmpwalk_cache_oid($device, "chSysFanTrayOperStatus", [], "F10-S-SERIES-CHASSIS-MIB");
$oids = snmpwalk_cache_oid($device, "chSysPowerSupplyOperStatus", $oids, "F10-S-SERIES-CHASSIS-MIB");
foreach ($oids as $index => $entry)
{
list($unit, $tray) = explode('.', $index);
if (!isset($units[$unit]))
{
// Skip inactive Units
continue;
}
foreach ($oids as $index => $entry) {
[$unit, $tray] = explode('.', $index);
if (!isset($units[$unit])) {
// Skip inactive Units
continue;
}
$descr = $units[$unit];
$descr = $units[$unit];
$oid_name = 'chSysFanTrayOperStatus';
$oid_num = '.1.3.6.1.4.1.6027.3.10.1.2.4.1.2.'.$index;
$type = 'chSysOperStatus';
$value = $entry[$oid_name];
$oid_name = 'chSysFanTrayOperStatus';
$oid_num = '.1.3.6.1.4.1.6027.3.10.1.2.4.1.2.' . $index;
$type = 'chSysOperStatus';
$value = $entry[$oid_name];
discover_status($device, $oid_num, $oid_name.'.'.$index, $type, $descr . ' Fan '. $tray, $value, array('entPhysicalClass' => 'fan'));
discover_status($device, $oid_num, $oid_name . '.' . $index, $type, $descr . ' Fan ' . $tray, $value, ['entPhysicalClass' => 'fan']);
$oid_name = 'chSysPowerSupplyOperStatus';
$oid_num = '.1.3.6.1.4.1.6027.3.10.1.2.3.1.2.'.$index;
$type = 'chSysOperStatus';
$value = $entry[$oid_name];
$oid_name = 'chSysPowerSupplyOperStatus';
$oid_num = '.1.3.6.1.4.1.6027.3.10.1.2.3.1.2.' . $index;
$type = 'chSysOperStatus';
$value = $entry[$oid_name];
discover_status($device, $oid_num, $oid_name.'.'.$index, $type, $descr . ' PowerSupply '. $tray, $value, array('entPhysicalClass' => 'powersupply'));
discover_status($device, $oid_num, $oid_name . '.' . $index, $type, $descr . ' PowerSupply ' . $tray, $value, ['entPhysicalClass' => 'powersupply']);
}
// DOM sensors
@ -89,56 +85,53 @@ foreach ($oids as $index => $entry)
//F10-S-SERIES-CHASSIS-MIB::chSysPortXfpTxPower.1.2 = INTEGER: -5.36 dB
//F10-S-SERIES-CHASSIS-MIB::chSysPortXfpTxPower.13.1 = INTEGER: .00 dB
$oids = snmpwalk_cache_oid($device, "chSysPortIfIndex", array(), "F10-S-SERIES-CHASSIS-MIB");
if (safe_count($oids))
{
$oids = snmpwalk_cache_oid($device, "chSysPortXfpRecvPower", $oids, "F10-S-SERIES-CHASSIS-MIB");
$oids = snmpwalk_cache_oid($device, "chSysPortXfpTxPower", $oids, "F10-S-SERIES-CHASSIS-MIB");
$oids = snmpwalk_cache_oid($device, "chSysPortXfpRecvTemp", $oids, "F10-S-SERIES-CHASSIS-MIB");
if (OBS_DEBUG > 1) { print_vars($oids); }
foreach ($oids as $index => $entry)
{
if (($entry['chSysPortXfpRecvPower'] === '655.35' && $entry['chSysPortXfpTxPower'] === '655.35' && $entry['chSysPortXfpRecvTemp'] === '65535') ||
($entry['chSysPortXfpRecvPower'] === '.00' && $entry['chSysPortXfpTxPower'] === '.00' && $entry['chSysPortXfpRecvTemp'] === '0') ||
($entry['chSysPortXfpRecvPower'] === '.00' && !is_numeric($entry['chSysPortXfpTxPower']) && !is_numeric($entry['chSysPortXfpRecvTemp']))) // Fix for old S25/S50 series
{
continue;
}
list(, $entPhysicalIndex) = explode('.', $index);
$port = get_port_by_index_cache($device['device_id'], $entry['chSysPortIfIndex']);
$options = array('entPhysicalIndex' => $entPhysicalIndex,
'measured_class' => 'port',
'measured_entity' => $port['port_id']);
if (is_numeric($entry['chSysPortXfpRecvPower']))
{
$oid = ".1.3.6.1.4.1.6027.3.10.1.2.5.1.6.".$index;
$descr = $port['ifDescr'] . " RX Power";
$value = $entry['chSysPortXfpRecvPower'] * 100;
discover_sensor('dbm', $device, $oid, $index, 'f10-s-series-dom-rx', $descr, 0.01, $value, $options);
$oids = snmpwalk_cache_oid($device, "chSysPortIfIndex", [], "F10-S-SERIES-CHASSIS-MIB");
if (safe_count($oids)) {
$oids = snmpwalk_cache_oid($device, "chSysPortXfpRecvPower", $oids, "F10-S-SERIES-CHASSIS-MIB");
$oids = snmpwalk_cache_oid($device, "chSysPortXfpTxPower", $oids, "F10-S-SERIES-CHASSIS-MIB");
$oids = snmpwalk_cache_oid($device, "chSysPortXfpRecvTemp", $oids, "F10-S-SERIES-CHASSIS-MIB");
if (OBS_DEBUG > 1) {
print_vars($oids);
}
if (is_numeric($entry['chSysPortXfpTxPower']))
{
$oid = ".1.3.6.1.4.1.6027.3.10.1.2.5.1.8.".$index;
$descr = $port['ifDescr'] . " TX Power";
$value = $entry['chSysPortXfpTxPower'] * 100;
foreach ($oids as $index => $entry) {
if (($entry['chSysPortXfpRecvPower'] === '655.35' && $entry['chSysPortXfpTxPower'] === '655.35' && $entry['chSysPortXfpRecvTemp'] === '65535') ||
($entry['chSysPortXfpRecvPower'] === '.00' && $entry['chSysPortXfpTxPower'] === '.00' && $entry['chSysPortXfpRecvTemp'] === '0') ||
($entry['chSysPortXfpRecvPower'] === '.00' && !is_numeric($entry['chSysPortXfpTxPower']) && !is_numeric($entry['chSysPortXfpRecvTemp']))) // Fix for old S25/S50 series
{
continue;
}
[, $entPhysicalIndex] = explode('.', $index);
discover_sensor('dbm', $device, $oid, $index, 'f10-s-series-dom-tx', $descr, 0.01, $value, $options);
$port = get_port_by_index_cache($device['device_id'], $entry['chSysPortIfIndex']);
$options = ['entPhysicalIndex' => $entPhysicalIndex,
'measured_class' => 'port',
'measured_entity' => $port['port_id']];
if (is_numeric($entry['chSysPortXfpRecvPower'])) {
$oid = ".1.3.6.1.4.1.6027.3.10.1.2.5.1.6." . $index;
$descr = $port['ifDescr'] . " RX Power";
$value = $entry['chSysPortXfpRecvPower'] * 100;
discover_sensor('dbm', $device, $oid, $index, 'f10-s-series-dom-rx', $descr, 0.01, $value, $options);
}
if (is_numeric($entry['chSysPortXfpTxPower'])) {
$oid = ".1.3.6.1.4.1.6027.3.10.1.2.5.1.8." . $index;
$descr = $port['ifDescr'] . " TX Power";
$value = $entry['chSysPortXfpTxPower'] * 100;
discover_sensor('dbm', $device, $oid, $index, 'f10-s-series-dom-tx', $descr, 0.01, $value, $options);
}
if (is_numeric($entry['chSysPortXfpRecvTemp'])) {
$oid = ".1.3.6.1.4.1.6027.3.10.1.2.5.1.7." . $index;
$descr = $port['ifDescr'] . " DOM";
$value = $entry['chSysPortXfpRecvTemp'];
discover_sensor('temperature', $device, $oid, $index, 'f10-s-series-dom', $descr, 1, $value, $options);
}
}
if (is_numeric($entry['chSysPortXfpRecvTemp']))
{
$oid = ".1.3.6.1.4.1.6027.3.10.1.2.5.1.7.".$index;
$descr = $port['ifDescr'] . " DOM";
$value = $entry['chSysPortXfpRecvTemp'];
discover_sensor('temperature', $device, $oid, $index, 'f10-s-series-dom', $descr, 1, $value, $options);
}
}
}
// EOF

View File

@ -6,7 +6,7 @@
*
* @package observium
* @subpackage discovery
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2021 Observium Limited
* @copyright (C) Adam Armstrong
*
*/
@ -23,80 +23,72 @@
$flags = OBS_SNMP_ALL_NUMERIC_INDEX;
$oids = snmpwalk_cache_oid($device, 'swSfpStatTable', array(), 'FA-EXT-MIB', NULL, $flags);
$oids = snmpwalk_cache_oid($device, 'swSfpStatTable', [], 'FA-EXT-MIB', NULL, $flags);
if (!safe_count($oids)) {
return;
return;
}
$oids = snmpwalk_cache_oid($device, 'connUnitPortIndex', $oids, 'FCMGMT-MIB', NULL, $flags);
//$oids = snmpwalk_cache_oid($device, 'connUnitPortName', $oids, 'FCMGMT-MIB', NULL, $flags);
$oids = snmpwalk_cache_oid($device, 'connUnitPortIndex', $oids, 'FCMGMT-MIB', NULL, $flags);
//$oids = snmpwalk_cache_oid($device, 'connUnitPortName', $oids, 'FCMGMT-MIB', NULL, $flags);
$port_sw = snmpwalk_cache_oid($device, 'swFCPortSpecifier', array(), 'SW-MIB');
$port_sw = snmpwalk_cache_oid($device, 'swFCPortSpecifier', [], 'SW-MIB');
//print_vars($oids);
foreach ($oids as $index => $entry)
{
if (isset($port_sw[$entry['connUnitPortIndex']])) {
$entry = array_merge($entry, $port_sw[$entry['connUnitPortIndex']]);
}
$port_fc = $entry['swFCPortSpecifier'];
foreach ($oids as $index => $entry) {
if (isset($port_sw[$entry['connUnitPortIndex']])) {
$entry = array_merge($entry, $port_sw[$entry['connUnitPortIndex']]);
}
$port_fc = $entry['swFCPortSpecifier'];
$port = dbFetchRow('SELECT * FROM `ports` WHERE `device_id` = ? AND (`ifName` = ? OR `ifDescr` REGEXP ?)', array($device['device_id'], $port_fc, '^FC[[:alnum:]]* port '.$port_fc.'$'));
if (!$port && is_numeric($port_fc))
{
// non-bladed
$port_fc = '0/' . $port_fc;
$port = dbFetchRow('SELECT * FROM `ports` WHERE `device_id` = ? AND (`ifName` = ? OR `ifDescr` REGEXP ?)', array($device['device_id'], $port_fc, '^FC[[:alnum:]]* port '.$port_fc.'$'));
}
$port = dbFetchRow('SELECT * FROM `ports` WHERE `device_id` = ? AND (`ifName` = ? OR `ifDescr` REGEXP ?)', [$device['device_id'], $port_fc, '^FC[[:alnum:]]* port ' . $port_fc . '$']);
if (!$port && is_numeric($port_fc)) {
// non-bladed
$port_fc = '0/' . $port_fc;
$port = dbFetchRow('SELECT * FROM `ports` WHERE `device_id` = ? AND (`ifName` = ? OR `ifDescr` REGEXP ?)', [$device['device_id'], $port_fc, '^FC[[:alnum:]]* port ' . $port_fc . '$']);
}
$options = array('entPhysicalIndex' => $entry['connUnitPortIndex']);
if ($port)
{
$name = $port['ifDescr'];
$options['measured_class'] = 'port';
$options['measured_entity'] = $port['port_id'];
} else {
$name = $entry['connUnitPortName'];
}
$options = ['entPhysicalIndex' => $entry['connUnitPortIndex']];
if ($port) {
$name = $port['ifDescr'];
$options['measured_class'] = 'port';
$options['measured_entity'] = $port['port_id'];
} else {
$name = $entry['connUnitPortName'];
}
$descr = $name . ' Temperature';
$oid_name = 'swSfpTemperature';
$oid_num = '.1.3.6.1.4.1.1588.2.1.1.1.28.1.1.1.'.$index;
$type = $mib . '-' . $oid_name;
$value = $entry[$oid_name];
$descr = $name . ' Temperature';
$oid_name = 'swSfpTemperature';
$oid_num = '.1.3.6.1.4.1.1588.2.1.1.1.28.1.1.1.' . $index;
$value = $entry[$oid_name];
discover_sensor_ng($device,'temperature', $mib, $oid_name, $oid_num, $entry['connUnitPortIndex'], NULL, $descr, 1, $value, $options);
discover_sensor_ng($device, 'temperature', $mib, $oid_name, $oid_num, $entry['connUnitPortIndex'], $descr, 1, $value, $options);
$descr = $name . ' Voltage';
$oid_name = 'swSfpVoltage';
$oid_num = '.1.3.6.1.4.1.1588.2.1.1.1.28.1.1.2.'.$index;
$type = $mib . '-' . $oid_name;
$value = $entry[$oid_name];
$descr = $name . ' Voltage';
$oid_name = 'swSfpVoltage';
$oid_num = '.1.3.6.1.4.1.1588.2.1.1.1.28.1.1.2.' . $index;
$value = $entry[$oid_name];
discover_sensor_ng($device,'voltage', $mib, $oid_name, $oid_num, $entry['connUnitPortIndex'], NULL, $descr, 0.001, $value, $options);
discover_sensor_ng($device, 'voltage', $mib, $oid_name, $oid_num, $entry['connUnitPortIndex'], $descr, 0.001, $value, $options);
$descr = $name . ' Bias Current';
$oid_name = 'swSfpCurrent';
$oid_num = '.1.3.6.1.4.1.1588.2.1.1.1.28.1.1.3.'.$index;
$type = $mib . '-' . $oid_name;
$value = $entry[$oid_name];
$descr = $name . ' Bias Current';
$oid_name = 'swSfpCurrent';
$oid_num = '.1.3.6.1.4.1.1588.2.1.1.1.28.1.1.3.' . $index;
$value = $entry[$oid_name];
discover_sensor_ng($device,'current', $mib, $oid_name, $oid_num, $entry['connUnitPortIndex'], NULL, $descr, 0.001, $value, $options);
discover_sensor_ng($device, 'current', $mib, $oid_name, $oid_num, $entry['connUnitPortIndex'], $descr, 0.001, $value, $options);
$descr = $name . ' Receive Power';
$oid_name = 'swSfpRxPower';
$oid_num = '.1.3.6.1.4.1.1588.2.1.1.1.28.1.1.4.'.$index;
$type = $mib . '-' . $oid_name;
$value = str_replace('-inf', '-40', $entry[$oid_name]);
$descr = $name . ' Receive Power';
$oid_name = 'swSfpRxPower';
$oid_num = '.1.3.6.1.4.1.1588.2.1.1.1.28.1.1.4.' . $index;
$value = str_replace('-inf', '-40', $entry[$oid_name]);
discover_sensor_ng($device,'dbm', $mib, $oid_name, $oid_num, $entry['connUnitPortIndex'], NULL, $descr, 1, $value, $options);
discover_sensor_ng($device, 'dbm', $mib, $oid_name, $oid_num, $entry['connUnitPortIndex'], $descr, 1, $value, $options);
$descr = $name . ' Transmit Power';
$oid_name = 'swSfpTxPower';
$oid_num = '.1.3.6.1.4.1.1588.2.1.1.1.28.1.1.5.'.$index;
$type = $mib . '-' . $oid_name;
$value = $entry[$oid_name];
$descr = $name . ' Transmit Power';
$oid_name = 'swSfpTxPower';
$oid_num = '.1.3.6.1.4.1.1588.2.1.1.1.28.1.1.5.' . $index;
$value = $entry[$oid_name];
discover_sensor_ng($device,'dbm', $mib, $oid_name, $oid_num, $entry['connUnitPortIndex'], NULL, $descr, 1, $value, $options);
discover_sensor_ng($device, 'dbm', $mib, $oid_name, $oid_num, $entry['connUnitPortIndex'], $descr, 1, $value, $options);
}

View File

@ -4,17 +4,17 @@
*
* This file is part of Observium.
*
* @package observium
* @subpackage discovery
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2021 Observium Limited
* @package observium
* @subpackage discovery
* @copyright (C) Adam Armstrong
*
*/
if (safe_count($valid['sensor']['temperature']['DNOS-BOXSERVICES-PRIVATE-MIB']) ||
safe_count($valid['sensor']['power']['DNOS-BOXSERVICES-PRIVATE-MIB'])) {
// Exit from discovery, since already added valid sensors by DNOS-BOXSERVICES-PRIVATE-MIB
// Note, DNOS-BOXSERVICES-PRIVATE-MIB and FASTPATH-BOXSERVICES-PRIVATE-MIB are crossed
return;
// Exit from discovery, since already added valid sensors by DNOS-BOXSERVICES-PRIVATE-MIB
// Note, DNOS-BOXSERVICES-PRIVATE-MIB and FASTPATH-BOXSERVICES-PRIVATE-MIB are crossed
return;
}
// Retrieve temperature limits
@ -37,69 +37,65 @@ $boxServicesStackTempSensorsTable = FALSE;
// FASTPATH-BOXSERVICES-PRIVATE-MIB::boxServicesStackTempSensorTemperature.1.0 = INTEGER: 28
// FASTPATH-BOXSERVICES-PRIVATE-MIB::boxServicesStackTempSensorTemperature.2.0 = INTEGER: 27
$oids = snmpwalk_cache_oid($device, 'boxServicesStackTempSensorsTable', array(), 'FASTPATH-BOXSERVICES-PRIVATE-MIB');
$oids = snmpwalk_cache_oid($device, 'boxServicesStackTempSensorsTable', [], 'FASTPATH-BOXSERVICES-PRIVATE-MIB');
foreach ($oids as $index => $entry)
{
if (preg_match('/[\d:]/', $entry['boxServicesStackTempSensorType']))
{
// Incorrect Stack table on new Dell firmwares,
// should to use DNOS-BOXSERVICES-PRIVATE-MIB instead
// FASTPATH-BOXSERVICES-PRIVATE-MIB::boxServicesStackTempSensorType.2.89 = Wrong Type (should be INTEGER): STRING: "239d:04:02:39"
// FASTPATH-BOXSERVICES-PRIVATE-MIB::boxServicesStackTempSensorType.2.90 = Wrong Type (should be INTEGER): STRING: "239d:03:02:38"
print_debug('Device must use DNOS-BOXSERVICES-PRIVATE-MIB');
return;
}
foreach ($oids as $index => $entry) {
if (preg_match('/[\d:]/', $entry['boxServicesStackTempSensorType'])) {
// Incorrect Stack table on new Dell firmwares,
// should to use DNOS-BOXSERVICES-PRIVATE-MIB instead
// FASTPATH-BOXSERVICES-PRIVATE-MIB::boxServicesStackTempSensorType.2.89 = Wrong Type (should be INTEGER): STRING: "239d:04:02:39"
// FASTPATH-BOXSERVICES-PRIVATE-MIB::boxServicesStackTempSensorType.2.90 = Wrong Type (should be INTEGER): STRING: "239d:03:02:38"
print_debug('Device must use DNOS-BOXSERVICES-PRIVATE-MIB');
return;
}
$boxServicesStackTempSensorsTable = TRUE;
$boxServicesStackTempSensorsTable = TRUE;
$descr = (count($oids) > 1 ? 'Stack Unit ' . $entry['boxServicesUnitIndex'] . ' ' : '') . 'Internal Temperature';
$oid = ".1.3.6.1.4.1.4413.1.1.43.1.9.1.5.$index";
$value = $entry['boxServicesStackTempSensorTemperature'];
$descr = (count($oids) > 1 ? 'Stack Unit ' . $entry['boxServicesUnitIndex'] . ' ' : '') . 'Internal Temperature';
$oid = ".1.3.6.1.4.1.4413.1.1.43.1.9.1.5.$index";
$value = $entry['boxServicesStackTempSensorTemperature'];
$options = array(
'limit_low' => $boxServicesNormalTempRangeMin,
'limit_high' => $boxServicesNormalTempRangeMax,
'entPhysicalClass' => 'temperature',
);
discover_sensor('temperature', $device, $oid, "boxServicesStackTempSensorTemperature.$index", 'fastpath-boxservices-private-mib', $descr, 1, $value, $options);
$oid = ".1.3.6.1.4.1.4413.1.1.43.1.9.1.4.$index";
$value = $entry['boxServicesStackTempSensorState'];
discover_status($device, $oid, "boxServicesStackTempSensorState.$index", 'boxServicesTempSensorState', $descr, $value, array('entPhysicalClass' => 'temperature'));
}
if (!$boxServicesStackTempSensorsTable)
{
// This table has been obsoleted by boxServicesStackTempSensorsTable - run it only if we didn't find that table.
$oids = snmpwalk_cache_oid($device, 'boxServicesTempSensorsTable', array(), 'FASTPATH-BOXSERVICES-PRIVATE-MIB');
// FASTPATH-BOXSERVICES-PRIVATE-MIB::boxServicesTempSensorIndex.0 = INTEGER: 0
// FASTPATH-BOXSERVICES-PRIVATE-MIB::boxServicesTempSensorType.0 = INTEGER: fixed(1)
// FASTPATH-BOXSERVICES-PRIVATE-MIB::boxServicesTempSensorState.0 = INTEGER: normal(1)
// FASTPATH-BOXSERVICES-PRIVATE-MIB::boxServicesTempSensorTemperature.0 = INTEGER: 26
foreach ($oids as $index => $entry)
{
$descr = 'Internal Temperature';
$oid = ".1.3.6.1.4.1.4413.1.1.43.1.8.1.4.$index";
$value = $entry['boxServicesTempSensorTemperature'];
$options = array(
$options = [
'limit_low' => $boxServicesNormalTempRangeMin,
'limit_high' => $boxServicesNormalTempRangeMax,
'entPhysicalClass' => 'temperature',
);
];
discover_sensor('temperature', $device, $oid, "boxServicesTempSensorTemperature.$index", 'fastpath-boxservices-private-mib', $descr, 1, $value, $options);
discover_sensor('temperature', $device, $oid, "boxServicesStackTempSensorTemperature.$index", 'fastpath-boxservices-private-mib', $descr, 1, $value, $options);
$oid = ".1.3.6.1.4.1.4413.1.1.43.1.8.1.3.$index";
$value = $entry['boxServicesTempSensorState'];
$oid = ".1.3.6.1.4.1.4413.1.1.43.1.9.1.4.$index";
$value = $entry['boxServicesStackTempSensorState'];
discover_status($device, $oid, "boxServicesTempSensorState.$index", 'boxServicesTempSensorState', $descr, $value, array('entPhysicalClass' => 'temperature'));
}
discover_status($device, $oid, "boxServicesStackTempSensorState.$index", 'boxServicesTempSensorState', $descr, $value, ['entPhysicalClass' => 'temperature']);
}
if (!$boxServicesStackTempSensorsTable) {
// This table has been obsoleted by boxServicesStackTempSensorsTable - run it only if we didn't find that table.
$oids = snmpwalk_cache_oid($device, 'boxServicesTempSensorsTable', [], 'FASTPATH-BOXSERVICES-PRIVATE-MIB');
// FASTPATH-BOXSERVICES-PRIVATE-MIB::boxServicesTempSensorIndex.0 = INTEGER: 0
// FASTPATH-BOXSERVICES-PRIVATE-MIB::boxServicesTempSensorType.0 = INTEGER: fixed(1)
// FASTPATH-BOXSERVICES-PRIVATE-MIB::boxServicesTempSensorState.0 = INTEGER: normal(1)
// FASTPATH-BOXSERVICES-PRIVATE-MIB::boxServicesTempSensorTemperature.0 = INTEGER: 26
foreach ($oids as $index => $entry) {
$descr = 'Internal Temperature';
$oid = ".1.3.6.1.4.1.4413.1.1.43.1.8.1.4.$index";
$value = $entry['boxServicesTempSensorTemperature'];
$options = [
'limit_low' => $boxServicesNormalTempRangeMin,
'limit_high' => $boxServicesNormalTempRangeMax,
'entPhysicalClass' => 'temperature',
];
discover_sensor('temperature', $device, $oid, "boxServicesTempSensorTemperature.$index", 'fastpath-boxservices-private-mib', $descr, 1, $value, $options);
$oid = ".1.3.6.1.4.1.4413.1.1.43.1.8.1.3.$index";
$value = $entry['boxServicesTempSensorState'];
discover_status($device, $oid, "boxServicesTempSensorState.$index", 'boxServicesTempSensorState', $descr, $value, ['entPhysicalClass' => 'temperature']);
}
}
// FASTPATH-BOXSERVICES-PRIVATE-MIB::boxServicesFansIndex.0 = INTEGER: 0
@ -123,43 +119,42 @@ if (!$boxServicesStackTempSensorsTable)
// FASTPATH-BOXSERVICES-PRIVATE-MIB::boxServicesFanDutyLevel.3 = INTEGER: 0
// FASTPATH-BOXSERVICES-PRIVATE-MIB::boxServicesFanDutyLevel.4 = INTEGER: 0
$oids = snmpwalk_cache_oid($device, 'boxServicesFansTable', array(), 'FASTPATH-BOXSERVICES-PRIVATE-MIB');
$oids = snmpwalk_cache_oid($device, 'boxServicesFansTable', [], 'FASTPATH-BOXSERVICES-PRIVATE-MIB');
foreach ($oids as $index => $entry)
{
if ($entry['boxServicesFanItemState'] == 'notpresent') { continue; }
foreach ($oids as $index => $entry) {
if ($entry['boxServicesFanItemState'] == 'notpresent') {
continue;
}
$descr = 'Fan';
if (count($oids) > 1)
{
$descr .= ' ' . ($index + 1);
}
$descr = 'Fan';
if (count($oids) > 1) {
$descr .= ' ' . ($index + 1);
}
$oid_name = 'boxServicesFanItemState';
$oid_num = '.1.3.6.1.4.1.4413.1.1.43.1.6.1.3.'.$index;
$type = 'boxServicesItemState';
$value = $entry[$oid_name];
$oid_name = 'boxServicesFanItemState';
$oid_num = '.1.3.6.1.4.1.4413.1.1.43.1.6.1.3.' . $index;
$type = 'boxServicesItemState';
$value = $entry[$oid_name];
discover_status($device, $oid_num, $oid_name.'.'.$index, $type, $descr, $value, array('entPhysicalClass' => 'fan'));
$scale = 1;
$oid_name = 'boxServicesFanSpeed';
$oid_num = '.1.3.6.1.4.1.4413.1.1.43.1.6.1.4.' . $index;
$type = $mib . '-' . $oid_name;
$value = $entry[$oid_name];
if ($value > 0)
{
discover_sensor('fanspeed', $device, $oid_num, $index, $type, $descr, $scale, $value);
discover_status($device, $oid_num, $oid_name . '.' . $index, $type, $descr, $value, ['entPhysicalClass' => 'fan']);
$scale = 1;
$oid_name = 'boxServicesFanDutyLevel';
$oid_num = '.1.3.6.1.4.1.4413.1.1.43.1.6.1.5.' . $index;
$oid_name = 'boxServicesFanSpeed';
$oid_num = '.1.3.6.1.4.1.4413.1.1.43.1.6.1.4.' . $index;
$type = $mib . '-' . $oid_name;
$value = $entry[$oid_name];
discover_sensor('load', $device, $oid_num, $index, $type, $descr, $scale, $value);
}
if ($value > 0) {
discover_sensor('fanspeed', $device, $oid_num, $index, $type, $descr, $scale, $value);
$scale = 1;
$oid_name = 'boxServicesFanDutyLevel';
$oid_num = '.1.3.6.1.4.1.4413.1.1.43.1.6.1.5.' . $index;
$type = $mib . '-' . $oid_name;
$value = $entry[$oid_name];
discover_sensor('load', $device, $oid_num, $index, $type, $descr, $scale, $value);
}
}
// FASTPATH-BOXSERVICES-PRIVATE-MIB::boxServicesPowSupplyIndex.0 = INTEGER: 0
@ -169,18 +164,16 @@ foreach ($oids as $index => $entry)
// FASTPATH-BOXSERVICES-PRIVATE-MIB::boxServicesPowSupplyItemState.0 = INTEGER: operational(2)
// FASTPATH-BOXSERVICES-PRIVATE-MIB::boxServicesPowSupplyItemState.1 = INTEGER: operational(2)
$oids = snmpwalk_cache_oid($device, 'boxServicesPowSuppliesTable', array(), 'FASTPATH-BOXSERVICES-PRIVATE-MIB');
$oids = snmpwalk_cache_oid($device, 'boxServicesPowSuppliesTable', [], 'FASTPATH-BOXSERVICES-PRIVATE-MIB');
foreach ($oids as $index => $entry)
{
$descr = ucfirst($entry['boxServicesPowSupplyItemType'] . ' Power Supply');
$oid = ".1.3.6.1.4.1.4413.1.1.43.1.7.1.3.$index";
$value = $entry['boxServicesPowSupplyItemState'];
foreach ($oids as $index => $entry) {
$descr = ucfirst($entry['boxServicesPowSupplyItemType'] . ' Power Supply');
$oid = ".1.3.6.1.4.1.4413.1.1.43.1.7.1.3.$index";
$value = $entry['boxServicesPowSupplyItemState'];
if ($entry['boxServicesPowSupplyItemState'] != 'notpresent')
{
discover_status($device, $oid, "boxServicesPowSupplyItemState.$index", 'boxServicesItemState', $descr, $value, array('entPhysicalClass' => 'power'));
}
if ($entry['boxServicesPowSupplyItemState'] != 'notpresent') {
discover_status($device, $oid, "boxServicesPowSupplyItemState.$index", 'boxServicesItemState', $descr, $value, ['entPhysicalClass' => 'power']);
}
}
// EOF

View File

@ -6,7 +6,7 @@
*
* @package observium
* @subpackage discovery
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2022 Observium Limited
* @copyright (C) Adam Armstrong
*
*/
@ -17,52 +17,79 @@ $oids = snmpwalk_multipart_oid($device, "fgHwSensorTable", [], "FORTINET-FORTIGA
print_debug_vars($oids);
foreach ($oids as $index => $entry) {
$descr = $entry['fgHwSensorEntName'];
$descr = $entry['fgHwSensorEntName'];
$oid_name = 'fgHwSensorEntValue';
$oid_num = '.1.3.6.1.4.1.12356.101.4.3.2.1.3.'.$index;
$scale = 1;
$value = $entry[$oid_name];
if (empty($descr) && $value == 0) { continue; }
// Detect class based on descr anv value (this is derp, table not have other data for detect class
if (str_iends($descr, ' Temp')) {
if ($value == 0) { continue; }
$descr = str_replace(' Temp', '', $descr);
$class = 'temperature';
} elseif (str_icontains_array($descr, 'Fan') && ($value > 100 || $value == 0)) {
if ($value == 0) { continue; }
$class = 'fanspeed';
} elseif (preg_match('/\d+V(SB|DD)?\d*$/', $descr) || preg_match('/P\d+V\d+/', $descr) ||
str_icontains_array($descr, [ 'VCC', 'VTT', 'VDD', 'VDQ', 'VBAT', 'VSA', 'Vcore', 'VIN', 'VOUT', 'Vbus', 'Vsht', 'VDimm', 'Vcpu', 'PVNN' ])) {
if ($value == 0) { continue; }
$class = 'voltage';
} elseif (str_icontains_array($descr, 'Status')) {
// FORTINET-FORTIGATE-MIB::fgHwSensorEntName.45 = STRING: PS1 Status
// FORTINET-FORTIGATE-MIB::fgHwSensorEntName.50 = STRING: PS2 Status
// FORTINET-FORTIGATE-MIB::fgHwSensorEntValue.45 = STRING: 0
// FORTINET-FORTIGATE-MIB::fgHwSensorEntValue.50 = STRING: 9
// FORTINET-FORTIGATE-MIB::fgHwSensorEntAlarmStatus.45 = INTEGER: false(0)
// FORTINET-FORTIGATE-MIB::fgHwSensorEntAlarmStatus.50 = INTEGER: true(1)
$descr = str_ireplace('Status', 'Alarm Status', $descr);
$oid_name = 'fgHwSensorEntAlarmStatus';
$oid_num = '.1.3.6.1.4.1.12356.101.4.3.2.1.4.'.$index;
$type = 'fgHwSensorEntAlarmStatus';
$oid_name = 'fgHwSensorEntValue';
$oid_num = '.1.3.6.1.4.1.12356.101.4.3.2.1.3.' . $index;
$scale = 1;
$value = $entry[$oid_name];
discover_status_ng($device, $mib, $oid_name, $oid_num, $index, $type, $descr, $value, array('entPhysicalClass' => 'powersupply'));
continue;
} else {
if ($value == 0) { continue; }
// FIXME, not always?
$class = 'temperature';
}
if (empty($descr) && $value == 0) {
continue;
}
discover_status_ng($device, $mib, `fgHwSensorEntAlarmStatus`, '.1.3.6.1.4.1.12356.101.4.3.2.1.4.'.$index, $index,
// Detect class based on descr anv value (this is derp, table not have other data for detect class
if (str_iends($descr, [' Temp', ' Temperature'])) {
if ($value == 0) {
continue;
}
$descr = str_replace([' Temperature', ' Temp' ], '', $descr);
$class = 'temperature';
} elseif (str_icontains_array($descr, 'Fan')) {
if ($value == 0) {
continue;
}
if ($value > 100) {
$class = 'fanspeed';
} elseif ($value > 0) {
$class = 'load';
}
} elseif (str_iends($descr, [' Curr', ' Current', ' IIN' ])) {
if ($value == 0) {
continue;
}
$descr = str_replace([' Curr', ' Current' ], '', $descr);
$class = 'current';
} elseif (str_iends($descr, [' Pwr', ' Power', ' POUT' ])) {
if ($value == 0) {
continue;
}
$descr = str_replace([' Pwr', ' Power' ], '', $descr);
$class = 'power';
} elseif (preg_match('/\d+V(SB|DD)?\d*$/', $descr) || preg_match('/P\d+V\d+/', $descr) ||
str_icontains_array($descr, [ 'VCC', 'VPP', 'VTT', 'VDD', 'VDQ', 'VBAT', 'VSA', 'Vcore', 'VIN', 'VOUT',
'Vbus', 'Vsht', 'VDimm', 'Vcpu', 'PVNN', 'SOC', 'VMEM' ])) {
if ($value == 0) {
continue;
}
$class = 'voltage';
} elseif (str_icontains_array($descr, 'Status')) {
// FORTINET-FORTIGATE-MIB::fgHwSensorEntName.45 = STRING: PS1 Status
// FORTINET-FORTIGATE-MIB::fgHwSensorEntName.50 = STRING: PS2 Status
// FORTINET-FORTIGATE-MIB::fgHwSensorEntValue.45 = STRING: 0
// FORTINET-FORTIGATE-MIB::fgHwSensorEntValue.50 = STRING: 9
// FORTINET-FORTIGATE-MIB::fgHwSensorEntAlarmStatus.45 = INTEGER: false(0)
// FORTINET-FORTIGATE-MIB::fgHwSensorEntAlarmStatus.50 = INTEGER: true(1)
$descr = str_ireplace('Status', 'Alarm Status', $descr);
$oid_name = 'fgHwSensorEntAlarmStatus';
$oid_num = '.1.3.6.1.4.1.12356.101.4.3.2.1.4.' . $index;
$type = 'fgHwSensorEntAlarmStatus';
$value = $entry[$oid_name];
discover_status_ng($device, $mib, $oid_name, $oid_num, $index, $type, $descr, $value, ['entPhysicalClass' => 'powersupply']);
continue;
} else {
if ($value == 0) {
continue;
}
// FIXME, not always?
$class = 'temperature';
}
discover_status_ng($device, $mib, 'fgHwSensorEntAlarmStatus', '.1.3.6.1.4.1.12356.101.4.3.2.1.4.' . $index, $index,
'fgHwSensorEntAlarmStatus', $descr, $entry['fgHwSensorEntAlarmStatus']);
discover_sensor_ng($device, $class, $mib, $oid_name, $oid_num, $index, NULL, $descr, $scale, $value);
discover_sensor_ng($device, $class, $mib, $oid_name, $oid_num, $index, $descr, $scale, $value);
}
// EOF

View File

@ -6,7 +6,7 @@
*
* @package observium
* @subpackage discovery
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2021 Observium Limited
* @copyright (C) Adam Armstrong
*
*/
@ -23,61 +23,61 @@
//FOUNDRY-POE-MIB::snAgentPoeUnitPowerCapacityFree.1 = Gauge32: 440000
//FOUNDRY-POE-MIB::snAgentPoeUnitPowerAllocationsRequestsHonored.1 = Gauge32: 94
$oids = snmpwalk_cache_oid($device, 'snAgentPoeUnitEntry', array(), $mib);
$oids = snmpwalk_cache_oid($device, 'snAgentPoeUnitEntry', [], $mib);
if (safe_count($oids)) {
// Stacked devices
foreach ($oids as $index => $entry) {
if ($entry['snAgentPoeUnitPowerCapacityTotal'] == 0) { continue; } // skip zero sensors
// Stacked devices
foreach ($oids as $index => $entry) {
if ($entry['snAgentPoeUnitPowerCapacityTotal'] == 0) {
continue;
} // skip zero sensors
$descr = "PoE Allocated Power Unit $index";
$oid_name = 'snAgentPoeUnitPowerCapacityFree';
$oid_num = ".1.3.6.1.4.1.1991.1.1.2.14.4.1.1.3.$index";
$type = $mib . '-' . $oid_name;
$value = $entry[$oid_name]; // What the f**k FOUNDRY, why not just used value??
$scale = 0.001;
$negative = -1;
$descr = "PoE Allocated Power Unit $index";
$oid_name = 'snAgentPoeUnitPowerCapacityFree';
$oid_num = ".1.3.6.1.4.1.1991.1.1.2.14.4.1.1.3.$index";
$value = $entry[$oid_name]; // What the f**k FOUNDRY, why not just used value??
$scale = 0.001;
$negative = -1;
// Options
$options = array('limit_high' => $entry['snAgentPoeUnitPowerCapacityTotal'] * $scale);
// Options
$options = ['limit_high' => $entry['snAgentPoeUnitPowerCapacityTotal'] * $scale];
$options['limit_high_warn'] = $options['limit_high'] * 0.9; // Warning at 90% of power limit - FIXME should move to centralized smart calculation function
$options['limit_high_warn'] = $options['limit_high'] * 0.9; // Warning at 90% of power limit - FIXME should move to centralized smart calculation function
// Note, this is not same what we do in unit conversion, since this is not different unit
// Here used combination with negative scale and negative addition, ie:
// 740 - 440 === -1 * (-740 + 440)
$options['sensor_addition'] = $entry['snAgentPoeUnitPowerCapacityTotal'] * $negative;
// Note, this is not same what we do in unit conversion, since this is not different unit
// Here used combination with negative scale and negative addition, ie:
// 740 - 440 === -1 * (-740 + 440)
$options['sensor_addition'] = $entry['snAgentPoeUnitPowerCapacityTotal'] * $negative;
// Warning, negative scale here!
discover_sensor_ng($device, 'power', $mib, $oid_name, $oid_num, $index, NULL, $descr, $negative * $scale, $value, $options);
}
// Warning, negative scale here!
discover_sensor_ng($device, 'power', $mib, $oid_name, $oid_num, $index, $descr, $negative * $scale, $value, $options);
}
} else {
// All other
$oids = snmp_get_multi_oid($device, 'snAgentPoeGblPowerCapacityTotal.0 snAgentPoeGblPowerCapacityFree.0', array(), $mib);
if (is_array($oids[0]) && $oids[0]['snAgentPoeGblPowerCapacityTotal'] != 0) {
$index = 0;
$entry = $oids[$index];
// All other
$oids = snmp_get_multi_oid($device, 'snAgentPoeGblPowerCapacityTotal.0 snAgentPoeGblPowerCapacityFree.0', [], $mib);
if (is_array($oids[0]) && $oids[0]['snAgentPoeGblPowerCapacityTotal'] != 0) {
$index = 0;
$entry = $oids[$index];
$descr = "PoE Allocated Power";
$oid_name = 'snAgentPoeGblPowerCapacityFree';
$oid_num = ".1.3.6.1.4.1.1991.1.1.2.14.1.2.$index";
$type = $mib . '-' . $oid_name;
$value = $entry[$oid_name]; // What the f**k FOUNDRY, why not just used value??
$scale = 0.001;
$negative = -1;
$descr = "PoE Allocated Power";
$oid_name = 'snAgentPoeGblPowerCapacityFree';
$oid_num = ".1.3.6.1.4.1.1991.1.1.2.14.1.2.$index";
$value = $entry[$oid_name];
$scale = 0.001;
$negative = -1;
// Options
$options = array('limit_high' => $entry['snAgentPoeGblPowerCapacityTotal'] * $scale); // Hardcode 0 as lower limit. Low warning limit will be calculated.
// Options
$options = ['limit_high' => $entry['snAgentPoeGblPowerCapacityTotal'] * $scale]; // Hardcode 0 as lower limit. Low warning limit will be calculated.
$options['limit_high_warn'] = $options['limit_high'] * 0.9; // Warning at 90% of power limit - FIXME should move to centralized smart calculation function
$options['limit_high_warn'] = $options['limit_high'] * 0.9; // Warning at 90% of power limit - FIXME should move to centralized smart calculation function
// Note, this is not same what we do in unit conversion, since this is not different unit
// Here used combination with negative scale and negative addition, ie:
// 740 - 440 === -1 * (-740 + 440)
$options['sensor_addition'] = $entry['snAgentPoeGblPowerCapacityTotal'] * $negative;
// Note, this is not same what we do in unit conversion, since this is not different unit
// Here used combination with negative scale and negative addition, ie:
// 740 - 440 === -1 * (-740 + 440)
$options['sensor_addition'] = $entry['snAgentPoeGblPowerCapacityTotal'] * $negative;
// Warning, negative scale here!
discover_sensor_ng($device, 'power', $mib, $oid_name, $oid_num, $index, NULL, $descr, $negative * $scale, $value, $options);
}
// Warning, negative scale here!
discover_sensor_ng($device, 'power', $mib, $oid_name, $oid_num, $index, $descr, $negative * $scale, $value, $options);
}
}
print_debug_vars($oids);
@ -100,50 +100,47 @@ print_debug_vars($oids);
//FOUNDRY-POE-MIB::snAgentPoePortConsumed.9 = INTEGER: 2723
//FOUNDRY-POE-MIB::snAgentPoePortType.9 = STRING: 802.3af
$oids = snmpwalk_cache_oid($device, 'snAgentPoePortEntry', array(), $mib);
$oids = snmpwalk_cache_oid($device, 'snAgentPoePortEntry', [], $mib);
print_debug_vars($oids);
foreach ($oids as $index => $entry)
{
if ($entry['snAgentPoePortControl'] == 'disable' ||
(($entry['snAgentPoePortPriority'] == 'other' || $entry['snAgentPoePortType'] == 'n/a') &&
$entry['snAgentPoePortConsumed'] == 0)) // && empty($entry['snAgentPoePortType'])))
{
// Skip PoE disabled ports
continue;
}
foreach ($oids as $index => $entry) {
if ($entry['snAgentPoePortControl'] == 'disable' ||
(($entry['snAgentPoePortPriority'] == 'other' || $entry['snAgentPoePortType'] == 'n/a') &&
$entry['snAgentPoePortConsumed'] == 0)) // && empty($entry['snAgentPoePortType'])))
{
// Skip PoE disabled ports
continue;
}
$options = array('entPhysicalIndex' => $index);
$port = get_port_by_ifIndex($device['device_id'], $index);
// print_vars($port);
$options = ['entPhysicalIndex' => $index];
$port = get_port_by_ifIndex($device['device_id'], $index);
// print_vars($port);
if (is_array($port))
{
$entry['ifDescr'] = $port['port_label'];
$options['measured_class'] = 'port';
$options['measured_entity'] = $port['port_id'];
$options['entPhysicalIndex_measured'] = $port['ifIndex'];
} else {
$entry['ifDescr'] = "Port $index";
}
if (is_array($port)) {
$entry['ifDescr'] = $port['port_label'];
$options['measured_class'] = 'port';
$options['measured_entity'] = $port['port_id'];
$options['entPhysicalIndex_measured'] = $port['ifIndex'];
} else {
$entry['ifDescr'] = "Port $index";
}
$descr = $entry['ifDescr'] . ' PoE Power';
$oid_name = 'snAgentPoePortConsumed';
$oid_num = ".1.3.6.1.4.1.1991.1.1.2.14.2.2.1.6.$index";
$type = $mib . '-' . $oid_name;
$value = $entry[$oid_name];
$scale = 0.001;
$descr = $entry['ifDescr'] . ' PoE Power';
$oid_name = 'snAgentPoePortConsumed';
$oid_num = ".1.3.6.1.4.1.1991.1.1.2.14.2.2.1.6.$index";
$type = $mib . '-' . $oid_name;
$value = $entry[$oid_name];
$scale = 0.001;
// Limits
$options['limit_high'] = $entry['snAgentPoePortWattage'] * $scale;
if ($options['limit_high'] > 0)
{
$options['limit_high_warn'] = $options['limit_high'] * 0.9; // Warning at 90% of power limit - FIXME should move to centralized smart calculation function
} else {
unset($options['limit_high']);
}
discover_sensor_ng($device, 'power', $mib, $oid_name, $oid_num, $index, NULL, $descr, $scale, $value, $options);
// Limits
$options['limit_high'] = $entry['snAgentPoePortWattage'] * $scale;
if ($options['limit_high'] > 0) {
$options['limit_high_warn'] = $options['limit_high'] * 0.9; // Warning at 90% of power limit - FIXME should move to centralized smart calculation function
} else {
unset($options['limit_high']);
}
discover_sensor_ng($device, 'power', $mib, $oid_name, $oid_num, $index, $descr, $scale, $value, $options);
}
// EOF

View File

@ -6,158 +6,146 @@
*
* @package observium
* @subpackage discovery
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2021 Observium Limited
* @copyright (C) Adam Armstrong
*
*/
// Temperature sensors
$cache['fnsnagent'] = snmpwalk_cache_oid($device, 'snAgentTempEntry', array(), 'FOUNDRY-SN-AGENT-MIB');
$cache['fnsnagent'] = snmpwalk_cache_oid($device, 'snAgentTempEntry', [], 'FOUNDRY-SN-AGENT-MIB');
print_debug_vars($cache['fnsnagent']);
foreach ($cache['fnsnagent'] as $index => $entry) {
if (!isset($entry['snAgentTempValue']) || !is_numeric($entry['snAgentTempValue']) || $entry['snAgentTempValue'] == 0) {
continue;
}
$descr = str_replace(array('temperature', 'sensor', 'Line module', 'Switch Fabric module', 'management module'),
array('', 'Sensor', 'Slot', 'Fabric', 'Mgmt Module'),
$entry['snAgentTempSensorDescr']);
$descr = preg_replace('!\s+!', ' ', trim($descr));
list($slot, ) = explode('.', $index);
if ($slot > 1) {
$descr .= ' Slot ' . $slot;
}
if (!isset($entry['snAgentTempValue']) || !is_numeric($entry['snAgentTempValue']) || $entry['snAgentTempValue'] == 0) {
continue;
}
$descr = str_replace(['temperature', 'sensor', 'Line module', 'Switch Fabric module', 'management module'],
['', 'Sensor', 'Slot', 'Fabric', 'Mgmt Module'],
$entry['snAgentTempSensorDescr']);
$descr = preg_replace('!\s+!', ' ', trim($descr));
[$slot,] = explode('.', $index);
if ($slot > 1) {
$descr .= ' Slot ' . $slot;
}
$oid_name = 'snAgentTempValue';
$oid_num = ".1.3.6.1.4.1.1991.1.1.2.13.1.1.4.$index";
$value = $entry[$oid_name];
$scale = 0.5;
$oid_name = 'snAgentTempValue';
$oid_num = ".1.3.6.1.4.1.1991.1.1.2.13.1.1.4.$index";
$value = $entry[$oid_name];
$scale = 0.5;
discover_sensor_ng($device,'temperature', $mib, 'snAgentTempValue', $oid_num, $index, 'ironware', $descr, $scale, $value, [ 'rename_rrd' => "ironware-$index" ]);
discover_sensor_ng($device, 'temperature', $mib, 'snAgentTempValue', $oid_num, $index, $descr, $scale, $value, [ 'rename_rrd' => "ironware-$index" ]);
}
// Module statuses
$cache['fnsnagent'] = snmpwalk_cache_oid($device, 'snAgentBrdModuleStatus', array(), 'FOUNDRY-SN-AGENT-MIB');
if ($GLOBALS['snmp_status'])
{
$cache['fnsnagent'] = snmpwalk_cache_oid($device, 'snAgentBrdMainBrdDescription', $cache['fnsnagent'], 'FOUNDRY-SN-AGENT-MIB');
$cache['fnsnagent'] = snmpwalk_cache_oid($device, 'snAgentBrdRedundantStatus', $cache['fnsnagent'], 'FOUNDRY-SN-AGENT-MIB');
$cache['fnsnagent'] = snmpwalk_cache_oid($device, 'snAgentBrdModuleStatus', [], 'FOUNDRY-SN-AGENT-MIB');
if ($GLOBALS['snmp_status']) {
$cache['fnsnagent'] = snmpwalk_cache_oid($device, 'snAgentBrdMainBrdDescription', $cache['fnsnagent'], 'FOUNDRY-SN-AGENT-MIB');
$cache['fnsnagent'] = snmpwalk_cache_oid($device, 'snAgentBrdRedundantStatus', $cache['fnsnagent'], 'FOUNDRY-SN-AGENT-MIB');
}
print_debug_vars($cache['fnsnagent']);
foreach ($cache['fnsnagent'] as $index => $entry)
{
$name = trim(str_ireplace('Module', '', $entry['snAgentBrdMainBrdDescription']));
foreach ($cache['fnsnagent'] as $index => $entry) {
$name = trim(str_ireplace('Module', '', $entry['snAgentBrdMainBrdDescription']));
// Module status
$descr = 'Module ' . $index . ': ' . $name;
$oid_name = 'snAgentBrdModuleStatus';
$oid_num = ".1.3.6.1.4.1.1991.1.1.2.2.1.1.12.$index";
$type = 'snAgentBrdModuleStatus';
$value = $entry[$oid_name];
// Module status
$descr = 'Module ' . $index . ': ' . $name;
$oid_name = 'snAgentBrdModuleStatus';
$oid_num = ".1.3.6.1.4.1.1991.1.1.2.2.1.1.12.$index";
$type = 'snAgentBrdModuleStatus';
$value = $entry[$oid_name];
discover_status($device, $oid_num, $oid_name.'.'.$index, $type, $descr, $value, array('entPhysicalClass' => 'other'));
discover_status($device, $oid_num, $oid_name . '.' . $index, $type, $descr, $value, ['entPhysicalClass' => 'other']);
// Module Redundant status
$descr = 'Redundant ' . $index . ': ' . $name;
$oid_name = 'snAgentBrdRedundantStatus';
$oid_num = ".1.3.6.1.4.1.1991.1.1.2.2.1.1.13.$index";
$type = 'snAgentBrdRedundantStatus';
$value = $entry[$oid_name];
// Module Redundant status
$descr = 'Redundant ' . $index . ': ' . $name;
$oid_name = 'snAgentBrdRedundantStatus';
$oid_num = ".1.3.6.1.4.1.1991.1.1.2.2.1.1.13.$index";
$type = 'snAgentBrdRedundantStatus';
$value = $entry[$oid_name];
discover_status($device, $oid_num, $oid_name.'.'.$index, $type, $descr, $value, array('entPhysicalClass' => 'other'));
discover_status($device, $oid_num, $oid_name . '.' . $index, $type, $descr, $value, ['entPhysicalClass' => 'other']);
}
// State sensors
$cache['fnsnagent'] = array();
$stackable = FALSE;
$cache['fnsnagent'] = [];
$stackable = FALSE;
// Power Suplies
// Stackable Switches
foreach (array('snChasPwrSupply2Table') as $table)
{
echo("$table ");
$cache['fnsnagent'] = snmpwalk_cache_oid($device, $table, $cache['fnsnagent'], 'FOUNDRY-SN-AGENT-MIB:FOUNDRY-SN-ROOT-MIB', NULL, OBS_SNMP_ALL_NUMERIC_INDEX);
foreach (['snChasPwrSupply2Table'] as $table) {
echo("$table ");
$cache['fnsnagent'] = snmpwalk_cache_oid($device, $table, $cache['fnsnagent'], 'FOUNDRY-SN-AGENT-MIB:FOUNDRY-SN-ROOT-MIB', NULL, OBS_SNMP_ALL_NUMERIC_INDEX);
}
print_debug_vars($cache['fnsnagent']);
foreach ($cache['fnsnagent'] as $index => $entry)
{
$descr = empty($entry['snChasPwrSupply2Description']) ? "Power Supply $index" : $entry['snChasPwrSupply2Description'];
if ($entry['snChasPwrSupply2Unit']) {
$descr .= ' Unit '. $entry['snChasPwrSupply2Unit'];
}
$oid = ".1.3.6.1.4.1.1991.1.1.1.2.2.1.4.$index";
$value = $entry['snChasPwrSupply2OperStatus'];
discover_status($device, $oid, "snChasPwrSupply2OperStatus.$index", 'foundry-sn-agent-oper-state', $descr, $value, array('entPhysicalClass' => 'powerSupply'));
$stackable = TRUE;
foreach ($cache['fnsnagent'] as $index => $entry) {
$descr = empty($entry['snChasPwrSupply2Description']) ? "Power Supply $index" : $entry['snChasPwrSupply2Description'];
if ($entry['snChasPwrSupply2Unit']) {
$descr .= ' Unit ' . $entry['snChasPwrSupply2Unit'];
}
$oid = ".1.3.6.1.4.1.1991.1.1.1.2.2.1.4.$index";
$value = $entry['snChasPwrSupply2OperStatus'];
discover_status($device, $oid, "snChasPwrSupply2OperStatus.$index", 'foundry-sn-agent-oper-state', $descr, $value, ['entPhysicalClass' => 'powerSupply']);
$stackable = TRUE;
}
// Chassis and Non Stackable Switches
if (!$stackable)
{
$cache['fnsnagent'] = array();
if (!$stackable) {
$cache['fnsnagent'] = [];
foreach (array('snChasPwrSupplyTable') as $table)
{
echo("$table ");
$cache['fnsnagent'] = snmpwalk_cache_oid($device, $table, $cache['fnsnagent'], 'FOUNDRY-SN-AGENT-MIB:FOUNDRY-SN-ROOT-MIB', NULL, OBS_SNMP_ALL_NUMERIC_INDEX);
}
print_debug_vars($cache['fnsnagent']);
foreach (['snChasPwrSupplyTable'] as $table) {
echo("$table ");
$cache['fnsnagent'] = snmpwalk_cache_oid($device, $table, $cache['fnsnagent'], 'FOUNDRY-SN-AGENT-MIB:FOUNDRY-SN-ROOT-MIB', NULL, OBS_SNMP_ALL_NUMERIC_INDEX);
}
print_debug_vars($cache['fnsnagent']);
foreach ($cache['fnsnagent'] as $index => $entry)
{
$descr = empty($entry['snChasPwrSupplyDescription']) ? "Power Supply $index" : $entry['snChasPwrSupplyDescription'];
$oid = ".1.3.6.1.4.1.1991.1.1.1.2.1.1.3.$index";
$value = $entry['snChasPwrSupplyOperStatus'];
discover_status($device, $oid, "snChasPwrSupplyOperStatus.$index", 'foundry-sn-agent-oper-state', $descr, $value, array('entPhysicalClass' => 'powerSupply'));
}
foreach ($cache['fnsnagent'] as $index => $entry) {
$descr = empty($entry['snChasPwrSupplyDescription']) ? "Power Supply $index" : $entry['snChasPwrSupplyDescription'];
$oid = ".1.3.6.1.4.1.1991.1.1.1.2.1.1.3.$index";
$value = $entry['snChasPwrSupplyOperStatus'];
discover_status($device, $oid, "snChasPwrSupplyOperStatus.$index", 'foundry-sn-agent-oper-state', $descr, $value, ['entPhysicalClass' => 'powerSupply']);
}
}
// Fans
$cache['fnsnagent'] = array();
$stackable = FALSE;
$cache['fnsnagent'] = [];
$stackable = FALSE;
// Stackable Switches
foreach (array('snChasFan2Table') as $table)
{
echo("$table ");
$cache['fnsnagent'] = snmpwalk_cache_oid($device, $table, $cache['fnsnagent'], 'FOUNDRY-SN-AGENT-MIB:FOUNDRY-SN-ROOT-MIB', NULL, OBS_SNMP_ALL_NUMERIC_INDEX);
foreach (['snChasFan2Table'] as $table) {
echo("$table ");
$cache['fnsnagent'] = snmpwalk_cache_oid($device, $table, $cache['fnsnagent'], 'FOUNDRY-SN-AGENT-MIB:FOUNDRY-SN-ROOT-MIB', NULL, OBS_SNMP_ALL_NUMERIC_INDEX);
}
print_debug_vars($cache['fnsnagent']);
foreach ($cache['fnsnagent'] as $index => $entry)
{
$descr = empty($entry['snChasFan2Description']) ? "Fan $index" : $entry['snChasFan2Description'];
if ($entry['snChasFan2Unit']) {
$descr .= ' Unit '. $entry['snChasFan2Unit'];
}
$oid = ".1.3.6.1.4.1.1991.1.1.1.3.2.1.4.$index";
$value = $entry['snChasFan2OperStatus'];
discover_status($device, $oid, "snChasFan2OperStatus.$index", 'foundry-sn-agent-oper-state', $descr, $value, array('entPhysicalClass' => 'fan'));
$stackable = TRUE;
foreach ($cache['fnsnagent'] as $index => $entry) {
$descr = empty($entry['snChasFan2Description']) ? "Fan $index" : $entry['snChasFan2Description'];
if ($entry['snChasFan2Unit']) {
$descr .= ' Unit ' . $entry['snChasFan2Unit'];
}
$oid = ".1.3.6.1.4.1.1991.1.1.1.3.2.1.4.$index";
$value = $entry['snChasFan2OperStatus'];
discover_status($device, $oid, "snChasFan2OperStatus.$index", 'foundry-sn-agent-oper-state', $descr, $value, ['entPhysicalClass' => 'fan']);
$stackable = TRUE;
}
// Chassis and Non Stackable Switches
if (!$stackable)
{
$cache['fnsnagent'] = array();
if (!$stackable) {
$cache['fnsnagent'] = [];
foreach (array('snChasFanEntry') as $table)
{
echo("$table ");
$cache['fnsnagent'] = snmpwalk_cache_oid($device, $table, $cache['fnsnagent'], 'FOUNDRY-SN-AGENT-MIB:FOUNDRY-SN-ROOT-MIB', NULL, OBS_SNMP_ALL_NUMERIC_INDEX);
}
print_debug_vars($cache['fnsnagent']);
foreach (['snChasFanEntry'] as $table) {
echo("$table ");
$cache['fnsnagent'] = snmpwalk_cache_oid($device, $table, $cache['fnsnagent'], 'FOUNDRY-SN-AGENT-MIB:FOUNDRY-SN-ROOT-MIB', NULL, OBS_SNMP_ALL_NUMERIC_INDEX);
}
print_debug_vars($cache['fnsnagent']);
foreach ($cache['fnsnagent'] as $index => $entry)
{
$descr = empty($entry['snChasFanDescription']) ? "Fan $index" : $entry['snChasFanDescription'];
$oid = ".1.3.6.1.4.1.1991.1.1.1.3.1.1.3.$index";
$value = $entry['snChasFanOperStatus'];
discover_status($device, $oid, "snChasFanOperStatus.$index", 'foundry-sn-agent-oper-state', $descr, $value, array('entPhysicalClass' => 'fan'));
}
foreach ($cache['fnsnagent'] as $index => $entry) {
$descr = empty($entry['snChasFanDescription']) ? "Fan $index" : $entry['snChasFanDescription'];
$oid = ".1.3.6.1.4.1.1991.1.1.1.3.1.1.3.$index";
$value = $entry['snChasFanOperStatus'];
discover_status($device, $oid, "snChasFanOperStatus.$index", 'foundry-sn-agent-oper-state', $descr, $value, ['entPhysicalClass' => 'fan']);
}
}
unset($stackable, $cache['fnsnagent']);

View File

@ -6,67 +6,66 @@
*
* @package observium
* @subpackage discovery
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2021 Observium Limited
* @copyright (C) Adam Armstrong
*
*/
// This could probably do with a rewrite, I suspect there's 1 table that can be walked for all the info below instead of 4.
$oids = snmpwalk_cache_oid($device, "snIfOpticalMonitoringInfoTable", array(), "FOUNDRY-SN-SWITCH-GROUP-MIB");
$oids = snmpwalk_cache_oid($device, "snIfOpticalMonitoringInfoTable", [], "FOUNDRY-SN-SWITCH-GROUP-MIB");
foreach ($oids as $index => $entry)
{
$options = array('entPhysicalIndex' => $index);
$port = get_port_by_index_cache($device['device_id'], $index);
foreach ($oids as $index => $entry) {
$options = ['entPhysicalIndex' => $index];
$port = get_port_by_index_cache($device['device_id'], $index);
if (is_array($port)) {
$descr = $port["port_label"];
$options['measured_class'] = 'port';
$options['measured_entity'] = $port['port_id'];
} else {
$descr = snmp_get_oid($device, "ifDescr.$index", "IF-MIB");
}
$value = $entry['snIfOpticalMonitoringTxBiasCurrent'];
if (!str_contains($value, "N/A")) {
$oid = ".1.3.6.1.4.1.1991.1.1.3.3.6.1.4.$index";
$options['rename_rrd'] = "brocade-dom-$index";
discover_sensor_ng($device, 'current', $mib, 'snIfOpticalMonitoringTxBiasCurrent', $oid, $index, NULL, $descr." TX Bias Current", 0.001, $value, $options);
}
$value = $entry['snIfOpticalMonitoringTxPower'];
if (!str_contains($value, "N/A")) {
$oid = ".1.3.6.1.4.1.1991.1.1.3.3.6.1.2.$index";
$options['rename_rrd'] = "brocade-dom-tx-$index";
if (str_icontains_array($value, 'uWatts')) {
discover_sensor_ng($device, 'power', $mib, 'snIfOpticalMonitoringTxPower', $oid, $index, NULL, $descr . " TX Power", 0.000001, $value, $options);
if (is_array($port)) {
$descr = $port["port_label"];
$options['measured_class'] = 'port';
$options['measured_entity'] = $port['port_id'];
} else {
discover_sensor_ng($device, 'dbm', $mib, 'snIfOpticalMonitoringTxPower', $oid, $index, NULL, $descr . " TX Power", 1, $value, $options);
$descr = snmp_get_oid($device, "ifDescr.$index", "IF-MIB");
}
}
$value = $entry['snIfOpticalMonitoringRxPower'];
if (!str_contains($value, "N/A")) {
$oid = ".1.3.6.1.4.1.1991.1.1.3.3.6.1.3.$index";
$value = $entry['snIfOpticalMonitoringTxBiasCurrent'];
if (!str_contains($value, "N/A")) {
$options['rename_rrd'] = "brocade-dom-rx-$index";
if (str_icontains_array($value, 'uWatts')) {
discover_sensor_ng($device, 'power', $mib, 'snIfOpticalMonitoringRxPower', $oid, $index, NULL, $descr . " RX Power", 0.000001, $value, $options);
} else {
discover_sensor_ng($device, 'dbm', $mib, 'snIfOpticalMonitoringRxPower', $oid, $index, NULL, $descr . " RX Power", 1, $value, $options);
$oid = ".1.3.6.1.4.1.1991.1.1.3.3.6.1.4.$index";
$options['rename_rrd'] = "brocade-dom-$index";
discover_sensor_ng($device, 'current', $mib, 'snIfOpticalMonitoringTxBiasCurrent', $oid, $index, $descr . " TX Bias Current", 0.001, $value, $options);
}
}
$value = $entry['snIfOpticalMonitoringTemperature'];
if (!str_contains($value, "N/A")) {
$oid = ".1.3.6.1.4.1.1991.1.1.3.3.6.1.1.$index";
$value = $entry['snIfOpticalMonitoringTxPower'];
if (!str_contains($value, "N/A")) {
$oid = ".1.3.6.1.4.1.1991.1.1.3.3.6.1.2.$index";
$options['rename_rrd'] = "brocade-dom-$index";
discover_sensor_ng($device, 'temperature', $mib, 'snIfOpticalMonitoringTemperature', $oid, $index, NULL, $descr." Temperature", 1, $value, $options);
}
$options['rename_rrd'] = "brocade-dom-tx-$index";
if (str_icontains_array($value, 'uWatts')) {
discover_sensor_ng($device, 'power', $mib, 'snIfOpticalMonitoringTxPower', $oid, $index, $descr . " TX Power", 0.000001, $value, $options);
} else {
discover_sensor_ng($device, 'dbm', $mib, 'snIfOpticalMonitoringTxPower', $oid, $index, $descr . " TX Power", 1, $value, $options);
}
}
$value = $entry['snIfOpticalMonitoringRxPower'];
if (!str_contains($value, "N/A")) {
$oid = ".1.3.6.1.4.1.1991.1.1.3.3.6.1.3.$index";
$options['rename_rrd'] = "brocade-dom-rx-$index";
if (str_icontains_array($value, 'uWatts')) {
discover_sensor_ng($device, 'power', $mib, 'snIfOpticalMonitoringRxPower', $oid, $index, $descr . " RX Power", 0.000001, $value, $options);
} else {
discover_sensor_ng($device, 'dbm', $mib, 'snIfOpticalMonitoringRxPower', $oid, $index, $descr . " RX Power", 1, $value, $options);
}
}
$value = $entry['snIfOpticalMonitoringTemperature'];
if (!str_contains($value, "N/A")) {
$oid = ".1.3.6.1.4.1.1991.1.1.3.3.6.1.1.$index";
$options['rename_rrd'] = "brocade-dom-$index";
discover_sensor_ng($device, 'temperature', $mib, 'snIfOpticalMonitoringTemperature', $oid, $index, $descr . " Temperature", 1, $value, $options);
}
}
/*
@ -88,76 +87,75 @@ $oids = snmpwalk_cache_twopart_oid($device, "snIfOpticalLaneMonitoringTable", []
foreach ($oids as $ifIndex => $lanes) {
$options = [];
$port = get_port_by_index_cache($device['device_id'], $ifIndex);
$options = [];
$port = get_port_by_index_cache($device['device_id'], $ifIndex);
if (is_array($port)) {
$port_descr = $port["port_label"];
$options['measured_class'] = 'port';
$options['measured_entity'] = $port['port_id'];
} else {
$port_descr = snmp_get_oid($device, "ifDescr.$index", "IF-MIB");
}
foreach($lanes as $lane => $entry)
{
$lane_descr = "$port_descr Lane $lane";
$index = "$ifIndex.$lane";
if ($entry['snIfOpticalLaneMonitoringTemperature'] !== "NA") {
$value = $entry['snIfOpticalLaneMonitoringTemperature'];
$oid_name = 'snIfOpticalLaneMonitoringTemperature';
$oid_num = '.1.3.6.1.4.1.1991.1.1.3.3.10.1.2.'.$index;
$descr = "$lane_descr Temperature";
discover_sensor_ng($device, 'temperature', $mib, $oid_name, $oid_num, $index, NULL, $descr, 1, $value, $options);
if (is_array($port)) {
$port_descr = $port["port_label"];
$options['measured_class'] = 'port';
$options['measured_entity'] = $port['port_id'];
} else {
$port_descr = snmp_get_oid($device, "ifDescr.$index", "IF-MIB");
}
if ($entry['snIfOpticalLaneMonitoringTxPower'] !== "NA") {
$value = $entry['snIfOpticalLaneMonitoringTxPower'];
$oid_name = 'snIfOpticalLaneMonitoringTxPower';
$oid_num = '.1.3.6.1.4.1.1991.1.1.3.3.10.1.3.'.$index;
$descr = "$lane_descr TX Power";
foreach ($lanes as $lane => $entry) {
if (str_icontains_array($value, 'dBm')) {
discover_sensor_ng($device, 'dbm', $mib, $oid_name, $oid_num, $index, NULL, $descr, 1, $value, $options);
} else {
discover_sensor_ng($device, 'power', $mib, $oid_name, $oid_num, $index, NULL, $descr, 0.000001, $value, $options);
}
$lane_descr = "$port_descr Lane $lane";
$index = "$ifIndex.$lane";
if ($entry['snIfOpticalLaneMonitoringTemperature'] !== "NA") {
$value = $entry['snIfOpticalLaneMonitoringTemperature'];
$oid_name = 'snIfOpticalLaneMonitoringTemperature';
$oid_num = '.1.3.6.1.4.1.1991.1.1.3.3.10.1.2.' . $index;
$descr = "$lane_descr Temperature";
discover_sensor_ng($device, 'temperature', $mib, $oid_name, $oid_num, $index, $descr, 1, $value, $options);
}
if ($entry['snIfOpticalLaneMonitoringTxPower'] !== "NA") {
$value = $entry['snIfOpticalLaneMonitoringTxPower'];
$oid_name = 'snIfOpticalLaneMonitoringTxPower';
$oid_num = '.1.3.6.1.4.1.1991.1.1.3.3.10.1.3.' . $index;
$descr = "$lane_descr TX Power";
if (str_icontains_array($value, 'dBm')) {
discover_sensor_ng($device, 'dbm', $mib, $oid_name, $oid_num, $index, $descr, 1, $value, $options);
} else {
discover_sensor_ng($device, 'power', $mib, $oid_name, $oid_num, $index, $descr, 0.000001, $value, $options);
}
}
if ($entry['snIfOpticalLaneMonitoringRxPower'] !== "NA") {
$value = $entry['snIfOpticalLaneMonitoringRxPower'];
$oid_name = 'snIfOpticalLaneMonitoringRxPower';
$oid_num = '.1.3.6.1.4.1.1991.1.1.3.3.10.1.4.' . $index;
$descr = "$lane_descr RX Power";
if (str_icontains_array($value, 'dBm')) {
discover_sensor_ng($device, 'dbm', $mib, $oid_name, $oid_num, $index, $descr, 1, $value, $options);
} else {
discover_sensor_ng($device, 'power', $mib, $oid_name, $oid_num, $index, $descr, 0.000001, $value, $options);
}
}
if ($entry['snIfOpticalLaneMonitoringTxBiasCurrent'] !== "NA") {
$value = $entry['snIfOpticalLaneMonitoringTxBiasCurrent'];
$oid_name = 'snIfOpticalLaneMonitoringTxBiasCurrent';
$oid_num = '.1.3.6.1.4.1.1991.1.1.3.3.10.1.5.' . $index;
$descr = "$lane_descr TX Bias Current";
discover_sensor_ng($device, 'current', $mib, $oid_name, $oid_num, $index, $descr, 0.001, $value, $options);
}
if ($entry['snIfOpticalLaneMonitoringVoltage'] !== "NA") {
$value = $entry['snIfOpticalLaneMonitoringVoltage'];
$oid_name = 'snIfOpticalLaneMonitoringVoltage';
$oid_num = '.1.3.6.1.4.1.1991.1.1.3.3.10.1.6.' . $index;
$descr = "$lane_descr Voltage";
discover_sensor_ng($device, 'voltage', $mib, $oid_name, $oid_num, $index, $descr, 1, $value, $options);
}
}
if ($entry['snIfOpticalLaneMonitoringRxPower'] !== "NA") {
$value = $entry['snIfOpticalLaneMonitoringRxPower'];
$oid_name = 'snIfOpticalLaneMonitoringRxPower';
$oid_num = '.1.3.6.1.4.1.1991.1.1.3.3.10.1.4.'.$index;
$descr = "$lane_descr RX Power";
if (str_icontains_array($value, 'dBm')) {
discover_sensor_ng($device, 'dbm', $mib, $oid_name, $oid_num, $index, NULL, $descr, 1, $value, $options);
} else {
discover_sensor_ng($device, 'power', $mib, $oid_name, $oid_num, $index, NULL, $descr, 0.000001, $value, $options);
}
}
if ($entry['snIfOpticalLaneMonitoringTxBiasCurrent'] !== "NA") {
$value = $entry['snIfOpticalLaneMonitoringTxBiasCurrent'];
$oid_name = 'snIfOpticalLaneMonitoringTxBiasCurrent';
$oid_num = '.1.3.6.1.4.1.1991.1.1.3.3.10.1.5.'.$index;
$descr = "$lane_descr TX Bias Current";
discover_sensor_ng($device, 'current', $mib, $oid_name, $oid_num, $index, NULL, $descr, 0.001, $value, $options);
}
if ($entry['snIfOpticalLaneMonitoringVoltage'] !== "NA") {
$value = $entry['snIfOpticalLaneMonitoringVoltage'];
$oid_name = 'snIfOpticalLaneMonitoringVoltage';
$oid_num = '.1.3.6.1.4.1.1991.1.1.3.3.10.1.6.'.$index;
$descr = "$lane_descr Voltage";
discover_sensor_ng($device, 'voltage', $mib, $oid_name, $oid_num, $index, NULL, $descr, 1, $value, $options);
}
}
}

View File

@ -6,7 +6,7 @@
*
* @package observium
* @subpackage discovery
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2021 Observium Limited
* @copyright (C) Adam Armstrong
*
*/
@ -14,36 +14,34 @@
// fs-MIB::switchThermalActionRisingThreshold.1.1.1 = INTEGER: 50
// fs-MIB::switchThermalActionFallingThreshold.1.1.1 = INTEGER: 40
$oids = snmpwalk_multipart_oid($device, 'switchThermalTempValue', array(), 'fs-MIB');
$oids = snmpwalk_multipart_oid($device, 'switchThermalTempValue', [], 'fs-MIB');
if (safe_empty($oids)) {
return;
return;
}
$limit_oids = snmpwalk_multipart_oid($device, 'switchThermalActionRisingThreshold', array(), 'fs-MIB');
$limit_oids = snmpwalk_multipart_oid($device, 'switchThermalActionRisingThreshold', [], 'fs-MIB');
$limit_oids = snmpwalk_multipart_oid($device, 'switchThermalActionFallingThreshold', $limit_oids, 'fs-MIB');
print_debug_vars($oids);
print_debug_vars($limit_oids);
foreach ($oids as $unit => $entries)
{
foreach ($entries as $i => $entry)
{
$index = "$unit.$i";
foreach ($oids as $unit => $entries) {
foreach ($entries as $i => $entry) {
$index = "$unit.$i";
$descr = "Sensor $i (Unit $unit)";
$oid_name = 'switchThermalTempValue';
$oid_num = '.1.3.6.1.4.1.52642.2.1.45.1.1.11.1.3.'.$index;
//$type = $mib . '-' . $oid_name;
$value = $entry[$oid_name];
$descr = "Sensor $i (Unit $unit)";
$oid_name = 'switchThermalTempValue';
$oid_num = '.1.3.6.1.4.1.52642.2.1.45.1.1.11.1.3.' . $index;
//$type = $mib . '-' . $oid_name;
$value = $entry[$oid_name];
// Limits
if (isset($port_sw[$entry['connUnitPortIndex']])) {
$entry = array_merge($entry, array_shift($limit_oids[$unit][$i]));
// Limits
if (isset($port_sw[$entry['connUnitPortIndex']])) {
$entry = array_merge($entry, array_shift($limit_oids[$unit][$i]));
}
$limits = [
'limit_high' => $entry['switchThermalActionRisingThreshold'],
'limit_high_warn' => $entry['switchThermalActionFallingThreshold']
];
discover_sensor_ng($device, 'temperature', $mib, $oid_name, $oid_num, $index, $descr, 1, $value, $limits);
}
$limits = [
'limit_high' => $entry['switchThermalActionRisingThreshold'],
'limit_high_warn' => $entry['switchThermalActionFallingThreshold']
];
discover_sensor_ng($device, 'temperature', $mib, $oid_name, $oid_num, $index, NULL, $descr, 1, $value, $limits);
}
}
// EOF

View File

@ -1,5 +1,4 @@
<?php
/**
* Observium
*
@ -7,82 +6,76 @@
*
* @package observium
* @subpackage discovery
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2019 Observium Limited
* @copyright (C) Adam Armstrong
*
*/
$oids = snmpwalk_cache_oid($device, 'currentPmSnapshotOutputPower', array(), $mib);
$oids = snmpwalk_cache_oid($device, 'currentPmSnapshotInputPower', $oids, $mib);
$oids = snmpwalk_cache_oid($device, 'currentPmSnapshotOutputPower', [], $mib);
$oids = snmpwalk_cache_oid($device, 'currentPmSnapshotInputPower', $oids, $mib);
$oids = snmpwalk_cache_oid($device, 'currentPmSnapshotRxLineAttenuation', $oids, $mib);
$oids = snmpwalk_cache_oid($device, 'currentPmSnapshotTxLineAttenuation', $oids, $mib);
$scale = 0.1;
foreach ($oids as $index => $entry)
{
$ifDescr = snmp_get($device, "ifDescr.$index", '-Oqv');
$options = array('entPhysicalIndex' => $index);
$port = get_port_by_index_cache($device['device_id'], $index);
foreach ($oids as $index => $entry) {
$ifDescr = snmp_get($device, "ifDescr.$index", '-Oqv');
$options = ['entPhysicalIndex' => $index];
$port = get_port_by_index_cache($device['device_id'], $index);
if (is_array($port))
{
$options['measured_class'] = 'port';
$options['measured_entity'] = $port['port_id'];
}
if (is_array($port)) {
$options['measured_class'] = 'port';
$options['measured_entity'] = $port['port_id'];
}
// Output Power
//FspR7-MIB::currentPmSnapshotOutputPower.269092419 = -990
//FspR7-MIB::currentPmSnapshotOutputPower.269092609 = -22
//FspR7-MIB::currentPmSnapshotOutputPower.269092673 = 49
//FspR7-MIB::currentPmSnapshotOutputPower.269092865 = -19
if (is_numeric($entry['currentPmSnapshotOutputPower']))
{
$descr = $ifDescr . ' Output Power';
$oid = ".1.3.6.1.4.1.2544.1.11.2.6.2.156.1.1.$index";
$value = $entry['currentPmSnapshotOutputPower'];
// Output Power
//FspR7-MIB::currentPmSnapshotOutputPower.269092419 = -990
//FspR7-MIB::currentPmSnapshotOutputPower.269092609 = -22
//FspR7-MIB::currentPmSnapshotOutputPower.269092673 = 49
//FspR7-MIB::currentPmSnapshotOutputPower.269092865 = -19
if (is_numeric($entry['currentPmSnapshotOutputPower'])) {
$descr = $ifDescr . ' Output Power';
$oid = ".1.3.6.1.4.1.2544.1.11.2.6.2.156.1.1.$index";
$value = $entry['currentPmSnapshotOutputPower'];
$options['rename_rrd'] = "adva-output-power-$index";
discover_sensor_ng($device,'dbm', $mib, 'currentPmSnapshotOutputPower' , $oid, $index, NULL, $descr, $scale, $value, $options);
}
$options['rename_rrd'] = "adva-output-power-$index";
discover_sensor_ng($device, 'dbm', $mib, 'currentPmSnapshotOutputPower', $oid, $index, $descr, $scale, $value, $options);
}
// Input Power
//FspR7-MIB::currentPmSnapshotInputPower.269092419 = -990
//FspR7-MIB::currentPmSnapshotInputPower.269092609 = -42
//FspR7-MIB::currentPmSnapshotInputPower.269092673 = -120
if (is_numeric($entry['currentPmSnapshotInputPower']))
{
$descr = $ifDescr . ' Input Power';
$oid = ".1.3.6.1.4.1.2544.1.11.2.6.2.156.1.2.$index";
$value = $entry['currentPmSnapshotInputPower'];
// Input Power
//FspR7-MIB::currentPmSnapshotInputPower.269092419 = -990
//FspR7-MIB::currentPmSnapshotInputPower.269092609 = -42
//FspR7-MIB::currentPmSnapshotInputPower.269092673 = -120
if (is_numeric($entry['currentPmSnapshotInputPower'])) {
$descr = $ifDescr . ' Input Power';
$oid = ".1.3.6.1.4.1.2544.1.11.2.6.2.156.1.2.$index";
$value = $entry['currentPmSnapshotInputPower'];
$options['rename_rrd'] = "adva-input-power-$index";
discover_sensor_ng($device,'dbm', $mib, 'currentPmSnapshotInputPower', $oid, $index, NULL, $descr, $scale, $value, $options);
}
$options['rename_rrd'] = "adva-input-power-$index";
discover_sensor_ng($device, 'dbm', $mib, 'currentPmSnapshotInputPower', $oid, $index, $descr, $scale, $value, $options);
}
// Rx Line Attenuation
//FspR7-MIB::currentPmSnapshotRxLineAttenuation.252314434 = 67
//FspR7-MIB::currentPmSnapshotRxLineAttenuation.252314435 = 75
if (is_numeric($entry['currentPmSnapshotRxLineAttenuation']))
{
$descr = $ifDescr . ' Rx Line Attenuation';
$oid = ".1.3.6.1.4.1.2544.1.11.2.6.2.156.1.11.$index";
$value = $entry['currentPmSnapshotRxLineAttenuation'];
// Rx Line Attenuation
//FspR7-MIB::currentPmSnapshotRxLineAttenuation.252314434 = 67
//FspR7-MIB::currentPmSnapshotRxLineAttenuation.252314435 = 75
if (is_numeric($entry['currentPmSnapshotRxLineAttenuation'])) {
$descr = $ifDescr . ' Rx Line Attenuation';
$oid = ".1.3.6.1.4.1.2544.1.11.2.6.2.156.1.11.$index";
$value = $entry['currentPmSnapshotRxLineAttenuation'];
$options['rename_rrd'] = "adva-rx-attenuation-$index";
discover_sensor_ng($device,'snr', $mib, 'currentPmSnapshotRxLineAttenuation', $oid, $index, NULL, $descr, $scale, $value, $options);
}
$options['rename_rrd'] = "adva-rx-attenuation-$index";
discover_sensor_ng($device, 'snr', $mib, 'currentPmSnapshotRxLineAttenuation', $oid, $index, $descr, $scale, $value, $options);
}
// Tx Line Attenuation
//FspR7-MIB::currentPmSnapshotTxLineAttenuation.252314434 = 82
//FspR7-MIB::currentPmSnapshotTxLineAttenuation.252314435 = 73
if (is_numeric($entry['currentPmSnapshotTxLineAttenuation']))
{
$descr = $ifDescr . ' Tx Line Attenuation';
$oid = ".1.3.6.1.4.1.2544.1.11.2.6.2.156.1.10.$index";
$value = $entry['currentPmSnapshotTxLineAttenuation'];
// Tx Line Attenuation
//FspR7-MIB::currentPmSnapshotTxLineAttenuation.252314434 = 82
//FspR7-MIB::currentPmSnapshotTxLineAttenuation.252314435 = 73
if (is_numeric($entry['currentPmSnapshotTxLineAttenuation'])) {
$descr = $ifDescr . ' Tx Line Attenuation';
$oid = ".1.3.6.1.4.1.2544.1.11.2.6.2.156.1.10.$index";
$value = $entry['currentPmSnapshotTxLineAttenuation'];
$options['rename_rrd'] = "adva-tx-attenuation-$index";
discover_sensor_ng($device,'snr', $mib, 'currentPmSnapshotTxLineAttenuation', $oid, $index, NULL, $descr, $scale, $value, $options);
}
$options['rename_rrd'] = "adva-tx-attenuation-$index";
discover_sensor_ng($device, 'snr', $mib, 'currentPmSnapshotTxLineAttenuation', $oid, $index, $descr, $scale, $value, $options);
}
}
// EOF

View File

@ -0,0 +1,346 @@
<?php
/**
* Observium
*
* This file is part of Observium.
*
* @package observium
* @subpackage discovery
* @copyright (C) Adam Armstrong
*
*/
/// Derp MIB and data
// FSS-EQPT::eqptShelfOperational-state.'1' = INTEGER: up(1)
// FSS-EQPT::eqptShelfAdministrative-state.'1' = INTEGER: up(1)
// FSS-EQPT::eqptShelfType.'1' = STRING: BDL1-3R11
// FSS-EQPT::eqptShelfPiVendorName.'1' = STRING: FUJITSU
// FSS-EQPT::eqptShelfPiUnitName.'1' = STRING: BDL1-3R11
// FSS-EQPT::eqptShelfPiVendorUnitCode.'1' = STRING: b111
// FSS-EQPT::eqptShelfPiHwRevision.'1' = STRING: 18
// FSS-EQPT::eqptShelfPiPartNumber.'1' = STRING: FC95453R11
// FSS-EQPT::eqptShelfPiClei.'1' = STRING: WOMS610DRD
// FSS-EQPT::eqptShelfPiDom.'1' = STRING: 21.01
// FSS-EQPT::eqptShelfPiSerialNumber.'1' = STRING: 01303
// FSS-EQPT::eqptShelfPiUsi.'1' = STRING: LBFJTU012115453R111801303
// FSS-EQPT::eqptShelfRowstatus.'1' = INTEGER: active(1)
$shelf_array = snmp_cache_table($device, 'eqptShelfEntry', [], 'FSS-EQPT');
if (!snmp_status()) {
return;
}
//print_debug_vars($shelf_array);
// FSS-PM::pmEqptShelfPm-recordTime-period-indexPm-data-value."1".temperature.nearEnd.na.a15-min.0 = STRING: 24.0
// FSS-PM::pmEqptShelfPm-recordTime-period-indexPm-data-value."1".temperature.nearEnd.na.a1-day.0 = STRING: 24.0
// FSS-PM::pmEqptShelfPm-recordTime-period-indexPm-data-value."1".temperatureMin.nearEnd.na.a15-min.0 = STRING: 23.0
// FSS-PM::pmEqptShelfPm-recordTime-period-indexPm-data-value."1".temperatureMin.nearEnd.na.a1-day.0 = STRING: 23.0
// FSS-PM::pmEqptShelfPm-recordTime-period-indexPm-data-value."1".temperatureMax.nearEnd.na.a15-min.0 = STRING: 26.0
// FSS-PM::pmEqptShelfPm-recordTime-period-indexPm-data-value."1".temperatureMax.nearEnd.na.a1-day.0 = STRING: 27.0
// FSS-PM::pmEqptShelfPm-recordTime-period-indexPm-data-value."1".temperatureAvg.nearEnd.na.a15-min.0 = STRING: 23.8
// FSS-PM::pmEqptShelfPm-recordTime-period-indexPm-data-value."1".temperatureAvg.nearEnd.na.a1-day.0 = STRING: 25.21
// Cache this walk because it's shared between several modules
if(isset($_GLOBALS['snmpwalk_cache'][$device['device_id']]['pmEqptShelfPm-recordTime-period-indexPm-data-value'])) {
$oids = $_GLOBALS['snmpwalk_cache'][$device['device_id']]['pmEqptShelfPm-recordTime-period-indexPm-data-value'];
} else {
$oids = snmpwalk_cache_twopart_oid($device, 'pmEqptShelfPm-recordTime-period-indexPm-data-value', [], 'FSS-PM');
$oids = snmpwalk_cache_twopart_oid($device, 'pmEqptShelfPm-recordTime-period-indexPm-validity', $oids, 'FSS-PM');
$_GLOBALS['snmpwalk_cache'][$device['device_id']]['pmEqptShelfPm-recordTime-period-indexPm-data-value'] = $oids;
}
foreach ($oids as $shelf => $array) {
if (!isset($shelf_array[$shelf])) {
continue;
}
print_debug_vars($shelf_array[$shelf]);
$shelf_name = $shelf_array[$shelf]['eqptShelfPiVendorName'] . ' ' . $shelf_array[$shelf]['eqptShelfType'] . " #$shelf";
$shelf_sensor = 0;
foreach ($array as $index_parts => $entry) {
//$entry = array_merge($entry, $shelf_array[$shelf]);
// FSS-PM::pmEqptShelfPm-recordTime-period-indexPm-data-value."1".temperature.nearEnd.na.a15-min.0 = STRING: 24.0
// FSS-PM::pmEqptShelfPm-recordTime-period-indexPm-data-value.1.49.1.0.2.1.0 = STRING: 24.00
[ $recordMontype, $recordLocn, $recordDirn, $recordTime, $recordIndex ] = explode('.', $index_parts);
// Process only Sensors here and only first valid entry for 15 min samples
if ($recordMontype !== 'temperature' || $recordTime !== 'a15-min' || $recordIndex !== 0 ||
$entry['pmEqptShelfPm-recordTime-period-indexPm-validity'] === 'false') {
continue;
}
print_debug_vars($entry);
$shelf_sensor++;
// Convert named index to numeric
// FCMonType from FSS-COMMON-PM-TC
// temperature (1),
// temperatureMin (2),
// temperatureMax (3),
// temperatureAvg (4),
$index = snmp_string_to_oid($shelf) . '.1';
// pmEqptShelfPm-recordLocn OBJECT-TYPE
// SYNTAX INTEGER {nearEnd(0),farEnd(1)}
switch ($recordLocn) {
case 'nearEnd': $index .= '.0'; break;
case 'farEnd': $index .= '.1'; break;
}
// pmEqptShelfPm-recordDirn OBJECT-TYPE
// SYNTAX INTEGER {transmit(0),receive(1),na(2)}
switch ($recordDirn) {
case 'transmit': $index .= '.0'; break;
case 'receive': $index .= '.1'; break;
case 'na': $index .= '.2'; break;
}
// pmEqptShelfPm-recordTime-period-indexTime-period OBJECT-TYPE
// SYNTAX INTEGER {cumulative(0),a15-min(1),a1-day(2),a1-week(3),a1-month(4)}
switch ($recordTime) {
case 'cumulative': $index .= '.0'; break;
case 'a15-min': $index .= '.1'; break;
case 'a1-day': $index .= '.2'; break;
case 'a1-week': $index .= '.3'; break;
case 'a1-month': $index .= '.4'; break;
}
$index .= ".$recordIndex";
print_debug("Index converted: '$shelf.$index_parts' = '$index'");
$oid_name = 'pmEqptShelfPm-recordTime-period-indexPm-data-value';
$oid_num = ".1.3.6.1.4.1.211.1.24.12.800.2.1.3.$index";
$descr = nicecase($recordMontype) . " ($shelf_name)";
$value = $entry[$oid_name];
discover_sensor_ng($device, $recordMontype, $mib, $oid_name, $oid_num, $index, $descr, 1, $value);
}
}
// DOM sensors
/// THIS IS MOSTLY DERP DEVICE, MIB, OIDS WHICH I SEEN!!!
/// I DO NOT KNOW HOW ASSOCIATE WITH PORTS,
/// I DO NOT KNOW WHAT SENSORS MEANS
/*
FSS-EQPT::eqptShelfSlotSubslotPortPluggableInterfaceType."1"."0"."0".'C1' = STRING: Client
FSS-EQPT::eqptShelfSlotSubslotPortPluggableInterfaceType."1"."0"."0".'C2' = STRING: Client
FSS-EQPT::eqptShelfSlotSubslotPortPluggableInterfaceType."1"."0"."0".'C3' = STRING: Client
FSS-EQPT::eqptShelfSlotSubslotPortPluggableInterfaceType."1"."0"."0".'C4' = STRING: Client
FSS-EQPT::eqptShelfSlotSubslotPortPluggableInterfaceType."1"."0"."0".'C5' = STRING: Client
FSS-EQPT::eqptShelfSlotSubslotPortPluggableInterfaceType."1"."0"."0".'C6' = STRING: Client
FSS-EQPT::eqptShelfSlotSubslotPortPluggableInterfaceType."1"."0"."0".'C7' = STRING: Client
FSS-EQPT::eqptShelfSlotSubslotPortPluggableInterfaceType."1"."0"."0".'C8' = STRING: Client
FSS-EQPT::eqptShelfSlotSubslotPortPluggableInterfaceType."1"."0"."0".'C9' = STRING: Client
FSS-EQPT::eqptShelfSlotSubslotPortPluggableInterfaceType."1"."0"."0".'E-SC-E1' = STRING: 100ME
FSS-EQPT::eqptShelfSlotSubslotPortPluggableInterfaceType."1"."0"."0".'E1' = STRING: Edge
FSS-EQPT::eqptShelfSlotSubslotPortPluggableInterfaceType."1"."0"."0".'L1' = STRING: Logical
FSS-EQPT::eqptShelfSlotSubslotPortPluggableInterfaceType."1"."0"."0".'LCN1' = STRING: 1GEBT
FSS-EQPT::eqptShelfSlotSubslotPortPluggableInterfaceType."1"."0"."0".'LCN3' = STRING: 1GEBT
FSS-EQPT::eqptShelfSlotSubslotPortPluggableInterfaceType."1"."0"."0".'LCN4' = STRING: 1GEBT
FSS-EQPT::eqptShelfSlotSubslotPortPluggableInterfaceType."1"."0"."0".'LMP' = STRING: LMP
FSS-EQPT::eqptShelfSlotSubslotPortPluggableInterfaceType."1"."0"."0".'OSC' = STRING: OSC
FSS-EQPT::eqptShelfSlotSubslotPortPluggableInterfaceType."2"."0"."0".'C1' = STRING: Client
FSS-EQPT::eqptShelfSlotSubslotPortPluggableInterfaceType."2"."0"."0".'C9' = STRING: Client
FSS-EQPT::eqptShelfSlotSubslotPortPluggableInterfaceType."2"."0"."0".'E-SC-E1' = STRING: 100ME
FSS-EQPT::eqptShelfSlotSubslotPortPluggableInterfaceType."2"."0"."0".'E1' = STRING: Edge
FSS-EQPT::eqptShelfSlotSubslotPortPluggableInterfaceType."2"."0"."0".'L1' = STRING: Logical
FSS-EQPT::eqptShelfSlotSubslotPortPluggableInterfaceType."2"."0"."0".'LCN3' = STRING: 1GEBT
FSS-EQPT::eqptShelfSlotSubslotPortPluggableInterfaceType."2"."0"."0".'LCN4' = STRING: 1GEBT
FSS-EQPT::eqptShelfSlotSubslotPortPluggableInterfaceType."2"."0"."0".'OSC' = STRING: OSC
*/
/*
FSS-PM::pmEqptShelfSlotSubslotPortPm-recordTime-period-indexPm-data-value."1"."0"."0"."8".opticalPowerReceive.nearEnd.receive.a15-min.0 = STRING: -17.2
FSS-PM::pmEqptShelfSlotSubslotPortPm-recordTime-period-indexPm-data-value."1"."0"."0"."8".opticalPowerTransmit.nearEnd.transmit.a15-min.0 = STRING: 4.7
FSS-PM::pmEqptShelfSlotSubslotPortPm-recordTime-period-indexPm-data-value."1"."0"."0"."8".laserBiasCurrent.nearEnd.transmit.a15-min.0 = STRING: 9.2
FSS-PM::pmEqptShelfSlotSubslotPortPm-recordTime-period-indexPm-data-value."1"."0"."0"."9".opticalPowerReceive.nearEnd.receive.a15-min.0 = STRING: 4.5
FSS-PM::pmEqptShelfSlotSubslotPortPm-recordTime-period-indexPm-data-value."1"."0"."0"."11".opticalPowerReceiveOts.nearEnd.receive.a15-min.0 = STRING: -8.5
FSS-PM::pmEqptShelfSlotSubslotPortPm-recordTime-period-indexPm-data-value."1"."0"."0"."11".opticalPowerTransmitOts.nearEnd.transmit.a15-min.0 = STRING: 9.2
FSS-PM::pmEqptShelfSlotSubslotPortPm-recordTime-period-indexPm-data-value."1"."0"."0"."11".opticalPowerReceiveOms.nearEnd.receive.a15-min.0 = STRING: -9.4
FSS-PM::pmEqptShelfSlotSubslotPortPm-recordTime-period-indexPm-data-value."1"."0"."0"."11".opticalPowerTransmitOms.nearEnd.transmit.a15-min.0 = STRING: 8.0
FSS-PM::pmEqptShelfSlotSubslotPortPm-recordTime-period-indexPm-data-value."1"."0"."0"."11".opticalPowerReceiveOsc.nearEnd.receive.a15-min.0 = STRING: -16.1
FSS-PM::pmEqptShelfSlotSubslotPortPm-recordTime-period-indexPm-data-value."1"."0"."0"."11".opticalPowerTransmitOsc.nearEnd.transmit.a15-min.0 = STRING: 2.9
FSS-PM::pmEqptShelfSlotSubslotPortPm-recordTime-period-indexPm-data-value."1"."0"."0"."11".spanLoss.nearEnd.receive.a15-min.0 = STRING: 18.2
FSS-PM::pmEqptShelfSlotSubslotPortPm-recordTime-period-indexPm-data-value."1"."0"."0"."11".spanLossVariation.nearEnd.receive.a15-min.0 = STRING: -0.4
FSS-PM::pmEqptShelfSlotSubslotPortPm-recordTime-period-indexPm-data-value."1"."0"."0"."11".reflectionPower.nearEnd.receive.a15-min.0 = STRING: 32.6
FSS-PM::pmEqptShelfSlotSubslotPortPm-recordTime-period-indexPm-data-value."1"."0"."0"."12".opticalPowerReceive.nearEnd.receive.a15-min.0 = STRING: 3.3
FSS-PM::pmEqptShelfSlotSubslotPortPm-recordTime-period-indexPm-data-value."1"."0"."0"."12".opticalPowerTransmit.nearEnd.transmit.a15-min.0 = STRING: 3.2
FSS-PM::pmEqptShelfSlotSubslotPortPm-recordTime-period-indexPm-data-value."1"."0"."0"."13".opticalPowerReceive.nearEnd.receive.a15-min.0 = STRING: -99.9
FSS-PM::pmEqptShelfSlotSubslotPortPm-recordTime-period-indexPm-data-value."1"."0"."0"."13".opticalPowerTransmit.nearEnd.transmit.a15-min.0 = STRING: -99.9
FSS-PM::pmEqptShelfSlotSubslotPortPm-recordTime-period-indexPm-data-value."1"."0"."0"."14".opticalPowerReceive.nearEnd.receive.a15-min.0 = STRING: -99.9
FSS-PM::pmEqptShelfSlotSubslotPortPm-recordTime-period-indexPm-data-value."1"."0"."0"."14".opticalPowerTransmit.nearEnd.transmit.a15-min.0 = STRING: -99.9
FSS-PM::pmEqptShelfSlotSubslotPortPm-recordTime-period-indexPm-data-value."1"."0"."0"."15".opticalPowerReceive.nearEnd.receive.a15-min.0 = STRING: -99.9
FSS-PM::pmEqptShelfSlotSubslotPortPm-recordTime-period-indexPm-data-value."1"."0"."0"."15".opticalPowerTransmit.nearEnd.transmit.a15-min.0 = STRING: -99.9
FSS-PM::pmEqptShelfSlotSubslotPortPm-recordTime-period-indexPm-data-value."1"."0"."0"."16".opticalPowerReceive.nearEnd.receive.a15-min.0 = STRING: -99.9
FSS-PM::pmEqptShelfSlotSubslotPortPm-recordTime-period-indexPm-data-value."1"."0"."0"."16".opticalPowerTransmit.nearEnd.transmit.a15-min.0 = STRING: -99.9
FSS-PM::pmEqptShelfSlotSubslotPortPm-recordTime-period-indexPm-data-value."1"."0"."0"."17".opticalPowerReceive.nearEnd.receive.a15-min.0 = STRING: -99.9
FSS-PM::pmEqptShelfSlotSubslotPortPm-recordTime-period-indexPm-data-value."1"."0"."0"."17".opticalPowerTransmit.nearEnd.transmit.a15-min.0 = STRING: -99.9
FSS-PM::pmEqptShelfSlotSubslotPortPm-recordTime-period-indexPm-data-value."1"."0"."0"."18".opticalPowerReceive.nearEnd.receive.a15-min.0 = STRING: -99.9
FSS-PM::pmEqptShelfSlotSubslotPortPm-recordTime-period-indexPm-data-value."1"."0"."0"."18".opticalPowerTransmit.nearEnd.transmit.a15-min.0 = STRING: -99.9
FSS-PM::pmEqptShelfSlotSubslotPortPm-recordTime-period-indexPm-data-value."1"."0"."0"."19".opticalPowerReceive.nearEnd.receive.a15-min.0 = STRING: -99.9
FSS-PM::pmEqptShelfSlotSubslotPortPm-recordTime-period-indexPm-data-value."1"."0"."0"."19".opticalPowerTransmit.nearEnd.transmit.a15-min.0 = STRING: -99.9
FSS-PM::pmEqptShelfSlotSubslotPortPm-recordTime-period-indexPm-data-value."1"."0"."0"."20".opticalPowerReceive.nearEnd.receive.a15-min.0 = STRING: 0.3
FSS-PM::pmEqptShelfSlotSubslotPortPm-recordTime-period-indexPm-data-value."1"."0"."0"."20".opticalPowerTransmit.nearEnd.transmit.a15-min.0 = STRING: -9.0
FSS-PM::pmEqptShelfSlotSubslotPortPm-recordTime-period-indexPm-data-value."2"."0"."0"."8".opticalPowerReceive.nearEnd.receive.a15-min.0 = STRING: -24.5
FSS-PM::pmEqptShelfSlotSubslotPortPm-recordTime-period-indexPm-data-value."2"."0"."0"."8".opticalPowerTransmit.nearEnd.transmit.a15-min.0 = STRING: 4.3
FSS-PM::pmEqptShelfSlotSubslotPortPm-recordTime-period-indexPm-data-value."2"."0"."0"."8".laserBiasCurrent.nearEnd.transmit.a15-min.0 = STRING: 9.4
FSS-PM::pmEqptShelfSlotSubslotPortPm-recordTime-period-indexPm-data-value."2"."0"."0"."9".opticalPowerReceive.nearEnd.receive.a15-min.0 = STRING: 3.9
FSS-PM::pmEqptShelfSlotSubslotPortPm-recordTime-period-indexPm-data-value."2"."0"."0"."11".opticalPowerReceiveOts.nearEnd.receive.a15-min.0 = STRING: -13.0
FSS-PM::pmEqptShelfSlotSubslotPortPm-recordTime-period-indexPm-data-value."2"."0"."0"."11".opticalPowerTransmitOts.nearEnd.transmit.a15-min.0 = STRING: 12.3
FSS-PM::pmEqptShelfSlotSubslotPortPm-recordTime-period-indexPm-data-value."2"."0"."0"."11".opticalPowerReceiveOms.nearEnd.receive.a15-min.0 = STRING: -13.4
FSS-PM::pmEqptShelfSlotSubslotPortPm-recordTime-period-indexPm-data-value."2"."0"."0"."11".opticalPowerTransmitOms.nearEnd.transmit.a15-min.0 = STRING: 11.8
FSS-PM::pmEqptShelfSlotSubslotPortPm-recordTime-period-indexPm-data-value."2"."0"."0"."11".opticalPowerReceiveOsc.nearEnd.receive.a15-min.0 = STRING: -23.4
FSS-PM::pmEqptShelfSlotSubslotPortPm-recordTime-period-indexPm-data-value."2"."0"."0"."11".opticalPowerTransmitOsc.nearEnd.transmit.a15-min.0 = STRING: 2.9
FSS-PM::pmEqptShelfSlotSubslotPortPm-recordTime-period-indexPm-data-value."2"."0"."0"."11".spanLoss.nearEnd.receive.a15-min.0 = STRING: 25.1
FSS-PM::pmEqptShelfSlotSubslotPortPm-recordTime-period-indexPm-data-value."2"."0"."0"."11".spanLossVariation.nearEnd.receive.a15-min.0 = STRING: -0.5
FSS-PM::pmEqptShelfSlotSubslotPortPm-recordTime-period-indexPm-data-value."2"."0"."0"."11".reflectionPower.nearEnd.receive.a15-min.0 = STRING: 33.0
FSS-PM::pmEqptShelfSlotSubslotPortPm-recordTime-period-indexPm-data-value."2"."0"."0"."12".opticalPowerReceive.nearEnd.receive.a15-min.0 = STRING: 2.9
FSS-PM::pmEqptShelfSlotSubslotPortPm-recordTime-period-indexPm-data-value."2"."0"."0"."12".opticalPowerTransmit.nearEnd.transmit.a15-min.0 = STRING: 3.2
FSS-PM::pmEqptShelfSlotSubslotPortPm-recordTime-period-indexPm-data-value."2"."0"."0"."20".opticalPowerReceive.nearEnd.receive.a15-min.0 = STRING: -0.2
FSS-PM::pmEqptShelfSlotSubslotPortPm-recordTime-period-indexPm-data-value."2"."0"."0"."20".opticalPowerTransmit.nearEnd.transmit.a15-min.0 = STRING: -9.0
*/
// This walk is only done once in code at present, so no cache.
$oids = snmpwalk_cache_oid($device, 'pmEqptShelfSlotSubslotPortPm-recordTime-period-indexPm-data-value', [], 'FSS-PM');
$oids = snmpwalk_cache_oid($device, 'pmEqptShelfSlotSubslotPortPm-recordTime-period-indexPm-validity', $oids, 'FSS-PM');
print_debug_vars($oids);
// FCMonType from FSS-COMMON-PM-TC
// temperature (1),
// opticalPowerReceive (6),
// opticalPowerTransmit (13),
// laserBiasCurrent (17),
// opticalPowerReceiveLane1 (18),
// opticalPowerTransmitLane1 (21),
// laserBiasCurrentLane1 (24),
// opticalPowerReceiveLane2 (25),
// opticalPowerTransmitLane2 (28),
// laserBiasCurrentLane2 (31),
// opticalPowerReceiveLane3 (32),
// opticalPowerTransmitLane3 (35),
// laserBiasCurrentLane3 (38),
// opticalPowerReceiveLane4 (39),
// opticalPowerTransmitLane4 (42),
// laserBiasCurrentLane4 (45),
// opticalSignalNoiseRatio (49),
$record_montypes = [
'temperature' => [ 'index' => 1, 'descr' => 'Temperature', 'class' => 'temperature' ], // not seen
'opticalPowerReceive' => [ 'index' => 6, 'descr' => 'RX Power', 'class' => 'dbm' ],
'opticalPowerTransmit' => [ 'index' => 13, 'descr' => 'TX Power', 'class' => 'dbm' ],
'laserBiasCurrent' => [ 'index' => 17, 'descr' => 'TX Bias', 'class' => 'current' ],
'opticalPowerReceiveLane1' => [ 'index' => 18, 'descr' => 'RX Power Lane 1', 'class' => 'dbm', 'unit' => 'split_lane1' ],
'opticalPowerTransmitLane1' => [ 'index' => 21, 'descr' => 'TX Power Lane 1', 'class' => 'dbm', 'unit' => 'split_lane1' ],
'laserBiasCurrentLane1' => [ 'index' => 24, 'descr' => 'TX Bias Lane 1', 'class' => 'current', 'unit' => 'split_lane1' ],
'opticalPowerReceiveLane2' => [ 'index' => 25, 'descr' => 'RX Power Lane 2', 'class' => 'dbm', 'unit' => 'split_lane2' ],
'opticalPowerTransmitLane2' => [ 'index' => 28, 'descr' => 'TX Power Lane 2', 'class' => 'dbm', 'unit' => 'split_lane2' ],
'laserBiasCurrentLane2' => [ 'index' => 31, 'descr' => 'TX Bias Lane 2', 'class' => 'current', 'unit' => 'split_lane2' ],
'opticalPowerReceiveLane3' => [ 'index' => 32, 'descr' => 'RX Power Lane 3', 'class' => 'dbm', 'unit' => 'split_lane3' ],
'opticalPowerTransmitLane3' => [ 'index' => 35, 'descr' => 'TX Power Lane 3', 'class' => 'dbm', 'unit' => 'split_lane3' ],
'laserBiasCurrentLane3' => [ 'index' => 38, 'descr' => 'TX Bias Lane 3', 'class' => 'current', 'unit' => 'split_lane3' ],
'opticalPowerReceiveLane4' => [ 'index' => 39, 'descr' => 'RX Power Lane 4', 'class' => 'dbm', 'unit' => 'split_lane4' ],
'opticalPowerTransmitLane4' => [ 'index' => 42, 'descr' => 'TX Power Lane 4', 'class' => 'dbm', 'unit' => 'split_lane4' ],
'laserBiasCurrentLane4' => [ 'index' => 45, 'descr' => 'TX Bias Lane 4', 'class' => 'current', 'unit' => 'split_lane4' ],
'opticalSignalNoiseRatio' => [ 'index' => 49, 'descr' => 'SNR', 'class' => 'snr' ],
];
foreach ($oids as $index_parts => $entry) {
[ $shelf, $shelf_slot, $shelf_subslot, $shelf_port,
$recordMontype, $recordLocn, $recordDirn, $recordTime, $recordIndex ] = explode('.', $index_parts);
if (!isset($shelf_array[$shelf])) {
continue;
}
//print_debug_vars($shelf_array[$shelf]);
$shelf_name = $shelf_array[$shelf]['eqptShelfPiVendorName'] . ' ' . $shelf_array[$shelf]['eqptShelfType'] . " #$shelf";
$shelf_sensor = 0;
// Process only Sensors here
print_debug_vars($entry);
if ($recordTime !== 'a15-min' || $entry['pmEqptShelfPm-recordTime-period-indexPm-validity'] === 'false' || $recordIndex !== 0 ||
!isset($record_montypes[$recordMontype])) {
continue;
}
//print_debug_vars($entry);
$index = snmp_string_to_oid($shelf) . '.' . snmp_string_to_oid($shelf_slot) . '.' .
snmp_string_to_oid($shelf_subslot) . '.' . snmp_string_to_oid($shelf_port);
$index .= '.' . $record_montypes[$recordMontype]['index'];
// pmEqptShelfPm-recordLocn OBJECT-TYPE
// SYNTAX INTEGER {nearEnd(0),farEnd(1)}
switch ($recordLocn) {
case 'nearEnd': $index .= '.0'; break;
case 'farEnd': $index .= '.1'; break;
}
// pmEqptShelfPm-recordDirn OBJECT-TYPE
// SYNTAX INTEGER {transmit(0),receive(1),na(2)}
switch ($recordDirn) {
case 'transmit': $index .= '.0'; break;
case 'receive': $index .= '.1'; break;
case 'na': $index .= '.2'; break;
}
// pmEqptShelfPm-recordTime-period-indexTime-period OBJECT-TYPE
// SYNTAX INTEGER {cumulative(0),a15-min(1),a1-day(2),a1-week(3),a1-month(4)}
switch ($recordTime) {
case 'cumulative': $index .= '.0'; break;
case 'a15-min': $index .= '.1'; break;
case 'a1-day': $index .= '.2'; break;
case 'a1-week': $index .= '.3'; break;
case 'a1-month': $index .= '.4'; break;
}
$index .= ".$recordIndex";
print_debug("Index converted: '$index_parts' = '$index'");
$port_label = "port-$shelf/$shelf_slot/$shelf_subslot/$shelf_port";
$descr = $port_label . ' ' . $record_montypes[$recordMontype]['descr'];
$options = [
'measured_class' => 'fiber',
'measured_entity_label' => $port_label,
];
if (isset($record_montypes[$recordMontype]['unit'])) {
$options['sensor_unit'] = $record_montypes[$recordMontype]['unit'];
}
$oid_name = 'pmEqptShelfSlotSubslotPortPm-recordTime-period-indexPm-data-value';
$oid_num = ".1.3.6.1.4.1.211.1.24.12.800.8.1.3.$index";
$value = $entry[$oid_name];
if ($record_montypes[$recordMontype]['class'] === 'dbm' && $value === '-99.9') {
// Not sure, seems as not exist port
continue;
}
discover_sensor_ng($device, $record_montypes[$recordMontype]['class'], $mib, $oid_name, $oid_num, $index, $descr, 1, $entry[$oid_name], $options);
}
// EOF

File diff suppressed because it is too large Load Diff

View File

@ -5,9 +5,9 @@
*
* This file is part of Observium.
*
* @package observium
* @subpackage discovery
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2019 Observium Limited
* @package observium
* @subpackage discovery
* @copyright (C) Adam Armstrong
*
*/
@ -16,45 +16,40 @@
// GUDEADS-PDU8110-MIB::pdu8110HygroSensor.1 = INTEGER: -9999 0.1 percent humidity
// GUDEADS-PDU8110-MIB::pdu8110HygroSensor.2 = INTEGER: -9999 0.1 percent humidity
$cache['pdu8110x'] = snmpwalk_cache_oid($device, 'pdu8110SensorTable', array(), 'GUDEADS-PDU8110-MIB');
$cache['pdu8110x'] = snmpwalk_cache_oid($device, 'pdu8110SensorTable', [], 'GUDEADS-PDU8110-MIB');
$scale = 0.1;
foreach ($cache['pdu8110x'] as $index => $entry)
{
$oid = ".1.3.6.1.4.1.28507.23.1.6.1.1.2.$index";
$descr = "Temp Sensor $index";
$value = $entry['pdu8110TempSensor'];
foreach ($cache['pdu8110x'] as $index => $entry) {
$oid = ".1.3.6.1.4.1.28507.23.1.6.1.1.2.$index";
$descr = "Temp Sensor $index";
$value = $entry['pdu8110TempSensor'];
if ($value != '' && $value != -9999)
{
discover_sensor('temperature', $device, $oid, 'pdu8110TempSensor.'.$index, 'pdu8110', $descr, $scale, $value);
}
if ($value != '' && $value != -9999) {
discover_sensor('temperature', $device, $oid, 'pdu8110TempSensor.' . $index, 'pdu8110', $descr, $scale, $value);
}
$oid = ".1.3.6.1.4.1.28507.23.1.6.1.1.3.$index";
$descr = "Hygro Sensor $index";
$value = $entry['pdu8110HygroSensor'];
$oid = ".1.3.6.1.4.1.28507.23.1.6.1.1.3.$index";
$descr = "Hygro Sensor $index";
$value = $entry['pdu8110HygroSensor'];
if ($value != '' && $value != -9999)
{
discover_sensor('humidity', $device, $oid, 'pdu8110HygroSensor.'.$index, 'pdu8110', $descr, $scale, $value);
}
if ($value != '' && $value != -9999) {
discover_sensor('humidity', $device, $oid, 'pdu8110HygroSensor.' . $index, 'pdu8110', $descr, $scale, $value);
}
}
$channels = snmp_get($device, 'pdu8110ActivePowerChan.0','-Oqv', 'GUDEADS-PDU8110-MIB');
$channels = snmp_get($device, 'pdu8110ActivePowerChan.0', '-Oqv', 'GUDEADS-PDU8110-MIB');
$scale = 0.001;
for ($index = 1;$index <= $channels;$index++)
{
// GUDEADS-PDU8110-MIB::pdu8110Current.1 = Gauge32: 933 mA
for ($index = 1; $index <= $channels; $index++) {
// GUDEADS-PDU8110-MIB::pdu8110Current.1 = Gauge32: 933 mA
$oid = ".1.3.6.1.4.1.28507.23.1.5.1.2.1.5.$index";
$descr = 'Output';
$value = snmp_get($device, "pdu8110Current.$index",'-Oqv', 'GUDEADS-PDU8110-MIB');
$oid = ".1.3.6.1.4.1.28507.23.1.5.1.2.1.5.$index";
$descr = 'Output';
$value = snmp_get($device, "pdu8110Current.$index", '-Oqv', 'GUDEADS-PDU8110-MIB');
if ($value != '' && $value != -9999)
{
discover_sensor('current', $device, $oid, "pdu8110Current.$index", 'pdu8110', $descr, $scale, $value);
}
if ($value != '' && $value != -9999) {
discover_sensor('current', $device, $oid, "pdu8110Current.$index", 'pdu8110', $descr, $scale, $value);
}
}
// EOF

View File

@ -5,72 +5,66 @@
*
* This file is part of Observium.
*
* @package observium
* @subpackage discovery
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2019 Observium Limited
* @package observium
* @subpackage discovery
* @copyright (C) Adam Armstrong
*
*/
$channels = snmp_get($device, 'pdu8310ActivePowerChan.0','-Oqv', 'GUDEADS-PDU8310-MIB');
$channels = snmp_get($device, 'pdu8310ActivePowerChan.0', '-Oqv', 'GUDEADS-PDU8310-MIB');
for ($index = 1;$index <= $channels;$index++)
{
// GUDEADS-PDU8310-MIB::pdu8310Voltage.1 = Gauge32: 230 V
for ($index = 1; $index <= $channels; $index++) {
// GUDEADS-PDU8310-MIB::pdu8310Voltage.1 = Gauge32: 230 V
$oid = ".1.3.6.1.4.1.28507.27.1.5.1.2.1.6.$index";
$descr = 'Output';
$value = snmp_get($device, "pdu8310Voltage.$index",'-Oqv', 'GUDEADS-PDU8310-MIB');
$oid = ".1.3.6.1.4.1.28507.27.1.5.1.2.1.6.$index";
$descr = 'Output';
$value = snmp_get($device, "pdu8310Voltage.$index", '-Oqv', 'GUDEADS-PDU8310-MIB');
if ($value != '' && $value != -9999)
{
discover_sensor('voltage', $device, $oid, "pdu8310Voltage.$index", 'pdu8310', $descr, 1, $value);
}
if ($value != '' && $value != -9999) {
discover_sensor('voltage', $device, $oid, "pdu8310Voltage.$index", 'pdu8310', $descr, 1, $value);
}
// GUDEADS-PDU8310-MIB::pdu8310PowerActive.1 = Gauge32: 39 W
// GUDEADS-PDU8310-MIB::pdu8310PowerActive.1 = Gauge32: 39 W
$oid = ".1.3.6.1.4.1.28507.27.1.5.1.2.1.4.$index";
$descr = 'Output';
$value = snmp_get($device, "pdu8310PowerActive.$index",'-Oqv', 'GUDEADS-PDU8310-MIB');
$oid = ".1.3.6.1.4.1.28507.27.1.5.1.2.1.4.$index";
$descr = 'Output';
$value = snmp_get($device, "pdu8310PowerActive.$index", '-Oqv', 'GUDEADS-PDU8310-MIB');
if ($value != '' && $value != -9999)
{
discover_sensor('power', $device, $oid, "pdu8310PowerActive.$index", 'pdu8310', $descr, 1, $value);
}
if ($value != '' && $value != -9999) {
discover_sensor('power', $device, $oid, "pdu8310PowerActive.$index", 'pdu8310', $descr, 1, $value);
}
// GUDEADS-PDU8310-MIB::pdu8310PowerApparent.1 = Gauge32: 77 VA
// GUDEADS-PDU8310-MIB::pdu8310PowerApparent.1 = Gauge32: 77 VA
$oid = ".1.3.6.1.4.1.28507.27.1.5.1.2.1.10.$index";
$descr = 'Output';
$value = snmp_get($device, "pdu8310PowerApparent.$index",'-Oqv', 'GUDEADS-PDU8310-MIB');
$oid = ".1.3.6.1.4.1.28507.27.1.5.1.2.1.10.$index";
$descr = 'Output';
$value = snmp_get($device, "pdu8310PowerApparent.$index", '-Oqv', 'GUDEADS-PDU8310-MIB');
if ($value != '' && $value != -9999)
{
discover_sensor('apower', $device, $oid, "pdu8310PowerApparent.$index", 'pdu8310', $descr, 1, $value);
}
if ($value != '' && $value != -9999) {
discover_sensor('apower', $device, $oid, "pdu8310PowerApparent.$index", 'pdu8310', $descr, 1, $value);
}
// GUDEADS-PDU8310-MIB::pdu8310Frequency.1 = Gauge32: 4997 0.01 hz
// GUDEADS-PDU8310-MIB::pdu8310Frequency.1 = Gauge32: 4997 0.01 hz
$oid = ".1.3.6.1.4.1.28507.27.1.5.1.2.1.7.$index";
$descr = 'Output';
$value = snmp_get($device, "pdu8310Frequency.$index",'-Oqv', 'GUDEADS-PDU8310-MIB');
$oid = ".1.3.6.1.4.1.28507.27.1.5.1.2.1.7.$index";
$descr = 'Output';
$value = snmp_get($device, "pdu8310Frequency.$index", '-Oqv', 'GUDEADS-PDU8310-MIB');
$scale = 0.01;
if ($value != '' && $value != -9999)
{
discover_sensor('frequency', $device, $oid, "pdu8310Frequency.$index", 'pdu8310', $descr, $scale, $value);
}
$scale = 0.01;
if ($value != '' && $value != -9999) {
discover_sensor('frequency', $device, $oid, "pdu8310Frequency.$index", 'pdu8310', $descr, $scale, $value);
}
// GUDEADS-PDU8310-MIB::pdu8310Current.1 = Gauge32: 336 mA
// GUDEADS-PDU8310-MIB::pdu8310Current.1 = Gauge32: 336 mA
$oid = ".1.3.6.1.4.1.28507.27.1.5.1.2.1.5.$index";
$descr = 'Output';
$value = snmp_get($device, "pdu8310Current.$index",'-Oqv', 'GUDEADS-PDU8310-MIB');
$oid = ".1.3.6.1.4.1.28507.27.1.5.1.2.1.5.$index";
$descr = 'Output';
$value = snmp_get($device, "pdu8310Current.$index", '-Oqv', 'GUDEADS-PDU8310-MIB');
$scale = 0.001;
if ($value != '' && $value != -9999)
{
discover_sensor('current', $device, $oid, "pdu8310Current.$index", 'pdu8310', $descr, $scale, $value);
}
$scale = 0.001;
if ($value != '' && $value != -9999) {
discover_sensor('current', $device, $oid, "pdu8310Current.$index", 'pdu8310', $descr, $scale, $value);
}
}
// EOF

View File

@ -7,78 +7,71 @@
*
* @package observium
* @subpackage discovery
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2019 Observium Limited
* @copyright (C) Adam Armstrong
*
*/
$oids = array('h3cEntityExtStateTable', 'entPhysicalName');
$entity_array = array();
foreach ($oids as $oid)
{
$entity_array = snmpwalk_cache_oid($device, $oid, $entity_array, 'ENTITY-MIB:HH3C-ENTITY-EXT-MIB');
$oids = ['h3cEntityExtStateTable', 'entPhysicalName'];
$entity_array = [];
foreach ($oids as $oid) {
$entity_array = snmpwalk_cache_oid($device, $oid, $entity_array, 'ENTITY-MIB:HH3C-ENTITY-EXT-MIB');
}
foreach ($entity_array as $index => $entry)
{
// HH3C-ENTITY-EXT-MIB::hh3cEntityExtTemperature.8 = INTEGER: 50
// HH3C-ENTITY-EXT-MIB::hh3cEntityExtTemperatureThreshold.8 = INTEGER: 85
// HH3C-ENTITY-EXT-MIB::hh3cEntityExtCriticalTemperatureThreshold.8 = INTEGER: 95
// HH3C-ENTITY-EXT-MIB::hh3cEntityExtLowerTemperatureThreshold.8 = INTEGER: -30
// HH3C-ENTITY-EXT-MIB::hh3cEntityExtShutdownTemperatureThreshold.8 = INTEGER: 65535
if ($entry['hh3cEntityExtTemperature'] != 0 &&
$entry['hh3cEntityExtTemperature'] != 65535 &&
$entry['hh3cEntityExtTemperatureThreshold'] != 65535 &&
$entry['hh3cEntityExtLowerTemperatureThreshold'] != 65535)
{
foreach ($entity_array as $index => $entry) {
// HH3C-ENTITY-EXT-MIB::hh3cEntityExtTemperature.8 = INTEGER: 50
// HH3C-ENTITY-EXT-MIB::hh3cEntityExtTemperatureThreshold.8 = INTEGER: 85
// HH3C-ENTITY-EXT-MIB::hh3cEntityExtCriticalTemperatureThreshold.8 = INTEGER: 95
// HH3C-ENTITY-EXT-MIB::hh3cEntityExtLowerTemperatureThreshold.8 = INTEGER: -30
// HH3C-ENTITY-EXT-MIB::hh3cEntityExtShutdownTemperatureThreshold.8 = INTEGER: 65535
if ($entry['hh3cEntityExtTemperature'] != 0 &&
$entry['hh3cEntityExtTemperature'] != 65535 &&
$entry['hh3cEntityExtTemperatureThreshold'] != 65535 &&
$entry['hh3cEntityExtLowerTemperatureThreshold'] != 65535) {
$options = array();
$options = [];
if($entry['hh3cEntityExtLowerTemperatureThreshold'] != 65535)
{
$options['limit_low'] = $entry['hh3cEntityExtLowerTemperatureThreshold'];
}
if($entry['hh3cEntityExtTemperatureThreshold'] != 65535 && $entry['hh3cEntityExtTemperatureThreshold'] != 0)
{
$options['limit_high_warn'] = $entry['hh3cEntityExtTemperatureThreshold'];
if ($entry['hh3cEntityExtLowerTemperatureThreshold'] != 65535) {
$options['limit_low'] = $entry['hh3cEntityExtLowerTemperatureThreshold'];
}
if ($entry['hh3cEntityExtTemperatureThreshold'] != 65535 && $entry['hh3cEntityExtTemperatureThreshold'] != 0) {
$options['limit_high_warn'] = $entry['hh3cEntityExtTemperatureThreshold'];
}
if (($entry['hh3cEntityExtCriticalTemperatureThreshold'] != 65535 && $entry['hh3cEntityExtCriticalTemperatureThreshold'] != 0 &&
$entry['hh3cEntityExtCriticalTemperatureThreshold'] >= $entry['hh3cEntityExtTemperatureThreshold'])) {
$options['limit_high'] = $entry['hh3cEntityExtCriticalTemperatureThreshold'];
} elseif (isset($options['limit_high_warn'])) {
$options['limit_high'] = $options['limit_high_warn'] + 10;
}
$value = $entry['hh3cEntityExtTemperature'];
$oid = ".1.3.6.1.4.1.25506.2.6.1.1.1.1.12.$index";
$oid_name = "hh3cEntityExtTemperature";
$descr = $entry['entPhysicalName'];
$options['rename_rrd'] = "hh3c-entity-ext-mib-hh3cEntityExtTemperature.$index";
discover_sensor_ng($device, 'temperature', $mib, $oid_name, $oid, $index, $descr, 1, $value, $options);
}
if (($entry['hh3cEntityExtCriticalTemperatureThreshold'] != 65535 && $entry['hh3cEntityExtCriticalTemperatureThreshold'] != 0 &&
$entry['hh3cEntityExtCriticalTemperatureThreshold'] >= $entry['hh3cEntityExtTemperatureThreshold']))
{
$options['limit_high'] = $entry['hh3cEntityExtCriticalTemperatureThreshold'];
} elseif(isset($options['limit_high_warn'])) {
$options['limit_high'] = $options['limit_high_warn'] + 10;
// HH3C-ENTITY-EXT-MIB::hh3cEntityExtVoltage.1 = INTEGER: 0
// HH3C-ENTITY-EXT-MIB::hh3cEntityExtVoltageLowThreshold.1 = INTEGER: 0
// HH3C-ENTITY-EXT-MIB::hh3cEntityExtVoltageHighThreshold.1 = INTEGER: 0
if ($entry['hh3cEntityExtVoltage'] != 0) {
$options['limit_low'] = $entry['hh3cEntityExtVoltageLowThreshold'];
$options['limit_high'] = $entry['hh3cEntityExtVoltageHighThreshold'];
$value = $entry['hh3cEntityExtVoltage'];
$oid = ".1.3.6.1.4.1.25506.2.6.1.1.1.1.14.$index";
$oid_name = "hh3cEntityExtVoltage";
$descr = $entry['entPhysicalName'];
$options['rename_rrd'] = "hh3c-entity-ext-mib-hh3cEntityExtVoltage.$index";
discover_sensor_ng($device, 'voltage', $mib, $oid_name, $oid, $index, $descr, 1, $value, $options);
// FIXME scale is unknown, and not documented in the MIB; probably not 1?? My V1910 doesn't have voltage sensors.
}
$value = $entry['hh3cEntityExtTemperature'];
$oid = ".1.3.6.1.4.1.25506.2.6.1.1.1.1.12.$index";
$oid_name = "hh3cEntityExtTemperature";
$descr = $entry['entPhysicalName'];
$options['rename_rrd'] = "hh3c-entity-ext-mib-hh3cEntityExtTemperature.$index";
discover_sensor_ng($device,'temperature', $mib, $oid_name, $oid, $index, NULL, $descr, 1, $value, $options);
}
// HH3C-ENTITY-EXT-MIB::hh3cEntityExtVoltage.1 = INTEGER: 0
// HH3C-ENTITY-EXT-MIB::hh3cEntityExtVoltageLowThreshold.1 = INTEGER: 0
// HH3C-ENTITY-EXT-MIB::hh3cEntityExtVoltageHighThreshold.1 = INTEGER: 0
if ($entry['hh3cEntityExtVoltage'] != 0)
{
$options['limit_low'] = $entry['hh3cEntityExtVoltageLowThreshold'];
$options['limit_high'] = $entry['hh3cEntityExtVoltageHighThreshold'];
$value = $entry['hh3cEntityExtVoltage'];
$oid = ".1.3.6.1.4.1.25506.2.6.1.1.1.1.14.$index";
$oid_name = "hh3cEntityExtVoltage";
$descr = $entry['entPhysicalName'];
$options['rename_rrd'] = "hh3c-entity-ext-mib-hh3cEntityExtVoltage.$index";
discover_sensor_ng($device,'voltage', $mib, $oid_name, $oid, $index, NULL, $descr, 1, $value, $options);
// FIXME scale is unknown, and not documented in the MIB; probably not 1?? My V1910 doesn't have voltage sensors.
}
// [hh3cEntityExtErrorStatus] => normal
// [hh3cEntityExtErrorStatus] => normal
}
unset($oids, $index, $value, $descr);

View File

@ -1,5 +1,4 @@
<?php
/**
* Observium
*
@ -7,7 +6,7 @@
*
* @package observium
* @subpackage discovery
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2019 Observium Limited
* @copyright (C) Adam Armstrong
*
*/
@ -25,134 +24,129 @@
// FIXME -- definitions
$oids = snmpwalk_cache_oid($device, 'h3cTransceiver', array(), 'HH3C-TRANSCEIVER-INFO-MIB');
$oids = snmpwalk_cache_oid($device, 'hh3cTransceiverInfoTable ', [], 'HH3C-TRANSCEIVER-INFO-MIB');
// Index = ifIndex
foreach ($oids as $index => $entry)
{
$options = [];
$entry['index'] = $index;
foreach ($oids as $index => $entry) {
$options = [];
$entry['index'] = $index;
// Associate measured port
$def = ['measured_match' => ['match' => '%index%', 'field' => 'ifIndex', 'entity_type' => 'port']];
if ($measured = entity_measured_match_definition($device, $def, $entry))
{
$options = $measured;
} else {
$options['port_label'] = "Port $index";
}
// Associate measured port
$def = ['measured_match' => ['match' => '%index%', 'field' => 'ifIndex', 'entity_type' => 'port']];
if ($measured = entity_measured_match_definition($device, $def, $entry)) {
$options = $measured;
} else {
$options['port_label'] = "Port $index";
}
$transceiver = ' (' . rewrite_vendor($entry['hh3cTransceiverVendorName']) . ' ' . $entry['hh3cTransceiverHardwareType'] .
' ' . $entry['hh3cTransceiverType'] . ' ' . $entry['hh3cTransceiverWaveLength'] . 'nm)';
$transceiver = ' (' . rewrite_vendor($entry['hh3cTransceiverVendorName']) . ' ' . $entry['hh3cTransceiverHardwareType'] .
' ' . $entry['hh3cTransceiverType'] . ' ' . $entry['hh3cTransceiverWaveLength'] . 'nm)';
// hh3cTransceiverTemperature.54 = INTEGER: 39
$descr = $options['port_label'] . ' Temperature';
$descr .= $transceiver;
$value = $entry['hh3cTransceiverTemperature'];
$scale = 1;
$oid = "1.3.6.1.4.1.25506.2.70.1.1.1.15.$index";
$oid_name = 'hh3cTransceiverTemperature';
// hh3cTransceiverTemperature.54 = INTEGER: 39
$descr = $options['port_label'] . ' Temperature';
$descr .= $transceiver;
$value = $entry['hh3cTransceiverTemperature'];
$scale = 1;
$oid = ".1.3.6.1.4.1.25506.2.70.1.1.1.15.$index";
$oid_name = 'hh3cTransceiverTemperature';
if ($value != 0 && $value < 2147483647)
{
$scale_limit = 0.001; // Limits have different scale
$limits = [
'limit_high' => $entry['hh3cTransceiverTempHiAlarm'] * $scale_limit,
'limit_high_warn' => $entry['hh3cTransceiverTempHiWarn'] * $scale_limit,
'limit_low_warn' => $entry['hh3cTransceiverTempLoWarn'] * $scale_limit,
'limit_low' => $entry['hh3cTransceiverTempLoAlarm'] * $scale_limit,
];
$options['rename_rrd'] = "hh3c-transceiver-info-mib-hh3cTransceiverTemperature.$index";
discover_sensor_ng($device, 'temperature', $mib, $oid_name, $oid, $index, NULL, $descr, $scale, $value, array_merge($options, $limits));
}
if ($value != 0 && $value < 2147483647) {
$scale_limit = 0.001; // Limits have different scale
$limits = [
'limit_high' => $entry['hh3cTransceiverTempHiAlarm'] * $scale_limit,
'limit_high_warn' => $entry['hh3cTransceiverTempHiWarn'] * $scale_limit,
'limit_low_warn' => $entry['hh3cTransceiverTempLoWarn'] * $scale_limit,
'limit_low' => $entry['hh3cTransceiverTempLoAlarm'] * $scale_limit,
];
$options['rename_rrd'] = "hh3c-transceiver-info-mib-hh3cTransceiverTemperature.$index";
discover_sensor_ng($device, 'temperature', $mib, $oid_name, $oid, $index, $descr, $scale, $value, array_merge($options, $limits));
}
// hh3cTransceiverBiasCurrent.54 = INTEGER: 532
$descr = $options['port_label'] . ' Bias Current';
$descr .= $transceiver;
$value = $entry['hh3cTransceiverBiasCurrent'];
$scale = 0.00001;
$oid = "1.3.6.1.4.1.25506.2.70.1.1.1.17.$index";
$oid_name = 'hh3cTransceiverBiasCurrent';
// hh3cTransceiverBiasCurrent.54 = INTEGER: 532
$descr = $options['port_label'] . ' Bias';
$descr .= $transceiver;
$value = $entry['hh3cTransceiverBiasCurrent'];
$scale = 0.00001;
$oid = ".1.3.6.1.4.1.25506.2.70.1.1.1.17.$index";
$oid_name = 'hh3cTransceiverBiasCurrent';
if ($value != 0 && $value < 2147483647)
{
$scale_limit = 0.000001; // Limits have different scale
$limits = [
'limit_high' => $entry['hh3cTransceiverBiasHiAlarm'] * $scale_limit,
'limit_high_warn' => $entry['hh3cTransceiverBiasHiWarn'] * $scale_limit,
'limit_low_warn' => $entry['hh3cTransceiverBiasLoWarn'] * $scale_limit,
'limit_low' => $entry['hh3cTransceiverBiasLoAlarm'] * $scale_limit,
];
$options['rename_rrd'] = "hh3c-transceiver-info-mib-hh3cTransceiverBiasCurrent.$index";
discover_sensor_ng($device,'current', $mib, $oid_name, $oid, $index, NULL, $descr, $scale, $value, array_merge($options, $limits));
}
if ($value != 0 && $value < 2147483647) {
$scale_limit = 0.000001; // Limits have different scale
$limits = [
'limit_high' => $entry['hh3cTransceiverBiasHiAlarm'] * $scale_limit,
'limit_high_warn' => $entry['hh3cTransceiverBiasHiWarn'] * $scale_limit,
'limit_low_warn' => $entry['hh3cTransceiverBiasLoWarn'] * $scale_limit,
'limit_low' => $entry['hh3cTransceiverBiasLoAlarm'] * $scale_limit,
];
$options['rename_rrd'] = "hh3c-transceiver-info-mib-hh3cTransceiverBiasCurrent.$index";
discover_sensor_ng($device, 'current', $mib, $oid_name, $oid, $index, $descr, $scale, $value, array_merge($options, $limits));
}
// hh3cTransceiverVoltage.54 = INTEGER: 325
$descr = $options['port_label'] . ' Voltage';
$descr .= $transceiver;
$value = $entry['hh3cTransceiverVoltage'];
$scale = 0.01;
$oid = "1.3.6.1.4.1.25506.2.70.1.1.1.16.$index";
$oid_name = 'hh3cTransceiverVoltage';
// hh3cTransceiverVoltage.54 = INTEGER: 325
$descr = $options['port_label'] . ' Voltage';
$descr .= $transceiver;
$value = $entry['hh3cTransceiverVoltage'];
$scale = 0.01;
$oid = ".1.3.6.1.4.1.25506.2.70.1.1.1.16.$index";
$oid_name = 'hh3cTransceiverVoltage';
if ($value != 0 && $value < 2147483647)
{
$scale_limit = 0.0001; // Limits have different scale
$limits = [
'limit_high' => $entry['hh3cTransceiverVccHiAlarm'] * $scale_limit,
'limit_high_warn' => $entry['hh3cTransceiverVccHiWarn'] * $scale_limit,
'limit_low_warn' => $entry['hh3cTransceiverVccLoWarn'] * $scale_limit,
'limit_low' => $entry['hh3cTransceiverVccLoAlarm'] * $scale_limit,
];
$options['rename_rrd'] = "hh3c-transceiver-info-mib-hh3cTransceiverVoltage.$index";
discover_sensor_ng($device,'voltage', $mib, $oid_name, $oid, $index, NULL, $descr, $scale, $value, array_merge($options, $limits));
}
if ($value != 0 && $value < 2147483647) {
$scale_limit = 0.0001; // Limits have different scale
$limits = [
'limit_high' => $entry['hh3cTransceiverVccHiAlarm'] * $scale_limit,
'limit_high_warn' => $entry['hh3cTransceiverVccHiWarn'] * $scale_limit,
'limit_low_warn' => $entry['hh3cTransceiverVccLoWarn'] * $scale_limit,
'limit_low' => $entry['hh3cTransceiverVccLoAlarm'] * $scale_limit,
];
$options['rename_rrd'] = "hh3c-transceiver-info-mib-hh3cTransceiverVoltage.$index";
discover_sensor_ng($device, 'voltage', $mib, $oid_name, $oid, $index, $descr, $scale, $value, array_merge($options, $limits));
}
// hh3cTransceiverCurTXPower.54 = INTEGER: -251
$descr = $options['port_label'] . ' TX Power';
$descr .= $transceiver;
$value = $entry['hh3cTransceiverCurTXPower'];
$scale = 0.01;
$oid = "1.3.6.1.4.1.25506.2.70.1.1.1.9.$index";
$oid_name = 'hh3cTransceiverCurTXPower';
// hh3cTransceiverCurTXPower.54 = INTEGER: -251
$descr = $options['port_label'] . ' TX Power';
$descr .= $transceiver;
$value = $entry['hh3cTransceiverCurTXPower'];
$scale = 0.01;
$oid = ".1.3.6.1.4.1.25506.2.70.1.1.1.9.$index";
$oid_name = 'hh3cTransceiverCurTXPower';
if ($value != 0 && $value < 2147483647)
{
// derp, power in dbm, but limits in watts....
// 22387 -> 0.0022387W -> 3.5dBm
$scale_limit = 0.0000001; // Limits have different scale
$limits = [
'limit_high' => value_to_si($entry['hh3cTransceiverPwrOutHiAlarm'] * $scale_limit, 'W', 'dbm'),
'limit_high_warn' => value_to_si($entry['hh3cTransceiverPwrOutHiWarn'] * $scale_limit, 'W', 'dbm'),
'limit_low_warn' => value_to_si($entry['hh3cTransceiverPwrOutLoWarn'] * $scale_limit, 'W', 'dbm'),
'limit_low' => value_to_si($entry['hh3cTransceiverPwrOutLoAlarm'] * $scale_limit, 'W', 'dbm'),
];
$options['rename_rrd'] = "hh3c-transceiver-info-mib-hh3cTransceiverCurTXPower.$index";
discover_sensor_ng($device, 'dbm', $mib, $oid_name, $oid, $index, NULL, $descr, $scale, $value, array_merge($options, $limits));
}
if ($value != 0 && $value < 2147483647) {
// derp, power in dbm, but limits in watts....
// 22387 -> 0.0022387W -> 3.5dBm
$scale_limit = 0.0000001; // Limits have different scale
$limits = [
'limit_unit' => 'W', // need unit conversion
'limit_high' => $entry['hh3cTransceiverPwrOutHiAlarm'] * $scale_limit,
'limit_high_warn' => $entry['hh3cTransceiverPwrOutHiWarn'] * $scale_limit,
'limit_low_warn' => $entry['hh3cTransceiverPwrOutLoWarn'] * $scale_limit,
'limit_low' => $entry['hh3cTransceiverPwrOutLoAlarm'] * $scale_limit,
];
$options['rename_rrd'] = "hh3c-transceiver-info-mib-hh3cTransceiverCurTXPower.$index";
discover_sensor_ng($device, 'dbm', $mib, $oid_name, $oid, $index, $descr, $scale, $value, array_merge($options, $limits));
}
// hh3cTransceiverCurRXPower.54 = INTEGER: -834
$descr = $options['port_label'] . ' RX Power';
$descr .= $transceiver;
$value = $entry['hh3cTransceiverCurRXPower'];
$scale = 0.01;
$oid = "1.3.6.1.4.1.25506.2.70.1.1.1.12.$index";
$oid_name = 'hh3cTransceiverCurRXPower';
// hh3cTransceiverCurRXPower.54 = INTEGER: -834
$descr = $options['port_label'] . ' RX Power';
$descr .= $transceiver;
$value = $entry['hh3cTransceiverCurRXPower'];
$scale = 0.01;
$oid = ".1.3.6.1.4.1.25506.2.70.1.1.1.12.$index";
$oid_name = 'hh3cTransceiverCurRXPower';
if ($value != 0 && $value < 2147483647)
{
// derp, power in dbm, but limits in watts....
// 22387 -> 0.0022387W -> 3.5dBm
$scale_limit = 0.0000001; // Limits have different scale
$limits = [
'limit_high' => value_to_si($entry['hh3cTransceiverRcvPwrHiAlarm'] * $scale_limit, 'W', 'dbm'),
'limit_high_warn' => value_to_si($entry['hh3cTransceiverRcvPwrHiWarn'] * $scale_limit, 'W', 'dbm'),
'limit_low_warn' => value_to_si($entry['hh3cTransceiverRcvPwrLoWarn'] * $scale_limit, 'W', 'dbm'),
'limit_low' => value_to_si($entry['hh3cTransceiverRcvPwrLoAlarm'] * $scale_limit, 'W', 'dbm'),
];
$options['rename_rrd'] = "hh3c-transceiver-info-mib-hh3cTransceiverCurRXPower.$index";
discover_sensor_ng($device, 'dbm', $mib, $oid_name, $oid, $index, NULL, $descr, $scale, $value, array_merge($options, $limits));
}
if ($value != 0 && $value < 2147483647) {
// derp, power in dbm, but limits in watts....
// 22387 -> 0.0022387W -> 3.5dBm
$scale_limit = 0.0000001; // Limits have different scale
$limits = [
'limit_unit' => 'W', // need unit conversion
'limit_high' => $entry['hh3cTransceiverRcvPwrHiAlarm'] * $scale_limit,
'limit_high_warn' => $entry['hh3cTransceiverRcvPwrHiWarn'] * $scale_limit,
'limit_low_warn' => $entry['hh3cTransceiverRcvPwrLoWarn'] * $scale_limit,
'limit_low' => $entry['hh3cTransceiverRcvPwrLoAlarm'] * $scale_limit,
];
$options['rename_rrd'] = "hh3c-transceiver-info-mib-hh3cTransceiverCurRXPower.$index";
discover_sensor_ng($device, 'dbm', $mib, $oid_name, $oid, $index, $descr, $scale, $value, array_merge($options, $limits));
}
}
// EOF

View File

@ -6,16 +6,18 @@
*
* @package observium
* @subpackage discovery
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2021 Observium Limited
* @copyright (C) Adam Armstrong
*
*/
$oids = snmpwalk_multipart_oid($device, 'hpicfXcvrChannelInfoEntry', [], 'HP-ICF-TRANSCEIVER-MIB');
if (!snmp_status()) { return; }
if (!snmp_status()) {
return;
}
print_debug_vars($oids);
// This oids already cached by definition discovery
$extra = [
$extra = [
'hpicfXcvrModel', 'hpicfXcvrType', 'hpicfXcvrWavelength',
'hpicfXcvrBiasLoAlarm', 'hpicfXcvrBiasLoWarn', 'hpicfXcvrBiasHiAlarm', 'hpicfXcvrBiasHiWarn',
'hpicfXcvrPwrOutLoAlarm', 'hpicfXcvrPwrOutLoWarn', 'hpicfXcvrPwrOutHiAlarm', 'hpicfXcvrPwrOutHiWarn',
@ -23,7 +25,7 @@ $extra = [
];
$oids_extra = [];
foreach ($extra as $oid) {
$oids_extra = snmp_cache_table($device, $oid, $oids_extra, 'HP-ICF-TRANSCEIVER-MIB');
$oids_extra = snmp_cache_table($device, $oid, $oids_extra, 'HP-ICF-TRANSCEIVER-MIB');
}
// HP-ICF-TRANSCEIVER-MIB::hpicfXcvrChannelTxBias.353.1 = Gauge32: 34292 microamps
// HP-ICF-TRANSCEIVER-MIB::hpicfXcvrChannelTxBias.353.2 = Gauge32: 34960 microamps
@ -39,91 +41,91 @@ foreach ($extra as $oid) {
// HP-ICF-TRANSCEIVER-MIB::hpicfXcvrChannelRxPower.354.2 = INTEGER: -1318 thousandths of dBm
foreach ($oids as $ifIndex => $lanes) {
foreach ($lanes as $lane => $entry) {
$index = $ifIndex . '.' . $lane;
foreach ($lanes as $lane => $entry) {
$index = $ifIndex . '.' . $lane;
if (isset($oids_extra[$ifIndex])) {
$entry = array_merge($entry, $oids_extra[$ifIndex]);
if (isset($oids_extra[$ifIndex])) {
$entry = array_merge($entry, $oids_extra[$ifIndex]);
}
$entry['ifIndex'] = $ifIndex;
$entry['index'] = $index;
//print_debug_vars($entry);
$match = ['measured_match' => ['entity_type' => 'port', 'field' => 'ifIndex', 'match' => '%ifIndex%']];
$options = entity_measured_match_definition($device, $match, $entry);
$name = $options['port_label'] . ' Lane ' . $lane;
// Tx Bias
$descr = $name . ' Tx Bias (' . $entry['hpicfXcvrModel'] . ' ' . $entry['hpicfXcvrType'] . ', ' . $entry['hpicfXcvrWavelength'] . ')';
$descr = preg_replace('/ *\?\? */', '', $descr);
$class = 'current';
$oid_name = 'hpicfXcvrChannelTxBias';
$oid_num = '.1.3.6.1.4.1.11.2.14.11.5.1.82.1.1.2.1.2.' . $index;
$scale = 0.000001;
$value = $entry[$oid_name];
$limits_def = [
'class' => 'current',
'limit_scale' => 0.000001,
'oid_limit_low' => 'hpicfXcvrBiasLoAlarm',
'oid_limit_low_warn' => 'hpicfXcvrBiasLoWarn',
'oid_limit_high' => 'hpicfXcvrBiasHiAlarm',
'oid_limit_high_warn' => 'hpicfXcvrBiasHiWarn',
];
$limits = entity_limits_definition($device, $limits_def, $entry, $scale);
discover_sensor_ng($device, $class, $mib, $oid_name, $oid_num, $index, $descr, $scale, $value, array_merge($options, $limits));
// Tx Power
$descr = $name . ' Tx Power (' . $entry['hpicfXcvrModel'] . ' ' . $entry['hpicfXcvrType'] . ', ' . $entry['hpicfXcvrWavelength'] . ')';
$descr = preg_replace('/ *\?\? */', '', $descr);
$class = 'dbm';
$oid_name = 'hpicfXcvrChannelTxPower';
$oid_num = '.1.3.6.1.4.1.11.2.14.11.5.1.82.1.1.2.1.3.' . $index;
$scale = 0.001;
$value = $entry[$oid_name];
$limits_def = [
'class' => 'dbm', // class required for unit conversion
'limit_scale' => 0.0000001,
'limit_unit' => 'W', // Strange choice, limits in different unit
'oid_limit_low' => 'hpicfXcvrPwrOutLoAlarm',
'oid_limit_low_warn' => 'hpicfXcvrPwrOutLoWarn',
'oid_limit_high' => 'hpicfXcvrPwrOutHiAlarm',
'oid_limit_high_warn' => 'hpicfXcvrPwrOutHiWarn',
'invalid_limit_low' => 0,
'invalid_limit_low_warn' => 0,
'invalid_limit_high' => 0,
'invalid_limit_high_warn' => 0,
];
$limits = entity_limits_definition($device, $limits_def, $entry, $scale);
discover_sensor_ng($device, $class, $mib, $oid_name, $oid_num, $index, $descr, $scale, $value, array_merge($options, $limits));
// Rx Power
$descr = $name . ' Rx Power (' . $entry['hpicfXcvrModel'] . ' ' . $entry['hpicfXcvrType'] . ', ' . $entry['hpicfXcvrWavelength'] . ')';
$descr = preg_replace('/ *\?\? */', '', $descr);
$class = 'dbm';
$oid_name = 'hpicfXcvrChannelRxPower';
$oid_num = '.1.3.6.1.4.1.11.2.14.11.5.1.82.1.1.2.1.4.' . $index;
$scale = 0.001;
$value = $entry[$oid_name];
$limits_def = [
'class' => 'dbm', // class required for unit conversion
'limit_scale' => 0.0000001,
'limit_unit' => 'W', // Strange choice, limits in different unit
'oid_limit_low' => 'hpicfXcvrRcvPwrLoAlarm',
'oid_limit_low_warn' => 'hpicfXcvrRcvPwrLoWarn',
'oid_limit_high' => 'hpicfXcvrRcvPwrHiAlarm',
'oid_limit_high_warn' => 'hpicfXcvrRcvPwrHiWarn',
];
$limits = entity_limits_definition($device, $limits_def, $entry, $scale);
discover_sensor_ng($device, $class, $mib, $oid_name, $oid_num, $index, $descr, $scale, $value, array_merge($options, $limits));
}
$entry['ifIndex'] = $ifIndex;
$entry['index'] = $index;
//print_debug_vars($entry);
$match = [ 'measured_match' => [ 'entity_type' => 'port', 'field' => 'ifIndex', 'match' => '%ifIndex%' ] ];
$options = entity_measured_match_definition($device, $match, $entry);
$name = $options['port_label'] . ' Lane '. $lane;
// Tx Bias
$descr = $name . ' Tx Bias ('.$entry['hpicfXcvrModel'].' '.$entry['hpicfXcvrType'].', '.$entry['hpicfXcvrWavelength'].')';
$descr = preg_replace('/ *\?\? */', '', $descr);
$class = 'current';
$oid_name = 'hpicfXcvrChannelTxBias';
$oid_num = '.1.3.6.1.4.1.11.2.14.11.5.1.82.1.1.2.1.2.'.$index;
$scale = 0.000001;
$value = $entry[$oid_name];
$limits_def = [
'class' => 'current',
'limit_scale' => 0.000001,
'oid_limit_low' => 'hpicfXcvrBiasLoAlarm',
'oid_limit_low_warn' => 'hpicfXcvrBiasLoWarn',
'oid_limit_high' => 'hpicfXcvrBiasHiAlarm',
'oid_limit_high_warn' => 'hpicfXcvrBiasHiWarn',
];
$limits = entity_limits_definition($device, $limits_def, $entry, $scale);
discover_sensor_ng($device, $class, $mib, $oid_name, $oid_num, $index, NULL, $descr, $scale, $value, array_merge($options, $limits));
// Tx Power
$descr = $name . ' Tx Power ('.$entry['hpicfXcvrModel'].' '.$entry['hpicfXcvrType'].', '.$entry['hpicfXcvrWavelength'].')';
$descr = preg_replace('/ *\?\? */', '', $descr);
$class = 'dbm';
$oid_name = 'hpicfXcvrChannelTxPower';
$oid_num = '.1.3.6.1.4.1.11.2.14.11.5.1.82.1.1.2.1.3.'.$index;
$scale = 0.001;
$value = $entry[$oid_name];
$limits_def = [
'class' => 'dbm', // class required for unit conversion
'limit_scale' => 0.0000001,
'limit_unit' => 'W', // Strange choice, limits in different unit
'oid_limit_low' => 'hpicfXcvrPwrOutLoAlarm',
'oid_limit_low_warn' => 'hpicfXcvrPwrOutLoWarn',
'oid_limit_high' => 'hpicfXcvrPwrOutHiAlarm',
'oid_limit_high_warn' => 'hpicfXcvrPwrOutHiWarn',
'invalid_limit_low' => 0,
'invalid_limit_low_warn' => 0,
'invalid_limit_high' => 0,
'invalid_limit_high_warn' => 0,
];
$limits = entity_limits_definition($device, $limits_def, $entry, $scale);
discover_sensor_ng($device, $class, $mib, $oid_name, $oid_num, $index, NULL, $descr, $scale, $value, array_merge($options, $limits));
// Rx Power
$descr = $name . ' Rx Power ('.$entry['hpicfXcvrModel'].' '.$entry['hpicfXcvrType'].', '.$entry['hpicfXcvrWavelength'].')';
$descr = preg_replace('/ *\?\? */', '', $descr);
$class = 'dbm';
$oid_name = 'hpicfXcvrChannelRxPower';
$oid_num = '.1.3.6.1.4.1.11.2.14.11.5.1.82.1.1.2.1.4.'.$index;
$scale = 0.001;
$value = $entry[$oid_name];
$limits_def = [
'class' => 'dbm', // class required for unit conversion
'limit_scale' => 0.0000001,
'limit_unit' => 'W', // Strange choice, limits in different unit
'oid_limit_low' => 'hpicfXcvrRcvPwrLoAlarm',
'oid_limit_low_warn' => 'hpicfXcvrRcvPwrLoWarn',
'oid_limit_high' => 'hpicfXcvrRcvPwrHiAlarm',
'oid_limit_high_warn' => 'hpicfXcvrRcvPwrHiWarn',
];
$limits = entity_limits_definition($device, $limits_def, $entry, $scale);
discover_sensor_ng($device, $class, $mib, $oid_name, $oid_num, $index, NULL, $descr, $scale, $value, array_merge($options, $limits));
}
}
// EOF

View File

@ -1,5 +1,4 @@
<?php
/**
* Observium
*
@ -7,71 +6,66 @@
*
* @package observium
* @subpackage discovery
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2019 Observium Limited
* @copyright (C) Adam Armstrong
*
*/
echo(" HPN-ICF-ENTITY-EXT-MIB ");
$oids = array('hpnicfEntityExtStateTable', 'entPhysicalName');
$entity_array = array();
foreach ($oids as $oid)
{
$entity_array = snmpwalk_cache_oid($device, $oid, $entity_array, 'ENTITY-MIB:HPN-ICF-ENTITY-EXT-MIB');
$oids = ['hpnicfEntityExtStateTable', 'entPhysicalName'];
$entity_array = [];
foreach ($oids as $oid) {
$entity_array = snmpwalk_cache_oid($device, $oid, $entity_array, 'ENTITY-MIB:HPN-ICF-ENTITY-EXT-MIB');
}
foreach ($entity_array as $index => $entry)
{
// HPN-ICF-ENTITY-EXT-MIB::hpnicfEntityExtTemperature.8 = INTEGER: 50
// HPN-ICF-ENTITY-EXT-MIB::hpnicfEntityExtTemperatureThreshold.8 = INTEGER: 85
// HPN-ICF-ENTITY-EXT-MIB::hpnicfEntityExtCriticalTemperatureThreshold.8 = INTEGER: 95
// HPN-ICF-ENTITY-EXT-MIB::hpnicfEntityExtLowerTemperatureThreshold.8 = INTEGER: -30
// HPN-ICF-ENTITY-EXT-MIB::hpnicfEntityExtShutdownTemperatureThreshold.8 = INTEGER: 65535
foreach ($entity_array as $index => $entry) {
// HPN-ICF-ENTITY-EXT-MIB::hpnicfEntityExtTemperature.8 = INTEGER: 50
// HPN-ICF-ENTITY-EXT-MIB::hpnicfEntityExtTemperatureThreshold.8 = INTEGER: 85
// HPN-ICF-ENTITY-EXT-MIB::hpnicfEntityExtCriticalTemperatureThreshold.8 = INTEGER: 95
// HPN-ICF-ENTITY-EXT-MIB::hpnicfEntityExtLowerTemperatureThreshold.8 = INTEGER: -30
// HPN-ICF-ENTITY-EXT-MIB::hpnicfEntityExtShutdownTemperatureThreshold.8 = INTEGER: 65535
$options = array('entPhysicalIndex' => $index);
$options = ['entPhysicalIndex' => $index];
if ($entry['hpnicfEntityExtTemperature'] != 65535 &&
$entry['hpnicfEntityExtTemperatureThreshold'] != 65535 &&
$entry['hpnicfEntityExtLowerTemperatureThreshold'] != 65535)
{
$options['limit_low'] = $entry['hpnicfEntityExtLowerTemperatureThreshold'];
$options['limit_high_warn'] = $entry['hpnicfEntityExtTemperatureThreshold'];
if (($entry['hpnicfEntityExtCriticalTemperatureThreshold'] != 65535 && $entry['hpnicfEntityExtCriticalTemperatureThreshold'] >= $entry['hpnicfEntityExtTemperatureThreshold']))
{
$options['limit_high'] = $entry['hpnicfEntityExtCriticalTemperatureThreshold'];
} else {
$options['limit_high'] = $entry['hpnicfEntityExtTemperatureThreshold'] + 10;
if ($entry['hpnicfEntityExtTemperature'] != 65535 &&
$entry['hpnicfEntityExtTemperatureThreshold'] != 65535 &&
$entry['hpnicfEntityExtLowerTemperatureThreshold'] != 65535) {
$options['limit_low'] = $entry['hpnicfEntityExtLowerTemperatureThreshold'];
$options['limit_high_warn'] = $entry['hpnicfEntityExtTemperatureThreshold'];
if (($entry['hpnicfEntityExtCriticalTemperatureThreshold'] != 65535 && $entry['hpnicfEntityExtCriticalTemperatureThreshold'] >= $entry['hpnicfEntityExtTemperatureThreshold'])) {
$options['limit_high'] = $entry['hpnicfEntityExtCriticalTemperatureThreshold'];
} else {
$options['limit_high'] = $entry['hpnicfEntityExtTemperatureThreshold'] + 10;
}
$value = $entry['hpnicfEntityExtTemperature'];
$oid = ".1.3.6.1.4.1.11.2.14.11.15.2.6.1.1.1.1.12.$index";
$descr = $entry['entPhysicalName'];
$oid_name = 'hpnicfEntityExtTemperature';
$options['rename_rrd'] = "hh3c-entity-ext-mib-hpnicfEntityExtTemperature.$index";
discover_sensor_ng($device, 'temperature', $mib, $oid_name, $oid, $index, $descr, 1, $value, $options);
}
$value = $entry['hpnicfEntityExtTemperature'];
$oid = ".1.3.6.1.4.1.11.2.14.11.15.2.6.1.1.1.1.12.$index";
$descr = $entry['entPhysicalName'];
$oid_name = 'hpnicfEntityExtTemperature';
// HPN-ICF-ENTITY-EXT-MIB::hpnicfEntityExtVoltage.1 = INTEGER: 0
// HPN-ICF-ENTITY-EXT-MIB::hpnicfEntityExtVoltageLowThreshold.1 = INTEGER: 0
// HPN-ICF-ENTITY-EXT-MIB::hpnicfEntityExtVoltageHighThreshold.1 = INTEGER: 0
$options['rename_rrd'] = "hh3c-entity-ext-mib-hpnicfEntityExtTemperature.$index";
discover_sensor_ng($device,'temperature', $mib, $oid_name, $oid, $index, NULL, $descr, 1, $value, $options);
}
if ($entry['hpnicfEntityExtVoltage'] != 0) {
$options['limit_low'] = $entry['hpnicfEntityExtVoltageLowThreshold'];
$options['limit_high'] = $entry['hpnicfEntityExtVoltageHighThreshold'];
// HPN-ICF-ENTITY-EXT-MIB::hpnicfEntityExtVoltage.1 = INTEGER: 0
// HPN-ICF-ENTITY-EXT-MIB::hpnicfEntityExtVoltageLowThreshold.1 = INTEGER: 0
// HPN-ICF-ENTITY-EXT-MIB::hpnicfEntityExtVoltageHighThreshold.1 = INTEGER: 0
$oid_name = 'hpnicfEntityExtVoltage';
$value = $entry['hpnicfEntityExtVoltage'];
$oid = ".1.3.6.1.4.1.11.2.14.11.15.2.6.1.1.1.1.14.$index";
$descr = $entry['entPhysicalName'];
if ($entry['hpnicfEntityExtVoltage'] != 0)
{
$options['limit_low'] = $entry['hpnicfEntityExtVoltageLowThreshold'];
$options['limit_high'] = $entry['hpnicfEntityExtVoltageHighThreshold'];
// FIXME scale is unknown, and not documented in the MIB; probably not 1?? My V1910 doesn't have voltage sensors.
$options['rename_rrd'] = "hh3c-entity-ext-mib-hpnicfEntityExtVoltage.$index";
discover_sensor_ng($device, 'voltage', $mib, $oid_name, $oid, $index, $descr, 1, $value, $options);
}
$oid_name = 'hpnicfEntityExtVoltage';
$value = $entry['hpnicfEntityExtVoltage'];
$oid = ".1.3.6.1.4.1.11.2.14.11.15.2.6.1.1.1.1.14.$index";
$descr = $entry['entPhysicalName'];
// FIXME scale is unknown, and not documented in the MIB; probably not 1?? My V1910 doesn't have voltage sensors.
$options['rename_rrd'] = "hh3c-entity-ext-mib-hpnicfEntityExtVoltage.$index";
discover_sensor_ng($device,'voltage', $mib, $oid_name, $oid, $index, NULL, $descr, 1, $value, $options);
}
// [hpnicfEntityExtErrorStatus] => normal
// [hpnicfEntityExtErrorStatus] => normal
}
unset($oids, $index, $value, $descr, $options);

View File

@ -6,7 +6,7 @@
*
* @package observium
* @subpackage discovery
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2022 Observium Limited
* @copyright (C) Adam Armstrong
*
*/
@ -16,81 +16,83 @@
//HUAWEI-ENTITY-EXTENT-MIB::hwEntityBomEnDesc.67371017 = STRING: Finished Board,S9700,EH1D2L08QX2E,8-Port 40GE QSFP+ Interface Card(X2E,QSFP+),20M TCAM
//HUAWEI-ENTITY-EXTENT-MIB::hwEntityBomEnDesc.68419593 = STRING: Finished Board,S12700,ET1D2X48SX2S,48-Port 10GE SFP+ Interface Card(X2S,SFP+)
$huawei['sensors_names'] = snmpwalk_cache_oid($device, 'hwEntityBomEnDesc', array(), 'HUAWEI-ENTITY-EXTENT-MIB');
$huawei['sensors_names'] = snmpwalk_cache_oid($device, 'hwEntityBomEnDesc', [], 'HUAWEI-ENTITY-EXTENT-MIB');
//$huawei['sensors_names'] = snmpwalk_cache_oid($device, 'entPhysicalName', $huawei['sensors_names'], 'ENTITY-MIB');
//$huawei['sensors_names'] = snmpwalk_cache_oid($device, 'entPhysicalAlias', $huawei['sensors_names'], 'ENTITY-MIB');
$huawei['temp'] = snmpwalk_cache_oid($device, 'hwEntityTemperature', array(), 'HUAWEI-ENTITY-EXTENT-MIB');
$huawei['voltage'] = snmpwalk_cache_oid($device, 'hwEntityVoltage', array(), 'HUAWEI-ENTITY-EXTENT-MIB');
$huawei['fan'] = snmpwalk_cache_oid($device, 'hwFanStatusEntry', array(), 'HUAWEI-ENTITY-EXTENT-MIB');
$huawei['temp'] = snmpwalk_cache_oid($device, 'hwEntityTemperature', [], 'HUAWEI-ENTITY-EXTENT-MIB');
$huawei['voltage'] = snmpwalk_cache_oid($device, 'hwEntityVoltage', [], 'HUAWEI-ENTITY-EXTENT-MIB');
$huawei['fan'] = snmpwalk_cache_oid($device, 'hwFanStatusEntry', [], 'HUAWEI-ENTITY-EXTENT-MIB');
print_debug_vars($huawei);
// Temperatures
foreach ($huawei['temp'] as $index => $entry) {
$oid_name = 'hwEntityTemperature';
$oid_num = ".1.3.6.1.4.1.2011.5.25.31.1.1.1.1.11.$index";
$oid_name = 'hwEntityTemperature';
$oid_num = ".1.3.6.1.4.1.2011.5.25.31.1.1.1.1.11.$index";
$value = $entry[$oid_name];
if ($value > 0 && $value <= 1000) {
$descr = snmp_get_oid($device, "entPhysicalAlias.$index", 'ENTITY-MIB');
if (empty($descr)) {
$descr = snmp_get_oid($device, "entPhysicalName.$index", 'ENTITY-MIB');
$value = $entry[$oid_name];
if ($value > 0 && $value <= 1000) {
$descr = snmp_get_oid($device, "entPhysicalAlias.$index", 'ENTITY-MIB');
if (empty($descr)) {
$descr = snmp_get_oid($device, "entPhysicalName.$index", 'ENTITY-MIB');
}
if (empty($descr)) {
$descr_array = explode(',', $huawei['sensors_names'][$index]['hwEntityBomEnDesc']);
$descr = end($descr_array);
}
$options = ['limit_high' => snmp_get_oid($device, "hwEntityTemperatureThreshold.$index", 'HUAWEI-ENTITY-EXTENT-MIB')];
$options['rename_rrd'] = "huawei-$index";
discover_sensor_ng($device, 'temperature', $mib, $oid_name, $oid_num, $index, $descr, 1, $value, $options);
}
if (empty($descr)) {
$descr_array = explode(',', $huawei['sensors_names'][$index]['hwEntityBomEnDesc']);
$descr = end($descr_array);
}
$options = array('limit_high' => snmp_get_oid($device, "hwEntityTemperatureThreshold.$index", 'HUAWEI-ENTITY-EXTENT-MIB'));
$options['rename_rrd'] = "huawei-$index";
discover_sensor_ng($device,'temperature', $mib, $oid_name, $oid_num, $index, NULL, $descr, 1, $value, $options);
}
}
// Voltages
foreach ($huawei['voltage'] as $index => $entry) {
$oid_name = 'hwEntityVoltage';
$oid_num = ".1.3.6.1.4.1.2011.5.25.31.1.1.1.1.13.$index";
$oid_name = 'hwEntityVoltage';
$oid_num = ".1.3.6.1.4.1.2011.5.25.31.1.1.1.1.13.$index";
$value = $entry[$oid_name];
if ($value != 0 && $value <= 1000) {
if (strlen($huawei['sensors_names'][$index]['hwEntityBomEnDesc'])) {
$descr_array = explode(',', $huawei['sensors_names'][$index]['hwEntityBomEnDesc']);
$descr = end($descr_array);
} else {
$descr = snmp_get_oid($device, "entPhysicalAlias.$index", 'ENTITY-MIB');
if (empty($descr)) {
$descr = snmp_get_oid($device, "entPhysicalName.$index", 'ENTITY-MIB');
}
$value = $entry[$oid_name];
if ($value != 0 && $value <= 1000) {
if (strlen($huawei['sensors_names'][$index]['hwEntityBomEnDesc'])) {
$descr_array = explode(',', $huawei['sensors_names'][$index]['hwEntityBomEnDesc']);
$descr = end($descr_array);
} else {
$descr = snmp_get_oid($device, "entPhysicalAlias.$index", 'ENTITY-MIB');
if (empty($descr)) {
$descr = snmp_get_oid($device, "entPhysicalName.$index", 'ENTITY-MIB');
}
}
$options = ['limit_high' => snmp_get_oid($device, "hwEntityVoltageHighThreshold.$index", 'HUAWEI-ENTITY-EXTENT-MIB'),
'limit_low' => snmp_get_oid($device, "hwEntityVoltageLowThreshold.$index", 'HUAWEI-ENTITY-EXTENT-MIB')];
$options['rename_rrd'] = "huawei-$index";
discover_sensor_ng($device, 'voltage', $mib, $oid_name, $oid_num, $index, $descr, 1, $value, $options);
}
$options = array('limit_high' => snmp_get_oid($device, "hwEntityVoltageHighThreshold.$index", 'HUAWEI-ENTITY-EXTENT-MIB'),
'limit_low' => snmp_get_oid($device, "hwEntityVoltageLowThreshold.$index", 'HUAWEI-ENTITY-EXTENT-MIB'));
$options['rename_rrd'] = "huawei-$index";
discover_sensor_ng($device,'voltage', $mib, $oid_name, $oid_num, $index, NULL, $descr, 1, $value, $options);
}
}
foreach ($huawei['fan'] as $index => $entry) {
if ($entry['hwEntityFanPresent'] === 'absent') { continue; }
if ($entry['hwEntityFanPresent'] === 'absent') {
continue;
}
$descr = 'Slot '.$entry['hwEntityFanSlot'].' Fan '.$entry['hwEntityFanSn'];
$descr = 'Slot ' . $entry['hwEntityFanSlot'] . ' Fan ' . $entry['hwEntityFanSn'];
$oid_name = 'hwEntityFanSpeed';
$oid_num = '.1.3.6.1.4.1.2011.5.25.31.1.1.10.1.5.'.$index;
$value = $entry[$oid_name];
$oid_name = 'hwEntityFanSpeed';
$oid_num = '.1.3.6.1.4.1.2011.5.25.31.1.1.10.1.5.' . $index;
$value = $entry[$oid_name];
if ($entry['hwEntityFanSpeed'] > 0) {
$options = [ 'rename_rrd' => "huawei-$index" ];
discover_sensor_ng($device, 'load', $mib, $oid_name, $oid_num, $index, NULL, $descr, 1, $value, $options);
}
if ($entry['hwEntityFanSpeed'] > 0) {
$options = ['rename_rrd' => "huawei-$index"];
discover_sensor_ng($device, 'load', $mib, $oid_name, $oid_num, $index, $descr, 1, $value, $options);
}
$oid_name = 'hwEntityFanState';
$oid_num = '.1.3.6.1.4.1.2011.5.25.31.1.1.10.1.7.'.$index;
$value = $entry[$oid_name];
discover_status($device, $oid_num, $index, 'huawei-entity-ext-mib-fan-state', $descr, $value, array('entPhysicalClass' => 'fan'));
$oid_name = 'hwEntityFanState';
$oid_num = '.1.3.6.1.4.1.2011.5.25.31.1.1.10.1.7.' . $index;
$value = $entry[$oid_name];
discover_status($device, $oid_num, $index, 'huawei-entity-ext-mib-fan-state', $descr, $value, ['entPhysicalClass' => 'fan']);
}
// Optical sensors
@ -103,245 +105,247 @@ $entity_array = [];
* See: https://jira.observium.org/browse/OBS-1362 (initially power hack was added)
* https://jira.observium.org/browse/OBS-2937 (issue with different scales sensor and limits)
*/
$power_class = 'power';
$power_scale = 0.000001;
$power_scale_multi = 0.01;
foreach (snmpwalk_cache_oid($device, 'hwEntityOpticalTemperature', [], 'HUAWEI-ENTITY-EXTENT-MIB') as $index => $entry) {
// Ignore optical sensors with temperature of zero or negative
if ($entry['hwEntityOpticalTemperature'] > 1) {
$optical_oids = array(
'hwEntityOpticalVoltage.' . $index,
'hwEntityOpticalBiasCurrent.' . $index,
'hwEntityOpticalRxPower.' . $index,
'hwEntityOpticalRxHighThreshold.' . $index,
'hwEntityOpticalRxHighWarnThreshold.' . $index,
'hwEntityOpticalRxLowThreshold.' . $index,
'hwEntityOpticalRxLowWarnThreshold.' . $index,
'hwEntityOpticalTxPower.' . $index,
'hwEntityOpticalTxHighThreshold.' . $index,
'hwEntityOpticalTxHighWarnThreshold.' . $index,
'hwEntityOpticalTxLowThreshold.' . $index,
'hwEntityOpticalTxLowWarnThreshold.' . $index,
// Multi Lane transceivers
'hwEntityOpticalLaneBiasCurrent.' . $index,
'hwEntityOpticalLaneRxPower.' . $index,
'hwEntityOpticalLaneTxPower.' . $index,
// Transceiver descriptions
'hwEntityOpticalVenderPn.' . $index,
'hwEntityOpticalVenderName.' . $index,
);
$optical_entry = snmp_get_multi_oid($device, $optical_oids, array(), 'HUAWEI-ENTITY-EXTENT-MIB');
if (isset($optical_entry[$index])) {
$entity_array[$index] = array_merge($entry, $optical_entry[$index]);
}
$power_class = 'power';
$power_scale = 0.000001;
// Detect correct scale for power sensors
if (($entity_array[$index]['hwEntityOpticalRxPower'] < 0 && $entity_array[$index]['hwEntityOpticalRxPower'] != -1) ||
($entity_array[$index]['hwEntityOpticalTxPower'] < 0 && $entity_array[$index]['hwEntityOpticalTxPower'] != -1)) {
// Disable power hack, sensors in dBm
$power_class = 'dbm';
$power_scale = 0.01;
foreach (snmpwalk_cache_oid($device, 'hwEntityOpticalTemperature', [], 'HUAWEI-ENTITY-EXTENT-MIB') as $index => $entry) {
// Ignore optical sensors with temperature of zero or negative
if ($entry['hwEntityOpticalTemperature'] > 1) {
$optical_oids = [
'hwEntityOpticalVoltage.' . $index,
'hwEntityOpticalBiasCurrent.' . $index,
'hwEntityOpticalRxPower.' . $index,
'hwEntityOpticalRxHighThreshold.' . $index,
'hwEntityOpticalRxHighWarnThreshold.' . $index,
'hwEntityOpticalRxLowThreshold.' . $index,
'hwEntityOpticalRxLowWarnThreshold.' . $index,
'hwEntityOpticalTxPower.' . $index,
'hwEntityOpticalTxHighThreshold.' . $index,
'hwEntityOpticalTxHighWarnThreshold.' . $index,
'hwEntityOpticalTxLowThreshold.' . $index,
'hwEntityOpticalTxLowWarnThreshold.' . $index,
// Multi Lane transceivers
'hwEntityOpticalLaneBiasCurrent.' . $index,
'hwEntityOpticalLaneRxPower.' . $index,
'hwEntityOpticalLaneTxPower.' . $index,
// Transceiver descriptions
'hwEntityOpticalVenderPn.' . $index,
'hwEntityOpticalVenderName.' . $index,
];
$optical_entry = snmp_get_multi_oid($device, $optical_oids, [], 'HUAWEI-ENTITY-EXTENT-MIB');
if (isset($optical_entry[$index])) {
$entity_array[$index] = array_merge($entry, $optical_entry[$index]);
}
// Detect correct scale for power sensors
if (($entity_array[$index]['hwEntityOpticalRxPower'] < 0 && $entity_array[$index]['hwEntityOpticalRxPower'] != -1) ||
($entity_array[$index]['hwEntityOpticalTxPower'] < 0 && $entity_array[$index]['hwEntityOpticalTxPower'] != -1)) {
// Disable power hack, sensors in dBm
$power_class = 'dbm';
$power_scale = 0.01;
}
unset($optical_entry, $entry);
}
unset($optical_entry, $entry);
}
}
print_debug_vars($entity_array);
$rx_limit_oids = array(
$rx_limit_oids = [
'limit_high' => 'hwEntityOpticalRxHighThreshold',
'limit_high_warn' => 'hwEntityOpticalRxHighWarnThreshold',
'limit_low' => 'hwEntityOpticalRxLowThreshold',
'limit_low_warn' => 'hwEntityOpticalRxLowWarnThreshold'
);
$tx_limit_oids = array(
];
$tx_limit_oids = [
'limit_high' => 'hwEntityOpticalTxHighThreshold',
'limit_high_warn' => 'hwEntityOpticalTxHighWarnThreshold',
'limit_low' => 'hwEntityOpticalTxLowThreshold',
'limit_low_warn' => 'hwEntityOpticalTxLowWarnThreshold'
);
];
foreach ($entity_array as $index => $entry) {
$port = get_port_by_ent_index($device, $index);
$options = array('entPhysicalIndex' => $index);
if (is_array($port)) {
$entry['ifDescr'] = $port['port_label'];
$options['measured_class'] = 'port';
$options['measured_entity'] = $port['port_id'];
$options['entPhysicalIndex_measured'] = $port['ifIndex'];
} else {
// Skip?
continue;
}
$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;
$options['rename_rrd'] = "huawei-$index";
if (!safe_empty($entry['hwEntityOpticalVenderPn'])) {
$trans = ' ('.str_ireplace('-EQUIV', '', $entry['hwEntityOpticalVenderName']).' '.$entry['hwEntityOpticalVenderPn'].')';
} else {
$trans = '';
}
discover_sensor_ng($device, 'temperature', $mib, 'hwEntityOpticalTemperature', $temperatureoid, $index, NULL, $entry['ifDescr'] . ' Temperature'.$trans, 1, $entry['hwEntityOpticalTemperature'], $options);
discover_sensor_ng($device, 'voltage', $mib, 'hwEntityOpticalVoltage', $voltageoid, $index, NULL, $entry['ifDescr'] . ' Voltage'.$trans, 0.001, $entry['hwEntityOpticalVoltage'], $options);
if ($entry['hwEntityOpticalBiasCurrent'] != -1) {
discover_sensor_ng($device, 'current', $mib, 'hwEntityOpticalBiasCurrent', $biascurrentoid, $index, NULL, $entry['ifDescr'] . ' Bias Current'.$trans, 0.000001, $entry['hwEntityOpticalBiasCurrent'], $options);
}
// MultiLane transceivers
/*
hwEntityOpticalVoltage.16981633 = 3310
hwEntityOpticalBiasCurrent.16981633 = 5900
hwEntityOpticalRxPower.16981633 = 133
hwEntityOpticalRxHighThreshold.16981633 = 340
hwEntityOpticalRxHighWarnThreshold.16981633 = No Such Instance currently exists at this OID
hwEntityOpticalRxLowThreshold.16981633 = -1429
hwEntityOpticalRxLowWarnThreshold.16981633 = No Such Instance currently exists at this OID
hwEntityOpticalTxPower.16981633 = -132
hwEntityOpticalTxHighThreshold.16981633 = 340
hwEntityOpticalTxHighWarnThreshold.16981633 = No Such Instance currently exists at this OID
hwEntityOpticalTxLowThreshold.16981633 = -1160
hwEntityOpticalTxLowWarnThreshold.16981633 = No Such Instance currently exists at this OID
hwEntityOpticalLaneBiasCurrent.16981633 = 5.90,5.90,5.90,5.90
hwEntityOpticalLaneRxPower.16981633 = 133.83,98.54,179.26,80.16
hwEntityOpticalLaneTxPower.16981633 = -132.65,-59.63,-24.66,-56.65
hwEntityOpticalVenderPn.16981633 = 02311GBW-OSI
hwEntityOpticalVenderName.16981633 = Huawei-EQUIV
*/
// Rx power
$rxoptions = $options;
if (isset($entry['hwEntityOpticalLaneRxPower']) && !safe_empty($entry['hwEntityOpticalLaneRxPower'])) {
// Prefer Lane Oid, as correct dBm
$lane_oid = '.1.3.6.1.4.1.2011.5.25.31.1.1.3.1.32.' . $index;
$multilane = str_contains($entry['hwEntityOpticalLaneRxPower'], ',');
foreach ($rx_limit_oids as $limit => $limit_oid) {
if (isset($entry[$limit_oid]) && $entry[$limit_oid] != -1) {
$rxoptions[$limit] = $entry[$limit_oid] * 0.01;
}
}
if ($multilane) {
// Fix incorrect Power scale.. again
// See: https://jira.observium.org/browse/OBS-4148
/*
hwEntityOpticalRxPower.16850463 = -121
hwEntityOpticalRxHighThreshold.16850463 = 400
hwEntityOpticalRxHighWarnThreshold.16850463 = No Such Object available on this agent at this OID
hwEntityOpticalRxLowThreshold.16850463 = -1801
hwEntityOpticalRxLowWarnThreshold.16850463 = No Such Object available on this agent at this OID
hwEntityOpticalLaneRxPower.16850463 = -1.21,-1.51,-1.83,-2.18
*/
list($lane1_rxpower) = explode(',', $entry['hwEntityOpticalLaneRxPower']);
if (($entry['hwEntityOpticalRxPower'] != -1) && float_cmp($entry['hwEntityOpticalRxPower'] * 0.01, $lane1_rxpower, 0.01) === 0) {
$power_scale_multi = 1;
}
$rxoptions['sensor_unit'] = 'split1';
$lane_descr = $entry['ifDescr'] . ' Lane 1 Rx Power' . $trans;
discover_sensor_ng($device, 'dbm', $mib, 'hwEntityOpticalLaneRxPower', $lane_oid, $index, NULL, $lane_descr, $power_scale_multi, $entry['hwEntityOpticalLaneRxPower'], $rxoptions);
$rxoptions['sensor_unit'] = 'split2';
$lane_descr = $entry['ifDescr'] . ' Lane 2 Rx Power' . $trans;
discover_sensor_ng($device, 'dbm', $mib, 'hwEntityOpticalLaneRxPower', $lane_oid, $index, NULL, $lane_descr, $power_scale_multi, $entry['hwEntityOpticalLaneRxPower'], $rxoptions);
$rxoptions['sensor_unit'] = 'split3';
$lane_descr = $entry['ifDescr'] . ' Lane 3 Rx Power' . $trans;
discover_sensor_ng($device, 'dbm', $mib, 'hwEntityOpticalLaneRxPower', $lane_oid, $index, NULL, $lane_descr, $power_scale_multi, $entry['hwEntityOpticalLaneRxPower'], $rxoptions);
$rxoptions['sensor_unit'] = 'split4';
$lane_descr = $entry['ifDescr'] . ' Lane 4 Rx Power' . $trans;
discover_sensor_ng($device, 'dbm', $mib, 'hwEntityOpticalLaneRxPower', $lane_oid, $index, NULL, $lane_descr, $power_scale_multi, $entry['hwEntityOpticalLaneRxPower'], $rxoptions);
$port = get_port_by_ent_index($device, $index);
$options = ['entPhysicalIndex' => $index];
if (is_array($port)) {
$entry['ifDescr'] = $port['port_label'];
$options['measured_class'] = 'port';
$options['measured_entity'] = $port['port_id'];
$options['entPhysicalIndex_measured'] = $port['ifIndex'];
} else {
$rxoptions['rename_rrd'] = "HUAWEI-ENTITY-EXTENT-MIB-hwEntityOpticalRxPower-$index";
$lane_descr = $entry['ifDescr'] . ' Rx Power' . $trans;
discover_sensor_ng($device, 'dbm', $mib, 'hwEntityOpticalLaneRxPower', $lane_oid, $index, NULL, $lane_descr, $power_scale_multi, $entry['hwEntityOpticalLaneRxPower'], $rxoptions);
}
} elseif ($entry['hwEntityOpticalRxPower'] != -1) {
// Huawei does not follow their own MIB for some devices and instead reports Rx/Tx Power as dBm converted to mW then multiplied by 1000
$rxpoweroid = '.1.3.6.1.4.1.2011.5.25.31.1.1.3.1.8.'.$index;
// Limits always as dBm
foreach ($rx_limit_oids as $limit => $limit_oid) {
if (isset($entry[$limit_oid]) && $entry[$limit_oid] != -1) {
$rxoptions[$limit] = $entry[$limit_oid] * 0.01;
if ($power_class === 'power') {
$rxoptions[$limit] = value_to_si($rxoptions[$limit], 'dBm', 'power'); // Limit in dBm, convert to W
}
}
// Skip?
continue;
}
$rxoptions['rename_rrd'] = "huawei-hwEntityOpticalRxPower.$index";
discover_sensor_ng($device, $power_class, $mib, 'hwEntityOpticalRxPower', $rxpoweroid, $index, NULL, $entry['ifDescr'] . ' Rx Power' . $trans, $power_scale, $entry['hwEntityOpticalRxPower'], $rxoptions);
}
$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;
// Tx power
$txoptions = $options;
if (isset($entry['hwEntityOpticalLaneTxPower']) && !safe_empty($entry['hwEntityOpticalLaneTxPower'])) {
// Prefer Lane Oid, as correct dBm
$lane_oid = '.1.3.6.1.4.1.2011.5.25.31.1.1.3.1.33.' . $index;
$multilane = str_contains($entry['hwEntityOpticalLaneTxPower'], ',');
foreach ($tx_limit_oids as $limit => $limit_oid) {
if (isset($entry[$limit_oid]) && $entry[$limit_oid] != -1) {
$txoptions[$limit] = $entry[$limit_oid] * 0.01;
}
}
if ($multilane) {
// Fix incorrect Power scale.. again
// See: https://jira.observium.org/browse/OBS-4148
/*
hwEntityOpticalTxPower.16850463 = -25
hwEntityOpticalTxHighThreshold.16850463 = 400
hwEntityOpticalTxHighWarnThreshold.16850463 = No Such Object available on this agent at this OID
hwEntityOpticalTxLowThreshold.16850463 = -1060
hwEntityOpticalTxLowWarnThreshold.16850463 = No Such Object available on this agent at this OID
hwEntityOpticalLaneTxPower.16850463 = -0.25,-0.26,-0.26,-0.23
*/
list($lane1_txpower) = explode(',', $entry['hwEntityOpticalLaneTxPower']);
if (($entry['hwEntityOpticalTxPower'] != -1) && float_cmp($entry['hwEntityOpticalTxPower'] * 0.01, $lane1_txpower, 0.01) === 0) {
$power_scale_multi = 1;
}
$txoptions['sensor_unit'] = 'split1';
$lane_descr = $entry['ifDescr'] . ' Lane 1 Tx Power' . $trans;
discover_sensor_ng($device, 'dbm', $mib, 'hwEntityOpticalLaneTxPower', $lane_oid, $index, NULL, $lane_descr, $power_scale_multi, $entry['hwEntityOpticalLaneTxPower'], $txoptions);
$txoptions['sensor_unit'] = 'split2';
$lane_descr = $entry['ifDescr'] . ' Lane 2 Tx Power' . $trans;
discover_sensor_ng($device, 'dbm', $mib, 'hwEntityOpticalLaneTxPower', $lane_oid, $index, NULL, $lane_descr, $power_scale_multi, $entry['hwEntityOpticalLaneTxPower'], $txoptions);
$txoptions['sensor_unit'] = 'split3';
$lane_descr = $entry['ifDescr'] . ' Lane 3 Tx Power' . $trans;
discover_sensor_ng($device, 'dbm', $mib, 'hwEntityOpticalLaneTxPower', $lane_oid, $index, NULL, $lane_descr, $power_scale_multi, $entry['hwEntityOpticalLaneTxPower'], $txoptions);
$txoptions['sensor_unit'] = 'split4';
$lane_descr = $entry['ifDescr'] . ' Lane 4 Tx Power' . $trans;
discover_sensor_ng($device, 'dbm', $mib, 'hwEntityOpticalLaneTxPower', $lane_oid, $index, NULL, $lane_descr, $power_scale_multi, $entry['hwEntityOpticalLaneTxPower'], $txoptions);
$options['rename_rrd'] = "huawei-$index";
if (!safe_empty($entry['hwEntityOpticalVenderPn'])) {
$trans = ' (' . str_ireplace('-EQUIV', '', $entry['hwEntityOpticalVenderName']) . ' ' . $entry['hwEntityOpticalVenderPn'] . ')';
} else {
$txoptions['rename_rrd'] = "HUAWEI-ENTITY-EXTENT-MIB-hwEntityOpticalTxPower-$index";
$lane_descr = $entry['ifDescr'] . ' Tx Power' . $trans;
discover_sensor_ng($device, 'dbm', $mib, 'hwEntityOpticalLaneTxPower', $lane_oid, $index, NULL, $lane_descr, 0.01, $entry['hwEntityOpticalLaneTxPower'], $txoptions);
$trans = '';
}
discover_sensor_ng($device, 'temperature', $mib, 'hwEntityOpticalTemperature', $temperatureoid, $index, $entry['ifDescr'] . ' Temperature' . $trans, 1, $entry['hwEntityOpticalTemperature'], $options);
discover_sensor_ng($device, 'voltage', $mib, 'hwEntityOpticalVoltage', $voltageoid, $index, $entry['ifDescr'] . ' Voltage' . $trans, 0.001, $entry['hwEntityOpticalVoltage'], $options);
if ($entry['hwEntityOpticalBiasCurrent'] != -1) {
discover_sensor_ng($device, 'current', $mib, 'hwEntityOpticalBiasCurrent', $biascurrentoid, $index, $entry['ifDescr'] . ' Bias Current' . $trans, 0.000001, $entry['hwEntityOpticalBiasCurrent'], $options);
}
} elseif ($entry['hwEntityOpticalTxPower'] != -1) {
// Huawei does not follow their own MIB for some devices and instead reports Rx/Tx Power as dBm converted to mW then multiplied by 1000
$txpoweroid = '.1.3.6.1.4.1.2011.5.25.31.1.1.3.1.9.'.$index;
foreach ($tx_limit_oids as $limit => $limit_oid) {
if (isset($entry[$limit_oid]) && $entry[$limit_oid] != -1) {
$txoptions[$limit] = $entry[$limit_oid] * 0.01;
if ($power_class === 'power') {
$txoptions[$limit] = value_to_si($txoptions[$limit], 'dBm', 'power'); // Limit in dBm, convert to W
// MultiLane transceivers
/*
hwEntityOpticalVoltage.16981633 = 3310
hwEntityOpticalBiasCurrent.16981633 = 5900
hwEntityOpticalRxPower.16981633 = 133
hwEntityOpticalRxHighThreshold.16981633 = 340
hwEntityOpticalRxHighWarnThreshold.16981633 = No Such Instance currently exists at this OID
hwEntityOpticalRxLowThreshold.16981633 = -1429
hwEntityOpticalRxLowWarnThreshold.16981633 = No Such Instance currently exists at this OID
hwEntityOpticalTxPower.16981633 = -132
hwEntityOpticalTxHighThreshold.16981633 = 340
hwEntityOpticalTxHighWarnThreshold.16981633 = No Such Instance currently exists at this OID
hwEntityOpticalTxLowThreshold.16981633 = -1160
hwEntityOpticalTxLowWarnThreshold.16981633 = No Such Instance currently exists at this OID
hwEntityOpticalLaneBiasCurrent.16981633 = 5.90,5.90,5.90,5.90
hwEntityOpticalLaneRxPower.16981633 = 133.83,98.54,179.26,80.16
hwEntityOpticalLaneTxPower.16981633 = -132.65,-59.63,-24.66,-56.65
hwEntityOpticalVenderPn.16981633 = 02311GBW-OSI
hwEntityOpticalVenderName.16981633 = Huawei-EQUIV
*/
$power_scale_multi = 0.01;
// Rx power
$rxoptions = $options;
if (isset($entry['hwEntityOpticalLaneRxPower']) && !safe_empty($entry['hwEntityOpticalLaneRxPower'])) {
// Prefer Lane Oid, as correct dBm
$lane_oid = '.1.3.6.1.4.1.2011.5.25.31.1.1.3.1.32.' . $index;
$multilane = str_contains($entry['hwEntityOpticalLaneRxPower'], ',');
foreach ($rx_limit_oids as $limit => $limit_oid) {
if (isset($entry[$limit_oid]) && $entry[$limit_oid] != -1) {
$rxoptions[$limit] = $entry[$limit_oid] * 0.01;
}
}
}
if ($multilane) {
// Fix incorrect Power scale.. again
// See: https://jira.observium.org/browse/OBS-4148
/*
hwEntityOpticalRxPower.16850463 = -121
hwEntityOpticalRxHighThreshold.16850463 = 400
hwEntityOpticalRxHighWarnThreshold.16850463 = No Such Object available on this agent at this OID
hwEntityOpticalRxLowThreshold.16850463 = -1801
hwEntityOpticalRxLowWarnThreshold.16850463 = No Such Object available on this agent at this OID
hwEntityOpticalLaneRxPower.16850463 = -1.21,-1.51,-1.83,-2.18
*/
[$lane1_rxpower] = explode(',', $entry['hwEntityOpticalLaneRxPower']);
if (($entry['hwEntityOpticalRxPower'] != -1) && float_cmp($entry['hwEntityOpticalRxPower'] * 0.01, $lane1_rxpower, 0.01) === 0) {
$power_scale_multi = 1;
}
$rxoptions['sensor_unit'] = 'split1';
$lane_descr = $entry['ifDescr'] . ' Lane 1 Rx Power' . $trans;
discover_sensor_ng($device, 'dbm', $mib, 'hwEntityOpticalLaneRxPower', $lane_oid, $index, $lane_descr, $power_scale_multi, $entry['hwEntityOpticalLaneRxPower'], $rxoptions);
$rxoptions['sensor_unit'] = 'split2';
$lane_descr = $entry['ifDescr'] . ' Lane 2 Rx Power' . $trans;
discover_sensor_ng($device, 'dbm', $mib, 'hwEntityOpticalLaneRxPower', $lane_oid, $index, $lane_descr, $power_scale_multi, $entry['hwEntityOpticalLaneRxPower'], $rxoptions);
$rxoptions['sensor_unit'] = 'split3';
$lane_descr = $entry['ifDescr'] . ' Lane 3 Rx Power' . $trans;
discover_sensor_ng($device, 'dbm', $mib, 'hwEntityOpticalLaneRxPower', $lane_oid, $index, $lane_descr, $power_scale_multi, $entry['hwEntityOpticalLaneRxPower'], $rxoptions);
$rxoptions['sensor_unit'] = 'split4';
$lane_descr = $entry['ifDescr'] . ' Lane 4 Rx Power' . $trans;
discover_sensor_ng($device, 'dbm', $mib, 'hwEntityOpticalLaneRxPower', $lane_oid, $index, $lane_descr, $power_scale_multi, $entry['hwEntityOpticalLaneRxPower'], $rxoptions);
} else {
$rxoptions['rename_rrd'] = "HUAWEI-ENTITY-EXTENT-MIB-hwEntityOpticalRxPower-$index";
$lane_descr = $entry['ifDescr'] . ' Rx Power' . $trans;
discover_sensor_ng($device, 'dbm', $mib, 'hwEntityOpticalLaneRxPower', $lane_oid, $index, $lane_descr, $power_scale_multi, $entry['hwEntityOpticalLaneRxPower'], $rxoptions);
}
} elseif ($entry['hwEntityOpticalRxPower'] != -1) {
// Huawei does not follow their own MIB for some devices and instead reports Rx/Tx Power as dBm converted to mW then multiplied by 1000
$rxpoweroid = '.1.3.6.1.4.1.2011.5.25.31.1.1.3.1.8.' . $index;
// Limits always as dBm
if ($power_class === 'power') {
$rxoptions['limit_unit'] = 'dBm'; // Limit in dBm, convert to W
}
foreach ($rx_limit_oids as $limit => $limit_oid) {
if (isset($entry[$limit_oid]) && $entry[$limit_oid] != -1) {
$rxoptions[$limit] = $entry[$limit_oid] * 0.01;
}
}
$rxoptions['rename_rrd'] = "huawei-hwEntityOpticalRxPower.$index";
discover_sensor_ng($device, $power_class, $mib, 'hwEntityOpticalRxPower', $rxpoweroid, $index, $entry['ifDescr'] . ' Rx Power' . $trans, $power_scale, $entry['hwEntityOpticalRxPower'], $rxoptions);
}
$txoptions['rename_rrd'] = "huawei-hwEntityOpticalTxPower.$index";
discover_sensor_ng($device, $power_class, $mib, 'hwEntityOpticalTxPower', $txpoweroid, $index, NULL, $entry['ifDescr'] . ' Tx Power' . $trans, $power_scale, $entry['hwEntityOpticalTxPower'], $txoptions);
}
// Tx power
$txoptions = $options;
if (isset($entry['hwEntityOpticalLaneTxPower']) && !safe_empty($entry['hwEntityOpticalLaneTxPower'])) {
// Prefer Lane Oid, as correct dBm
$lane_oid = '.1.3.6.1.4.1.2011.5.25.31.1.1.3.1.33.' . $index;
$multilane = str_contains($entry['hwEntityOpticalLaneTxPower'], ',');
foreach ($tx_limit_oids as $limit => $limit_oid) {
if (isset($entry[$limit_oid]) && $entry[$limit_oid] != -1) {
$txoptions[$limit] = $entry[$limit_oid] * 0.01;
}
}
if ($multilane) {
// Fix incorrect Power scale.. again
// See: https://jira.observium.org/browse/OBS-4148
/*
hwEntityOpticalTxPower.16850463 = -25
hwEntityOpticalTxHighThreshold.16850463 = 400
hwEntityOpticalTxHighWarnThreshold.16850463 = No Such Object available on this agent at this OID
hwEntityOpticalTxLowThreshold.16850463 = -1060
hwEntityOpticalTxLowWarnThreshold.16850463 = No Such Object available on this agent at this OID
hwEntityOpticalLaneTxPower.16850463 = -0.25,-0.26,-0.26,-0.23
*/
[$lane1_txpower] = explode(',', $entry['hwEntityOpticalLaneTxPower']);
if (($entry['hwEntityOpticalTxPower'] != -1) && float_cmp($entry['hwEntityOpticalTxPower'] * 0.01, $lane1_txpower, 0.01) === 0) {
$power_scale_multi = 1;
}
$txoptions['sensor_unit'] = 'split1';
$lane_descr = $entry['ifDescr'] . ' Lane 1 Tx Power' . $trans;
discover_sensor_ng($device, 'dbm', $mib, 'hwEntityOpticalLaneTxPower', $lane_oid, $index, $lane_descr, $power_scale_multi, $entry['hwEntityOpticalLaneTxPower'], $txoptions);
$txoptions['sensor_unit'] = 'split2';
$lane_descr = $entry['ifDescr'] . ' Lane 2 Tx Power' . $trans;
discover_sensor_ng($device, 'dbm', $mib, 'hwEntityOpticalLaneTxPower', $lane_oid, $index, $lane_descr, $power_scale_multi, $entry['hwEntityOpticalLaneTxPower'], $txoptions);
$txoptions['sensor_unit'] = 'split3';
$lane_descr = $entry['ifDescr'] . ' Lane 3 Tx Power' . $trans;
discover_sensor_ng($device, 'dbm', $mib, 'hwEntityOpticalLaneTxPower', $lane_oid, $index, $lane_descr, $power_scale_multi, $entry['hwEntityOpticalLaneTxPower'], $txoptions);
$txoptions['sensor_unit'] = 'split4';
$lane_descr = $entry['ifDescr'] . ' Lane 4 Tx Power' . $trans;
discover_sensor_ng($device, 'dbm', $mib, 'hwEntityOpticalLaneTxPower', $lane_oid, $index, $lane_descr, $power_scale_multi, $entry['hwEntityOpticalLaneTxPower'], $txoptions);
} else {
$txoptions['rename_rrd'] = "HUAWEI-ENTITY-EXTENT-MIB-hwEntityOpticalTxPower-$index";
$lane_descr = $entry['ifDescr'] . ' Tx Power' . $trans;
discover_sensor_ng($device, 'dbm', $mib, 'hwEntityOpticalLaneTxPower', $lane_oid, $index, $lane_descr, 0.01, $entry['hwEntityOpticalLaneTxPower'], $txoptions);
}
} elseif ($entry['hwEntityOpticalTxPower'] != -1) {
// Huawei does not follow their own MIB for some devices and instead reports Rx/Tx Power as dBm converted to mW then multiplied by 1000
$txpoweroid = '.1.3.6.1.4.1.2011.5.25.31.1.1.3.1.9.' . $index;
if ($power_class === 'power') {
$txoptions['limit_unit'] = 'dBm'; // Limit in dBm, convert to W
}
foreach ($tx_limit_oids as $limit => $limit_oid) {
if (isset($entry[$limit_oid]) && $entry[$limit_oid] != -1) {
$txoptions[$limit] = $entry[$limit_oid] * 0.01;
}
}
$txoptions['rename_rrd'] = "huawei-hwEntityOpticalTxPower.$index";
discover_sensor_ng($device, $power_class, $mib, 'hwEntityOpticalTxPower', $txpoweroid, $index, $entry['ifDescr'] . ' Tx Power' . $trans, $power_scale, $entry['hwEntityOpticalTxPower'], $txoptions);
}
}

View File

@ -4,9 +4,9 @@
*
* This file is part of Observium.
*
* @package observium
* @subpackage discovery
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2021 Observium Limited
* @package observium
* @subpackage discovery
* @copyright (C) Adam Armstrong
*
*/
@ -29,30 +29,28 @@
//HUAWEI-POE-MIB::hwPoeSlotPowerRsvPercent.0 = INTEGER: 20
//HUAWEI-POE-MIB::hwPoeSlotPowerUtilizationThreshold.0 = INTEGER: 90
$oids = snmpwalk_cache_oid($device, 'hwPoeSlotEntry', array(), $mib);
$oids = snmpwalk_cache_oid($device, 'hwPoeSlotEntry', [], $mib);
// Stacked devices
foreach ($oids as $index => $entry)
{
if ($entry['hwPoeSlotConsumingPower'] == 0 && $entry['hwPoeSlotIsPoeDevice'] != 'yes')
{
continue;
}
foreach ($oids as $index => $entry) {
if ($entry['hwPoeSlotConsumingPower'] == 0 && $entry['hwPoeSlotIsPoeDevice'] != 'yes') {
continue;
}
$descr = "PoE Slot " . ($index + 1);
$oid_name = 'hwPoeSlotConsumingPower';
$oid_num = ".1.3.6.1.4.1.2011.5.25.195.2.1.5.$index";
$type = $mib . '-' . $oid_name;
$value = $entry[$oid_name];
$scale = 0.001;
$descr = "PoE Slot " . ($index + 1);
$oid_name = 'hwPoeSlotConsumingPower';
$oid_num = ".1.3.6.1.4.1.2011.5.25.195.2.1.5.$index";
$type = $mib . '-' . $oid_name;
$value = $entry[$oid_name];
$scale = 0.001;
// Options
$options = array('limit_high' => $entry['hwPoeSlotMaximumPower'] * $scale, // I not sure.. or hwPoeSlotAvailablePower or hwPoeSlotReferencePower
'limit_low' => 0); // Hardcode 0 as lower limit. Low warning limit will be calculated.
// Options
$options = ['limit_high' => $entry['hwPoeSlotMaximumPower'] * $scale, // I not sure.. or hwPoeSlotAvailablePower or hwPoeSlotReferencePower
'limit_low' => 0]; // Hardcode 0 as lower limit. Low warning limit will be calculated.
$options['limit_high_warn'] = $entry['hwPoeSlotPowerUtilizationThreshold'] > 0 ? $entry['hwPoeSlotPowerUtilizationThreshold'] / 100 : 0.9;
$options['limit_high_warn'] *= $options['limit_high'];
discover_sensor('power', $device, $oid_num, $index, $type, $descr, $scale, $value, $options);
$options['limit_high_warn'] = $entry['hwPoeSlotPowerUtilizationThreshold'] > 0 ? $entry['hwPoeSlotPowerUtilizationThreshold'] / 100 : 0.9;
$options['limit_high_warn'] *= $options['limit_high'];
discover_sensor('power', $device, $oid_num, $index, $type, $descr, $scale, $value, $options);
}
print_debug_vars($oids);
@ -89,73 +87,69 @@ print_debug_vars($oids);
//HUAWEI-POE-MIB::hwPoePortVoltage.20 = STRING: "0"
//HUAWEI-POE-MIB::hwPoePortManualOperation.20 = INTEGER: powerOff(1)
$oids = snmpwalk_cache_oid($device, 'hwPoePortEntry', array(), $mib);
$oids = snmpwalk_cache_oid($device, 'hwPoePortEntry', [], $mib);
print_debug_vars($oids);
foreach ($oids as $index => $entry)
{
if ($entry['hwPoePortEnable'] != 'enabled' ||
(($entry['hwPoePortPowerOnStatus'] == 'off' || $entry['hwPoePortPowerStatus'] == 'Detecting') &&
$entry['hwPoePortConsumingPower'] == 0 && $entry['hwPoePortCurrent'] == 0 && $entry['hwPoePortVoltage'] == 0))
{
// Skip PoE disabled ports
continue;
}
foreach ($oids as $index => $entry) {
if ($entry['hwPoePortEnable'] != 'enabled' ||
(($entry['hwPoePortPowerOnStatus'] == 'off' || $entry['hwPoePortPowerStatus'] == 'Detecting') &&
$entry['hwPoePortConsumingPower'] == 0 && $entry['hwPoePortCurrent'] == 0 && $entry['hwPoePortVoltage'] == 0)) {
// Skip PoE disabled ports
continue;
}
$options = array('entPhysicalIndex' => $index);
$port = get_port_by_ifIndex($device['device_id'], $index);
// print_vars($port);
$options = ['entPhysicalIndex' => $index];
$port = get_port_by_ifIndex($device['device_id'], $index);
// print_vars($port);
if (is_array($port))
{
$entry['ifDescr'] = $port['port_label'];
$options['measured_class'] = 'port';
$options['measured_entity'] = $port['port_id'];
$options['entPhysicalIndex_measured'] = $port['ifIndex'];
} else {
$entry['ifDescr'] = $entry['hwPoePortName'];
}
if (is_array($port)) {
$entry['ifDescr'] = $port['port_label'];
$options['measured_class'] = 'port';
$options['measured_entity'] = $port['port_id'];
$options['entPhysicalIndex_measured'] = $port['ifIndex'];
} else {
$entry['ifDescr'] = $entry['hwPoePortName'];
}
$descr = $entry['ifDescr'] . ' PoE Power';
$oid_name = 'hwPoePortConsumingPower';
$oid_num = ".1.3.6.1.4.1.2011.5.25.195.3.1.10.$index";
$type = $mib . '-' . $oid_name;
$value = $entry[$oid_name];
$scale = 0.001;
$descr = $entry['ifDescr'] . ' PoE Power';
$oid_name = 'hwPoePortConsumingPower';
$oid_num = ".1.3.6.1.4.1.2011.5.25.195.3.1.10.$index";
$type = $mib . '-' . $oid_name;
$value = $entry[$oid_name];
$scale = 0.001;
// Limits
$options['limit_high'] = $entry['hwPoePortMaximumPower'] * $scale;
if ($options['limit_high'] > 0)
{
$options['limit_high_warn'] = $options['limit_high'] * 0.9; // Warning at 90% of power limit - FIXME should move to centralized smart calculation function
} else {
unset($options['limit_high']);
}
// Limits
$options['limit_high'] = $entry['hwPoePortMaximumPower'] * $scale;
if ($options['limit_high'] > 0) {
$options['limit_high_warn'] = $options['limit_high'] * 0.9; // Warning at 90% of power limit - FIXME should move to centralized smart calculation function
} else {
unset($options['limit_high']);
}
discover_sensor('power', $device, $oid_num, $index, $type, $descr, $scale, $value, $options);
discover_sensor('power', $device, $oid_num, $index, $type, $descr, $scale, $value, $options);
$descr = $entry['ifDescr'] . ' PoE Current';
$oid_name = 'hwPoePortCurrent';
$oid_num = ".1.3.6.1.4.1.2011.5.25.195.3.1.13.$index";
$type = $mib . '-' . $oid_name;
$value = $entry[$oid_name];
$scale = 0.001;
$descr = $entry['ifDescr'] . ' PoE Current';
$oid_name = 'hwPoePortCurrent';
$oid_num = ".1.3.6.1.4.1.2011.5.25.195.3.1.13.$index";
$type = $mib . '-' . $oid_name;
$value = $entry[$oid_name];
$scale = 0.001;
unset($options['limit_high'], $options['limit_high_warn']);
unset($options['limit_high'], $options['limit_high_warn']);
discover_sensor('current', $device, $oid_num, $index, $type, $descr, $scale, $value, $options);
discover_sensor('current', $device, $oid_num, $index, $type, $descr, $scale, $value, $options);
$descr = $entry['ifDescr'] . ' PoE Voltage';
$oid_name = 'hwPoePortVoltage';
$oid_num = ".1.3.6.1.4.1.2011.5.25.195.3.1.14.$index";
$type = $mib . '-' . $oid_name;
$value = $entry[$oid_name];
$scale = 1;
$descr = $entry['ifDescr'] . ' PoE Voltage';
$oid_name = 'hwPoePortVoltage';
$oid_num = ".1.3.6.1.4.1.2011.5.25.195.3.1.14.$index";
$type = $mib . '-' . $oid_name;
$value = $entry[$oid_name];
$scale = 1;
unset($options['limit_high'], $options['limit_high_warn']);
unset($options['limit_high'], $options['limit_high_warn']);
discover_sensor('voltage', $device, $oid_num, $index, $type, $descr, $scale, $value, $options);
discover_sensor('voltage', $device, $oid_num, $index, $type, $descr, $scale, $value, $options);
}

View File

@ -6,7 +6,7 @@
*
* @package observium
* @subpackage discovery
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2021 Observium Limited
* @copyright (C) Adam Armstrong
*
*/
@ -14,88 +14,78 @@
echo("HWG-PWR-MIB ");
$meters = snmpwalk_cache_oid($device, 'mtEntry', array(), 'HWG-PWR-MIB');
$oids = snmpwalk_cache_twopart_oid($device, 'mtvalEntry', array(), 'HWG-PWR-MIB');
$meters = snmpwalk_cache_oid($device, 'mtEntry', [], 'HWG-PWR-MIB');
$oids = snmpwalk_cache_twopart_oid($device, 'mtvalEntry', [], 'HWG-PWR-MIB');
print_debug_vars($meters);
print_debug_vars($oids);
foreach ($oids as $meter => $entry1)
{
$name = $meters[$meter]['mtName'];
foreach ($entry1 as $idx => $entry)
{
$index = "{$meter}.{$idx}";
$descr = $entry['mtvalName'];
if ($name)
{
$descr .= ' - ' . $name;
}
$oid_name = 'mtvalMbusValue';
$oid_num = ".1.3.6.1.4.1.21796.4.6.1.3.1.6.{$index}";
$type = $mib . '-' . $oid_name;
$scale = si_to_scale($entry['mtvalExp']);
$value = $entry[$oid_name];
if ($entry['mtvalAlarmState'] == 'invalid' && $value == 0) { continue; } // Skip invalid empty entries
$sensor_type = FALSE;
switch (strtolower($entry['mtvalUnit']))
{
case 'm3':
$scale = si_to_scale($entry['mtvalExp'] + 3); // Convert to L
// not break here
case 'l':
$sensor_type = 'volume';
break;
case 'kwh':
$scale = si_to_scale($entry['mtvalExp'] + 3); // Convert to Wh
// not break here
case 'wh':
$sensor_type = 'energy';
break;
case 'kw':
$scale = si_to_scale($entry['mtvalExp'] + 3); // Convert to W
// not break here
case 'w':
$sensor_type = 'power';
break;
case 'v':
$sensor_type = 'voltage';
break;
case 'a':
$sensor_type = 'current';
break;
case '':
if (str_icontains_array($entry['mtvalName'], 'Power factor'))
{
$sensor_type = 'powerfactor';
foreach ($oids as $meter => $entry1) {
$name = $meters[$meter]['mtName'];
foreach ($entry1 as $idx => $entry) {
$index = "{$meter}.{$idx}";
$descr = $entry['mtvalName'];
if ($name) {
$descr .= ' - ' . $name;
}
elseif (str_icontains_array($entry['mtvalName'], 'counter'))
{
$sensor_type = 'counter';
$oid_name = 'mtvalMbusValue';
$oid_num = ".1.3.6.1.4.1.21796.4.6.1.3.1.6.{$index}";
$scale = si_to_scale($entry['mtvalExp']);
$value = $entry[$oid_name];
if ($entry['mtvalAlarmState'] == 'invalid' && $value == 0) {
continue;
} // Skip invalid empty entries
$sensor_class = FALSE;
switch (strtolower($entry['mtvalUnit'])) {
case 'm3':
$scale = si_to_scale($entry['mtvalExp'] + 3); // Convert to L
// not break here
case 'l':
$sensor_class = 'volume';
break;
case 'kwh':
$scale = si_to_scale($entry['mtvalExp'] + 3); // Convert to Wh
// not break here
case 'wh':
$sensor_class = 'energy';
break;
case 'kw':
$scale = si_to_scale($entry['mtvalExp'] + 3); // Convert to W
// not break here
case 'w':
$sensor_class = 'power';
break;
case 'v':
$sensor_class = 'voltage';
break;
case 'a':
$sensor_class = 'current';
break;
case '':
if (str_icontains_array($entry['mtvalName'], 'Power factor')) {
$sensor_class = 'powerfactor';
} elseif (str_icontains_array($entry['mtvalName'], 'counter')) {
$sensor_class = 'counter';
}
break;
}
if (in_array($sensor_class, [ 'counter', 'energy' ])) {
// Counters
discover_counter($device, $sensor_class, $mib, $oid_name, $oid_num, $index, $descr, $scale, $value);
} elseif ($sensor_class) {
discover_sensor_ng($device, $sensor_class, $mib, $oid_name, $oid_num, $index, $descr, $scale, $value);
}
break;
}
if (in_array($sensor_type, ['counter', 'energy']))
{
// Counters
discover_counter($device, $sensor_type, $mib, $oid_name, $oid_num, $index, $descr, $scale, $value);
}
elseif ($sensor_type)
{
// FIXME convert to discover_sensor_ng()
discover_sensor($sensor_type, $device, $oid_num, $index, $type, $descr, $scale, $value);
}
$oid_name = 'mtvalAlarmState';
$oid_num = ".1.3.6.1.4.1.21796.4.6.1.3.1.8.{$index}";
$type = 'mtvalAlarmState';
$value = $entry[$oid_name];
$oid_name = 'mtvalAlarmState';
$oid_num = ".1.3.6.1.4.1.21796.4.6.1.3.1.8.{$index}";
$type = 'mtvalAlarmState';
$value = $entry[$oid_name];
// FIXME convert to discover_status_ng()
discover_status($device, $oid_num, $oid_name.'.'.$index, $type, $descr, $value, array('entPhysicalClass' => 'other'));
}
// FIXME convert to discover_status_ng()
discover_status($device, $oid_num, $oid_name . '.' . $index, $type, $descr, $value, ['entPhysicalClass' => 'other']);
}
}
// EOF

View File

@ -5,9 +5,9 @@
*
* This file is part of Observium.
*
* @package observium
* @subpackage discovery
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2019 Observium Limited
* @package observium
* @subpackage discovery
* @copyright (C) Adam Armstrong
*
*/
@ -20,8 +20,8 @@ $cache['ipoman']['out'] = snmpwalk_cache_oid($device, 'outletConfigLocation', $c
echo('inletConfigDesc ');
$cache['ipoman']['in'] = snmpwalk_cache_oid($device, 'inletConfigDesc', $cache['ipoman'], $mib);
$oids_in = array();
$oids_out = array();
$oids_in = [];
$oids_out = [];
echo('inletConfigCurrentHigh ');
$oids_in = snmpwalk_cache_oid($device, 'inletConfigCurrentHigh', $oids_in, $mib);
@ -33,33 +33,29 @@ echo('outletStatusCurrent ');
$oids_out = snmpwalk_cache_oid($device, 'outletStatusCurrent', $oids_out, $mib);
$scale = 0.001;
foreach ($oids_in as $index => $entry)
{
$descr = (trim($cache['ipoman']['in'][$index]['inletConfigDesc'],'"') != '' ? trim($cache['ipoman']['in'][$index]['inletConfigDesc'],'"') : "Inlet $index");
$oid = ".1.3.6.1.4.1.2468.1.4.2.1.3.1.3.1.3.$index";
$value = $entry['inletStatusCurrent'];
$limits = array('limit_high' => $entry['inletConfigCurrentHigh'] / 10);
foreach ($oids_in as $index => $entry) {
$descr = (trim($cache['ipoman']['in'][$index]['inletConfigDesc'], '"') != '' ? trim($cache['ipoman']['in'][$index]['inletConfigDesc'], '"') : "Inlet $index");
$oid = ".1.3.6.1.4.1.2468.1.4.2.1.3.1.3.1.3.$index";
$value = $entry['inletStatusCurrent'];
$limits = ['limit_high' => $entry['inletConfigCurrentHigh'] / 10];
if (is_numeric($value))
{
discover_sensor('current', $device, $oid, '1.3.1.3.'.$index, 'ipoman', $descr, $scale, $value, $limits);
}
if (is_numeric($value)) {
discover_sensor('current', $device, $oid, '1.3.1.3.' . $index, 'ipoman', $descr, $scale, $value, $limits);
}
}
foreach ($oids_out as $index => $entry)
{
$descr = (trim($cache['ipoman']['out'][$index]['outletConfigDesc'],'"') != '' ? trim($cache['ipoman']['out'][$index]['outletConfigDesc'],'"') : "Output $index");
$oid = ".1.3.6.1.4.1.2468.1.4.2.1.3.2.3.1.3.$index";
$value = $entry['outletStatusCurrent'];
$limits = array('limit_high' => $entry['outletConfigCurrentHigh'] / 10);
foreach ($oids_out as $index => $entry) {
$descr = (trim($cache['ipoman']['out'][$index]['outletConfigDesc'], '"') != '' ? trim($cache['ipoman']['out'][$index]['outletConfigDesc'], '"') : "Output $index");
$oid = ".1.3.6.1.4.1.2468.1.4.2.1.3.2.3.1.3.$index";
$value = $entry['outletStatusCurrent'];
$limits = ['limit_high' => $entry['outletConfigCurrentHigh'] / 10];
if (is_numeric($value))
{
discover_sensor('current', $device, $oid, '2.3.1.3.'.$index, 'ipoman', $descr, $scale, $value, $limits);
}
if (is_numeric($value)) {
discover_sensor('current', $device, $oid, '2.3.1.3.' . $index, 'ipoman', $descr, $scale, $value, $limits);
}
}
$oids = array();
$oids = [];
echo('inletConfigFrequencyHigh ');
$oids = snmpwalk_cache_oid($device, 'inletConfigFrequencyHigh', $oids, $mib);
@ -69,62 +65,56 @@ echo('inletStatusFrequency ');
$oids = snmpwalk_cache_oid($device, 'inletStatusFrequency', $oids, $mib);
$scale = 0.1;
foreach ($oids as $index => $entry)
{
$descr = (trim($cache['ipoman']['in'][$index]['inletConfigDesc'],'"') != '' ? trim($cache['ipoman']['in'][$index]['inletConfigDesc'],'"') : "Inlet $index");
$oid = ".1.3.6.1.4.1.2468.1.4.2.1.3.1.3.1.4.$index";
$value = $entry['inletStatusFrequency'];
$limits = array(
'limit_high' => ($entry['inletConfigFrequencyHigh'] != 0 ? $entry['inletConfigFrequencyHigh'] : NULL),
'limit_low' => ($entry['inletConfigFrequencyLow'] != 0 ? $entry['inletConfigFrequencyLow'] : NULL)
);
foreach ($oids as $index => $entry) {
$descr = (trim($cache['ipoman']['in'][$index]['inletConfigDesc'], '"') != '' ? trim($cache['ipoman']['in'][$index]['inletConfigDesc'], '"') : "Inlet $index");
$oid = ".1.3.6.1.4.1.2468.1.4.2.1.3.1.3.1.4.$index";
$value = $entry['inletStatusFrequency'];
$limits = [
'limit_high' => ($entry['inletConfigFrequencyHigh'] != 0 ? $entry['inletConfigFrequencyHigh'] : NULL),
'limit_low' => ($entry['inletConfigFrequencyLow'] != 0 ? $entry['inletConfigFrequencyLow'] : NULL)
];
if (is_numeric($value))
{
discover_sensor('frequency', $device, $oid, $index, 'ipoman', $descr, $scale, $value, $limits);
}
if (is_numeric($value)) {
discover_sensor('frequency', $device, $oid, $index, 'ipoman', $descr, $scale, $value, $limits);
}
}
// FIXME: What to do with ipmEnvEmdConfigHumiOffset.0 ?
$emd_installed = snmp_get($device, 'ipmEnvEmdStatusEmdType.0',' -Oqv', $mib);
$scale = 0.1;
if ($emd_installed == 'eMD-HT')
{
$descr = snmp_get($device, 'ipmEnvEmdConfigHumiName.0', '-Oqv', $mib);
$oid = '.1.3.6.1.4.1.2468.1.4.2.1.5.1.1.3.0';
$value = snmp_get($device, 'ipmEnvEmdStatusHumidity.0', '-Oqv', $mib);
$limits = array('limit_high' => snmp_get($device, 'ipmEnvEmdConfigHumiHighSetPoint.0', '-Oqv', $mib),
'limit_low' => snmp_get($device, 'ipmEnvEmdConfigHumiLowSetPoint.0', '-Oqv', $mib));
$emd_installed = snmp_get($device, 'ipmEnvEmdStatusEmdType.0', ' -Oqv', $mib);
$scale = 0.1;
if ($emd_installed == 'eMD-HT') {
$descr = snmp_get($device, 'ipmEnvEmdConfigHumiName.0', '-Oqv', $mib);
$oid = '.1.3.6.1.4.1.2468.1.4.2.1.5.1.1.3.0';
$value = snmp_get($device, 'ipmEnvEmdStatusHumidity.0', '-Oqv', $mib);
$limits = ['limit_high' => snmp_get($device, 'ipmEnvEmdConfigHumiHighSetPoint.0', '-Oqv', $mib),
'limit_low' => snmp_get($device, 'ipmEnvEmdConfigHumiLowSetPoint.0', '-Oqv', $mib)];
if ($descr != '' && is_numeric($value) && $value > 0)
{
$descr = trim(str_replace('"', '', $descr));
if ($descr != '' && is_numeric($value) && $value > 0) {
$descr = trim(str_replace('"', '', $descr));
discover_sensor('humidity', $device, $oid, 1, 'ipoman', $descr, $scale, $value, $limits);
}
discover_sensor('humidity', $device, $oid, 1, 'ipoman', $descr, $scale, $value, $limits);
}
}
if ($emd_installed != 'disabled')
{
$descr = snmp_get($device, 'ipmEnvEmdConfigTempName.0', '-Oqv', $mib);
$oid = '.1.3.6.1.4.1.2468.1.4.2.1.5.1.1.2.0';
$value = snmp_get($device, 'ipmEnvEmdStatusTemperature.0', '-Oqv', $mib);
$limits = array('limit_high' => snmp_get($device, 'ipmEnvEmdConfigTempHighSetPoint.0', '-Oqv', $mib),
'limit_low' => snmp_get($device, 'ipmEnvEmdConfigTempLowSetPoint.0', '-Oqv', $mib));
if ($emd_installed != 'disabled') {
$descr = snmp_get($device, 'ipmEnvEmdConfigTempName.0', '-Oqv', $mib);
$oid = '.1.3.6.1.4.1.2468.1.4.2.1.5.1.1.2.0';
$value = snmp_get($device, 'ipmEnvEmdStatusTemperature.0', '-Oqv', $mib);
$limits = ['limit_high' => snmp_get($device, 'ipmEnvEmdConfigTempHighSetPoint.0', '-Oqv', $mib),
'limit_low' => snmp_get($device, 'ipmEnvEmdConfigTempLowSetPoint.0', '-Oqv', $mib)];
if ($descr != '' && is_numeric($value) && $value > 0)
{
$descr = trim(str_replace('"', '', $descr));
if ($descr != '' && is_numeric($value) && $value > 0) {
$descr = trim(str_replace('"', '', $descr));
discover_sensor('temperature', $device, $oid, 1, 'ipoman', $descr, $scale, $value, $limits);
}
discover_sensor('temperature', $device, $oid, 1, 'ipoman', $descr, $scale, $value, $limits);
}
}
// Inlet Disabled due to the fact thats it's Kwh instead of just Watt
# $oids_in = array();
$oids_out = array();
$oids_out = [];
# echo('inletStatusWH ');
# $oids_in = snmpwalk_cache_oid($device, 'inletStatusWH', $oids_in, $mib);
@ -141,19 +131,17 @@ $oids_out = snmpwalk_cache_oid($device, 'outletStatusWH', $oids_out, $mib);
# }
$scale = 0.1;
foreach ($oids_out as $index => $entry)
{
$descr = (trim($cache['ipoman']['out'][$index]['outletConfigDesc'],'"') != '' ? trim($cache['ipoman']['out'][$index]['outletConfigDesc'],'"') : "Output $index");
$oid = ".1.3.6.1.4.1.2468.1.4.2.1.3.2.3.1.5.$index";
$value = $entry['outletStatusWH'];
foreach ($oids_out as $index => $entry) {
$descr = (trim($cache['ipoman']['out'][$index]['outletConfigDesc'], '"') != '' ? trim($cache['ipoman']['out'][$index]['outletConfigDesc'], '"') : "Output $index");
$oid = ".1.3.6.1.4.1.2468.1.4.2.1.3.2.3.1.5.$index";
$value = $entry['outletStatusWH'];
if (is_numeric($value))
{
discover_sensor('power', $device, $oid, '2.3.1.3.'.$index, 'ipoman', $descr, $scale, $value);
}
if (is_numeric($value)) {
discover_sensor('power', $device, $oid, '2.3.1.3.' . $index, 'ipoman', $descr, $scale, $value);
}
}
$oids = array();
$oids = [];
echo('inletConfigVoltageHigh ');
$oids = snmpwalk_cache_oid($device, 'inletConfigVoltageHigh', $oids, $mib);
@ -163,17 +151,15 @@ echo('inletStatusVoltage ');
$oids = snmpwalk_cache_oid($device, 'inletStatusVoltage', $oids, $mib);
$scale = 0.1;
foreach ($oids as $index => $entry)
{
$descr = (trim($cache['ipoman']['in'][$index]['inletConfigDesc'],'"') != '' ? trim($cache['ipoman']['in'][$index]['inletConfigDesc'],'"') : "Inlet $index");
$oid = ".1.3.6.1.4.1.2468.1.4.2.1.3.1.3.1.2.$index";
$value = $entry['inletStatusVoltage'];
$limits = array('limit_high' => $entry['inletConfigVoltageHigh'], 'limit_low' => $entry['inletConfigVoltageLow']);
foreach ($oids as $index => $entry) {
$descr = (trim($cache['ipoman']['in'][$index]['inletConfigDesc'], '"') != '' ? trim($cache['ipoman']['in'][$index]['inletConfigDesc'], '"') : "Inlet $index");
$oid = ".1.3.6.1.4.1.2468.1.4.2.1.3.1.3.1.2.$index";
$value = $entry['inletStatusVoltage'];
$limits = ['limit_high' => $entry['inletConfigVoltageHigh'], 'limit_low' => $entry['inletConfigVoltageLow']];
if (is_numeric($value))
{
discover_sensor('voltage', $device, $oid, $index, 'ipoman', $descr, $scale, $value, $limits);
}
if (is_numeric($value)) {
discover_sensor('voltage', $device, $oid, $index, 'ipoman', $descr, $scale, $value, $limits);
}
}
// EOF

View File

@ -5,13 +5,13 @@
*
* This file is part of Observium.
*
* @package observium
* @subpackage discovery
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2019 Observium Limited
* @package observium
* @subpackage discovery
* @copyright (C) Adam Armstrong
*
*/
$oids = snmpwalk_cache_oid($device, 'isDeviceConfigTable', array(), 'ISPRO-MIB');
$oids = snmpwalk_cache_oid($device, 'isDeviceConfigTable', [], 'ISPRO-MIB');
$oids = snmpwalk_cache_oid($device, 'isDeviceMonitorTemperatureTable', $oids, 'ISPRO-MIB');
$oids = snmpwalk_cache_oid($device, 'isDeviceConfigTemperatureTable', $oids, 'ISPRO-MIB');
$oids = snmpwalk_cache_oid($device, 'isDeviceMonitorHumidityTable', $oids, 'ISPRO-MIB');
@ -22,138 +22,130 @@ $oids = snmpwalk_cache_oid($device, 'isDeviceConfigDigitalInTable', $oids, 'ISPR
// isConfigTemperatureUnit.0 = INTEGER: celsius(1)
$isConfigTemperatureUnit = snmp_get($device, 'isConfigTemperatureUnit.0', '-Oqv', 'ISPRO-MIB');
foreach ($oids as $index => $entry)
{
// Skip if this sensor has been disabled for display in the web interface
if ($entry['isDeviceConfigDisplay'] == 'enabled')
{
// Temperature
foreach ($oids as $index => $entry) {
// Skip if this sensor has been disabled for display in the web interface
if ($entry['isDeviceConfigDisplay'] == 'enabled') {
// Temperature
// isDeviceConfigTemperatureIndex.1 = INTEGER: 1
// isDeviceMonitorTemperatureName.1 = STRING: "Temperature1"
// isDeviceMonitorTemperature.1 = INTEGER: 3121
// isDeviceConfigTemperatureName.1 = STRING: "Temperature1"
// isDeviceConfigTemperatureIndex.1 = INTEGER: 1
// isDeviceMonitorTemperatureName.1 = STRING: "Temperature1"
// isDeviceMonitorTemperature.1 = INTEGER: 3121
// isDeviceConfigTemperatureName.1 = STRING: "Temperature1"
$descr = $entry['isDeviceMonitorTemperatureName'];
$oid = ".1.3.6.1.4.1.19011.1.3.2.1.3.1.1.1.3.$index";
$value = $entry['isDeviceMonitorTemperature'];
$descr = $entry['isDeviceMonitorTemperatureName'];
$oid = ".1.3.6.1.4.1.19011.1.3.2.1.3.1.1.1.3.$index";
$value = $entry['isDeviceMonitorTemperature'];
// Warning/Critical limits can be enabled/disabled in the web interface. Use them as supplied if enabled, calculate our own if not enabled.
//
// isDeviceConfigTemperatureLowWarning.1 = INTEGER: 2300
// isDeviceConfigTemperatureLowCritical.1 = INTEGER: 2000
// isDeviceConfigTemperatureHighWarning.1 = INTEGER: 2700
// isDeviceConfigTemperatureHighCritical.1 = INTEGER: 3000
// isDeviceConfigTemperatureLowWarningState.1 = INTEGER: disabled(2)
// isDeviceConfigTemperatureLowCriticalState.1 = INTEGER: disabled(2)
// isDeviceConfigTemperatureHighWarningState.1 = INTEGER: disabled(2)
// isDeviceConfigTemperatureHighCriticalState.1 = INTEGER: disabled(2)
// Warning/Critical limits can be enabled/disabled in the web interface. Use them as supplied if enabled, calculate our own if not enabled.
//
// isDeviceConfigTemperatureLowWarning.1 = INTEGER: 2300
// isDeviceConfigTemperatureLowCritical.1 = INTEGER: 2000
// isDeviceConfigTemperatureHighWarning.1 = INTEGER: 2700
// isDeviceConfigTemperatureHighCritical.1 = INTEGER: 3000
// isDeviceConfigTemperatureLowWarningState.1 = INTEGER: disabled(2)
// isDeviceConfigTemperatureLowCriticalState.1 = INTEGER: disabled(2)
// isDeviceConfigTemperatureHighWarningState.1 = INTEGER: disabled(2)
// isDeviceConfigTemperatureHighCriticalState.1 = INTEGER: disabled(2)
$options = array('limit_high' => ($entry['isDeviceConfigTemperatureHighCriticalState'] == 'enabled' ? $entry['isDeviceConfigTemperatureHighCritical'] / 100 : NULL),
'limit_high_warn' => ($entry['isDeviceConfigTemperatureHighWarningState'] == 'enabled' ? $entry['isDeviceConfigTemperatureHighWarning'] / 100 : NULL),
'limit_low_warn' => ($entry['isDeviceConfigTemperatureLowWarningState'] == 'enabled' ? $entry['isDeviceConfigTemperatureLowWarning'] / 100 : NULL),
'limit_low' => ($entry['isDeviceConfigTemperatureLowCriticalState'] == 'enabled' ? $entry['isDeviceConfigTemperatureLowCritical'] / 100 : NULL));
$options = ['limit_high' => ($entry['isDeviceConfigTemperatureHighCriticalState'] == 'enabled' ? $entry['isDeviceConfigTemperatureHighCritical'] / 100 : NULL),
'limit_high_warn' => ($entry['isDeviceConfigTemperatureHighWarningState'] == 'enabled' ? $entry['isDeviceConfigTemperatureHighWarning'] / 100 : NULL),
'limit_low_warn' => ($entry['isDeviceConfigTemperatureLowWarningState'] == 'enabled' ? $entry['isDeviceConfigTemperatureLowWarning'] / 100 : NULL),
'limit_low' => ($entry['isDeviceConfigTemperatureLowCriticalState'] == 'enabled' ? $entry['isDeviceConfigTemperatureLowCritical'] / 100 : NULL)];
if ($isConfigTemperatureUnit == 'fahrenheit')
{
$options['sensor_unit'] = 'F';
} else {
$options['sensor_unit'] = 'C';
if ($isConfigTemperatureUnit == 'fahrenheit') {
$options['sensor_unit'] = 'F';
} else {
$options['sensor_unit'] = 'C';
}
// Not used:
// isDeviceConfigTemperatureCalibration.1 = INTEGER: temperatureIncrease0Point0(1)
// isDeviceConfigTemperatureHysteresis.1 = INTEGER: 200
// 32768 = No sensor connected
if ($value != 32768 && $value != '') {
discover_sensor('temperature', $device, $oid, "isDeviceMonitorTemperature.$index", 'ispro-mib', $descr, 0.01, $value, $options);
}
$oid = ".1.3.6.1.4.1.19011.1.3.2.1.3.1.1.1.4.$index";
$value = $entry['isDeviceMonitorTemperatureAlarm'];
// isDeviceMonitorTemperatureAlarm.1 = INTEGER: normal(3)
// unknown = No sensor connected
if ($value != 'unknown' && $value != '') {
discover_status($device, $oid, "isDeviceMonitorTemperatureAlarm.$index", 'ispro-mib-threshold-state', $descr, $value);
}
// Humidity
// isDeviceConfigHumidityIndex.1 = INTEGER: 1
// isDeviceMonitorHumidityName.1 = STRING: "Humidity1"
// isDeviceMonitorHumidity.1 = INTEGER: 2166
// isDeviceConfigHumidityName.1 = STRING: "Humidity1"
$descr = $entry['isDeviceMonitorHumidityName'];
$oid = ".1.3.6.1.4.1.19011.1.3.2.1.3.1.2.1.3.$index";
$value = $entry['isDeviceMonitorHumidity'];
// Warning/Critical limits can be enabled/disabled in the web interface. Use them as supplied if enabled, calculate our own if not enabled.
//
// isDeviceConfigHumidityLowWarning.1 = INTEGER: 4000
// isDeviceConfigHumidityLowCritical.1 = INTEGER: 3500
// isDeviceConfigHumidityHighWarning.1 = INTEGER: 5000
// isDeviceConfigHumidityHighCritical.1 = INTEGER: 5500
// isDeviceConfigHumidityLowWarningState.1 = INTEGER: disabled(2)
// isDeviceConfigHumidityLowCriticalState.1 = INTEGER: disabled(2)
// isDeviceConfigHumidityHighWarningState.1 = INTEGER: disabled(2)
// isDeviceConfigHumidityHighCriticalState.1 = INTEGER: disabled(2)
$options = ['limit_high' => ($entry['isDeviceConfigHumidityHighCriticalState'] == 'enabled' ? $entry['isDeviceConfigHumidityHighCritical'] / 100 : NULL),
'limit_high_warn' => ($entry['isDeviceConfigHumidityHighWarningState'] == 'enabled' ? $entry['isDeviceConfigHumidityHighWarning'] / 100 : NULL),
'limit_low_warn' => ($entry['isDeviceConfigHumidityLowWarningState'] == 'enabled' ? $entry['isDeviceConfigHumidityLowWarning'] / 100 : NULL),
'limit_low' => ($entry['isDeviceConfigHumidityLowCriticalState'] == 'enabled' ? $entry['isDeviceConfigHumidityLowCritical'] / 100 : NULL)];
// Not used:
// isDeviceConfigHumidityCalibration.1 = INTEGER: humidityIncrease0Point0(1)
// isDeviceConfigHumidityHysteresis.2 = INTEGER: 500
// 32768 = No sensor connected
if ($value != 32768 && $value != '') {
discover_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_status($device, $oid, "isDeviceMonitorHumidityAlarm.$index", 'ispro-mib-threshold-state', $descr, $value);
}
}
// Not used:
// isDeviceConfigTemperatureCalibration.1 = INTEGER: temperatureIncrease0Point0(1)
// isDeviceConfigTemperatureHysteresis.1 = INTEGER: 200
// 32768 = No sensor connected
if ($value != 32768 && $value != '')
{
discover_sensor('temperature', $device, $oid, "isDeviceMonitorTemperature.$index", 'ispro-mib', $descr, 0.01, $value, $options);
}
$oid = ".1.3.6.1.4.1.19011.1.3.2.1.3.1.1.1.4.$index";
$value = $entry['isDeviceMonitorTemperatureAlarm'];
// isDeviceMonitorTemperatureAlarm.1 = INTEGER: normal(3)
// unknown = No sensor connected
if ($value != 'unknown' && $value != '')
{
discover_status($device, $oid, "isDeviceMonitorTemperatureAlarm.$index", 'ispro-mib-threshold-state', $descr, $value);
}
// Humidity
// isDeviceConfigHumidityIndex.1 = INTEGER: 1
// isDeviceMonitorHumidityName.1 = STRING: "Humidity1"
// isDeviceMonitorHumidity.1 = INTEGER: 2166
// isDeviceConfigHumidityName.1 = STRING: "Humidity1"
$descr = $entry['isDeviceMonitorHumidityName'];
$oid = "1.3.6.1.4.1.19011.1.3.2.1.3.1.2.1.3.$index";
$value = $entry['isDeviceMonitorHumidity'];
// Warning/Critical limits can be enabled/disabled in the web interface. Use them as supplied if enabled, calculate our own if not enabled.
//
// isDeviceConfigHumidityLowWarning.1 = INTEGER: 4000
// isDeviceConfigHumidityLowCritical.1 = INTEGER: 3500
// isDeviceConfigHumidityHighWarning.1 = INTEGER: 5000
// isDeviceConfigHumidityHighCritical.1 = INTEGER: 5500
// isDeviceConfigHumidityLowWarningState.1 = INTEGER: disabled(2)
// isDeviceConfigHumidityLowCriticalState.1 = INTEGER: disabled(2)
// isDeviceConfigHumidityHighWarningState.1 = INTEGER: disabled(2)
// isDeviceConfigHumidityHighCriticalState.1 = INTEGER: disabled(2)
$options = array('limit_high' => ($entry['isDeviceConfigHumidityHighCriticalState'] == 'enabled' ? $entry['isDeviceConfigHumidityHighCritical'] / 100 : NULL),
'limit_high_warn' => ($entry['isDeviceConfigHumidityHighWarningState'] == 'enabled' ? $entry['isDeviceConfigHumidityHighWarning'] / 100 : NULL),
'limit_low_warn' => ($entry['isDeviceConfigHumidityLowWarningState'] == 'enabled' ? $entry['isDeviceConfigHumidityLowWarning'] / 100 : NULL),
'limit_low' => ($entry['isDeviceConfigHumidityLowCriticalState'] == 'enabled' ? $entry['isDeviceConfigHumidityLowCritical'] / 100 : NULL));
// Not used:
// isDeviceConfigHumidityCalibration.1 = INTEGER: humidityIncrease0Point0(1)
// isDeviceConfigHumidityHysteresis.2 = INTEGER: 500
// 32768 = No sensor connected
if ($value != 32768 && $value != '')
{
discover_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_status($device, $oid, "isDeviceMonitorHumidityAlarm.$index", 'ispro-mib-threshold-state', $descr, $value);
}
}
}
$oids = snmpwalk_cache_oid($device, 'isDeviceMonitorDigitalInTable', array(), 'ISPRO-MIB');
$oids = snmpwalk_cache_oid($device, 'isDeviceMonitorDigitalInTable', [], '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.
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)
// isDeviceMonitorDigitalInIndex.1 = INTEGER: 1
// isDeviceMonitorDigitalInName.1 = STRING: "Alarm1-1"
// isDeviceMonitorDigitalIn.1 = INTEGER: inactive(2)
// isDeviceMonitorDigitalInAlarm.1 = INTEGER: normal(1)
$descr = $entry['isDeviceMonitorDigitalInName'] /* . ' (' . $entry['isDeviceConfigDigitalInState'] . ')'*/;
$oid = "1.3.6.1.4.1.19011.1.3.2.1.3.1.3.1.4.$index";
$value = $entry['isDeviceMonitorDigitalInAlarm'];
$descr = $entry['isDeviceMonitorDigitalInName'] /* . ' (' . $entry['isDeviceConfigDigitalInState'] . ')'*/
;
$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_status($device, $oid, "isDeviceMonitorDigitalInAlarm.$index", 'ispro-mib-trigger-state', $descr, $value);
}
if ($entry['isDeviceConfigDigitalInState'] != 'disabled' && $value != '') {
discover_status($device, $oid, "isDeviceMonitorDigitalInAlarm.$index", 'ispro-mib-trigger-state', $descr, $value);
}
}
// EOF

View File

@ -5,67 +5,59 @@
*
* This file is part of Observium.
*
* @package observium
* @subpackage discovery
* @author Nick Schmalenberger <nick@schmalenberger.us>
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2019 Observium Limited
* @package observium
* @subpackage discovery
* @author Nick Schmalenberger <nick@schmalenberger.us>
* @copyright (C) Adam Armstrong
*
*/
#this gets the sensors from the device
$sensor_array = snmpwalk_cache_oid($device, 'owl.climateTable', array(), 'IT-WATCHDOGS-MIB-V3');
$sensor_array = snmpwalk_cache_oid($device, 'owl.climateTable', [], 'IT-WATCHDOGS-MIB-V3');
#these are the 2 types of sensors we want to handle
$sensor_type_map = array(
'climateTempC' => 'temperature',
'climateHumidity' => 'humidity',
);
$sensor_type_map = [
'climateTempC' => 'temperature',
'climateHumidity' => 'humidity',
];
#the sensor array has members that are climateTables which include various sensor data
foreach ($sensor_array as $indexof_climateTables => $climateTable)
{
foreach ($climateTable as $oidname => $value)
{
#this checks if the sensor in this climateTable is one of the 2 types we want
if ($sensor_type_map[$oidname] && is_numeric($value))
{
$ok = TRUE;
foreach ($sensor_array as $indexof_climateTables => $climateTable) {
foreach ($climateTable as $oidname => $value) {
#this checks if the sensor in this climateTable is one of the 2 types we want
if ($sensor_type_map[$oidname] && is_numeric($value)) {
$ok = TRUE;
$type = $sensor_type_map[$oidname];
if ($type == 'temperature')
{
#this checks if the temperature reading is within the range from the datasheet
#http://www.itwatchdogs.com/DataSheets/MicroGoose%20datasheet%20(v1.06).pdf
if ($value < -30 || $value > 85)
{
$ok = FALSE;
print_debug('Temperature was out of range.');
$type = $sensor_type_map[$oidname];
if ($type == 'temperature') {
#this checks if the temperature reading is within the range from the datasheet
#http://www.itwatchdogs.com/DataSheets/MicroGoose%20datasheet%20(v1.06).pdf
if ($value < -30 || $value > 85) {
$ok = FALSE;
print_debug('Temperature was out of range.');
}
#this oid is IT-WATCHDOGS-MIB-V3::climateTempC .X
$oid = ".1.3.6.1.4.1.17373.3.2.1.5.$indexof_climateTables";
$descr = 'Degrees Celsius';
}
if ($type == 'humidity') {
#this checks if the humidity reading is within range as a percentage point
if ($value < 0 || $value > 100) {
$ok = FALSE;
print_debug('Humidity was out of range.');
}
#this oid is IT-WATCHDOGS-MIB-V3::climateHumidity .X
$oid = ".1.3.6.1.4.1.17373.3.2.1.7.$indexof_climateTables";
$descr = 'Relative Humidity';
}
if ($ok) {
#this is what actually adds the sensor
discover_sensor($type, $device, $oid, $oidname, 'it-watchdogs-mib-v3', $descr, 1, $value);
}
}
#this oid is IT-WATCHDOGS-MIB-V3::climateTempC .X
$oid = ".1.3.6.1.4.1.17373.3.2.1.5.$indexof_climateTables";
$descr = 'Degrees Celsius';
}
if ($type == 'humidity')
{
#this checks if the humidity reading is within range as a percentage point
if ($value < 0 || $value > 100)
{
$ok = FALSE;
print_debug('Humidity was out of range.');
}
#this oid is IT-WATCHDOGS-MIB-V3::climateHumidity .X
$oid = ".1.3.6.1.4.1.17373.3.2.1.7.$indexof_climateTables";
$descr = 'Relative Humidity';
}
if ($ok)
{
#this is what actually adds the sensor
discover_sensor($type, $device, $oid, $oidname, 'it-watchdogs-mib-v3', $descr, 1, $value);
}
}
}
}
unset($sensor_type_map, $oid, $sensor_array, $index, $type, $value, $descr, $ok);

View File

@ -5,9 +5,9 @@
*
* This file is part of Observium.
*
* @package observium
* @subpackage discovery
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2019 Observium Limited
* @package observium
* @subpackage discovery
* @copyright (C) Adam Armstrong
*
*/
@ -34,64 +34,50 @@
# The return from this structure is Integer.
#BUILT-IN Sensors
$cache['itwatchdogs']['climateTable'] = snmpwalk_cache_oid($device, 'climateTable', array(), 'IT-WATCHDOGS-MIB');
$cache['itwatchdogs']['climateTable'] = snmpwalk_cache_oid($device, 'climateTable', [], 'IT-WATCHDOGS-MIB');
foreach ($cache['itwatchdogs']['climateTable'] as $index => $entry)
{
if ($entry['climateAvail'])
{
$descr = $entry['climateName'] . ' Temperature';
$oid = ".1.3.6.1.4.1.17373.2.2.1.5.$index";
$value = $entry['climateTempC'];
foreach ($cache['itwatchdogs']['climateTable'] as $index => $entry) {
if ($entry['climateAvail']) {
$descr = $entry['climateName'] . ' Temperature';
$oid = ".1.3.6.1.4.1.17373.2.2.1.5.$index";
$value = $entry['climateTempC'];
if (is_numeric($value))
{
discover_sensor ($valid['sensor'], 'temperature', $device, $oid, 'climateTempC.'.$index, 'it-watchdogs-mib', $descr, $scale, $value);
if (is_numeric($value)) {
discover_sensor($valid['sensor'], 'temperature', $device, $oid, 'climateTempC.' . $index, 'it-watchdogs-mib', $descr, $scale, $value);
} else {
print_debug("Sensor data '$value' not-numeric.");
}
$descr = $entry['climateName'] . ' Humidity';
$oid = ".1.3.6.1.4.1.17373.2.2.1.6.$index";
$value = $entry['climateHumidity'];
if (is_numeric($value)) {
discover_sensor($valid['sensor'], 'humidity', $device, $oid, 'climateHumidity.' . $index, 'it-watchdogs-mib', $descr, $scale, $value);
} else {
print_debug("Sensor data '$value' not-numeric.");
}
}
else
{
print_debug("Sensor data '$value' not-numeric.");
}
$descr = $entry['climateName'] . ' Humidity';
$oid = ".1.3.6.1.4.1.17373.2.2.1.6.$index";
$value = $entry['climateHumidity'];
if (is_numeric($value))
{
discover_sensor ($valid['sensor'], 'humidity', $device, $oid, 'climateHumidity.'.$index, 'it-watchdogs-mib', $descr, $scale, $value);
}
else
{
print_debug("Sensor data '$value' not-numeric.");
}
}
}
#Add-on sensors
$cache['itwatchdogs']['tempSensorTable'] = snmpwalk_cache_oid($device, 'tempSensorTable', array(), 'IT-WATCHDOGS-MIB');
$cache['itwatchdogs']['tempSensorTable'] = snmpwalk_cache_oid($device, 'tempSensorTable', [], 'IT-WATCHDOGS-MIB');
foreach ($cache['itwatchdogs']['tempSensorTable'] as $index => $entry)
{
if ($entry['tempSensorAvail'])
{
$descr = $entry['tempSensorName'];
$oid = ".1.3.6.1.4.1.17373.2.4.1.5.$index";
$value = $entry['tempSensorTempC'];
foreach ($cache['itwatchdogs']['tempSensorTable'] as $index => $entry) {
if ($entry['tempSensorAvail']) {
$descr = $entry['tempSensorName'];
$oid = ".1.3.6.1.4.1.17373.2.4.1.5.$index";
$value = $entry['tempSensorTempC'];
if (is_numeric($value))
{
discover_sensor ($valid['sensor'], 'temperature', $device, $oid, 'tempSensorTempC'.$index, 'it-watchdogs-mib', $descr, $scale, $value);
if (is_numeric($value)) {
discover_sensor($valid['sensor'], 'temperature', $device, $oid, 'tempSensorTempC' . $index, 'it-watchdogs-mib', $descr, $scale, $value);
} else {
print_debug("Sensor data '$value' not-numeric for oid $oid Sensor: $index");
}
}
else
{
print_debug("Sensor data '$value' not-numeric for oid $oid Sensor: $index");
}
}
}
// EOF

View File

@ -5,9 +5,9 @@
*
* This file is part of Observium.
*
* @package observium
* @subpackage discovery
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2019 Observium Limited
* @package observium
* @subpackage discovery
* @copyright (C) Adam Armstrong
*
*/
@ -27,32 +27,30 @@
//IT-WATCHDOGS-V4-MIB::internalDewPoint.1 = INTEGER: 394 0.1 Degrees
$temperatureUnits = snmp_get($device, 'temperatureUnits.0', '-Oqv', 'IT-WATCHDOGS-V4-MIB');
$oids = snmpwalk_cache_oid($device, 'internalTable', array(), 'IT-WATCHDOGS-V4-MIB');
$oids = snmpwalk_cache_oid($device, 'internalTable', [], 'IT-WATCHDOGS-V4-MIB');
foreach ($oids as $index => $entry)
{
$descr = 'Sensor '.$entry['internalName'];
// internalTemp
$oid = ".1.3.6.1.4.1.17373.4.1.2.1.5.$index";
$scale = 0.1;
foreach ($oids as $index => $entry) {
$descr = 'Sensor ' . $entry['internalName'];
// internalTemp
$oid = ".1.3.6.1.4.1.17373.4.1.2.1.5.$index";
$scale = 0.1;
// 0 => fahrenheit, 1 => celsius
switch ($temperatureUnits)
{
case 0:
$options['sensor_unit'] = 'F';
break;
case 1:
$options['sensor_unit'] = 'C';
break;
}
// 0 => fahrenheit, 1 => celsius
switch ($temperatureUnits) {
case 0:
$options['sensor_unit'] = 'F';
break;
case 1:
$options['sensor_unit'] = 'C';
break;
}
discover_sensor('temperature', $device, $oid, "internalTemp.$index", 'wxgoos', $descr, $scale, $entry['internalTemp'], $options);
discover_sensor('temperature', $device, $oid, "internalTemp.$index", 'wxgoos', $descr, $scale, $entry['internalTemp'], $options);
// internalHumidity
$oid = ".1.3.6.1.4.1.17373.4.1.2.1.6.$index";
$scale = 1;
discover_sensor('humidity', $device, $oid, "internalHumidity.$index", 'wxgoos', $descr, $scale, $entry['internalHumidity']);
// internalHumidity
$oid = ".1.3.6.1.4.1.17373.4.1.2.1.6.$index";
$scale = 1;
discover_sensor('humidity', $device, $oid, "internalHumidity.$index", 'wxgoos', $descr, $scale, $entry['internalHumidity']);
}
// EOF

View File

@ -6,217 +6,244 @@
*
* @package observium
* @subpackage discovery
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2021 Observium Limited
* @copyright (C) Adam Armstrong
*
*/
$jnxDomCurrentTable_oids = array(
'jnxDomCurrentModuleTemperature',
'jnxDomCurrentModuleTemperatureHighAlarmThreshold',
'jnxDomCurrentModuleTemperatureLowAlarmThreshold',
'jnxDomCurrentModuleTemperatureHighWarningThreshold',
'jnxDomCurrentModuleTemperatureLowWarningThreshold',
$jnxDomCurrentTable_oids = [
'jnxDomCurrentModuleTemperature',
'jnxDomCurrentModuleTemperatureHighAlarmThreshold',
'jnxDomCurrentModuleTemperatureLowAlarmThreshold',
'jnxDomCurrentModuleTemperatureHighWarningThreshold',
'jnxDomCurrentModuleTemperatureLowWarningThreshold',
'jnxDomCurrentTxLaserBiasCurrent',
'jnxDomCurrentTxLaserBiasCurrentHighAlarmThreshold',
'jnxDomCurrentTxLaserBiasCurrentLowAlarmThreshold',
'jnxDomCurrentTxLaserBiasCurrentHighWarningThreshold',
'jnxDomCurrentTxLaserBiasCurrentLowWarningThreshold',
'jnxDomCurrentModuleVoltage',
'jnxDomCurrentModuleVoltageHighAlarmThreshold',
'jnxDomCurrentModuleVoltageLowAlarmThreshold',
'jnxDomCurrentModuleVoltageHighWarningThreshold',
'jnxDomCurrentModuleVoltageLowWarningThreshold',
'jnxDomCurrentRxLaserPower',
'jnxDomCurrentRxLaserPowerHighAlarmThreshold',
'jnxDomCurrentRxLaserPowerLowAlarmThreshold',
'jnxDomCurrentRxLaserPowerHighWarningThreshold',
'jnxDomCurrentRxLaserPowerLowWarningThreshold',
'jnxDomCurrentTxLaserBiasCurrent',
'jnxDomCurrentTxLaserBiasCurrentHighAlarmThreshold',
'jnxDomCurrentTxLaserBiasCurrentLowAlarmThreshold',
'jnxDomCurrentTxLaserBiasCurrentHighWarningThreshold',
'jnxDomCurrentTxLaserBiasCurrentLowWarningThreshold',
'jnxDomCurrentTxLaserOutputPower',
'jnxDomCurrentTxLaserOutputPowerHighAlarmThreshold',
'jnxDomCurrentTxLaserOutputPowerLowAlarmThreshold',
'jnxDomCurrentTxLaserOutputPowerHighWarningThreshold',
'jnxDomCurrentTxLaserOutputPowerLowWarningThreshold',
'jnxDomCurrentRxLaserPower',
'jnxDomCurrentRxLaserPowerHighAlarmThreshold',
'jnxDomCurrentRxLaserPowerLowAlarmThreshold',
'jnxDomCurrentRxLaserPowerHighWarningThreshold',
'jnxDomCurrentRxLaserPowerLowWarningThreshold',
'jnxDomCurrentModuleLaneCount'
);
'jnxDomCurrentTxLaserOutputPower',
'jnxDomCurrentTxLaserOutputPowerHighAlarmThreshold',
'jnxDomCurrentTxLaserOutputPowerLowAlarmThreshold',
'jnxDomCurrentTxLaserOutputPowerHighWarningThreshold',
'jnxDomCurrentTxLaserOutputPowerLowWarningThreshold',
$jnxDomCurrentLaneTable_oids = array(
'jnxDomCurrentLaneLaserTemperature',
'jnxDomCurrentLaneTxLaserBiasCurrent',
'jnxDomCurrentLaneRxLaserPower',
'jnxDomCurrentLaneTxLaserOutputPower',
);
'jnxDomCurrentModuleLaneCount'
];
$oids = array();
foreach ($jnxDomCurrentTable_oids as $oid)
{
$oids = snmpwalk_cache_oid($device, $oid, $oids, 'JUNIPER-DOM-MIB');
$jnxDomCurrentLaneTable_oids = [
'jnxDomCurrentLaneLaserTemperature',
'jnxDomCurrentLaneTxLaserBiasCurrent',
'jnxDomCurrentLaneRxLaserPower',
'jnxDomCurrentLaneTxLaserOutputPower',
];
$oids = [];
foreach ($jnxDomCurrentTable_oids as $oid) {
$oids = snmpwalk_cache_oid($device, $oid, $oids, 'JUNIPER-DOM-MIB');
}
//$oids = snmpwalk_cache_oid($device, 'jnxDomCurrentEntry', array(), 'JUNIPER-DOM-MIB');
$lane_oids = array();
$lane_oids = [];
foreach ($jnxDomCurrentLaneTable_oids as $oid) {
$lane_oids = snmpwalk_cache_oid($device, $oid, $lane_oids, 'JUNIPER-DOM-MIB');
$lane_oids = snmpwalk_cache_twopart_oid($device, $oid, $lane_oids, 'JUNIPER-DOM-MIB');
}
foreach ($oids as $index => $entry) {
$options = array('entPhysicalIndex' => $index);
$entry['index'] = $index;
$match = [ 'measured_match' => [ 'entity_type' => 'port', 'field' => 'ifIndex', 'match' => '%index%' ] ];
$options = entity_measured_match_definition($device, $match, $entry);
$port = get_port_by_index_cache($device['device_id'], $index);
if (is_array($port)) {
$entry['ifDescr'] = $port['port_label'];
$options['measured_class'] = 'port';
$options['measured_entity'] = $port['port_id'];
} else {
$entry['ifDescr'] = snmp_get_oid($device, "ifDescr.$index", 'IF-MIB');
}
if (isset($lane_oids[$index]) && safe_count($lane_oids[$index]) > 1) {
// Multi-lane sensors.
// Note, jnxDomCurrentModuleLaneCount can be 0 and 4 incorrectly
foreach ($lane_oids[$index] as $i => $lane_entry) {
$lane = $i + 1;
$lane_index = "$index.$i";
$descr = $entry['ifDescr'] . " Lane $lane Temperature";
$oid_name = 'jnxDomCurrentLaneLaserTemperature';
$oid_num = ".1.3.6.1.4.1.2636.3.60.1.2.1.1.9.{$lane_index}";
$scale = 1;
$value = $lane_entry[$oid_name];
$limits = [
'limit_high' => $entry['jnxDomCurrentModuleTemperatureHighAlarmThreshold'],
'limit_low' => $entry['jnxDomCurrentModuleTemperatureLowAlarmThreshold'],
'limit_high_warn' => $entry['jnxDomCurrentModuleTemperatureHighWarningThreshold'],
'limit_low_warn' => $entry['jnxDomCurrentModuleTemperatureLowWarningThreshold']
];
if ($value != 0) {
$limits['rename_rrd'] = "juniper-dom-$lane_index";
discover_sensor_ng($device, 'temperature', $mib, $oid_name, $oid_num, $lane_index, $descr, $scale, $value, array_merge($options, $limits));
}
// jnxDomCurrentTxLaserBiasCurrent
$descr = $entry['ifDescr'] . " Lane $lane TX Bias";
$oid_name = 'jnxDomCurrentLaneTxLaserBiasCurrent';
$oid_num = ".1.3.6.1.4.1.2636.3.60.1.2.1.1.7.{$lane_index}";
$scale = 0.000001;
$value = $lane_entry[$oid_name];
$limits = [
'limit_high' => $entry['jnxDomCurrentTxLaserBiasCurrentHighAlarmThreshold'] * $scale,
'limit_low' => $entry['jnxDomCurrentTxLaserBiasCurrentLowAlarmThreshold'] * $scale,
'limit_high_warn' => $entry['jnxDomCurrentTxLaserBiasCurrentHighWarningThreshold'] * $scale,
'limit_low_warn' => $entry['jnxDomCurrentTxLaserBiasCurrentLowWarningThreshold'] * $scale
];
$limits['rename_rrd'] = "juniper-dom-$lane_index";
discover_sensor_ng($device, 'current', $mib, $oid_name, $oid_num, $lane_index, $descr, $scale, $value, array_merge($options, $limits));
# jnxDomCurrentRxLaserPower[508] -507 0.01 dbm
$descr = $entry['ifDescr'] . " Lane $lane RX Power";
$oid_name = 'jnxDomCurrentLaneRxLaserPower';
$oid_num = ".1.3.6.1.4.1.2636.3.60.1.2.1.1.6.{$lane_index}";
$scale = 0.01;
$value = $lane_entry[$oid_name];
$limits = [
'limit_high' => $entry['jnxDomCurrentRxLaserPowerHighAlarmThreshold'] * $scale,
'limit_low' => $entry['jnxDomCurrentRxLaserPowerLowAlarmThreshold'] * $scale,
'limit_high_warn' => $entry['jnxDomCurrentRxLaserPowerHighWarningThreshold'] * $scale,
'limit_low_warn' => $entry['jnxDomCurrentRxLaserPowerLowWarningThreshold'] * $scale
];
$limits['rename_rrd'] = "juniper-dom-rx-$lane_index";
discover_sensor_ng($device, 'dbm', $mib, $oid_name, $oid_num, $lane_index, $descr, $scale, $value, array_merge($options, $limits));
# jnxDomCurrentTxLaserOutputPower[508] -507 0.01 dbm
$descr = $entry['ifDescr'] . " Lane $lane TX Power";
$oid_name = 'jnxDomCurrentLaneTxLaserOutputPower';
$oid_num = ".1.3.6.1.4.1.2636.3.60.1.2.1.1.8.{$lane_index}";
$scale = 0.01;
$value = $lane_entry[$oid_name];
$limits = [
'limit_high' => $entry['jnxDomCurrentTxLaserOutputPowerHighAlarmThreshold'] * $scale,
'limit_low' => $entry['jnxDomCurrentTxLaserOutputPowerLowAlarmThreshold'] * $scale,
'limit_high_warn' => $entry['jnxDomCurrentTxLaserOutputPowerHighWarningThreshold'] * $scale,
'limit_low_warn' => $entry['jnxDomCurrentTxLaserOutputPowerLowWarningThreshold'] * $scale
];
$limits['rename_rrd'] = "juniper-dom-tx-$lane_index";
discover_sensor_ng($device, 'dbm', $mib, $oid_name, $oid_num, $lane_index, $descr, $scale, $value, array_merge($options, $limits));
}
} else {
if ($entry['jnxDomCurrentTxLaserBiasCurrent'] == 0 &&
$entry['jnxDomCurrentTxLaserOutputPower'] == 0 && $entry['jnxDomCurrentRxLaserPower'] == 0) {
// Skip empty dom sensors
continue;
}
# jnxDomCurrentModuleTemperature[508] 35
# jnxDomCurrentModuleTemperatureHighAlarmThreshold[508] 100
# jnxDomCurrentModuleTemperatureLowAlarmThreshold[508] -25
# jnxDomCurrentModuleTemperatureHighWarningThreshold[508] 95
# jnxDomCurrentModuleTemperatureLowWarningThreshold[508] -20
$descr = $entry['ifDescr'] . ' Temperature';
$oid_name = 'jnxDomCurrentModuleTemperature';
$oid_num = ".1.3.6.1.4.1.2636.3.60.1.1.1.1.8.{$index}";
$scale = 1;
$value = $entry[$oid_name];
$limits = [
'limit_high' => $entry['jnxDomCurrentModuleTemperatureHighAlarmThreshold'],
'limit_low' => $entry['jnxDomCurrentModuleTemperatureLowAlarmThreshold'],
'limit_high_warn' => $entry['jnxDomCurrentModuleTemperatureHighWarningThreshold'],
'limit_low_warn' => $entry['jnxDomCurrentModuleTemperatureLowWarningThreshold']
];
if (isset($entry['jnxDomCurrentModuleLaneCount']) && $entry['jnxDomCurrentModuleLaneCount'] > 1) {
for ($i = 0; $i < $entry['jnxDomCurrentModuleLaneCount']; $i++) {
$lane = $i + 1;
$lane_index = "{$index}.{$i}";
$limits['rename_rrd'] = "juniper-dom-$index";
discover_sensor_ng($device, 'temperature', $mib, $oid_name, $oid_num, $index, $descr, $scale, $value, array_merge($options, $limits));
$descr = $entry['ifDescr'] . " Lane $lane Temperature";
$oid_name = 'jnxDomCurrentLaneLaserTemperature';
$oid_num = ".1.3.6.1.4.1.2636.3.60.1.2.1.1.9.{$lane_index}";
$scale = 1;
$value = $lane_oids[$lane_index][$oid_name];
// jnxDomCurrentModuleVoltage
if (isset($entry['jnxDomCurrentModuleVoltage'])) {
$descr = $entry['ifDescr'] . " Voltage";
$oid_name = 'jnxDomCurrentModuleVoltage';
$oid_num = ".1.3.6.1.4.1.2636.3.60.1.1.1.1.25.{$index}";
$scale = 0.001;
$value = $entry[$oid_name];
$limits = array('limit_high' => $entry['jnxDomCurrentModuleTemperatureHighAlarmThreshold'],
'limit_low' => $entry['jnxDomCurrentModuleTemperatureLowAlarmThreshold'],
'limit_high_warn' => $entry['jnxDomCurrentModuleTemperatureHighWarningThreshold'],
'limit_low_warn' => $entry['jnxDomCurrentModuleTemperatureLowWarningThreshold']);
$limits = [
'limit_high' => $entry['jnxDomCurrentModuleVoltageHighAlarmThreshold'] * $scale,
'limit_low' => $entry['jnxDomCurrentModuleVoltageLowAlarmThreshold'] * $scale,
'limit_high_warn' => $entry['jnxDomCurrentModuleVoltageHighWarningThreshold'] * $scale,
'limit_low_warn' => $entry['jnxDomCurrentModuleVoltageLowWarningThreshold'] * $scale
];
if ($value != 0)
{
$limits['rename_rrd'] = "juniper-dom-$lane_index";
discover_sensor_ng($device,'temperature', $mib, $oid_name, $oid_num, $lane_index, NULL, $descr, $scale, $value, array_merge($options, $limits));
}
discover_sensor_ng($device, 'voltage', $mib, $oid_name, $oid_num, $index, $descr, $scale, $value, array_merge($options, $limits));
}
// jnxDomCurrentTxLaserBiasCurrent
$descr = $entry['ifDescr'] . " Lane $lane TX Bias";
$oid_name = 'jnxDomCurrentLaneTxLaserBiasCurrent';
$oid_num = ".1.3.6.1.4.1.2636.3.60.1.2.1.1.7.{$lane_index}";
$scale = si_to_scale('micro'); // Yah, I forgot number :)
$value = $lane_oids[$lane_index][$oid_name];
// jnxDomCurrentTxLaserBiasCurrent
$descr = $entry['ifDescr'] . " TX Bias";
$oid_name = 'jnxDomCurrentTxLaserBiasCurrent';
$oid_num = ".1.3.6.1.4.1.2636.3.60.1.1.1.1.6.{$index}";
$scale = 0.000001;
$value = $entry[$oid_name];
$limits = array('limit_high' => $entry['jnxDomCurrentTxLaserBiasCurrentHighAlarmThreshold'] * $scale,
'limit_low' => $entry['jnxDomCurrentTxLaserBiasCurrentLowAlarmThreshold'] * $scale,
'limit_high_warn' => $entry['jnxDomCurrentTxLaserBiasCurrentHighWarningThreshold'] * $scale,
'limit_low_warn' => $entry['jnxDomCurrentTxLaserBiasCurrentLowWarningThreshold'] * $scale);
$limits = [
'limit_high' => $entry['jnxDomCurrentTxLaserBiasCurrentHighAlarmThreshold'] * $scale,
'limit_low' => $entry['jnxDomCurrentTxLaserBiasCurrentLowAlarmThreshold'] * $scale,
'limit_high_warn' => $entry['jnxDomCurrentTxLaserBiasCurrentHighWarningThreshold'] * $scale,
'limit_low_warn' => $entry['jnxDomCurrentTxLaserBiasCurrentLowWarningThreshold'] * $scale
];
$limits['rename_rrd'] = "juniper-dom-$lane_index";
discover_sensor_ng($device,'current', $mib, $oid_name, $oid_num, $lane_index, NULL, $descr, $scale, $value, array_merge($options, $limits));
$limits['rename_rrd'] = "juniper-dom-$index";
discover_sensor_ng($device, 'current', $mib, $oid_name, $oid_num, $index, $descr, $scale, $value, array_merge($options, $limits));
# jnxDomCurrentRxLaserPower[508] -507 0.01 dbm
$descr = $entry['ifDescr'] . " Lane $lane RX Power";
$oid_name = 'jnxDomCurrentLaneRxLaserPower';
$oid_num = ".1.3.6.1.4.1.2636.3.60.1.2.1.1.6.{$lane_index}";
$scale = 0.01;
$value = $lane_oids[$lane_index][$oid_name];
# jnxDomCurrentRxLaserPower[508] -507 0.01 dbm
$descr = $entry['ifDescr'] . " RX Power";
$oid_name = 'jnxDomCurrentRxLaserPower';
$oid_num = ".1.3.6.1.4.1.2636.3.60.1.1.1.1.5.{$index}";
$scale = 0.01;
$value = $entry[$oid_name];
$limits = array('limit_high' => $entry['jnxDomCurrentRxLaserPowerHighAlarmThreshold'] * $scale,
'limit_low' => $entry['jnxDomCurrentRxLaserPowerLowAlarmThreshold'] * $scale,
'limit_high_warn' => $entry['jnxDomCurrentRxLaserPowerHighWarningThreshold'] * $scale,
'limit_low_warn' => $entry['jnxDomCurrentRxLaserPowerLowWarningThreshold'] * $scale);
$limits = [
'limit_high' => $entry['jnxDomCurrentRxLaserPowerHighAlarmThreshold'] * $scale,
'limit_low' => $entry['jnxDomCurrentRxLaserPowerLowAlarmThreshold'] * $scale,
'limit_high_warn' => $entry['jnxDomCurrentRxLaserPowerHighWarningThreshold'] * $scale,
'limit_low_warn' => $entry['jnxDomCurrentRxLaserPowerLowWarningThreshold'] * $scale
];
$limits['rename_rrd'] = "juniper-dom-rx-$lane_index";
discover_sensor_ng($device,'dbm', $mib, $oid_name, $oid_num, $lane_index, NULL, $descr, $scale, $value, array_merge($options, $limits));
$limits['rename_rrd'] = "juniper-dom-rx-$index";
discover_sensor_ng($device, 'dbm', $mib, $oid_name, $oid_num, $index, $descr, $scale, $value, array_merge($options, $limits));
# jnxDomCurrentTxLaserOutputPower[508] -507 0.01 dbm
$descr = $entry['ifDescr'] . " Lane $lane TX Power";
$oid_name = 'jnxDomCurrentLaneTxLaserOutputPower';
$oid_num = ".1.3.6.1.4.1.2636.3.60.1.2.1.1.8.{$lane_index}";
$scale = 0.01;
$value = $lane_oids[$lane_index][$oid_name];
# jnxDomCurrentTxLaserOutputPower[508] -507 0.01 dbm
$descr = $entry['ifDescr'] . " TX Power";
$oid_name = 'jnxDomCurrentTxLaserOutputPower';
$oid_num = ".1.3.6.1.4.1.2636.3.60.1.1.1.1.7.{$index}";
$type = 'juniper-dom-tx'; // $mib . '-' . $oid_name;
$scale = 0.01;
$value = $entry[$oid_name];
$limits = array('limit_high' => $entry['jnxDomCurrentTxLaserOutputPowerHighAlarmThreshold'] * $scale,
'limit_low' => $entry['jnxDomCurrentTxLaserOutputPowerLowAlarmThreshold'] * $scale,
'limit_high_warn' => $entry['jnxDomCurrentTxLaserOutputPowerHighWarningThreshold'] * $scale,
'limit_low_warn' => $entry['jnxDomCurrentTxLaserOutputPowerLowWarningThreshold'] * $scale);
$limits = [
'limit_high' => $entry['jnxDomCurrentTxLaserOutputPowerHighAlarmThreshold'] * $scale,
'limit_low' => $entry['jnxDomCurrentTxLaserOutputPowerLowAlarmThreshold'] * $scale,
'limit_high_warn' => $entry['jnxDomCurrentTxLaserOutputPowerHighWarningThreshold'] * $scale,
'limit_low_warn' => $entry['jnxDomCurrentTxLaserOutputPowerLowWarningThreshold'] * $scale
];
$limits['rename_rrd'] = "juniper-dom-tx-$index";
discover_sensor_ng($device, 'dbm', $mib, $oid_name, $oid_num, $index, $descr, $scale, $value, array_merge($options, $limits));
$limits['rename_rrd'] = "juniper-dom-tx-$lane_index";
discover_sensor_ng($device,'dbm', $mib, $oid_name, $oid_num, $lane_index, NULL, $descr, $scale, $value, array_merge($options, $limits));
}
} else {
# jnxDomCurrentModuleTemperature[508] 35
# jnxDomCurrentModuleTemperatureHighAlarmThreshold[508] 100
# jnxDomCurrentModuleTemperatureLowAlarmThreshold[508] -25
# jnxDomCurrentModuleTemperatureHighWarningThreshold[508] 95
# jnxDomCurrentModuleTemperatureLowWarningThreshold[508] -20
$descr = $entry['ifDescr'] . ' Temperature';
$oid_name = 'jnxDomCurrentModuleTemperature';
$oid_num = ".1.3.6.1.4.1.2636.3.60.1.1.1.1.8.{$index}";
$scale = 1;
$value = $entry[$oid_name];
$limits = array('limit_high' => $entry['jnxDomCurrentModuleTemperatureHighAlarmThreshold'],
'limit_low' => $entry['jnxDomCurrentModuleTemperatureLowAlarmThreshold'],
'limit_high_warn' => $entry['jnxDomCurrentModuleTemperatureHighWarningThreshold'],
'limit_low_warn' => $entry['jnxDomCurrentModuleTemperatureLowWarningThreshold']);
if ($value != 0)
{
$limits['rename_rrd'] = "juniper-dom-$index";
discover_sensor_ng($device,'temperature', $mib, $oid_name, $oid_num, $index, NULL, $descr, $scale, $value, array_merge($options, $limits));
}
if ($entry['jnxDomCurrentTxLaserBiasCurrent'] == 0 &&
$entry['jnxDomCurrentTxLaserOutputPower'] == 0 && $entry['jnxDomCurrentRxLaserPower'] == 0)
{
// Skip other empty dom sensors
continue;
}
// jnxDomCurrentTxLaserBiasCurrent
$descr = $entry['ifDescr'] . " TX Bias";
$oid_name = 'jnxDomCurrentTxLaserBiasCurrent';
$oid_num = ".1.3.6.1.4.1.2636.3.60.1.1.1.1.6.{$index}";
$scale = si_to_scale('micro'); // Yah, I forgot number :)
$value = $entry[$oid_name];
$limits = array('limit_high' => $entry['jnxDomCurrentTxLaserBiasCurrentHighAlarmThreshold'] * $scale,
'limit_low' => $entry['jnxDomCurrentTxLaserBiasCurrentLowAlarmThreshold'] * $scale,
'limit_high_warn' => $entry['jnxDomCurrentTxLaserBiasCurrentHighWarningThreshold'] * $scale,
'limit_low_warn' => $entry['jnxDomCurrentTxLaserBiasCurrentLowWarningThreshold'] * $scale);
$limits['rename_rrd'] = "juniper-dom-$index";
discover_sensor_ng($device,'current', $mib, $oid_name, $oid_num, $index, NULL, $descr, $scale, $value, array_merge($options, $limits));
# jnxDomCurrentRxLaserPower[508] -507 0.01 dbm
$descr = $entry['ifDescr'] . " RX Power";
$oid_name = 'jnxDomCurrentRxLaserPower';
$oid_num = ".1.3.6.1.4.1.2636.3.60.1.1.1.1.5.{$index}";
$scale = 0.01;
$value = $entry[$oid_name];
$limits = array('limit_high' => $entry['jnxDomCurrentRxLaserPowerHighAlarmThreshold'] * $scale,
'limit_low' => $entry['jnxDomCurrentRxLaserPowerLowAlarmThreshold'] * $scale,
'limit_high_warn' => $entry['jnxDomCurrentRxLaserPowerHighWarningThreshold'] * $scale,
'limit_low_warn' => $entry['jnxDomCurrentRxLaserPowerLowWarningThreshold'] * $scale);
$limits['rename_rrd'] = "juniper-dom-rx-$index";
discover_sensor_ng($device,'dbm', $mib, $oid_name, $oid_num, $index, NULL, $descr, $scale, $value, array_merge($options, $limits));
# jnxDomCurrentTxLaserOutputPower[508] -507 0.01 dbm
$descr = $entry['ifDescr'] . " TX Power";
$oid_name = 'jnxDomCurrentTxLaserOutputPower';
$oid_num = ".1.3.6.1.4.1.2636.3.60.1.1.1.1.7.{$index}";
$type = 'juniper-dom-tx'; // $mib . '-' . $oid_name;
$scale = 0.01;
$value = $entry[$oid_name];
$limits = array('limit_high' => $entry['jnxDomCurrentTxLaserOutputPowerHighAlarmThreshold'] * $scale,
'limit_low' => $entry['jnxDomCurrentTxLaserOutputPowerLowAlarmThreshold'] * $scale,
'limit_high_warn' => $entry['jnxDomCurrentTxLaserOutputPowerHighWarningThreshold'] * $scale,
'limit_low_warn' => $entry['jnxDomCurrentTxLaserOutputPowerLowWarningThreshold'] * $scale);
$limits['rename_rrd'] = "juniper-dom-tx-$index";
discover_sensor_ng($device,'dbm', $mib, $oid_name, $oid_num, $index, NULL, $descr, $scale, $value, array_merge($options, $limits));
}
}

View File

@ -6,108 +6,104 @@
*
* @package observium
* @subpackage discovery
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2021 Observium Limited
* @copyright (C) Adam Armstrong
*
*/
$jnx = snmpwalk_cache_oid($device, 'jnxOpticsPMCurrentTable', array(), 'JUNIPER-IFOPTICS-MIB');
if (count($jnx) == 0 ) { return; }
$jnx = snmpwalk_cache_oid($device, 'jnxOpticsPMCurrentTable', [], 'JUNIPER-IFOPTICS-MIB');
if (count($jnx) == 0) {
return;
}
$jnx_config = snmpwalk_cache_oid($device, 'jnxOpticsConfigTable', array(), 'JUNIPER-IFOPTICS-MIB');
$jnx_config = snmpwalk_cache_oid($device, 'jnxOpticsConfigTable', [], 'JUNIPER-IFOPTICS-MIB');
$jnx_config = snmpwalk_cache_oid($device, 'jnxIfOtnOChCfgTable', $jnx_config, 'JUNIPER-IFOTN-MIB');
foreach ($jnx_config as $entry)
{
$ifIndex = $entry['jnxIfOtnIndex'];
if (isset($jnx[$ifIndex])) {
$jnx[$ifIndex] = array_merge($jnx[$ifIndex], $entry);
}
foreach ($jnx_config as $entry) {
$ifIndex = $entry['jnxIfOtnIndex'];
if (isset($jnx[$ifIndex])) {
$jnx[$ifIndex] = array_merge($jnx[$ifIndex], $entry);
}
}
if (OBS_DEBUG > 1)
{
print_vars($jnx);
//print_vars($jnx_config);
if (OBS_DEBUG > 1) {
print_vars($jnx);
//print_vars($jnx_config);
}
foreach ($jnx as $index => $entry)
{
$options = array('entPhysicalIndex' => $index);
$port = get_port_by_index_cache($device['device_id'], $index);
if (is_array($port))
{
$entry['ifDescr'] = $port['ifDescr'];
$options['measured_class'] = 'port';
$options['measured_entity'] = $port['port_id'];
} else {
$entry['ifDescr'] = snmp_get($device, 'ifDescr.'.$index, '-Oqv', 'IF-MIB');
}
foreach ($jnx as $index => $entry) {
$options = ['entPhysicalIndex' => $index];
$port = get_port_by_index_cache($device['device_id'], $index);
if (is_array($port)) {
$entry['ifDescr'] = $port['ifDescr'];
$options['measured_class'] = 'port';
$options['measured_entity'] = $port['port_id'];
} else {
$entry['ifDescr'] = snmp_get($device, 'ifDescr.' . $index, '-Oqv', 'IF-MIB');
}
// jnxPMCurTemperature
$descr = $entry['ifDescr'] . ' DOM';
$oid_name = 'jnxPMCurTemperature';
$oid_num = ".1.3.6.1.4.1.2636.3.71.1.2.1.1.39.{$index}";
$scale = 1;
$value = $entry[$oid_name];
$limits = array('limit_high' => $entry['jnxModuleTempHighThresh'] * $scale,
'limit_low' => $entry['jnxModuleTempLowThresh'] * $scale);
if ($value != 0 && $value != -32768)
{
discover_sensor_ng($device,'temperature', $mib, $oid_name, $oid_num, $index, NULL, $descr, $scale, $value, array_merge($options, $limits));
}
// jnxPMCurTemperature
$descr = $entry['ifDescr'] . ' DOM';
$oid_name = 'jnxPMCurTemperature';
$oid_num = ".1.3.6.1.4.1.2636.3.71.1.2.1.1.39.{$index}";
$scale = 1;
$value = $entry[$oid_name];
$limits = ['limit_high' => $entry['jnxModuleTempHighThresh'] * $scale,
'limit_low' => $entry['jnxModuleTempLowThresh'] * $scale];
if ($value != 0 && $value != -32768) {
discover_sensor_ng($device, 'temperature', $mib, $oid_name, $oid_num, $index, $descr, $scale, $value, array_merge($options, $limits));
}
if ( ($entry['jnxPMCurTxOutputPower'] == 0 || $entry['jnxPMCurTxOutputPower'] == -32768) &&
($entry['jnxPMCurRxInputPower'] == 0 || $entry['jnxPMCurRxInputPower'] == -32768) &&
($entry['jnxPMCurTxLaserBiasCurrent'] == 0 || $entry['jnxPMCurTxLaserBiasCurrent'] == -32768) &&
($entry['jnxPMCurRxLaserBiasCurrent'] == 0 || $entry['jnxPMCurRxLaserBiasCurrent'] == -32768) )
{
// Skip other empty dom sensors if all values are zero or -32768
continue;
}
if (($entry['jnxPMCurTxOutputPower'] == 0 || $entry['jnxPMCurTxOutputPower'] == -32768) &&
($entry['jnxPMCurRxInputPower'] == 0 || $entry['jnxPMCurRxInputPower'] == -32768) &&
($entry['jnxPMCurTxLaserBiasCurrent'] == 0 || $entry['jnxPMCurTxLaserBiasCurrent'] == -32768) &&
($entry['jnxPMCurRxLaserBiasCurrent'] == 0 || $entry['jnxPMCurRxLaserBiasCurrent'] == -32768)) {
// Skip other empty dom sensors if all values are zero or -32768
continue;
}
// jnxPMCurTxOutputPower
$descr = $entry['ifDescr'] . ' TX Power';
$oid_name = 'jnxPMCurTxOutputPower';
$oid_num = ".1.3.6.1.4.1.2636.3.71.1.2.1.1.7.{$index}";
$scale = 0.01;
$value = $entry[$oid_name];
$limits = array('limit_high' => $entry['jnxTxPowerHighThresh'] * $scale,
'limit_low' => $entry['jnxTxPowerLowThresh'] * $scale);
// jnxPMCurTxOutputPower
$descr = $entry['ifDescr'] . ' TX Power';
$oid_name = 'jnxPMCurTxOutputPower';
$oid_num = ".1.3.6.1.4.1.2636.3.71.1.2.1.1.7.{$index}";
$scale = 0.01;
$value = $entry[$oid_name];
$limits = ['limit_high' => $entry['jnxTxPowerHighThresh'] * $scale,
'limit_low' => $entry['jnxTxPowerLowThresh'] * $scale];
discover_sensor_ng($device,'dbm', $mib, $oid_name, $oid_num, $index, NULL, $descr, $scale, $value, array_merge($options, $limits));
discover_sensor_ng($device, 'dbm', $mib, $oid_name, $oid_num, $index, $descr, $scale, $value, array_merge($options, $limits));
// jnxPMCurRxInputPower
$descr = $entry['ifDescr'] . ' RX Power';
$oid_name = 'jnxPMCurRxInputPower';
$oid_num = ".1.3.6.1.4.1.2636.3.71.1.2.1.1.8.{$index}";
$scale = 0.01;
$value = $entry[$oid_name];
$limits = array('limit_high' => $entry['jnxRxPowerHighThresh'] * $scale,
'limit_low' => $entry['jnxRxPowerLowThresh'] * $scale);
discover_sensor_ng($device,'dbm', $mib, $oid_name, $oid_num, $index, NULL, $descr, $scale, $value, array_merge($options, $limits));
// jnxPMCurRxInputPower
$descr = $entry['ifDescr'] . ' RX Power';
$oid_name = 'jnxPMCurRxInputPower';
$oid_num = ".1.3.6.1.4.1.2636.3.71.1.2.1.1.8.{$index}";
$scale = 0.01;
$value = $entry[$oid_name];
$limits = ['limit_high' => $entry['jnxRxPowerHighThresh'] * $scale,
'limit_low' => $entry['jnxRxPowerLowThresh'] * $scale];
discover_sensor_ng($device, 'dbm', $mib, $oid_name, $oid_num, $index, $descr, $scale, $value, array_merge($options, $limits));
// jnxPMCurTxLaserBiasCurrent
$descr = $entry['ifDescr'] . ' TX Bias';
$oid_name = 'jnxPMCurTxLaserBiasCurrent';
$oid_num = ".1.3.6.1.4.1.2636.3.71.1.2.1.1.35.{$index}";
$scale = 0.0001;
$value = $entry[$oid_name];
discover_sensor_ng($device,'current', $mib, $oid_name, $oid_num, $index, NULL, $descr, $scale, $value, array_merge($options, $limits));
// jnxPMCurTxLaserBiasCurrent
$descr = $entry['ifDescr'] . ' TX Bias';
$oid_name = 'jnxPMCurTxLaserBiasCurrent';
$oid_num = ".1.3.6.1.4.1.2636.3.71.1.2.1.1.35.{$index}";
$scale = 0.0001;
$value = $entry[$oid_name];
discover_sensor_ng($device, 'current', $mib, $oid_name, $oid_num, $index, $descr, $scale, $value, array_merge($options, $limits));
// jnxPMCurRxLaserBiasCurrent
$descr = $entry['ifDescr'] . ' RX Bias';
$oid_name = 'jnxPMCurRxLaserBiasCurrent';
$oid_num = ".1.3.6.1.4.1.2636.3.71.1.2.1.1.47.{$index}";
$scale = 0.0001;
$value = $entry[$oid_name];
discover_sensor_ng($device,'current', $mib, $oid_name, $oid_num, $index, NULL, $descr, $scale, $value, array_merge($options, $limits));
// jnxPMCurRxLaserBiasCurrent
$descr = $entry['ifDescr'] . ' RX Bias';
$oid_name = 'jnxPMCurRxLaserBiasCurrent';
$oid_num = ".1.3.6.1.4.1.2636.3.71.1.2.1.1.47.{$index}";
$scale = 0.0001;
$value = $entry[$oid_name];
discover_sensor_ng($device, 'current', $mib, $oid_name, $oid_num, $index, $descr, $scale, $value, array_merge($options, $limits));
// FIXME. Not added or unsupported now
// jnxPMCurChromaticDispersion
// jnxPMCurDiffGroupDelay
// jnxPMCurQ
// jnxPMCurSNR
// jnxPMCurSuspectedFlag
// jnxPMCurCarFreqOffset
// FIXME. Not added or unsupported now
// jnxPMCurChromaticDispersion
// jnxPMCurDiffGroupDelay
// jnxPMCurQ
// jnxPMCurSNR
// jnxPMCurSuspectedFlag
// jnxPMCurCarFreqOffset
}
// EOF

View File

@ -5,9 +5,9 @@
*
* This file is part of Observium.
*
* @package observium
* @subpackage discovery
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2019 Observium Limited
* @package observium
* @subpackage discovery
* @copyright (C) Adam Armstrong
*
*/
@ -25,35 +25,31 @@
#LIEBERT-GP-ENVIRONMENTAL-MIB::lgpEnvTemperatureDescrDegC.10 = OID: LIEBERT-GP-ENVIRONMENTAL-MIB::lgpCoolantTemperature
// temperature/humidity sensor
$lgpEnvTemperature = snmpwalk_cache_oid($device, 'lgpEnvTemperature', array(), 'LIEBERT-GP-ENVIRONMENTAL-MIB');
$lgpEnvTemperature = snmpwalk_cache_oid($device, 'lgpEnvTemperature', [], 'LIEBERT-GP-ENVIRONMENTAL-MIB');
foreach ($lgpEnvTemperature as $index => $entry)
{
$descr = str_replace(array('lgp', 'lgpEnv'), '', $entry['lgpEnvTemperatureDescrDegC']);
$descr = trim(preg_replace('/([A-Z][a-z]+\d*)/', '$1 ', $descr)); // turn "DigitalScrollCompressor1Temperature" into "Digital Scroll Compressor1 Temperature"
foreach ($lgpEnvTemperature as $index => $entry) {
$descr = str_replace(['lgp', 'lgpEnv'], '', $entry['lgpEnvTemperatureDescrDegC']);
$descr = trim(preg_replace('/([A-Z][a-z]+\d*)/', '$1 ', $descr)); // turn "DigitalScrollCompressor1Temperature" into "Digital Scroll Compressor1 Temperature"
if (isset($entry['lgpEnvTemperatureMeasurementTenthsDegC']) &&
$entry['lgpEnvTemperatureMeasurementTenthsDegC'] >= 0 && $entry['lgpEnvTemperatureMeasurementTenthsDegC'] < 2147483647)
{
// Tenths tables have more accurate values
$scale = 0.1;
$oid = '.1.3.6.1.4.1.476.1.42.3.4.1.3.3.1.50.'.$index;
$value = $entry['lgpEnvTemperatureMeasurementTenthsDegC'];
$limits = array('limit_high' => (isset($entry['lgpEnvTemperatureHighThresholdTenthsDegC']) ? $entry['lgpEnvTemperatureHighThresholdTenthsDegC'] * $scale : NULL),
'limit_low' => (isset($entry['lgpEnvTemperatureLowThresholdTenthsDegC']) ? $entry['lgpEnvTemperatureLowThresholdTenthsDegC'] * $scale : NULL));
if (isset($entry['lgpEnvTemperatureMeasurementTenthsDegC']) &&
$entry['lgpEnvTemperatureMeasurementTenthsDegC'] >= 0 && $entry['lgpEnvTemperatureMeasurementTenthsDegC'] < 2147483647) {
// Tenths tables have more accurate values
$scale = 0.1;
$oid = '.1.3.6.1.4.1.476.1.42.3.4.1.3.3.1.50.' . $index;
$value = $entry['lgpEnvTemperatureMeasurementTenthsDegC'];
$limits = ['limit_high' => (isset($entry['lgpEnvTemperatureHighThresholdTenthsDegC']) ? $entry['lgpEnvTemperatureHighThresholdTenthsDegC'] * $scale : NULL),
'limit_low' => (isset($entry['lgpEnvTemperatureLowThresholdTenthsDegC']) ? $entry['lgpEnvTemperatureLowThresholdTenthsDegC'] * $scale : NULL)];
discover_sensor('temperature', $device, $oid, "lgpEnvTemperatureMeasurementTenthsDegC.$index", 'liebert', $descr, $scale, $value, $limits);
}
else if (isset($entry['lgpEnvTemperatureMeasurementDegC']) &&
$entry['lgpEnvTemperatureMeasurementDegC'] >= 0 && $entry['lgpEnvTemperatureMeasurementDegC'] < 2147483647)
{
$oid = '.1.3.6.1.4.1.476.1.42.3.4.1.3.3.1.3.'.$index;
$value = $entry['lgpEnvTemperatureMeasurementDegC'];
$limits = array('limit_high' => (isset($entry['lgpEnvTemperatureHighThresholdDegC']) ? $entry['lgpEnvTemperatureHighThresholdDegC'] : NULL),
'limit_low' => (isset($entry['lgpEnvTemperatureLowThresholdDegC']) ? $entry['lgpEnvTemperatureLowThresholdDegC'] : NULL));
discover_sensor('temperature', $device, $oid, "lgpEnvTemperatureMeasurementTenthsDegC.$index", 'liebert', $descr, $scale, $value, $limits);
} elseif (isset($entry['lgpEnvTemperatureMeasurementDegC']) &&
$entry['lgpEnvTemperatureMeasurementDegC'] >= 0 && $entry['lgpEnvTemperatureMeasurementDegC'] < 2147483647) {
$oid = '.1.3.6.1.4.1.476.1.42.3.4.1.3.3.1.3.' . $index;
$value = $entry['lgpEnvTemperatureMeasurementDegC'];
$limits = ['limit_high' => (isset($entry['lgpEnvTemperatureHighThresholdDegC']) ? $entry['lgpEnvTemperatureHighThresholdDegC'] : NULL),
'limit_low' => (isset($entry['lgpEnvTemperatureLowThresholdDegC']) ? $entry['lgpEnvTemperatureLowThresholdDegC'] : NULL)];
discover_sensor('temperature', $device, $oid, "lgpEnvTemperatureMeasurementDegC.$index", 'liebert', $descr, 1, $value, $limits);
}
discover_sensor('temperature', $device, $oid, "lgpEnvTemperatureMeasurementDegC.$index", 'liebert', $descr, 1, $value, $limits);
}
}
#LIEBERT-GP-ENVIRONMENTAL-MIB::lgpEnvHumidityMeasurementRel.1 = INTEGER: 18 percent Relative Humidity
@ -64,34 +60,30 @@ foreach ($lgpEnvTemperature as $index => $entry)
#LIEBERT-GP-ENVIRONMENTAL-MIB::lgpEnvHumidityLowThresholdRelTenths.1 = 150
#LIEBERT-GP-ENVIRONMENTAL-MIB::lgpEnvHumidityDescrRel.1 = lgpEnvControlHumidity
$lgpEnvHumidity = snmpwalk_cache_oid($device, 'lgpEnvHumidity', array(), 'LIEBERT-GP-ENVIRONMENTAL-MIB');
$lgpEnvHumidity = snmpwalk_cache_oid($device, 'lgpEnvHumidity', [], 'LIEBERT-GP-ENVIRONMENTAL-MIB');
foreach ($lgpEnvHumidity as $index => $entry)
{
$descr = str_replace(array('lgp', 'lgpEnv'), '', $entry['lgpEnvHumidityDescrRel']);
$descr = trim(preg_replace('/([A-Z][a-z]+\d*)/', '$1 ', $descr)); // turn "EnvControlHumidity" into "Env Control Humidity"
foreach ($lgpEnvHumidity as $index => $entry) {
$descr = str_replace(['lgp', 'lgpEnv'], '', $entry['lgpEnvHumidityDescrRel']);
$descr = trim(preg_replace('/([A-Z][a-z]+\d*)/', '$1 ', $descr)); // turn "EnvControlHumidity" into "Env Control Humidity"
if (isset($entry['lgpEnvHumidityMeasurementRelTenths']) &&
$entry['lgpEnvHumidityMeasurementRelTenths'] >= 0 && $entry['lgpEnvHumidityMeasurementRelTenths'] < 2147483647)
{
// Tenths tables have more accurate values
$scale = 0.1;
$oid = '.1.3.6.1.4.1.476.1.42.3.4.2.2.3.1.50.'.$index;
$value = $entry['lgpEnvHumidityMeasurementRelTenths'];
$limits = array('limit_high' => (isset($entry['lgpEnvHumidityHighThresholdRelTenths']) ? $entry['lgpEnvHumidityHighThresholdRelTenths'] * $scale : NULL),
'limit_low' => (isset($entry['lgpEnvHumidityLowThresholdRelTenths']) ? $entry['lgpEnvHumidityLowThresholdRelTenths'] * $scale : NULL));
if (isset($entry['lgpEnvHumidityMeasurementRelTenths']) &&
$entry['lgpEnvHumidityMeasurementRelTenths'] >= 0 && $entry['lgpEnvHumidityMeasurementRelTenths'] < 2147483647) {
// Tenths tables have more accurate values
$scale = 0.1;
$oid = '.1.3.6.1.4.1.476.1.42.3.4.2.2.3.1.50.' . $index;
$value = $entry['lgpEnvHumidityMeasurementRelTenths'];
$limits = ['limit_high' => (isset($entry['lgpEnvHumidityHighThresholdRelTenths']) ? $entry['lgpEnvHumidityHighThresholdRelTenths'] * $scale : NULL),
'limit_low' => (isset($entry['lgpEnvHumidityLowThresholdRelTenths']) ? $entry['lgpEnvHumidityLowThresholdRelTenths'] * $scale : NULL)];
discover_sensor('humidity', $device, $oid, "lgpEnvHumidityMeasurementRel.$index", 'liebert', $descr, $scale, $value, $limits);
}
else if (isset($entry['lgpEnvHumidityMeasurementRel']) && $entry['lgpEnvHumidityMeasurementRel'] >= 0)
{
$oid = '.1.3.6.1.4.1.476.1.42.3.4.2.2.3.1.3.'.$index;
$value = $entry['lgpEnvHumidityMeasurementRel'];
$limits = array('limit_high' => (isset($entry['lgpEnvHumidityHighThresholdRel']) ? $entry['lgpEnvHumidityHighThresholdRel'] : NULL),
'limit_low' => (isset($entry['lgpEnvHumidityLowThresholdRel']) ? $entry['lgpEnvHumidityLowThresholdRel'] : NULL));
discover_sensor('humidity', $device, $oid, "lgpEnvHumidityMeasurementRel.$index", 'liebert', $descr, $scale, $value, $limits);
} elseif (isset($entry['lgpEnvHumidityMeasurementRel']) && $entry['lgpEnvHumidityMeasurementRel'] >= 0) {
$oid = '.1.3.6.1.4.1.476.1.42.3.4.2.2.3.1.3.' . $index;
$value = $entry['lgpEnvHumidityMeasurementRel'];
$limits = ['limit_high' => (isset($entry['lgpEnvHumidityHighThresholdRel']) ? $entry['lgpEnvHumidityHighThresholdRel'] : NULL),
'limit_low' => (isset($entry['lgpEnvHumidityLowThresholdRel']) ? $entry['lgpEnvHumidityLowThresholdRel'] : NULL)];
discover_sensor('humidity', $device, $oid, "lgpEnvHumidityMeasurementRel.$index", 'liebert', $descr, 1, $value, $limits);
}
discover_sensor('humidity', $device, $oid, "lgpEnvHumidityMeasurementRel.$index", 'liebert', $descr, 1, $value, $limits);
}
}
//LIEBERT-GP-ENVIRONMENTAL-MIB::lgpEnvStateSystem.0 = INTEGER: on(1)
@ -110,42 +102,39 @@ foreach ($lgpEnvHumidity as $index => $entry)
//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');
$lgpEnvState = snmpwalk_cache_oid($device, 'lgpEnvState', [], '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'),
);
$states = [
'lgpEnvStateSystem' => ['type' => 'state', 'oid' => '.1.3.6.1.4.1.476.1.42.3.4.3.1.0'],
'lgpEnvStateCooling' => ['type' => 'state', 'oid' => '.1.3.6.1.4.1.476.1.42.3.4.3.2.0'],
'lgpEnvStateHumidifying' => ['type' => 'state', 'oid' => '.1.3.6.1.4.1.476.1.42.3.4.3.4.0'],
'lgpEnvStateDehumidifying' => ['type' => 'state', 'oid' => '.1.3.6.1.4.1.476.1.42.3.4.3.5.0'],
'lgpEnvStateFan' => ['type' => 'state', 'oid' => '.1.3.6.1.4.1.476.1.42.3.4.3.7.0'],
'lgpEnvStateFreeCooling' => ['type' => 'state', 'oid' => '.1.3.6.1.4.1.476.1.42.3.4.3.20.0'],
'lgpEnvStateElectricHeater' => ['type' => 'state', 'oid' => '.1.3.6.1.4.1.476.1.42.3.4.3.21.0'],
'lgpEnvStateHotWater' => ['type' => 'state', 'oid' => '.1.3.6.1.4.1.476.1.42.3.4.3.22.0'],
'lgpEnvStateCoolingCapacity' => ['type' => 'capacity', 'oid' => '.1.3.6.1.4.1.476.1.42.3.4.3.9.0'],
'lgpEnvStateHeatingCapacity' => ['type' => 'capacity', 'oid' => '.1.3.6.1.4.1.476.1.42.3.4.3.10.0'],
'lgpEnvStateFanCapacity' => ['type' => 'capacity', 'oid' => '.1.3.6.1.4.1.476.1.42.3.4.3.16.0'],
'lgpEnvStateFreeCoolingCapacity' => ['type' => 'capacity', 'oid' => '.1.3.6.1.4.1.476.1.42.3.4.3.17.0'],
'lgpEnvStateDehumidifyingCapacity' => ['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('capacity', $device, $oid, "$name.0", 'liebert', $descr, 1, $value);
break;
default:
// Statuses
discover_status($device, $oid, "$name.0", 'liebert-state', $descr, $value);
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('capacity', $device, $oid, "$name.0", 'liebert', $descr, 1, $value);
break;
default:
// Statuses
discover_status($device, $oid, "$name.0", 'liebert-state', $descr, $value);
}
}
}
}
// EOF

View File

@ -5,9 +5,9 @@
*
* This file is part of Observium.
*
* @package observium
* @subpackage discovery
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2019 Observium Limited
* @package observium
* @subpackage discovery
* @copyright (C) Adam Armstrong
*
*/
@ -31,254 +31,240 @@ $mib = 'LIEBERT-GP-PDU-MIB';
//LIEBERT-GP-PDU-MIB::lgpPduPsEntryApTotal.1.1 = Gauge32: 4667 VoltAmp
//LIEBERT-GP-PDU-MIB::lgpPduPsEntryPfTotal.1.1 = INTEGER: 0 0.01 Power Factor
$lgpPduPsEntry = snmpwalk_cache_oid($device, 'lgpPduPsEntry', array(), $mib);
$lgpPduPsEntry = snmpwalk_cache_oid($device, 'lgpPduPsEntry', [], $mib);
print_debug_vars($lgpPduPsEntry);
foreach ($lgpPduPsEntry as $index => $entry)
{
$descr = $entry['lgpPduPsEntrySysAssignLabel'] . ' Total';
foreach ($lgpPduPsEntry as $index => $entry) {
$descr = $entry['lgpPduPsEntrySysAssignLabel'] . ' Total';
$scale = 1;
$oid_name = 'lgpPduPsEntryPwrTotal';
$oid_num = '.1.3.6.1.4.1.476.1.42.3.8.30.20.1.65.' . $index;
$type = $mib . '-' . $oid_name;
$value = $entry[$oid_name];
$scale = 1;
$oid_name = 'lgpPduPsEntryPwrTotal';
$oid_num = '.1.3.6.1.4.1.476.1.42.3.8.30.20.1.65.' . $index;
$type = $mib . '-' . $oid_name;
$value = $entry[$oid_name];
discover_sensor('power', $device, $oid_num, $index, $type, $descr, $scale, $value);
discover_sensor('power', $device, $oid_num, $index, $type, $descr, $scale, $value);
$scale = 0.1;
$oid_name = 'lgpPduPsEntryEcNeutral';
$oid_num = '.1.3.6.1.4.1.476.1.42.3.8.30.20.1.70.' . $index;
$type = $mib . '-' . $oid_name;
$value = $entry[$oid_name];
// convert percent limits to absolute values
$options = array('limit_high_warn' => $entry['lgpPduPsEntryEcNeutralThrshldOvrWarn'] * $entry['lgpPduPsEntryEcInputRated'] * 0.001,
'limit_high' => $entry['lgpPduPsEntryEcNeutralThrshldOvrAlarm'] * $entry['lgpPduPsEntryEcInputRated'] * 0.001);
$scale = 0.1;
$oid_name = 'lgpPduPsEntryEcNeutral';
$oid_num = '.1.3.6.1.4.1.476.1.42.3.8.30.20.1.70.' . $index;
$type = $mib . '-' . $oid_name;
$value = $entry[$oid_name];
// convert percent limits to absolute values
$options = ['limit_high_warn' => $entry['lgpPduPsEntryEcNeutralThrshldOvrWarn'] * $entry['lgpPduPsEntryEcInputRated'] * 0.001,
'limit_high' => $entry['lgpPduPsEntryEcNeutralThrshldOvrAlarm'] * $entry['lgpPduPsEntryEcInputRated'] * 0.001];
discover_sensor('current', $device, $oid_num, $index, $type, $descr, $scale, $value, $options);
discover_sensor('current', $device, $oid_num, $index, $type, $descr, $scale, $value, $options);
$scale = 1;
$oid_name = 'lgpPduPsEntryApTotal';
$oid_num = '.1.3.6.1.4.1.476.1.42.3.8.30.20.1.90.' . $index;
$type = $mib . '-' . $oid_name;
$value = $entry[$oid_name];
$scale = 1;
$oid_name = 'lgpPduPsEntryApTotal';
$oid_num = '.1.3.6.1.4.1.476.1.42.3.8.30.20.1.90.' . $index;
$type = $mib . '-' . $oid_name;
$value = $entry[$oid_name];
discover_sensor('apower', $device, $oid_num, $index, $type, $descr, $scale, $value);
discover_sensor('apower', $device, $oid_num, $index, $type, $descr, $scale, $value);
$scale = 0.01;
$oid_name = 'lgpPduPsEntryPfTotal';
$oid_num = '.1.3.6.1.4.1.476.1.42.3.8.30.20.1.95.' . $index;
$type = $mib . '-' . $oid_name;
$value = $entry[$oid_name];
$scale = 0.01;
$oid_name = 'lgpPduPsEntryPfTotal';
$oid_num = '.1.3.6.1.4.1.476.1.42.3.8.30.20.1.95.' . $index;
$type = $mib . '-' . $oid_name;
$value = $entry[$oid_name];
if ($value > 0)
{
discover_sensor('powerfactor', $device, $oid_num, $index, $type, $descr, $scale, $value);
}
if ($value > 0) {
discover_sensor('powerfactor', $device, $oid_num, $index, $type, $descr, $scale, $value);
}
}
$oids = snmpwalk_cache_oid($device, 'lgpPduPsLineEntry', array(), $mib);
$oids = snmpwalk_cache_oid($device, 'lgpPduPsLineEntry', [], $mib);
print_debug_vars($oids);
foreach ($oids as $index => $entry)
{
list($lgpPduEntryIndex, $lgpPduPsEntryIndex, $lgpPduPsLineEntryIndex) = explode('.', $index);
$pdu_index = $lgpPduEntryIndex . '.' . $lgpPduPsEntryIndex;
foreach ($oids as $index => $entry) {
[$lgpPduEntryIndex, $lgpPduPsEntryIndex, $lgpPduPsLineEntryIndex] = explode('.', $index);
$pdu_index = $lgpPduEntryIndex . '.' . $lgpPduPsEntryIndex;
if (isset($lgpPduPsEntry[$pdu_index]['lgpPduPsEntrySysAssignLabel']))
{
$descr = $lgpPduPsEntry[$pdu_index]['lgpPduPsEntrySysAssignLabel'];
} else {
$descr = 'PEM: ' . $lgpPduEntryIndex . '-' . $lgpPduPsEntryIndex;
}
$descr .= ' Phase ' . str_ireplace('phase', '', $entry['lgpPduPsLineEntryLine']); // add phase name
if (isset($lgpPduPsEntry[$pdu_index]['lgpPduPsEntrySysAssignLabel'])) {
$descr = $lgpPduPsEntry[$pdu_index]['lgpPduPsEntrySysAssignLabel'];
} else {
$descr = 'PEM: ' . $lgpPduEntryIndex . '-' . $lgpPduPsEntryIndex;
}
$descr .= ' Phase ' . str_ireplace('phase', '', $entry['lgpPduPsLineEntryLine']); // add phase name
if (isset($entry['lgpPduPsLineEntryEpLNTenths'])) {
$scale = 0.1;
$oid_name = 'lgpPduPsLineEntryEpLNTenths';
$oid_num = '.1.3.6.1.4.1.476.1.42.3.8.30.40.1.19.' . $index;
$type = $mib . '-' . $oid_name;
$value = $entry[$oid_name];
} else {
$scale = 1;
$oid_name = 'lgpPduPsLineEntryEpLN';
$oid_num = '.1.3.6.1.4.1.476.1.42.3.8.30.40.1.20.' . $index;
$type = $mib . '-' . $oid_name;
$value = $entry[$oid_name];
}
discover_sensor('voltage', $device, $oid_num, $index, $type, $descr, $scale, $value);
if (isset($entry['lgpPduPsLineEntryEcHundredths'])) {
$scale = 0.01;
$oid_name = 'lgpPduPsLineEntryEcHundredths';
$oid_num = '.1.3.6.1.4.1.476.1.42.3.8.30.40.1.22.' . $index;
$type = $mib . '-' . $oid_name;
$value = $entry[$oid_name];
} else {
$scale = 0.1;
$oid_name = 'lgpPduPsLineEntryEc';
$oid_num = '.1.3.6.1.4.1.476.1.42.3.8.30.40.1.21.' . $index;
$type = $mib . '-' . $oid_name;
$value = $entry[$oid_name];
}
// convert percent limits to absolute values
$options = ['limit_high_warn' => $entry['lgpPduPsLineEntryEcThrshldOvrWarn'] * $lgpPduPsEntry[$pdu_index]['lgpPduPsEntryEcInputRated'] * 0.001,
'limit_high' => $entry['lgpPduPsLineEntryEcThrshldOvrAlarm'] * $lgpPduPsEntry[$pdu_index]['lgpPduPsEntryEcInputRated'] * 0.001];
discover_sensor('current', $device, $oid_num, $index, $type, $descr, $scale, $value, $options);
if (isset($entry['lgpPduPsLineEntryEpLNTenths']))
{
$scale = 0.1;
$oid_name = 'lgpPduPsLineEntryEpLNTenths';
$oid_num = '.1.3.6.1.4.1.476.1.42.3.8.30.40.1.19.' . $index;
$type = $mib . '-' . $oid_name;
$value = $entry[$oid_name];
} else {
$scale = 1;
$oid_name = 'lgpPduPsLineEntryEpLN';
$oid_num = '.1.3.6.1.4.1.476.1.42.3.8.30.40.1.20.' . $index;
$oid_name = 'lgpPduPsLineEntryPwrLN';
$oid_num = '.1.3.6.1.4.1.476.1.42.3.8.30.40.1.63.' . $index;
$type = $mib . '-' . $oid_name;
$value = $entry[$oid_name];
}
discover_sensor('voltage', $device, $oid_num, $index, $type, $descr, $scale, $value);
discover_sensor('power', $device, $oid_num, $index, $type, $descr, $scale, $value);
$scale = 1;
$oid_name = 'lgpPduPsLineEntryApLN';
$oid_num = '.1.3.6.1.4.1.476.1.42.3.8.30.40.1.65.' . $index;
$type = $mib . '-' . $oid_name;
$value = $entry[$oid_name];
discover_sensor('apower', $device, $oid_num, $index, $type, $descr, $scale, $value);
if (isset($entry['lgpPduPsLineEntryEcHundredths']))
{
$scale = 0.01;
$oid_name = 'lgpPduPsLineEntryEcHundredths';
$oid_num = '.1.3.6.1.4.1.476.1.42.3.8.30.40.1.22.' . $index;
$oid_name = 'lgpPduPsLineEntryPfLN';
$oid_num = '.1.3.6.1.4.1.476.1.42.3.8.30.40.1.67.' . $index;
$type = $mib . '-' . $oid_name;
$value = $entry[$oid_name];
} else {
$scale = 0.1;
$oid_name = 'lgpPduPsLineEntryEc';
$oid_num = '.1.3.6.1.4.1.476.1.42.3.8.30.40.1.21.' . $index;
$type = $mib . '-' . $oid_name;
$value = $entry[$oid_name];
}
// convert percent limits to absolute values
$options = array('limit_high_warn' => $entry['lgpPduPsLineEntryEcThrshldOvrWarn'] * $lgpPduPsEntry[$pdu_index]['lgpPduPsEntryEcInputRated'] * 0.001,
'limit_high' => $entry['lgpPduPsLineEntryEcThrshldOvrAlarm'] * $lgpPduPsEntry[$pdu_index]['lgpPduPsEntryEcInputRated'] * 0.001);
discover_sensor('current', $device, $oid_num, $index, $type, $descr, $scale, $value, $options);
$scale = 1;
$oid_name = 'lgpPduPsLineEntryPwrLN';
$oid_num = '.1.3.6.1.4.1.476.1.42.3.8.30.40.1.63.' . $index;
$type = $mib . '-' . $oid_name;
$value = $entry[$oid_name];
discover_sensor('power', $device, $oid_num, $index, $type, $descr, $scale, $value);
$scale = 1;
$oid_name = 'lgpPduPsLineEntryApLN';
$oid_num = '.1.3.6.1.4.1.476.1.42.3.8.30.40.1.65.' . $index;
$type = $mib . '-' . $oid_name;
$value = $entry[$oid_name];
discover_sensor('apower', $device, $oid_num, $index, $type, $descr, $scale, $value);
$scale = 0.01;
$oid_name = 'lgpPduPsLineEntryPfLN';
$oid_num = '.1.3.6.1.4.1.476.1.42.3.8.30.40.1.67.' . $index;
$type = $mib . '-' . $oid_name;
$value = $entry[$oid_name];
if ($value > 0)
{
discover_sensor('powerfactor', $device, $oid_num, $index, $type, $descr, $scale, $value);
}
if ($value > 0) {
discover_sensor('powerfactor', $device, $oid_num, $index, $type, $descr, $scale, $value);
}
}
$lgpPduRbEntry = snmpwalk_cache_oid($device, 'lgpPduRbEntry', array(), $mib);
$lgpPduRbEntry = snmpwalk_cache_oid($device, 'lgpPduRbEntry', [], $mib);
print_debug_vars($lgpPduRbEntry);
foreach ($lgpPduRbEntry as $index => $entry)
{
foreach ($lgpPduRbEntry as $index => $entry) {
}
$oids = snmpwalk_cache_oid($device, 'lgpPduRcpEntry', array(), $mib);
$oids = snmpwalk_cache_oid($device, 'lgpPduRcpEntry', [], $mib);
print_debug_vars($oids);
foreach ($oids as $index => $entry)
{
list($lgpPduEntryIndex, $lgpPduRbEntryIndex, $lgpPduRcpEntryIndex) = explode('.', $index);
$rb_index = $lgpPduEntryIndex . '.' . $lgpPduRbEntryIndex;
foreach ($oids as $index => $entry) {
[$lgpPduEntryIndex, $lgpPduRbEntryIndex, $lgpPduRcpEntryIndex] = explode('.', $index);
$rb_index = $lgpPduEntryIndex . '.' . $lgpPduRbEntryIndex;
if (strlen($entry['lgpPduRcpEntryUsrLabel']))
{
$descr = $entry['lgpPduRcpEntryUsrLabel'];
if (strlen($entry['lgpPduRcpEntryUsrLabel'])) {
$descr = $entry['lgpPduRcpEntryUsrLabel'];
if (strlen($entry['lgpPduRcpEntryUsrTag1']))
{
$descr .= ' (' . $entry['lgpPduRcpEntryUsrTag1'] . ')';
if (strlen($entry['lgpPduRcpEntryUsrTag1'])) {
$descr .= ' (' . $entry['lgpPduRcpEntryUsrTag1'] . ')';
}
} else {
$descr = $entry['lgpPduRcpEntrySysAssignLabel'];
}
} else {
$descr = $entry['lgpPduRcpEntrySysAssignLabel'];
}
if (isset($entry['lgpPduRcpEntryEpTenths']))
{
$scale = 0.1;
$oid_name = 'lgpPduRcpEntryEpTenths';
$oid_num = '.1.3.6.1.4.1.476.1.42.3.8.50.20.1.56.' . $index;
$type = $mib . '-' . $oid_name;
$value = $entry[$oid_name];
} else {
if (isset($entry['lgpPduRcpEntryEpTenths'])) {
$scale = 0.1;
$oid_name = 'lgpPduRcpEntryEpTenths';
$oid_num = '.1.3.6.1.4.1.476.1.42.3.8.50.20.1.56.' . $index;
$type = $mib . '-' . $oid_name;
$value = $entry[$oid_name];
} else {
$scale = 1;
$oid_name = 'lgpPduRcpEntryEp';
$oid_num = '.1.3.6.1.4.1.476.1.42.3.8.50.20.1.55.' . $index;
$type = $mib . '-' . $oid_name;
$value = $entry[$oid_name];
}
discover_sensor('voltage', $device, $oid_num, $index, $type, $descr, $scale, $value);
if (isset($entry['lgpPduRcpEntryEcHundredths'])) {
$scale = 0.01;
$oid_name = 'lgpPduRcpEntryEcHundredths';
$oid_num = '.1.3.6.1.4.1.476.1.42.3.8.50.20.1.61.' . $index;
$type = $mib . '-' . $oid_name;
$value = $entry[$oid_name];
} else {
$scale = 0.1;
$oid_name = 'lgpPduRcpEntryEc';
$oid_num = '.1.3.6.1.4.1.476.1.42.3.8.50.20.1.60.' . $index;
$type = $mib . '-' . $oid_name;
$value = $entry[$oid_name];
}
// convert percent limits to absolute values
$options = ['limit_high_warn' => $entry['lgpPduRcpEntryEcThrshldOverWarn'] * $lgpPduRbEntry[$rb_index]['lgpPduRbEntryEcRated'] * 0.001,
'limit_high' => $entry['lgpPduRcpEntryEcThrshldOverAlarm'] * $lgpPduRbEntry[$rb_index]['lgpPduRbEntryEcRated'] * 0.001];
discover_sensor('current', $device, $oid_num, $index, $type, $descr, $scale, $value, $options);
$scale = 1;
$oid_name = 'lgpPduRcpEntryEp';
$oid_num = '.1.3.6.1.4.1.476.1.42.3.8.50.20.1.55.' . $index;
$oid_name = 'lgpPduRcpEntryPwrOut';
$oid_num = '.1.3.6.1.4.1.476.1.42.3.8.50.20.1.65.' . $index;
$type = $mib . '-' . $oid_name;
$value = $entry[$oid_name];
}
discover_sensor('voltage', $device, $oid_num, $index, $type, $descr, $scale, $value);
discover_sensor('power', $device, $oid_num, $index, $type, $descr, $scale, $value);
$scale = 1;
$oid_name = 'lgpPduRcpEntryApOut';
$oid_num = '.1.3.6.1.4.1.476.1.42.3.8.50.20.1.70.' . $index;
$type = $mib . '-' . $oid_name;
$value = $entry[$oid_name];
discover_sensor('apower', $device, $oid_num, $index, $type, $descr, $scale, $value);
if (isset($entry['lgpPduRcpEntryEcHundredths']))
{
$scale = 0.01;
$oid_name = 'lgpPduRcpEntryEcHundredths';
$oid_num = '.1.3.6.1.4.1.476.1.42.3.8.50.20.1.61.' . $index;
$oid_name = 'lgpPduRcpEntryPf';
$oid_num = '.1.3.6.1.4.1.476.1.42.3.8.50.20.1.75.' . $index;
$type = $mib . '-' . $oid_name;
$value = $entry[$oid_name];
} else {
if ($value > 0) {
discover_sensor('powerfactor', $device, $oid_num, $index, $type, $descr, $scale, $value);
}
$scale = 0.01;
$oid_name = 'lgpPduRcpEntryEcCrestFactor';
$oid_num = '.1.3.6.1.4.1.476.1.42.3.8.50.20.1.162.' . $index;
$type = $mib . '-' . $oid_name;
$value = $entry[$oid_name];
discover_sensor('crestfactor', $device, $oid_num, $index, $type, $descr, $scale, $value);
$scale = 0.1;
$oid_name = 'lgpPduRcpEntryEc';
$oid_num = '.1.3.6.1.4.1.476.1.42.3.8.50.20.1.60.' . $index;
$oid_name = 'lgpPduRcpEntryFreq';
$oid_num = '.1.3.6.1.4.1.476.1.42.3.8.50.20.1.80.' . $index;
$type = $mib . '-' . $oid_name;
$value = $entry[$oid_name];
}
// convert percent limits to absolute values
$options = array('limit_high_warn' => $entry['lgpPduRcpEntryEcThrshldOverWarn'] * $lgpPduRbEntry[$rb_index]['lgpPduRbEntryEcRated'] * 0.001,
'limit_high' => $entry['lgpPduRcpEntryEcThrshldOverAlarm'] * $lgpPduRbEntry[$rb_index]['lgpPduRbEntryEcRated'] * 0.001);
discover_sensor('current', $device, $oid_num, $index, $type, $descr, $scale, $value, $options);
discover_sensor('frequency', $device, $oid_num, $index, $type, $descr, $scale, $value);
$scale = 1;
$oid_name = 'lgpPduRcpEntryPwrOut';
$oid_num = '.1.3.6.1.4.1.476.1.42.3.8.50.20.1.65.' . $index;
$type = $mib . '-' . $oid_name;
$value = $entry[$oid_name];
// FIXME, this operational/administrative states, need migrate to outlets status polling
$oid_name = 'lgpPduRcpEntryPwrState';
$oid_num = '.1.3.6.1.4.1.476.1.42.3.8.50.20.1.95.' . $index;
$type = 'lgpPduRcpEntryPwrState';
$value = $entry[$oid_name];
discover_sensor('power', $device, $oid_num, $index, $type, $descr, $scale, $value);
discover_status($device, $oid_num, $oid_name . '.' . $index, $type, 'Power: ' . $descr, $value, ['entPhysicalClass' => 'outlet']);
$scale = 1;
$oid_name = 'lgpPduRcpEntryApOut';
$oid_num = '.1.3.6.1.4.1.476.1.42.3.8.50.20.1.70.' . $index;
$type = $mib . '-' . $oid_name;
$value = $entry[$oid_name];
$oid_name = 'lgpPduRcpEntryOperationCondition';
$oid_num = '.1.3.6.1.4.1.476.1.42.3.8.50.20.1.210.' . $index;
$type = 'lgpPduRcpEntryOperationCondition';
$value = $entry[$oid_name];
discover_sensor('apower', $device, $oid_num, $index, $type, $descr, $scale, $value);
$scale = 0.01;
$oid_name = 'lgpPduRcpEntryPf';
$oid_num = '.1.3.6.1.4.1.476.1.42.3.8.50.20.1.75.' . $index;
$type = $mib . '-' . $oid_name;
$value = $entry[$oid_name];
if ($value > 0)
{
discover_sensor('powerfactor', $device, $oid_num, $index, $type, $descr, $scale, $value);
}
$scale = 0.01;
$oid_name = 'lgpPduRcpEntryEcCrestFactor';
$oid_num = '.1.3.6.1.4.1.476.1.42.3.8.50.20.1.162.' . $index;
$type = $mib . '-' . $oid_name;
$value = $entry[$oid_name];
discover_sensor('crestfactor', $device, $oid_num, $index, $type, $descr, $scale, $value);
$scale = 0.1;
$oid_name = 'lgpPduRcpEntryFreq';
$oid_num = '.1.3.6.1.4.1.476.1.42.3.8.50.20.1.80.' . $index;
$type = $mib . '-' . $oid_name;
$value = $entry[$oid_name];
discover_sensor('frequency', $device, $oid_num, $index, $type, $descr, $scale, $value);
// FIXME, this operational/administrative states, need migrate to outlets status polling
$oid_name = 'lgpPduRcpEntryPwrState';
$oid_num = '.1.3.6.1.4.1.476.1.42.3.8.50.20.1.95.'.$index;
$type = 'lgpPduRcpEntryPwrState';
$value = $entry[$oid_name];
discover_status($device, $oid_num, $oid_name.'.'.$index, $type, 'Power: ' . $descr, $value, array('entPhysicalClass' => 'outlet'));
$oid_name = 'lgpPduRcpEntryOperationCondition';
$oid_num = '.1.3.6.1.4.1.476.1.42.3.8.50.20.1.210.'.$index;
$type = 'lgpPduRcpEntryOperationCondition';
$value = $entry[$oid_name];
discover_status($device, $oid_num, $oid_name.'.'.$index, $type, 'Condition: ' . $descr, $value, array('entPhysicalClass' => 'outlet'));
discover_status($device, $oid_num, $oid_name . '.' . $index, $type, 'Condition: ' . $descr, $value, ['entPhysicalClass' => 'outlet']);
}
// EOF

View File

@ -5,9 +5,9 @@
*
* This file is part of Observium.
*
* @package observium
* @subpackage discovery
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2019 Observium Limited
* @package observium
* @subpackage discovery
* @copyright (C) Adam Armstrong
*
*/
@ -37,95 +37,87 @@ $mib = 'LIEBERT-GP-POWER-MIB';
//LIEBERT-GP-POWER-MIB::lgpPwrLineMeasurementVolts.2.1 = INTEGER: 228 Volt
//LIEBERT-GP-POWER-MIB::lgpPwrLineMeasurementVolts.3.1 = INTEGER: 231 Volt
$oids = snmpwalk_cache_twopart_oid($device, 'lgpPwrLineMeasurementEntry', array(), $mib);
$oids = snmpwalk_cache_twopart_oid($device, 'lgpPwrLineMeasurementEntry', [], $mib);
print_debug_vars($oids);
foreach ($oids as $id => $entry1)
{
$phase_count = count($entry1);
foreach ($entry1 as $phase => $entry)
{
$index = $id . '.' . $phase;
switch ($entry['lgpPwrMeasurementPoint'])
{
case 'lgpPwrSource1Input':
case 'lgpPwrSourcePdu1Input':
$descr = 'Input';
break;
case 'lgpPwrSource2Input':
case 'lgpPwrSourcePdu2Input':
$descr = 'Input2';
break;
case 'lgpPwrOutputToLoad':
$descr = 'Output';
break;
case 'lgpPwrMeasBattery':
$descr = 'Battery';
break;
case 'lgpPwrMeasBypass':
$descr = 'Bypass';
break;
//case 'lgpPwrMeasDcBus':
// $descr = 'DC Bus';
// break;
//case 'lgpPwrMeasSystemOutput':
// $descr = 'System';
// break;
//case 'lgpPwrMeasBatteryCabinet':
// $descr = 'Battery Cabinet';
// break;
default:
continue 2;
foreach ($oids as $id => $entry1) {
$phase_count = count($entry1);
foreach ($entry1 as $phase => $entry) {
$index = $id . '.' . $phase;
switch ($entry['lgpPwrMeasurementPoint']) {
case 'lgpPwrSource1Input':
case 'lgpPwrSourcePdu1Input':
$descr = 'Input';
break;
case 'lgpPwrSource2Input':
case 'lgpPwrSourcePdu2Input':
$descr = 'Input2';
break;
case 'lgpPwrOutputToLoad':
$descr = 'Output';
break;
case 'lgpPwrMeasBattery':
$descr = 'Battery';
break;
case 'lgpPwrMeasBypass':
$descr = 'Bypass';
break;
//case 'lgpPwrMeasDcBus':
// $descr = 'DC Bus';
// break;
//case 'lgpPwrMeasSystemOutput':
// $descr = 'System';
// break;
//case 'lgpPwrMeasBatteryCabinet':
// $descr = 'Battery Cabinet';
// break;
default:
continue 2;
}
if ($phase_count > 1 || $phase > 1) {
$descr .= ' Phase ' . $phase;
}
$scale = 1;
$oid_name = 'lgpPwrLineMeasurementVA';
$oid_num = '.1.3.6.1.4.1.476.1.42.3.5.2.3.1.8.' . $index;
$type = $mib . '-' . $oid_name;
$value = $entry[$oid_name];
if (isset($entry[$oid_name])) {
discover_sensor('apower', $device, $oid_num, $index, $type, $descr, $scale, $value);
}
$scale = 1;
$oid_name = 'lgpPwrLineMeasurementVAR';
$oid_num = '.1.3.6.1.4.1.476.1.42.3.5.2.3.1.18.' . $index;
$type = $mib . '-' . $oid_name;
$value = $entry[$oid_name];
if (isset($entry[$oid_name])) {
discover_sensor('rpower', $device, $oid_num, $index, $type, $descr, $scale, $value);
}
$scale = 0.1;
$oid_name = 'lgpPwrLineMeasurementCrestFactorCurrent';
$oid_num = '.1.3.6.1.4.1.476.1.42.3.5.2.3.1.13.' . $index;
$type = $mib . '-' . $oid_name;
$value = $entry[$oid_name];
if (isset($entry[$oid_name])) {
discover_sensor('crestfactor', $device, $oid_num, $index, $type, $descr, $scale, $value);
}
$scale = 0.01;
$oid_name = 'lgpPwrLineMeasurementPowerFactor';
$oid_num = '.1.3.6.1.4.1.476.1.42.3.5.2.3.1.14.' . $index;
$type = $mib . '-' . $oid_name;
$value = $entry[$oid_name];
if (isset($entry[$oid_name])) {
discover_sensor('powerfactor', $device, $oid_num, $index, $type, $descr, $scale, $value);
}
}
if ($phase_count > 1 || $phase > 1)
{
$descr .= ' Phase ' . $phase;
}
$scale = 1;
$oid_name = 'lgpPwrLineMeasurementVA';
$oid_num = '.1.3.6.1.4.1.476.1.42.3.5.2.3.1.8.' . $index;
$type = $mib . '-' . $oid_name;
$value = $entry[$oid_name];
if (isset($entry[$oid_name]))
{
discover_sensor('apower', $device, $oid_num, $index, $type, $descr, $scale, $value);
}
$scale = 1;
$oid_name = 'lgpPwrLineMeasurementVAR';
$oid_num = '.1.3.6.1.4.1.476.1.42.3.5.2.3.1.18.' . $index;
$type = $mib . '-' . $oid_name;
$value = $entry[$oid_name];
if (isset($entry[$oid_name]))
{
discover_sensor('rpower', $device, $oid_num, $index, $type, $descr, $scale, $value);
}
$scale = 0.1;
$oid_name = 'lgpPwrLineMeasurementCrestFactorCurrent';
$oid_num = '.1.3.6.1.4.1.476.1.42.3.5.2.3.1.13.' . $index;
$type = $mib . '-' . $oid_name;
$value = $entry[$oid_name];
if (isset($entry[$oid_name]))
{
discover_sensor('crestfactor', $device, $oid_num, $index, $type, $descr, $scale, $value);
}
$scale = 0.01;
$oid_name = 'lgpPwrLineMeasurementPowerFactor';
$oid_num = '.1.3.6.1.4.1.476.1.42.3.5.2.3.1.14.' . $index;
$type = $mib . '-' . $oid_name;
$value = $entry[$oid_name];
if (isset($entry[$oid_name]))
{
discover_sensor('powerfactor', $device, $oid_num, $index, $type, $descr, $scale, $value);
}
}
}
// EOF

View File

@ -6,57 +6,65 @@
*
* @package observium
* @subpackage discovery
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2020 Observium Limited
* @copyright (C) Adam Armstrong
*
*/
$lm_array['temp'] = snmpwalk_cache_oid($device, 'lmTempSensorsEntry', array(), 'LM-SENSORS-MIB');
$lm_array['fan'] = snmpwalk_cache_oid($device, 'lmFanSensorsEntry', array(), 'LM-SENSORS-MIB');
$lm_array['volt'] = snmpwalk_cache_oid($device, 'lmVoltSensorsEntry', array(), 'LM-SENSORS-MIB');
//$lm_array['misc'] = snmpwalk_cache_oid($device, 'lmMiscSensorsEntry', array(), 'LM-SENSORS-MIB');
$scale = 0.001;
foreach ($lm_array['temp'] as $index => $entry)
{
$oid = ".1.3.6.1.4.1.2021.13.16.2.1.3.$index";
$descr = str_ireplace(array('temperature-', 'temp-'), '', $entry['lmTempSensorsDevice']);
$value = $entry['lmTempSensorsValue'];
/* VM:
lmTempSensorsDevice.1 = Core 0
lmTempSensorsDevice.2 = Core 1
lmTempSensorsValue.1 = 100000
lmTempSensorsValue.2 = 100000
*/
if ($entry['lmTempSensorsValue'] > 0 &&
$value != 100000 && // VM always report 100000
$value * $scale <= 200)
{
discover_sensor_ng($device,'temperature', $mib, 'lmTempSensorsValue', $oid, $index, NULL, $descr, $scale, $value, ['rename_rrd' => "lmsensors-$index"]);
}
if (!isset($valid['sensor']['temperature']['UBNT-EdgeMAX-MIB-ubntThermTemperature']) &&
!isset($valid['sensor']['temperature']['ENTITY-SENSOR-MIB-entPhySensorValue'])) {
$scale = 0.001;
$oids = snmpwalk_cache_oid($device, 'lmTempSensorsEntry', [], 'LM-SENSORS-MIB');
foreach ($oids as $index => $entry) {
$oid = ".1.3.6.1.4.1.2021.13.16.2.1.3.$index";
$descr = str_ireplace([ 'temperature-', 'temp-', 'temp_' ], '', $entry['lmTempSensorsDevice']);
$value = $entry['lmTempSensorsValue'];
/* VM:
lmTempSensorsDevice.1 = Core 0
lmTempSensorsDevice.2 = Core 1
lmTempSensorsValue.1 = 100000
lmTempSensorsValue.2 = 100000
*/
if ($entry['lmTempSensorsValue'] > 0 &&
$value != 100000 && // VM always report 100000
$value * $scale <= 200) {
discover_sensor_ng($device, 'temperature', $mib, 'lmTempSensorsValue', $oid, $index, $descr, $scale, $value, [ 'rename_rrd' => "lmsensors-$index" ]);
}
}
}
$scale = 1;
foreach ($lm_array['fan'] as $index => $entry)
{
$oid = ".1.3.6.1.4.1.2021.13.16.3.1.3.$index";
$descr = str_ireplace('fan-', '', $entry['lmFanSensorsDevice']);
$value = $entry['lmFanSensorsValue'];
if ($entry['lmFanSensorsValue'] > 0)
{
discover_sensor_ng($device,'fanspeed', $mib, 'lmFanSensorsValue', $oid, $index, NULL, $descr, $scale, $value, ['rename_rrd' => "lmsensors-$index"]);
}
if (!isset($valid['sensor']['fanspeed']['UBNT-EdgeMAX-MIB-ubntFanRpm']) &&
!isset($valid['sensor']['fanspeed']['ENTITY-SENSOR-MIB-entPhySensorValue'])) {
$scale = 1;
$oids = snmpwalk_cache_oid($device, 'lmFanSensorsEntry', [], 'LM-SENSORS-MIB');
foreach ($oids as $index => $entry) {
$oid = ".1.3.6.1.4.1.2021.13.16.3.1.3.$index";
$descr = str_ireplace('fan-', '', $entry['lmFanSensorsDevice']);
$value = $entry['lmFanSensorsValue'];
if ($entry['lmFanSensorsValue'] > 0) {
discover_sensor_ng($device, 'fanspeed', $mib, 'lmFanSensorsValue', $oid, $index, $descr, $scale, $value, [ 'rename_rrd' => "lmsensors-$index" ]);
}
}
}
$scale = 0.001;
foreach ($lm_array['volt'] as $index => $entry)
{
$oid = ".1.3.6.1.4.1.2021.13.16.4.1.3.$index";
$descr = str_ireplace(array('voltage, ', 'volt-'), '', $entry['lmVoltSensorsDevice']);
$value = $entry['lmVoltSensorsValue'];
if (is_numeric($entry['lmVoltSensorsValue']))
{
discover_sensor_ng($device,'voltage', $mib, 'lmVoltSensorsValue', $oid, $index, NULL, $descr, $scale, $value, ['rename_rrd' => "lmsensors-$index"]);
}
}
//if (!isset($valid['sensor']['voltage'])) {
$scale = 0.001;
$oids = snmpwalk_cache_oid($device, 'lmVoltSensorsEntry', [], 'LM-SENSORS-MIB');
foreach ($oids as $index => $entry) {
$oid = ".1.3.6.1.4.1.2021.13.16.4.1.3.$index";
$descr = str_ireplace([ 'voltage, ', 'volt-' ], '', $entry['lmVoltSensorsDevice']);
$value = $entry['lmVoltSensorsValue'];
if (is_numeric($entry['lmVoltSensorsValue']) && ($entry['lmVoltSensorsValue'] < 4000000000)) {
// LM-SENSORS-MIB::lmVoltSensorsDevice.1 = STRING: in1
// LM-SENSORS-MIB::lmVoltSensorsDevice.2 = STRING: in2
// LM-SENSORS-MIB::lmVoltSensorsValue.1 = Gauge32: 4294967234
// LM-SENSORS-MIB::lmVoltSensorsValue.2 = Gauge32: 273
discover_sensor_ng($device, 'voltage', $mib, 'lmVoltSensorsValue', $oid, $index, $descr, $scale, $value, [ 'rename_rrd' => "lmsensors-$index" ]);
}
}
//}
//$oids = snmpwalk_cache_oid($device, 'lmMiscSensorsEntry', array(), 'LM-SENSORS-MIB');
unset($oids);
// EOF

View File

@ -5,9 +5,9 @@
*
* This file is part of Observium.
*
* @package observium
* @subpackage discovery
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2019 Observium Limited
* @package observium
* @subpackage discovery
* @copyright (C) Adam Armstrong
*
*/
@ -24,7 +24,7 @@
//$cache['megaraid']['pd'] = snmpwalk_cache_oid($device, 'physicalDriveTable', array(), 'LSI-MegaRAID-SAS-MIB');
echo('enclosureTable ');
$cache['megaraid']['encl'] = snmpwalk_cache_oid($device, 'enclosureTable', array(), 'LSI-MegaRAID-SAS-MIB');
$cache['megaraid']['encl'] = snmpwalk_cache_oid($device, 'enclosureTable', [], 'LSI-MegaRAID-SAS-MIB');
/*
FIXME
@ -52,9 +52,8 @@ _> state sensor: lsi-megaraid-sas-pd-state
*/
// Fix up enclosure indexes
foreach ($cache['megaraid']['encl'] as $oldindex => $data)
{
$cache['megaraid']['enclosure'][$data['enclosureIndex']] = $data;
foreach ($cache['megaraid']['encl'] as $oldindex => $data) {
$cache['megaraid']['enclosure'][$data['enclosureIndex']] = $data;
}
// Physical disk temperature and state
@ -65,27 +64,26 @@ foreach ($cache['megaraid']['encl'] as $oldindex => $data)
// LSI-MegaRAID-SAS-MIB::slotNumber.0 = INTEGER: 0
// LSI-MegaRAID-SAS-MIB::enclDeviceId.0 = INTEGER: 8
foreach ($cache['megaraid']['pd'] as $index => $pd)
{
$encl = trim(trim($cache['megaraid']['enclosure'][$pd['enclIndex']]['vendorID'], '.') . ' ' . trim($cache['megaraid']['enclosure'][$pd['enclIndex']]['productID'], '.'));
if ($encl == '') { $encl = 'Enclosure'; } // Static string if no enclosure vendor/product ID
$descr = $encl . ' (' . $pd['enclIndex'] . ') Slot ' . $pd['slotNumber'] . ': ' . $pd['pdVendorID'] . ' ' . $pd['pdProductID'];
foreach ($cache['megaraid']['pd'] as $index => $pd) {
$encl = trim(trim($cache['megaraid']['enclosure'][$pd['enclIndex']]['vendorID'], '.') . ' ' . trim($cache['megaraid']['enclosure'][$pd['enclIndex']]['productID'], '.'));
if ($encl == '') {
$encl = 'Enclosure';
} // Static string if no enclosure vendor/product ID
$descr = $encl . ' (' . $pd['enclIndex'] . ') Slot ' . $pd['slotNumber'] . ': ' . $pd['pdVendorID'] . ' ' . $pd['pdProductID'];
$value = $pd['pdTemperature'];
$oid = ".1.3.6.1.4.1.3582.4.1.4.2.1.2.1.36.$index";
$value = $pd['pdTemperature'];
$oid = ".1.3.6.1.4.1.3582.4.1.4.2.1.2.1.36.$index";
if ($value != '')
{
//discover_sensor('temperature', $device, $oid, "pdTemperature.$index", 'lsi-megaraid-sas-mib', $descr, 1, $value);
}
if ($value != '') {
//discover_sensor('temperature', $device, $oid, "pdTemperature.$index", 'lsi-megaraid-sas-mib', $descr, 1, $value);
}
$value = $pd['pdState'];
$oid = ".1.3.6.1.4.1.3582.4.1.4.2.1.2.1.10.$index";
$value = $pd['pdState'];
$oid = ".1.3.6.1.4.1.3582.4.1.4.2.1.2.1.10.$index";
if ($value !== '')
{
//discover_status($device, $oid, "pdState.$index", 'lsi-megaraid-sas-pd-state', $descr, $value);
}
if ($value !== '') {
//discover_status($device, $oid, "pdState.$index", 'lsi-megaraid-sas-pd-state', $descr, $value);
}
}
// Enclosure power supplies
@ -98,23 +96,21 @@ foreach ($cache['megaraid']['pd'] as $index => $pd)
// LSI-MegaRAID-SAS-MIB::powerSupplyStatus.1 = INTEGER: status-ok(2)
echo(' enclosurePowerSupplyTable ');
$cache['megaraid']['psu'] = snmpwalk_cache_oid($device, 'enclosurePowerSupplyTable', array(), 'LSI-MegaRAID-SAS-MIB');
$cache['megaraid']['psu'] = snmpwalk_cache_oid($device, 'enclosurePowerSupplyTable', [], 'LSI-MegaRAID-SAS-MIB');
foreach ($cache['megaraid']['psu'] as $index => $psu)
{
$encl = trim(trim($cache['megaraid']['encl'][$psu['enclosureId-EPST']]['vendorID'], '.') . ' ' . trim($cache['megaraid']['encl'][$psu['enclosureId-EPST']]['productID'], '.'));
if ($encl == '')
{
$encl = 'Enclosure (' . $cache['megaraid']['encl'][$psu['enclosureId-EPST']]['enclosureIndex'] . ')'; // Static string if no vendor/product ID for enclosure
} else {
$encl .= ' (' . $cache['megaraid']['encl'][$psu['enclosureId-EPST']]['enclosureIndex'] . ')';
}
$descr = $encl . ' Power Supply ' . (++$lsi_counter['psu'][$psu['enclosureId-EPST']]);
foreach ($cache['megaraid']['psu'] as $index => $psu) {
$encl = trim(trim($cache['megaraid']['encl'][$psu['enclosureId-EPST']]['vendorID'], '.') . ' ' . trim($cache['megaraid']['encl'][$psu['enclosureId-EPST']]['productID'], '.'));
if ($encl == '') {
$encl = 'Enclosure (' . $cache['megaraid']['encl'][$psu['enclosureId-EPST']]['enclosureIndex'] . ')'; // Static string if no vendor/product ID for enclosure
} else {
$encl .= ' (' . $cache['megaraid']['encl'][$psu['enclosureId-EPST']]['enclosureIndex'] . ')';
}
$descr = $encl . ' Power Supply ' . (++$lsi_counter['psu'][$psu['enclosureId-EPST']]);
$value = $psu['powerSupplyStatus'];
$oid = ".1.3.6.1.4.1.3582.4.1.5.5.1.3.$index";
$value = $psu['powerSupplyStatus'];
$oid = ".1.3.6.1.4.1.3582.4.1.5.5.1.3.$index";
discover_status($device, $oid, "powerSupplyStatus.$index", 'lsi-megaraid-sas-sensor-state', $descr, $value);
discover_status($device, $oid, "powerSupplyStatus.$index", 'lsi-megaraid-sas-sensor-state', $descr, $value);
}
// Enclosure temperature sensors
@ -133,31 +129,29 @@ foreach ($cache['megaraid']['psu'] as $index => $psu)
// LSI-MegaRAID-SAS-MIB::enclosureTemperature.2 = INTEGER: 211
echo(' enclosureTempSensorTable ');
$cache['megaraid']['temp'] = snmpwalk_cache_oid($device, 'enclosureTempSensorTable', array(), 'LSI-MegaRAID-SAS-MIB');
$cache['megaraid']['temp'] = snmpwalk_cache_oid($device, 'enclosureTempSensorTable', [], 'LSI-MegaRAID-SAS-MIB');
foreach ($cache['megaraid']['temp'] as $index => $temp)
{
$encl = trim(trim($cache['megaraid']['encl'][$temp['enclosureId-ETST']]['vendorID'], '.') . ' ' . trim($cache['megaraid']['encl'][$temp['enclosureId-ETST']]['productID'], '.'));
if ($encl == '')
{
$encl = 'Enclosure (' . $cache['megaraid']['encl'][$temp['enclosureId-ETST']]['enclosureIndex'] . ')'; // Static string if no vendor/product ID for enclosure
} else {
$encl .= ' (' . $cache['megaraid']['encl'][$temp['enclosureId-ETST']]['enclosureIndex'] . ')';
}
$descr = $encl . ' Temperature sensor ' . (++$lsi_counter['temp'][$temp['enclosureId-ETST']]);
foreach ($cache['megaraid']['temp'] as $index => $temp) {
$encl = trim(trim($cache['megaraid']['encl'][$temp['enclosureId-ETST']]['vendorID'], '.') . ' ' . trim($cache['megaraid']['encl'][$temp['enclosureId-ETST']]['productID'], '.'));
if ($encl == '') {
$encl = 'Enclosure (' . $cache['megaraid']['encl'][$temp['enclosureId-ETST']]['enclosureIndex'] . ')'; // Static string if no vendor/product ID for enclosure
} else {
$encl .= ' (' . $cache['megaraid']['encl'][$temp['enclosureId-ETST']]['enclosureIndex'] . ')';
}
$descr = $encl . ' Temperature sensor ' . (++$lsi_counter['temp'][$temp['enclosureId-ETST']]);
$value = $temp['tempSensorStatus'];
$oid = ".1.3.6.1.4.1.3582.4.1.5.6.1.3.$index";
$value = $temp['tempSensorStatus'];
$oid = ".1.3.6.1.4.1.3582.4.1.5.6.1.3.$index";
discover_status($device, $oid, "tempSensorStatus.$index", 'lsi-megaraid-sas-sensor-state', $descr, $value);
discover_status($device, $oid, "tempSensorStatus.$index", 'lsi-megaraid-sas-sensor-state', $descr, $value);
$value = $temp['enclosureTemperature'];
$oid = ".1.3.6.1.4.1.3582.4.1.5.6.1.4.$index";
$value = $temp['enclosureTemperature'];
$oid = ".1.3.6.1.4.1.3582.4.1.5.6.1.4.$index";
if ($value < 200) // Filter out some silly values, possibly *10'd?
{
discover_sensor('temperature', $device, $oid, "enclosureTemperature.$index", 'lsi-megaraid-sas-mib', $descr, 1, $value);
}
if ($value < 200) // Filter out some silly values, possibly *10'd?
{
discover_sensor('temperature', $device, $oid, "enclosureTemperature.$index", 'lsi-megaraid-sas-mib', $descr, 1, $value);
}
}
// LSI-MegaRAID-SAS-MIB::fanID.0 = INTEGER: 0
@ -165,23 +159,21 @@ foreach ($cache['megaraid']['temp'] as $index => $temp)
// LSI-MegaRAID-SAS-MIB::fanStatus.0 = INTEGER: status-ok(2)
echo(' enclosureFanTable ');
$cache['megaraid']['fan'] = snmpwalk_cache_oid($device, 'enclosureFanTable', array(), 'LSI-MegaRAID-SAS-MIB');
$cache['megaraid']['fan'] = snmpwalk_cache_oid($device, 'enclosureFanTable', [], 'LSI-MegaRAID-SAS-MIB');
foreach ($cache['megaraid']['fan'] as $index => $fan)
{
$encl = trim(trim($cache['megaraid']['encl'][$fan['enclosureId']]['vendorID'], '.') . ' ' . trim($cache['megaraid']['encl'][$fan['enclosureId']]['productID'], '.'));
if ($encl == '')
{
$encl = 'Enclosure (' . $cache['megaraid']['encl'][$fan['enclosureId']]['enclosureIndex'] . ')'; // Static string if no vendor/product ID for enclosure
} else {
$encl .= ' (' . $cache['megaraid']['encl'][$fan['enclosureId']]['enclosureIndex'] . ')';
}
$descr = $encl . ' Fan ' . (++$lsi_counter['fan'][$fan['enclosureId']]);
foreach ($cache['megaraid']['fan'] as $index => $fan) {
$encl = trim(trim($cache['megaraid']['encl'][$fan['enclosureId']]['vendorID'], '.') . ' ' . trim($cache['megaraid']['encl'][$fan['enclosureId']]['productID'], '.'));
if ($encl == '') {
$encl = 'Enclosure (' . $cache['megaraid']['encl'][$fan['enclosureId']]['enclosureIndex'] . ')'; // Static string if no vendor/product ID for enclosure
} else {
$encl .= ' (' . $cache['megaraid']['encl'][$fan['enclosureId']]['enclosureIndex'] . ')';
}
$descr = $encl . ' Fan ' . (++$lsi_counter['fan'][$fan['enclosureId']]);
$value = $fan['fanStatus'];
$oid = ".1.3.6.1.4.1.3582.4.1.5.3.1.3.$index";
$value = $fan['fanStatus'];
$oid = ".1.3.6.1.4.1.3582.4.1.5.3.1.3.$index";
discover_status($device, $oid, "fanStatus.$index", 'lsi-megaraid-sas-sensor-state', $descr, $value);
discover_status($device, $oid, "fanStatus.$index", 'lsi-megaraid-sas-sensor-state', $descr, $value);
}
/*

View File

@ -6,351 +6,337 @@
*
* @package observium
* @subpackage discovery
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2021 Observium Limited
* @copyright (C) Adam Armstrong
*
*/
$cache['mge'] = array();
$cache['mge'] = snmpwalk_cache_oid($device, "upsmgInputPhaseTable", $cache['mge'], "MG-SNMP-UPS-MIB");
$oids = snmpwalk_cache_oid($device, "upsmgInputPhaseTable", [], "MG-SNMP-UPS-MIB");
// Input
$numPhase = snmp_get_oid($device, "upsmgInputPhaseNum.0", "MG-SNMP-UPS-MIB");
// Great job MGE - my devices don't have mginputPhaseIndex, and mginputMinimumVoltage and mginputMaximumVoltage. are using different indexes.
if (safe_count(array_keys($cache['mge'])) > $numPhase) { unset($cache['mge'][0]); } // Remove [0] key with above 2 fields, leaving 1.0 etc for actual phases.
if (safe_count(array_keys($oids)) > $numPhase) {
unset($oids[0]);
} // Remove [0] key with above 2 fields, leaving 1.0 etc for actual phases.
$scale = 0.1;
foreach ($cache['mge'] as $index => $entry)
{
list($i,) = explode('.',$index,2);
foreach ($oids as $index => $entry) {
$phase = explode('.', $index, 2)[0];
if ($i > $numPhase) { break; } // MGE returns 3 phase values even if their mgInputPhaseNum is 1. Doh.
if ($phase > $numPhase) {
break;
} // MGE returns 3 phase values even if their mgInputPhaseNum is 1. Doh.
$descr = "Input"; if ($numPhase > 1) { $descr .= " Phase $index"; }
$descr = "Input";
$options = [];
if ($numPhase > 1) {
$descr .= " Phase $phase";
if (is_numeric($entry['mginputVoltage']))
{
$oid = ".1.3.6.1.4.1.705.1.6.2.1.2.$index"; // MG-SNMP-UPS-MIB:mginputVoltage.$index
$value = $entry['mginputVoltage'];
if ($value != 0)
{
discover_sensor('voltage', $device, $oid, 100+$index, 'mge-ups', $descr, $scale, $value);
$options = [
'measured_entity_label' => "Input Phase $phase",
'measured_class' => 'phase'
];
}
}
if (is_numeric($entry['mginputCurrent']))
{
$oid = ".1.3.6.1.4.1.705.1.6.2.1.6.$index"; // MG-SNMP-UPS-MIB:mginputCurrent.$index
$value = $entry['mginputCurrent'];
if ($value != 0)
{
discover_sensor('current', $device, $oid, 100+$index, 'mge-ups', $descr, $scale, $value);
if (is_numeric($entry['mginputVoltage'])) {
$oid = ".1.3.6.1.4.1.705.1.6.2.1.2.$index"; // MG-SNMP-UPS-MIB:mginputVoltage.$index
$value = $entry['mginputVoltage'];
if ($value != 0) {
// FIXME. Incorrect indexes!
discover_sensor('voltage', $device, $oid, 100 + $index, 'mge-ups', $descr, $scale, $value, $options);
}
}
}
if (is_numeric($entry['mginputFrequency']))
{
$oid = ".1.3.6.1.4.1.705.1.6.2.1.3.$index"; // MG-SNMP-UPS-MIB:mginputFrequency.$index
$value = $entry['mginputFrequency'];
if ($value != 0)
{
discover_sensor('frequency', $device, $oid, 100+$index, 'mge-ups', $descr, $scale, $value);
if (is_numeric($entry['mginputCurrent'])) {
$oid = ".1.3.6.1.4.1.705.1.6.2.1.6.$index"; // MG-SNMP-UPS-MIB:mginputCurrent.$index
$value = $entry['mginputCurrent'];
if ($value != 0) {
// FIXME. Incorrect indexes!
discover_sensor('current', $device, $oid, 100 + $index, 'mge-ups', $descr, $scale, $value, $options);
}
}
if (is_numeric($entry['mginputFrequency'])) {
$oid = ".1.3.6.1.4.1.705.1.6.2.1.3.$index"; // MG-SNMP-UPS-MIB:mginputFrequency.$index
$value = $entry['mginputFrequency'];
if ($value != 0) {
// FIXME. Incorrect indexes!
discover_sensor('frequency', $device, $oid, 100 + $index, 'mge-ups', $descr, $scale, $value, $options);
}
}
}
}
// Output
$cache['mge'] = array();
$cache['mge'] = snmpwalk_cache_oid($device, "upsmgOutput", $cache['mge'], "MG-SNMP-UPS-MIB");
// WHAT the f..k, why this wrong $index copy-pasted
$index_rename = $index; // Get old broken index for rename rrds
$index = 0; // Use 0 only, upsmgOutput includes the PhaseTable used below.
$entry = $cache['mge'][$index];
$oids = snmpwalk_cache_oid($device, "upsmgOutput", [], "MG-SNMP-UPS-MIB");
$index = 0;
$entry = $oids[$index];
// MG-SNMP-UPS-MIB::upsmgOutputOnBattery.0 = INTEGER: no(2)
if (isset($entry['upsmgOutputOnBattery']))
{
$descr = 'On Battery';
$oid_name = 'upsmgOutputOnBattery';
$oid_num = '.1.3.6.1.4.1.705.1.7.3.0';
$type = 'mge-status-state';
$value = $entry[$oid_name];
if (isset($entry['upsmgOutputOnBattery'])) {
$descr = 'Output On Battery';
$oid_name = 'upsmgOutputOnBattery';
$oid_num = '.1.3.6.1.4.1.705.1.7.3.0';
$type = 'mge-status-state';
$value = $entry[$oid_name];
rename_rrd($device, "status-{$type}-{$oid_name}.{$index_rename}", "status-{$type}-{$oid_name}.{$index}");
discover_status($device, $oid_num, $oid_name.'.'.$index, $type, $descr, $value, array('entPhysicalClass' => 'battery'));
//rename_rrd($device, "status-{$type}-{$oid_name}.{$index_rename}", "status-{$type}-{$oid_name}.{$index}");
discover_status($device, $oid_num, $oid_name . '.' . $index, $type, $descr, $value, ['entPhysicalClass' => 'battery']);
}
// MG-SNMP-UPS-MIB::upsmgOutputOnByPass.0 = INTEGER: no(2)
if (isset($entry['upsmgOutputOnByPass']))
{
$descr = 'On Bypass';
$oid_name = 'upsmgOutputOnByPass';
$oid_num = '.1.3.6.1.4.1.705.1.7.4.0';
$type = 'mge-status-state';
$value = $entry[$oid_name];
if (isset($entry['upsmgOutputOnByPass'])) {
$descr = 'Output On Bypass';
$oid_name = 'upsmgOutputOnByPass';
$oid_num = '.1.3.6.1.4.1.705.1.7.4.0';
$type = 'mge-status-state';
$value = $entry[$oid_name];
rename_rrd($device, "status-{$type}-{$oid_name}.{$index_rename}", "status-{$type}-{$oid_name}.{$index}");
discover_status($device, $oid_num, $oid_name.'.'.$index, $type, $descr, $value, array('entPhysicalClass' => 'battery'));
//rename_rrd($device, "status-{$type}-{$oid_name}.{$index_rename}", "status-{$type}-{$oid_name}.{$index}");
discover_status($device, $oid_num, $oid_name . '.' . $index, $type, $descr, $value, ['entPhysicalClass' => 'battery']);
}
// FIXME TODO: State sensors:
// MG-SNMP-UPS-MIB::upsmgOutputUnavailableByPass.0 = INTEGER: no(2)
if (isset($entry['upsmgOutputUnavailableByPass']))
{
$descr = 'Unavailable Bypass';
$oid_name = 'upsmgOutputUnavailableByPass';
$oid_num = '.1.3.6.1.4.1.705.1.7.5.0';
$type = 'mge-status-state';
$value = $entry[$oid_name];
if (isset($entry['upsmgOutputUnavailableByPass'])) {
$descr = 'Output Unavailable Bypass';
$oid_name = 'upsmgOutputUnavailableByPass';
$oid_num = '.1.3.6.1.4.1.705.1.7.5.0';
$type = 'mge-status-state';
$value = $entry[$oid_name];
rename_rrd($device, "status-{$type}-{$oid_name}.{$index_rename}", "status-{$type}-{$oid_name}.{$index}");
discover_status($device, $oid_num, $oid_name.'.'.$index, $type, $descr, $value, array('entPhysicalClass' => 'other'));
//rename_rrd($device, "status-{$type}-{$oid_name}.{$index_rename}", "status-{$type}-{$oid_name}.{$index}");
discover_status($device, $oid_num, $oid_name . '.' . $index, $type, $descr, $value, ['entPhysicalClass' => 'other']);
}
// MG-SNMP-UPS-MIB::upsmgOutputNoByPass.0 = INTEGER: no(2)
if (isset($entry['upsmgOutputNoByPass']))
{
$descr = 'No Bypass';
$oid_name = 'upsmgOutputNoByPass';
$oid_num = '.1.3.6.1.4.1.705.1.7.6.0';
$type = 'mge-status-state';
$value = $entry[$oid_name];
if (isset($entry['upsmgOutputNoByPass'])) {
$descr = 'Output No Bypass';
$oid_name = 'upsmgOutputNoByPass';
$oid_num = '.1.3.6.1.4.1.705.1.7.6.0';
$type = 'mge-status-state';
$value = $entry[$oid_name];
rename_rrd($device, "status-{$type}-{$oid_name}.{$index_rename}", "status-{$type}-{$oid_name}.{$index}");
discover_status($device, $oid_num, $oid_name.'.'.$index, $type, $descr, $value, array('entPhysicalClass' => 'other'));
//rename_rrd($device, "status-{$type}-{$oid_name}.{$index_rename}", "status-{$type}-{$oid_name}.{$index}");
discover_status($device, $oid_num, $oid_name . '.' . $index, $type, $descr, $value, ['entPhysicalClass' => 'other']);
}
// MG-SNMP-UPS-MIB::upsmgOutputUtilityOff.0 = INTEGER: no(2)
if (isset($entry['upsmgOutputUtilityOff']))
{
$descr = 'Utility Off';
$oid_name = 'upsmgOutputUtilityOff';
$oid_num = '.1.3.6.1.4.1.705.1.7.7.0';
$type = 'mge-status-state';
$value = $entry[$oid_name];
if (isset($entry['upsmgOutputUtilityOff'])) {
$descr = 'Output Utility Off';
$oid_name = 'upsmgOutputUtilityOff';
$oid_num = '.1.3.6.1.4.1.705.1.7.7.0';
$type = 'mge-status-state';
$value = $entry[$oid_name];
rename_rrd($device, "status-{$type}-{$oid_name}.{$index_rename}", "status-{$type}-{$oid_name}.{$index}");
discover_status($device, $oid_num, $oid_name.'.'.$index, $type, $descr, $value, array('entPhysicalClass' => 'other'));
//rename_rrd($device, "status-{$type}-{$oid_name}.{$index_rename}", "status-{$type}-{$oid_name}.{$index}");
discover_status($device, $oid_num, $oid_name . '.' . $index, $type, $descr, $value, ['entPhysicalClass' => 'other']);
}
// MG-SNMP-UPS-MIB::upsmgOutputOnBoost.0 = INTEGER: no(2)
if (isset($entry['upsmgOutputOnBoost']))
{
$descr = 'On Boost';
$oid_name = 'upsmgOutputOnBoost';
$oid_num = '.1.3.6.1.4.1.705.1.7.8.0';
$type = 'mge-status-state';
$value = $entry[$oid_name];
if (isset($entry['upsmgOutputOnBoost'])) {
$descr = 'Output On Boost';
$oid_name = 'upsmgOutputOnBoost';
$oid_num = '.1.3.6.1.4.1.705.1.7.8.0';
$type = 'mge-status-state';
$value = $entry[$oid_name];
rename_rrd($device, "status-{$type}-{$oid_name}.{$index_rename}", "status-{$type}-{$oid_name}.{$index}");
discover_status($device, $oid_num, $oid_name.'.'.$index, $type, $descr, $value, array('entPhysicalClass' => 'other'));
//rename_rrd($device, "status-{$type}-{$oid_name}.{$index_rename}", "status-{$type}-{$oid_name}.{$index}");
discover_status($device, $oid_num, $oid_name . '.' . $index, $type, $descr, $value, ['entPhysicalClass' => 'other']);
}
// MG-SNMP-UPS-MIB::upsmgOutputInverterOff.0 = INTEGER: no(2)
if (isset($entry['upsmgOutputInverterOff']))
{
$family_name = strtolower(snmp_get($device, 'upsmgIdentFamilyName.0', '-Oqv', 'MG-SNMP-UPS-MIB'));
$family_name = str_replace('eaton ', '', $family_name);
if (isset($entry['upsmgOutputInverterOff'])) {
$family_name = strtolower(snmp_get_oid($device, 'upsmgIdentFamilyName.0', 'MG-SNMP-UPS-MIB'));
$family_name = str_replace('eaton ', '', $family_name);
$descr = "Inverter Off";
$oid_name = 'upsmgOutputInverterOff';
$oid_num = '.1.3.6.1.4.1.705.1.7.9.0';
$value = $entry[$oid_name];
$descr = "Output Inverter Off";
$oid_name = 'upsmgOutputInverterOff';
$oid_num = '.1.3.6.1.4.1.705.1.7.9.0';
$value = $entry[$oid_name];
// FIXME - find a better way to do this. Currently it seems all things starting with 8 and "ex" are online.
if (in_array($family_name, array('ex', '9sx', '9135')) || $family_name[0] == 9) // Known Online UPSes
{
$type = 'mge-status-state';
// This rename for old wrong indexes
rename_rrd($device, "status-{$type}-{$oid_name}.{$index_rename}", "status-{$type}-{$oid_name}.{$index}");
// This rename for changed family name
rename_rrd($device, "status-mge-status-inverter-{$oid_name}.{$index}", "status-{$type}-{$oid_name}.{$index}");
} else {
$type = 'mge-status-inverter';
rename_rrd($device, "status-mge-status-state-{$oid_name}.{$index_rename}", "status-{$type}-{$oid_name}.{$index}");
}
// FIXME - find a better way to do this. Currently it seems all things starting with 8 and "ex" are online.
if (in_array($family_name, ['ex', '9sx', '9135']) || $family_name[0] == 9) // Known Online UPSes
{
$type = 'mge-status-state';
// This rename for old wrong indexes
//rename_rrd($device, "status-{$type}-{$oid_name}.{$index_rename}", "status-{$type}-{$oid_name}.{$index}");
// This rename for changed family name
rename_rrd($device, "status-mge-status-inverter-{$oid_name}.{$index}", "status-{$type}-{$oid_name}.{$index}");
} else {
$type = 'mge-status-inverter';
//rename_rrd($device, "status-mge-status-state-{$oid_name}.{$index_rename}", "status-{$type}-{$oid_name}.{$index}");
}
discover_status($device, $oid_num, $oid_name.'.'.$index, $type, $descr, $value, array('entPhysicalClass' => 'other'));
discover_status($device, $oid_num, $oid_name . '.' . $index, $type, $descr, $value, ['entPhysicalClass' => 'other']);
}
// MG-SNMP-UPS-MIB::upsmgOutputOverLoad.0 = INTEGER: no(2)
if (isset($entry['upsmgOutputOverLoad']))
{
$descr = 'Over Load';
$oid_name = 'upsmgOutputOverLoad';
$oid_num = '.1.3.6.1.4.1.705.1.7.10.0';
$type = 'mge-status-state';
$value = $entry[$oid_name];
if (isset($entry['upsmgOutputOverLoad'])) {
$descr = 'Output Over Load';
$oid_name = 'upsmgOutputOverLoad';
$oid_num = '.1.3.6.1.4.1.705.1.7.10.0';
$type = 'mge-status-state';
$value = $entry[$oid_name];
rename_rrd($device, "status-{$type}-{$oid_name}.{$index_rename}", "status-{$type}-{$oid_name}.{$index}");
discover_status($device, $oid_num, $oid_name.'.'.$index, $type, $descr, $value, array('entPhysicalClass' => 'other'));
//rename_rrd($device, "status-{$type}-{$oid_name}.{$index_rename}", "status-{$type}-{$oid_name}.{$index}");
discover_status($device, $oid_num, $oid_name . '.' . $index, $type, $descr, $value, ['entPhysicalClass' => 'other']);
}
// MG-SNMP-UPS-MIB::upsmgOutputOverTemp.0 = INTEGER: no(2)
if (isset($entry['upsmgOutputOverTemp']))
{
$descr = 'Over Temperature';
$oid_name = 'upsmgOutputOverTemp';
$oid_num = '.1.3.6.1.4.1.705.1.7.11.0';
$type = 'mge-status-state';
$value = $entry[$oid_name];
if (isset($entry['upsmgOutputOverTemp'])) {
$descr = 'Output Over Temperature';
$oid_name = 'upsmgOutputOverTemp';
$oid_num = '.1.3.6.1.4.1.705.1.7.11.0';
$type = 'mge-status-state';
$value = $entry[$oid_name];
rename_rrd($device, "status-{$type}-{$oid_name}.{$index_rename}", "status-{$type}-{$oid_name}.{$index}");
discover_status($device, $oid_num, $oid_name.'.'.$index, $type, $descr, $value, array('entPhysicalClass' => 'other'));
//rename_rrd($device, "status-{$type}-{$oid_name}.{$index_rename}", "status-{$type}-{$oid_name}.{$index}");
discover_status($device, $oid_num, $oid_name . '.' . $index, $type, $descr, $value, ['entPhysicalClass' => 'other']);
}
// MG-SNMP-UPS-MIB::upsmgOutputOnBuck.0 = INTEGER: 2
$scale = 0.1;
$cache['mge'] = array();
$cache['mge'] = snmpwalk_cache_oid($device, "upsmgOutputPhaseTable", $cache['mge'], "MG-SNMP-UPS-MIB");
$scale = 0.1;
$oids = snmpwalk_cache_oid($device, "upsmgOutputPhaseTable", [], "MG-SNMP-UPS-MIB");
$upsmgOutputPhaseNum = snmp_get_oid($device, "upsmgOutputPhaseNum.0", "MG-SNMP-UPS-MIB");
foreach ($cache['mge'] as $index => $entry)
{
$descr = "Output"; if ($upsmgOutputPhaseNum > 1) { $descr .= " Phase $index"; }
foreach ($oids as $index => $entry) {
$descr = "Output";
$options = [];
if ($upsmgOutputPhaseNum > 1) {
$descr .= " Phase $index";
if ($index > $upsmgOutputPhaseNum) { break; } // MGE returns 3 phase values even if their mgOutputPhaseNum is 1. Doh.
$options = [
'measured_entity_label' => "Output Phase $index",
'measured_class' => 'phase'
];
}
$oid = ".1.3.6.1.4.1.705.1.7.2.1.4.$index"; // MG-SNMP-UPS-MIB:mgoutputLoadPerPhase.$index
$value = $entry['mgoutputLoadPerPhase'];
discover_sensor('load', $device, $oid, "mgoutputLoadPerPhase.$index", 'mge-ups', $descr . ' Load', 1, $value, array('limit_high' => 85, 'limit_high_warn' => 70));
if ($index > $upsmgOutputPhaseNum) {
break;
} // MGE returns 3 phase values even if their mgOutputPhaseNum is 1. Doh.
$oid = ".1.3.6.1.4.1.705.1.7.2.1.2.$index"; // MG-SNMP-UPS-MIB:mgoutputVoltage.$index
$value = $entry['mgoutputVoltage'];
if ($value != 0)
{
discover_sensor('voltage', $device, $oid, $index, 'mge-ups', $descr, $scale, $value);
}
$limits = [ 'limit_high' => 85, 'limit_high_warn' => 70 ];
$oid = ".1.3.6.1.4.1.705.1.7.2.1.4.$index"; // MG-SNMP-UPS-MIB:mgoutputLoadPerPhase.$index
$value = $entry['mgoutputLoadPerPhase'];
discover_sensor('load', $device, $oid, "mgoutputLoadPerPhase.$index", 'mge-ups', $descr . ' Load', 1, $value, array_merge($options, $limits));
$oid = ".1.3.6.1.4.1.705.1.7.2.1.5.$index"; // MG-SNMP-UPS-MIB:mgoutputCurrent.$index
$value = $entry['mgoutputCurrent'];
if ($value != 0)
{
discover_sensor('current', $device, $oid, $index, 'mge-ups', $descr, $scale, $value);
}
$oid = ".1.3.6.1.4.1.705.1.7.2.1.2.$index"; // MG-SNMP-UPS-MIB:mgoutputVoltage.$index
$value = $entry['mgoutputVoltage'];
if ($value != 0) {
discover_sensor('voltage', $device, $oid, $index, 'mge-ups', $descr, $scale, $value, $options);
}
$oid = ".1.3.6.1.4.1.705.1.7.2.1.3.$index"; // MG-SNMP-UPS-MIB:mgoutputFrequency.$index
$value = $entry['mgoutputFrequency'];
if ($value != 0)
{
discover_sensor('frequency', $device, $oid, $index, 'mge-ups', $descr, $scale, $value);
}
$oid = ".1.3.6.1.4.1.705.1.7.2.1.5.$index"; // MG-SNMP-UPS-MIB:mgoutputCurrent.$index
$value = $entry['mgoutputCurrent'];
if ($value != 0) {
discover_sensor('current', $device, $oid, $index, 'mge-ups', $descr, $scale, $value, $options);
}
$oid = ".1.3.6.1.4.1.705.1.7.2.1.3.$index"; // MG-SNMP-UPS-MIB:mgoutputFrequency.$index
$value = $entry['mgoutputFrequency'];
if ($value != 0) {
discover_sensor('frequency', $device, $oid, $index, 'mge-ups', $descr, $scale, $value, $options);
}
}
echo(" ");
// Battery data
$cache['mge'] = array();
foreach (array("upsmgBattery") as $table)
{
echo("$table ");
$cache['mge'] = snmpwalk_cache_oid($device, $table, $cache['mge'], "MG-SNMP-UPS-MIB", NULL, OBS_SNMP_ALL_NUMERIC_INDEX);
}
foreach ($cache['mge'] as $index => $entry)
{
$descr = "Battery";
$oids = snmpwalk_cache_oid($device, 'upsmgBattery', [], "MG-SNMP-UPS-MIB", NULL, OBS_SNMP_ALL_NUMERIC_INDEX);
// MG-SNMP-UPS-MIB::upsmgBatteryVoltage.0 = 810
if (isset($entry['upsmgBatteryVoltage']))
{
$oid = ".1.3.6.1.4.1.705.1.5.5.$index";
$value = $entry['upsmgBatteryVoltage'];
foreach ($oids as $index => $entry) {
$descr = "Battery";
if ($value != 0)
{
discover_sensor('voltage', $device, $oid, "upsmgBatteryVoltage.$index", 'mge', $descr, $scale, $value);
// MG-SNMP-UPS-MIB::upsmgBatteryVoltage.0 = 810
if (isset($entry['upsmgBatteryVoltage'])) {
$oid = ".1.3.6.1.4.1.705.1.5.5.$index";
$value = $entry['upsmgBatteryVoltage'];
if ($value != 0) {
discover_sensor('voltage', $device, $oid, "upsmgBatteryVoltage.$index", 'mge', $descr, $scale, $value);
}
}
}
// MG-SNMP-UPS-MIB::upsmgBatteryCurrent.0 = 0
if (isset($entry['upsmgBatteryCurrent']))
{
$oid = ".1.3.6.1.4.1.705.1.5.6.$index";
$value = $entry['upsmgBatteryCurrent'];
// MG-SNMP-UPS-MIB::upsmgBatteryCurrent.0 = 0
if (isset($entry['upsmgBatteryCurrent'])) {
$oid = ".1.3.6.1.4.1.705.1.5.6.$index";
$value = $entry['upsmgBatteryCurrent'];
if ($value != 0)
{
discover_sensor('current', $device, $oid, "upsmgBatteryCurrent.$index", 'mge', $descr, $scale, $value);
if ($value != 0) {
discover_sensor('current', $device, $oid, "upsmgBatteryCurrent.$index", 'mge', $descr, $scale, $value);
}
}
}
// MG-SNMP-UPS-MIB::upsmgBatteryTemperature.0 = INTEGER: 15
if (isset($entry['upsmgBatteryTemperature']))
{
$oid = ".1.3.6.1.4.1.705.1.5.7.$index";
$value = $entry['upsmgBatteryTemperature'];
// MG-SNMP-UPS-MIB::upsmgBatteryTemperature.0 = INTEGER: 15
if (isset($entry['upsmgBatteryTemperature'])) {
$oid = ".1.3.6.1.4.1.705.1.5.7.$index";
$value = $entry['upsmgBatteryTemperature'];
if ($value != 0)
{
discover_sensor('temperature', $device, $oid, "upsmgBatteryTemperature.$index", 'mge', $descr, 1, $value);
if ($value != 0) {
discover_sensor('temperature', $device, $oid, "upsmgBatteryTemperature.$index", 'mge', $descr, 1, $value);
}
}
}
// MG-SNMP-UPS-MIB::upsmgBatteryLevel.0 = INTEGER: 100
if (isset($entry['upsmgBatteryLevel']))
{
$oid = ".1.3.6.1.4.1.705.1.5.2.$index";
$limits = array('limit_low' => snmp_get_oid($device, "upsmgConfigLowBatteryLevel.0", "MG-SNMP-UPS-MIB"));
$value = $entry['upsmgBatteryLevel'];
// MG-SNMP-UPS-MIB::upsmgBatteryLevel.0 = INTEGER: 100
if (isset($entry['upsmgBatteryLevel'])) {
$oid = ".1.3.6.1.4.1.705.1.5.2.$index";
$limits = ['limit_low' => snmp_get_oid($device, "upsmgConfigLowBatteryLevel.0", "MG-SNMP-UPS-MIB")];
$value = $entry['upsmgBatteryLevel'];
discover_sensor('capacity', $device, $oid, "upsmgBatteryLevel.$index", 'mge', $descr . ' Capacity', 1, $value, $limits);
}
discover_sensor('capacity', $device, $oid, "upsmgBatteryLevel.$index", 'mge', $descr . ' Capacity', 1, $value, $limits);
}
// MG-SNMP-UPS-MIB::upsmgBatteryRemainingTime.0 = INTEGER: 12180
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_oid($device, "upsmgConfigLowBatteryTime.0", "MG-SNMP-UPS-MIB"));
$value = $entry['upsmgBatteryRemainingTime'];
$scale = 1 / 60;
// MG-SNMP-UPS-MIB::upsmgBatteryRemainingTime.0 = INTEGER: 12180
if (isset($entry['upsmgBatteryRemainingTime'])) {
$descr = "Battery Runtime Remaining";
$oid = ".1.3.6.1.4.1.705.1.5.1.$index";
$limits = ['limit_low' => snmp_get_oid($device, "upsmgConfigLowBatteryTime.0", "MG-SNMP-UPS-MIB")];
$value = $entry['upsmgBatteryRemainingTime'];
$scale = 1 / 60;
// FIXME: Use this as limit?
// MG-SNMP-UPS-MIB::upsmgConfigLowBatteryTime.0 = 180
// FIXME: Use this as limit?
// MG-SNMP-UPS-MIB::upsmgConfigLowBatteryTime.0 = 180
discover_sensor('runtime', $device, $oid, "upsmgBatteryRemainingTime.$index", 'mge', $descr, $scale, $value);
}
discover_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::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, ['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_status($device, $oid, "upsmgBatteryChargerFault.$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_status($device, $oid, "upsmgBatteryChargerFault.$index", 'mge-status-state', $descr, $value, ['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'];
discover_status($device, $oid, "upsmgBatteryLowCondition.$index", 'mge-status-state', $descr, $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'];
discover_status($device, $oid, "upsmgBatteryLowCondition.$index", 'mge-status-state', $descr, $value, ['entPhysicalClass' => 'battery']);
}
// MG-SNMP-UPS-MIB::upsmgBatteryReplacement.0 = no
if (isset($entry['upsmgBatteryReplacement']))
{
$descr = "Battery Replacement Needed";
$oid = ".1.3.6.1.4.1.705.1.5.11.$index";
$value = $entry['upsmgBatteryReplacement'];
discover_status($device, $oid, "upsmgBatteryReplacement.$index", 'mge-status-state', $descr, $value, array('entPhysicalClass' => 'battery'));
}
// MG-SNMP-UPS-MIB::upsmgBatteryReplacement.0 = no
if (isset($entry['upsmgBatteryReplacement'])) {
$descr = "Battery Replacement Needed";
$oid = ".1.3.6.1.4.1.705.1.5.11.$index";
$value = $entry['upsmgBatteryReplacement'];
discover_status($device, $oid, "upsmgBatteryReplacement.$index", 'mge-status-state', $descr, $value, ['entPhysicalClass' => 'battery']);
}
}
@ -358,45 +344,37 @@ echo(" ");
// Environmental monitoring
$cache['mge'] = array();
foreach (array("upsmgEnviron") as $table)
{
//echo("$table ");
$cache['mge'] = snmpwalk_cache_oid($device, $table, $cache['mge'], "MG-SNMP-UPS-MIB", NULL, OBS_SNMP_ALL_NUMERIC_INDEX);
}
$oids = snmpwalk_cache_oid($device, 'upsmgEnviron', [], "MG-SNMP-UPS-MIB", NULL, OBS_SNMP_ALL_NUMERIC_INDEX);
// MG-SNMP-UPS-MIB::upsmgEnvironAmbientTemp.0 = INTEGER: 0
// MG-SNMP-UPS-MIB::upsmgEnvironAmbientHumidity.0 = INTEGER: 0
$scale = 0.1;
foreach ($cache['mge'] as $index => $entry)
{
$descr = "Ambient";
foreach ($oids as $index => $entry) {
$descr = "Ambient";
$oid = ".1.3.6.1.4.1.705.1.8.1.$index";
$value = $entry['upsmgEnvironAmbientTemp'];
$oid = ".1.3.6.1.4.1.705.1.8.1.$index";
$value = $entry['upsmgEnvironAmbientTemp'];
if ($value != 0)
{ // Temp = 0 -> Sensor not available
discover_sensor('temperature', $device, $oid, "upsmgEnvironAmbientTemp.$index", 'mge', $descr, $scale, $value);
if ($value != 0) { // Temp = 0 -> Sensor not available
discover_sensor('temperature', $device, $oid, "upsmgEnvironAmbientTemp.$index", 'mge', $descr, $scale, $value);
}
$oid = ".1.3.6.1.4.1.705.1.8.2.$index";
$value = $entry['upsmgEnvironAmbientHumidity'];
$oid = ".1.3.6.1.4.1.705.1.8.2.$index";
$value = $entry['upsmgEnvironAmbientHumidity'];
if ($value != 0)
{ // Humidity = 0 -> Sensor not available
// Should be /10 on all devices but apparently not on all, let's try to work around:
if ($value > 100) { $scale = 0.1; } else { $scale = 1; }
discover_sensor('humidity', $device, $oid, "upsmgEnvironAmbientHumidity.$index", 'mge', $descr, $scale, $value);
if ($value != 0) { // Humidity = 0 -> Sensor not available
// Should be /10 on all devices but apparently not on all, let's try to work around:
if ($value > 100) {
$scale = 0.1;
} else {
$scale = 1;
}
discover_sensor('humidity', $device, $oid, "upsmgEnvironAmbientHumidity.$index", 'mge', $descr, $scale, $value);
}
}
$cache['mge'] = array();
foreach (array("upsmgConfigEnvironmentTable","upsmgEnvironmentSensorTable") as $table)
{
echo("$table ");
$cache['mge'] = snmpwalk_cache_oid($device, $table, $cache['mge'], "MG-SNMP-UPS-MIB", NULL, OBS_SNMP_ALL_NUMERIC_INDEX);
}
$oids = snmpwalk_cache_oid($device, 'upsmgConfigEnvironmentTable', [], "MG-SNMP-UPS-MIB", NULL, OBS_SNMP_ALL_NUMERIC_INDEX);
$oids = snmpwalk_cache_oid($device, 'upsmgEnvironmentSensorTable', $oids, "MG-SNMP-UPS-MIB", NULL, OBS_SNMP_ALL_NUMERIC_INDEX);
// upsmgConfigSensorIndex.1 = 1
// upsmgConfigSensorName.1 = "Environment sensor"
@ -424,43 +402,45 @@ foreach (array("upsmgConfigEnvironmentTable","upsmgEnvironmentSensorTable") as $
// upsmgEnvironmentInput1State.1 = open
// upsmgEnvironmentInput2State.1 = open
foreach ($cache['mge'] as $index => $entry)
{
if ($entry['upsmgEnvironmentComFailure'] == 'no') // yes means no environment module present
{
$descr = $entry['upsmgConfigSensorName'];
$oid = ".1.3.6.1.4.1.705.1.8.7.1.6.$index";
$value = $entry['upsmgEnvironmentHumidity'];
// FIXME warninglevels might need some other calculation instead of hysteresis
$hysteresis = $entry['upsmgConfigHumidityHysteresis'];
$limits = array('limit_high' => $entry['upsmgConfigHumidityHigh'],
'limit_low' => $entry['upsmgConfigHumidityLow'],
'limit_high_warn' => $entry['upsmgConfigHumidityHigh'] - $hysteresis,
'limit_low_warn' => $entry['upsmgConfigHumidityLow'] + $hysteresis);
if ($value != 0)
{ // Humidity = 0 -> Sensor not available
// Should be /10 on all devices but apparently not on all, let's try to work around:
if ($value > 100) { $scale = 0.1; } else { $scale = 1; }
discover_sensor('humidity', $device, $oid, $index, 'mge', $descr, $scale, $value, $limits);
foreach ($oids as $index => $entry) {
if ($entry['upsmgEnvironmentComFailure'] !== 'no') { // yes means no environment module present
continue;
}
$scale = 0.1;
$oid = '.1.3.6.1.4.1.705.1.8.7.1.3.' . $index;
$value = $entry['upsmgEnvironmentTemperature'];
// FIXME warninglevels might need some other calculation instead of hysteresis
$hysteresis = $entry['upsmgConfigTemperatureHysteresis'];
$limits = array('limit_high' => $entry['upsmgConfigTemperatureHigh'],
'limit_low' => $entry['upsmgConfigTemperatureLow'],
'limit_high_warn' => $entry['upsmgConfigTemperatureHigh'] - $hysteresis,
'limit_low_warn' => $entry['upsmgConfigTemperatureLow'] + $hysteresis);
$descr = $entry['upsmgConfigSensorName'];
if ($value != 0)
{
discover_sensor('temperature', $device, $oid, $index, 'mge', $descr, $scale, $value, $limits);
$oid = ".1.3.6.1.4.1.705.1.8.7.1.6.$index";
$value = $entry['upsmgEnvironmentHumidity'];
// FIXME warninglevels might need some other calculation instead of hysteresis
$hysteresis = $entry['upsmgConfigHumidityHysteresis'];
$limits = ['limit_high' => $entry['upsmgConfigHumidityHigh'],
'limit_low' => $entry['upsmgConfigHumidityLow'],
'limit_high_warn' => $entry['upsmgConfigHumidityHigh'] - $hysteresis,
'limit_low_warn' => $entry['upsmgConfigHumidityLow'] + $hysteresis];
if ($value != 0) { // Humidity = 0 -> Sensor not available
// Should be /10 on all devices but apparently not on all, let's try to work around:
if ($value > 100) {
$scale = 0.1;
} else {
$scale = 1;
}
discover_sensor('humidity', $device, $oid, $index, 'mge', $descr, $scale, $value, $limits);
}
$scale = 0.1;
$oid = '.1.3.6.1.4.1.705.1.8.7.1.3.' . $index;
$value = $entry['upsmgEnvironmentTemperature'];
// FIXME warninglevels might need some other calculation instead of hysteresis
$hysteresis = $entry['upsmgConfigTemperatureHysteresis'];
$limits = ['limit_high' => $entry['upsmgConfigTemperatureHigh'],
'limit_low' => $entry['upsmgConfigTemperatureLow'],
'limit_high_warn' => $entry['upsmgConfigTemperatureHigh'] - $hysteresis,
'limit_low_warn' => $entry['upsmgConfigTemperatureLow'] + $hysteresis];
if ($value != 0) {
discover_sensor('temperature', $device, $oid, $index, 'mge', $descr, $scale, $value, $limits);
}
}
}
// EOF

View File

@ -5,9 +5,9 @@
*
* This file is part of Observium.
*
* @package observium
* @subpackage discovery
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2019 Observium Limited
* @package observium
* @subpackage discovery
* @copyright (C) Adam Armstrong
*
*/
@ -38,24 +38,22 @@ MSERIES-ENVMON-MIB::smartEnvMonTemperatureValue.43 = INTEGER: 32 degrees Celsius
MSERIES-ENVMON-MIB::smartEnvMonTemperatureValue.44 = INTEGER: 32 degrees Celsius
*/
$oids = array();
$todo = array('smartEnvMonTemperatureDescr', 'smartEnvMonTemperatureValue');
foreach ($todo as $table)
{
$oids = snmpwalk_cache_oid($device, $table, $oids, 'MSERIES-ENVMON-MIB');
$oids = [];
$todo = ['smartEnvMonTemperatureDescr', 'smartEnvMonTemperatureValue'];
foreach ($todo as $table) {
$oids = snmpwalk_cache_oid($device, $table, $oids, 'MSERIES-ENVMON-MIB');
}
foreach ($oids as $index => $entry)
{
$descr = $entry['smartEnvMonTemperatureDescr'];
$oid = ".1.3.6.1.4.1.30826.1.4.1.1.1.3.$index";
$current = $entry['smartEnvMonTemperatureValue'];
$limits = array('limit_high' => 55,
'limit_low' => 0.01,
'limit_high_warn' => 50,
'limit_low_warn' => 5);
foreach ($oids as $index => $entry) {
$descr = $entry['smartEnvMonTemperatureDescr'];
$oid = ".1.3.6.1.4.1.30826.1.4.1.1.1.3.$index";
$current = $entry['smartEnvMonTemperatureValue'];
$limits = ['limit_high' => 55,
'limit_low' => 0.01,
'limit_high_warn' => 50,
'limit_low_warn' => 5];
discover_sensor('temperature', $device, $oid, $index, 'mseries-envmon', $descr, 1, $current, $limits);
discover_sensor('temperature', $device, $oid, $index, 'mseries-envmon', $descr, 1, $current, $limits);
}
// EOF

View File

@ -5,9 +5,9 @@
*
* This file is part of Observium.
*
* @package observium
* @subpackage discovery
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2019 Observium Limited
* @package observium
* @subpackage discovery
* @copyright (C) Adam Armstrong
*
*/
@ -44,35 +44,32 @@ MSERIES-PORT-MIB::smartPortLowPowerAlarmThreshold.12 = INTEGER: -50
*/
$oids = array();
$todo = array ('smartPortName', 'smartPortPower', 'smartPortHighPowerAlarmThreshold', 'smartPortLowPowerAlarmThreshold', 'smartPortStatus');
foreach ($todo as $table)
{
$oids = snmpwalk_cache_oid($device, $table, $oids, 'MSERIES-PORT-MIB');
$oids = [];
$todo = ['smartPortName', 'smartPortPower', 'smartPortHighPowerAlarmThreshold', 'smartPortLowPowerAlarmThreshold', 'smartPortStatus'];
foreach ($todo as $table) {
$oids = snmpwalk_cache_oid($device, $table, $oids, 'MSERIES-PORT-MIB');
}
$pwr_pfx = ".1.3.6.1.4.1.30826.1.3.1.2.1.1.5";
$status_pfx = ".1.3.6.1.4.1.30826.1.3.1.2.1.1.6";
foreach ($oids as $index => $entry)
{
$pwr_current = $entry['smartPortPower'];
$options = array();
$options['limit_high'] = $entry['smartPortHighPowerAlarmThreshold'] / 10;
$options['limit_low'] = $entry['smartPortLowPowerAlarmThreshold'] / 10;
# Idle ports indicate -40dBm signal power and always fail the threshold check
# because the lowest threshold is -25dBm. To stop such ports making to the
# list of failed health checks override the thresholds of an idle port to
# a range that never fails.
if ($entry['smartPortStatus'] == 'idle')
{
$options['limit_high'] = 50;
$options['limit_low'] = -50;
}
foreach ($oids as $index => $entry) {
$pwr_current = $entry['smartPortPower'];
$options = [];
$options['limit_high'] = $entry['smartPortHighPowerAlarmThreshold'] / 10;
$options['limit_low'] = $entry['smartPortLowPowerAlarmThreshold'] / 10;
# Idle ports indicate -40dBm signal power and always fail the threshold check
# because the lowest threshold is -25dBm. To stop such ports making to the
# list of failed health checks override the thresholds of an idle port to
# a range that never fails.
if ($entry['smartPortStatus'] == 'idle') {
$options['limit_high'] = 50;
$options['limit_low'] = -50;
}
$status_current = $entry['smartPortStatus'];
$status_current = $entry['smartPortStatus'];
discover_sensor('dbm', $device, "$pwr_pfx.$index", $index, 'mseries-port-power', $entry['smartPortName'], 0.1, $pwr_current, $options);
discover_status($device, "$status_pfx.$index", $index, 'mseries-port-status-state', $entry['smartPortName'], $status_current);
discover_sensor('dbm', $device, "$pwr_pfx.$index", $index, 'mseries-port-power', $entry['smartPortName'], 0.1, $pwr_current, $options);
discover_status($device, "$status_pfx.$index", $index, 'mseries-port-status-state', $entry['smartPortName'], $status_current);
}
// EOF

View File

@ -4,9 +4,9 @@
*
* This file is part of Observium.
*
* @package observium
* @subpackage discovery
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2020 Observium Limited
* @package observium
* @subpackage discovery
* @copyright (C) Adam Armstrong
*
*/
@ -18,60 +18,51 @@
// nbsCmmcPortBiasAmps.1.2.3 = 46863
// nbsCmmcPortSupplyVolts.1.2.3 = 3329
$oid_list = array('nbsCmmcPortName', 'nbsCmmcPortIfIndex', 'nbsCmmcPortTemperature', 'nbsCmmcPortTxPower', 'nbsCmmcPortRxPower', 'nbsCmmcPortBiasAmps', 'nbsCmmcPortSupplyVolts');
$oids = array();
$oid_list = ['nbsCmmcPortName', 'nbsCmmcPortIfIndex', 'nbsCmmcPortTemperature', 'nbsCmmcPortTxPower', 'nbsCmmcPortRxPower', 'nbsCmmcPortBiasAmps', 'nbsCmmcPortSupplyVolts'];
$oids = [];
foreach ($oid_list as $oid)
{
$oids = snmpwalk_cache_oid($device, $oid, $oids, "NBS-CMMC-MIB");
foreach ($oid_list as $oid) {
$oids = snmpwalk_cache_oid($device, $oid, $oids, "NBS-CMMC-MIB");
}
foreach ($oids as $index => $port)
{
$name = $port['nbsCmmcPortName'];
foreach ($oids as $index => $port) {
$name = $port['nbsCmmcPortName'];
$options = array();
$options = [];
if (is_numeric($port['nbsCmmcPortIfIndex']))
{
$db_port = get_port_by_index_cache($device['device_id'], $port['nbsCmmcPortIfIndex']);
if (is_numeric($port['nbsCmmcPortIfIndex'])) {
$db_port = get_port_by_index_cache($device['device_id'], $port['nbsCmmcPortIfIndex']);
if (is_array($db_port))
{
$options['measured_class'] = 'port';
$options['measured_entity'] = $db_port['port_id'];
if (is_array($db_port)) {
$options['measured_class'] = 'port';
$options['measured_entity'] = $db_port['port_id'];
}
}
}
if ($port['nbsCmmcPortTemperature'] != -2147483648)
{
$sensor_oid = '.1.3.6.1.4.1.629.200.8.1.1.30.' . $index;
discover_sensor("temperature", $device, $sensor_oid, $index, 'nbsCmmcPortTemperature', $port['nbsCmmcPortName'], 1, $port['nbsCmmcPortTemperature'], $options);
}
if ($port['nbsCmmcPortTemperature'] != -2147483648) {
$sensor_oid = '.1.3.6.1.4.1.629.200.8.1.1.30.' . $index;
discover_sensor("temperature", $device, $sensor_oid, $index, 'nbsCmmcPortTemperature', $port['nbsCmmcPortName'], 1, $port['nbsCmmcPortTemperature'], $options);
}
if ($port['nbsCmmcPortTxPower'] != -2147483648)
{
$sensor_oid = '.1.3.6.1.4.1.629.200.8.1.1.31.' . $index;
discover_sensor("dbm", $device, $sensor_oid, $index, 'nbsCmmcPortTxPower', $port['nbsCmmcPortName'] . ' TX Power', 0.001, $port['nbsCmmcPortTxPower'], $options);
}
if ($port['nbsCmmcPortTxPower'] != -2147483648) {
$sensor_oid = '.1.3.6.1.4.1.629.200.8.1.1.31.' . $index;
discover_sensor("dbm", $device, $sensor_oid, $index, 'nbsCmmcPortTxPower', $port['nbsCmmcPortName'] . ' TX Power', 0.001, $port['nbsCmmcPortTxPower'], $options);
}
if ($port['nbsCmmcPortRxPower'] != -2147483648)
{
$sensor_oid = '.1.3.6.1.4.1.629.200.8.1.1.32.' . $index;
discover_sensor("dbm", $device, $sensor_oid, $index, 'nbsCmmcPortRxPower', $port['nbsCmmcPortName'] . ' RX Power', 0.001, $port['nbsCmmcPortRxPower'], $options);
}
if ($port['nbsCmmcPortRxPower'] != -2147483648) {
$sensor_oid = '.1.3.6.1.4.1.629.200.8.1.1.32.' . $index;
discover_sensor("dbm", $device, $sensor_oid, $index, 'nbsCmmcPortRxPower', $port['nbsCmmcPortName'] . ' RX Power', 0.001, $port['nbsCmmcPortRxPower'], $options);
}
if ($port['nbsCmmcPortBiasAmps'] != -1)
{
$sensor_oid = '.1.3.6.1.4.1.629.200.8.1.1.33.' . $index;
discover_sensor("current", $device, $sensor_oid, $index, 'nbsCmmcPortBiasAmps', $port['nbsCmmcPortName'] . ' Bias', 0.000001, $port['nbsCmmcPortBiasAmps'], $options);
}
if ($port['nbsCmmcPortBiasAmps'] != -1) {
$sensor_oid = '.1.3.6.1.4.1.629.200.8.1.1.33.' . $index;
discover_sensor("current", $device, $sensor_oid, $index, 'nbsCmmcPortBiasAmps', $port['nbsCmmcPortName'] . ' Bias', 0.000001, $port['nbsCmmcPortBiasAmps'], $options);
}
if ($port['nbsCmmcPortSupplyVolts'] != -1)
{
$sensor_oid = '.1.3.6.1.4.1.629.200.8.1.1.34.' . $index;
discover_sensor("voltage", $device, $sensor_oid, $index, 'nbsCmmcPortSupplyVolts', $port['nbsCmmcPortName'] . ' Supply', 0.001, $port['nbsCmmcPortSupplyVolts'], $options);
}
if ($port['nbsCmmcPortSupplyVolts'] != -1) {
$sensor_oid = '.1.3.6.1.4.1.629.200.8.1.1.34.' . $index;
discover_sensor("voltage", $device, $sensor_oid, $index, 'nbsCmmcPortSupplyVolts', $port['nbsCmmcPortName'] . ' Supply', 0.001, $port['nbsCmmcPortSupplyVolts'], $options);
}
}
// EOF

View File

@ -1,195 +1,195 @@
<?php
/*
/**
* Observium
*
* This file is part of Observium.
*
* @package observium
* @subpackage discovery
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2021 Observium Limited
* @copyright (C) Adam Armstrong
*
*/
$oids = snmpwalk_cache_oid($device, 'enclTable', [], 'NETAPP-MIB');
foreach ($oids as $index => $entry) {
// NETAPP-MIB::enclNumber.0 = INTEGER: 1
// NETAPP-MIB::enclIndex.1 = INTEGER: 1
// NETAPP-MIB::enclContactState.1 = INTEGER: active(3)
// NETAPP-MIB::enclChannelShelfAddr.1 = STRING: 0b.shelf0
// NETAPP-MIB::enclProductLogicalID.1 = STRING: 5:00a:09800e:56ea77
// NETAPP-MIB::enclProductID.1 = STRING: DS224-12
// NETAPP-MIB::enclProductVendor.1 = STRING: NETAPP
// NETAPP-MIB::enclProductModel.1 = STRING: DS224-12
// NETAPP-MIB::enclProductRevision.1 = STRING: 0220
// NETAPP-MIB::enclProductSerialNo.1 = STRING: SHFGB2051000413
$enclosure = $entry['enclProductModel'];
if ($entry['enclProductModel'] && !str_icontains_array($entry['enclProductVendor'], 'NETAPP')) {
$enclosure = $entry['enclProductVendor'] . ' ' . $enclosure;
}
$descr = "Enclosure $index Contact ($enclosure)";
$oid = ".1.3.6.1.4.1.789.1.21.1.2.1.2.$index";
$oid_name = 'enclContactState';
$value = $entry[$oid_name];
discover_status_ng($device, $mib, $oid_name, $oid, $index, $oid_name, $descr, $value, [ 'entPhysicalClass' => 'enclosure' ]);
// NETAPP-MIB::enclTempSensorsMaximum.1 = INTEGER: 15
// NETAPP-MIB::enclTempSensorsPresent.1 = STRING: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15
// NETAPP-MIB::enclTempSensorsOverTempFail.1 = STRING:
// NETAPP-MIB::enclTempSensorsOverTempWarn.1 = STRING:
// NETAPP-MIB::enclTempSensorsUnderTempFail.1 = STRING:
// NETAPP-MIB::enclTempSensorsUnderTempWarn.1 = STRING:
// NETAPP-MIB::enclTempSensorsCurrentTemp.1 = STRING: 19C (66F) ambient, 22C (71F), 22C (71F), 22C (71F), 22C (71F), 24C (75F), 41C (105F), 24C (75F), 42C (107F), 30C (86F), 41C (105F), 25C (77F), 31C (87F), 42C (107F), 26C (78F)
// NETAPP-MIB::enclTempSensorsOverTempFailThr.1 = STRING: 52C (125F), 60C (140F), 60C (140F), 60C (140F), 60C (140F), 62C (143F), 100C (212F), 62C (143F), 100C (212F), 90C (194F), 105C (221F), 75C (167F), 90C (194F), 105C (221F), 75C (167F)
// NETAPP-MIB::enclTempSensorsOverTempWarnThr.1 = STRING: 47C (116F), 47C (116F), 47C (116F), 47C (116F), 47C (116F), 57C (134F), 95C (203F), 57C (134F), 95C (203F), 80C (176F), 100C (212F), 60C (140F), 80C (176F), 100C (212F), 60C (140F)
// NETAPP-MIB::enclTempSensorsUnderTempFailThr.1 = STRING: 0C (32F), 0C (32F), 0C (32F), 0C (32F), 0C (32F), 5C (41F), 5C (41F), 5C (41F), 5C (41F), 0C (32F), 0C (32F), 0C (32F), 0C (32F), 0C (32F), 0C (32F)
// NETAPP-MIB::enclTempSensorsUnderTempWarnThr.1 = STRING: 5C (41F), 5C (41F), 5C (41F), 5C (41F), 5C (41F), 10C (50F), 10C (50F), 10C (50F), 10C (50F), 5C (41F), 5C (41F), 5C (41F), 5C (41F), 5C (41F), 5C (41F)
$oid = ".1.3.6.1.4.1.789.1.21.1.2.1.25.$index";
$oid_name = 'enclTempSensorsCurrentTemp';
$value = $entry[$oid_name];
$items = explode(', ', $entry['enclTempSensorsPresent']);
$values = explode(', ', $value);
foreach ($items as $i => $item) {
list(,, $extra) = explode(' ', $values[$i]);
if (safe_empty($extra)) {
$descr = "Enclosure $index Sensor $item";
} else {
$descr = "Enclosure $index " . nicecase($extra);
// NETAPP-MIB::enclNumber.0 = INTEGER: 1
// NETAPP-MIB::enclIndex.1 = INTEGER: 1
// NETAPP-MIB::enclContactState.1 = INTEGER: active(3)
// NETAPP-MIB::enclChannelShelfAddr.1 = STRING: 0b.shelf0
// NETAPP-MIB::enclProductLogicalID.1 = STRING: 5:00a:09800e:56ea77
// NETAPP-MIB::enclProductID.1 = STRING: DS224-12
// NETAPP-MIB::enclProductVendor.1 = STRING: NETAPP
// NETAPP-MIB::enclProductModel.1 = STRING: DS224-12
// NETAPP-MIB::enclProductRevision.1 = STRING: 0220
// NETAPP-MIB::enclProductSerialNo.1 = STRING: SHFGB2051000413
$enclosure = $entry['enclProductModel'];
if ($entry['enclProductModel'] && !str_icontains_array($entry['enclProductVendor'], 'NETAPP')) {
$enclosure = $entry['enclProductVendor'] . ' ' . $enclosure;
}
$descr .= " ($enclosure)";
$unit = 'split' . ($i+1);
$options = [
'entPhysicalIndex_measured' => $index,
'entPhysicalIndex' => $item,
'sensor_unit' => $unit,
'limit_high' => snmp_fix_numeric($entry['enclTempSensorsOverTempFailThr'], $unit),
'limit_high_warn' => snmp_fix_numeric($entry['enclTempSensorsOverTempWarnThr'], $unit),
'limit_low' => snmp_fix_numeric($entry['enclTempSensorsUnderTempFailThr'], $unit),
'limit_low_warn' => snmp_fix_numeric($entry['enclTempSensorsUnderTempWarnThr'], $unit),
];
$descr = "Enclosure $index Contact ($enclosure)";
discover_sensor_ng($device, 'temperature', $mib, $oid_name, $oid, $index, NULL, $descr, 1, $value, $options);
}
$oid = ".1.3.6.1.4.1.789.1.21.1.2.1.2.$index";
$oid_name = 'enclContactState';
$value = $entry[$oid_name];
// NETAPP-MIB::enclVoltSensorsMaximum.1 = INTEGER: 4
// NETAPP-MIB::enclVoltSensorsPresent.1 = STRING: 1, 2, 3, 4
// NETAPP-MIB::enclVoltSensorsOverVoltFail.1 = STRING:
// NETAPP-MIB::enclVoltSensorsOverVoltWarn.1 = STRING:
// NETAPP-MIB::enclVoltSensorsUnderVoltFail.1 = STRING:
// NETAPP-MIB::enclVoltSensorsUnderVoltWarn.1 = STRING:
// NETAPP-MIB::enclVoltSensorsCurrentVolt.1 = STRING: 507 mV, 1226 mV, 507 mV, 1226 mV
// NETAPP-MIB::enclVoltSensorsOverVoltFailThr.1 = STRING:
// NETAPP-MIB::enclVoltSensorsOverVoltWarnThr.1 = STRING:
// NETAPP-MIB::enclVoltSensorsUnderVoltFailThr.1 = STRING:
// NETAPP-MIB::enclVoltSensorsUnderVoltWarnThr.1 = STRING:
discover_status_ng($device, $mib, $oid_name, $oid, $index, $oid_name, $descr, $value, ['entPhysicalClass' => 'enclosure']);
$oid = ".1.3.6.1.4.1.789.1.21.1.2.1.40.$index";
$oid_name = 'enclVoltSensorsCurrentVolt';
$value = $entry[$oid_name];
// NETAPP-MIB::enclTempSensorsMaximum.1 = INTEGER: 15
// NETAPP-MIB::enclTempSensorsPresent.1 = STRING: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15
// NETAPP-MIB::enclTempSensorsOverTempFail.1 = STRING:
// NETAPP-MIB::enclTempSensorsOverTempWarn.1 = STRING:
// NETAPP-MIB::enclTempSensorsUnderTempFail.1 = STRING:
// NETAPP-MIB::enclTempSensorsUnderTempWarn.1 = STRING:
// NETAPP-MIB::enclTempSensorsCurrentTemp.1 = STRING: 19C (66F) ambient, 22C (71F), 22C (71F), 22C (71F), 22C (71F), 24C (75F), 41C (105F), 24C (75F), 42C (107F), 30C (86F), 41C (105F), 25C (77F), 31C (87F), 42C (107F), 26C (78F)
// NETAPP-MIB::enclTempSensorsOverTempFailThr.1 = STRING: 52C (125F), 60C (140F), 60C (140F), 60C (140F), 60C (140F), 62C (143F), 100C (212F), 62C (143F), 100C (212F), 90C (194F), 105C (221F), 75C (167F), 90C (194F), 105C (221F), 75C (167F)
// NETAPP-MIB::enclTempSensorsOverTempWarnThr.1 = STRING: 47C (116F), 47C (116F), 47C (116F), 47C (116F), 47C (116F), 57C (134F), 95C (203F), 57C (134F), 95C (203F), 80C (176F), 100C (212F), 60C (140F), 80C (176F), 100C (212F), 60C (140F)
// NETAPP-MIB::enclTempSensorsUnderTempFailThr.1 = STRING: 0C (32F), 0C (32F), 0C (32F), 0C (32F), 0C (32F), 5C (41F), 5C (41F), 5C (41F), 5C (41F), 0C (32F), 0C (32F), 0C (32F), 0C (32F), 0C (32F), 0C (32F)
// NETAPP-MIB::enclTempSensorsUnderTempWarnThr.1 = STRING: 5C (41F), 5C (41F), 5C (41F), 5C (41F), 5C (41F), 10C (50F), 10C (50F), 10C (50F), 10C (50F), 5C (41F), 5C (41F), 5C (41F), 5C (41F), 5C (41F), 5C (41F)
$items = explode(', ', $entry['enclVoltSensorsPresent']);
$values = explode(', ', $value);
$oid = ".1.3.6.1.4.1.789.1.21.1.2.1.25.$index";
$oid_name = 'enclTempSensorsCurrentTemp';
$value = $entry[$oid_name];
foreach ($items as $i => $item) {
$items = explode(', ', $entry['enclTempSensorsPresent']);
$values = explode(', ', $value);
list(,, $extra) = explode(' ', $values[$i]);
if (safe_empty($extra)) {
$descr = "Enclosure $index Sensor $item";
} else {
$descr = "Enclosure $index " . nicecase($extra);
foreach ($items as $i => $item) {
[, , $extra] = explode(' ', $values[$i]);
if (safe_empty($extra)) {
$descr = "Enclosure $index Sensor $item";
} else {
$descr = "Enclosure $index " . nicecase($extra);
}
$descr .= " ($enclosure)";
$unit = 'split' . ($i + 1);
$options = [
'entPhysicalIndex_measured' => $index,
'entPhysicalIndex' => $item,
'sensor_unit' => $unit,
'limit_high' => snmp_fix_numeric($entry['enclTempSensorsOverTempFailThr'], $unit),
'limit_high_warn' => snmp_fix_numeric($entry['enclTempSensorsOverTempWarnThr'], $unit),
'limit_low' => snmp_fix_numeric($entry['enclTempSensorsUnderTempFailThr'], $unit),
'limit_low_warn' => snmp_fix_numeric($entry['enclTempSensorsUnderTempWarnThr'], $unit),
];
discover_sensor_ng($device, 'temperature', $mib, $oid_name, $oid, $index, $descr, 1, $value, $options);
}
$descr .= " ($enclosure)";
$unit = 'split' . ($i+1);
$options = [
'entPhysicalIndex_measured' => $index,
'entPhysicalIndex' => $item,
'sensor_unit' => $unit,
'limit_high' => snmp_fix_numeric($entry['enclVoltSensorsOverVoltFailThr'], $unit),
'limit_high_warn' => snmp_fix_numeric($entry['enclVoltSensorsOverVoltWarnThr'], $unit),
'limit_low' => snmp_fix_numeric($entry['enclVoltSensorsUnderVoltFailThr'], $unit),
'limit_low_warn' => snmp_fix_numeric($entry['enclVoltSensorsUnderVoltWarnThr'], $unit),
];
// NETAPP-MIB::enclVoltSensorsMaximum.1 = INTEGER: 4
// NETAPP-MIB::enclVoltSensorsPresent.1 = STRING: 1, 2, 3, 4
// NETAPP-MIB::enclVoltSensorsOverVoltFail.1 = STRING:
// NETAPP-MIB::enclVoltSensorsOverVoltWarn.1 = STRING:
// NETAPP-MIB::enclVoltSensorsUnderVoltFail.1 = STRING:
// NETAPP-MIB::enclVoltSensorsUnderVoltWarn.1 = STRING:
// NETAPP-MIB::enclVoltSensorsCurrentVolt.1 = STRING: 507 mV, 1226 mV, 507 mV, 1226 mV
// NETAPP-MIB::enclVoltSensorsOverVoltFailThr.1 = STRING:
// NETAPP-MIB::enclVoltSensorsOverVoltWarnThr.1 = STRING:
// NETAPP-MIB::enclVoltSensorsUnderVoltFailThr.1 = STRING:
// NETAPP-MIB::enclVoltSensorsUnderVoltWarnThr.1 = STRING:
discover_sensor_ng($device, 'voltage', $mib, $oid_name, $oid, $index, NULL, $descr, 0.001, $value, $options);
}
$oid = ".1.3.6.1.4.1.789.1.21.1.2.1.40.$index";
$oid_name = 'enclVoltSensorsCurrentVolt';
$value = $entry[$oid_name];
// NETAPP-MIB::enclCurSensorsMaximum.1 = INTEGER: 4
// NETAPP-MIB::enclCurSensorsPresent.1 = STRING: 1, 2, 3, 4
// NETAPP-MIB::enclCurSensorsOverCurFail.1 = STRING:
// NETAPP-MIB::enclCurSensorsOverCurWarn.1 = STRING:
// NETAPP-MIB::enclCurSensorsCurrentCur.1 = STRING: 6090 mA, 8710 mA, 6670 mA, 8280 mA
// NETAPP-MIB::enclCurSensorsOverCurFailThr.1 = STRING:
// NETAPP-MIB::enclCurSensorsOverCurWarnThr.1 = STRING:
$items = explode(', ', $entry['enclVoltSensorsPresent']);
$values = explode(', ', $value);
$oid = ".1.3.6.1.4.1.789.1.21.1.2.1.49.$index";
$oid_name = 'enclCurSensorsCurrentCur';
$value = $entry[$oid_name];
foreach ($items as $i => $item) {
$items = explode(', ', $entry['enclCurSensorsPresent']);
$values = explode(', ', $value);
[, , $extra] = explode(' ', $values[$i]);
if (safe_empty($extra)) {
$descr = "Enclosure $index Sensor $item";
} else {
$descr = "Enclosure $index " . nicecase($extra);
}
$descr .= " ($enclosure)";
foreach ($items as $i => $item) {
$unit = 'split' . ($i + 1);
$options = [
'entPhysicalIndex_measured' => $index,
'entPhysicalIndex' => $item,
'sensor_unit' => $unit,
'limit_high' => snmp_fix_numeric($entry['enclVoltSensorsOverVoltFailThr'], $unit),
'limit_high_warn' => snmp_fix_numeric($entry['enclVoltSensorsOverVoltWarnThr'], $unit),
'limit_low' => snmp_fix_numeric($entry['enclVoltSensorsUnderVoltFailThr'], $unit),
'limit_low_warn' => snmp_fix_numeric($entry['enclVoltSensorsUnderVoltWarnThr'], $unit),
];
list(,, $extra) = explode(' ', $values[$i]);
if (safe_empty($extra)) {
$descr = "Enclosure $index Sensor $item";
} else {
$descr = "Enclosure $index " . nicecase($extra);
discover_sensor_ng($device, 'voltage', $mib, $oid_name, $oid, $index, $descr, 0.001, $value, $options);
}
$descr .= " ($enclosure)";
$unit = 'split' . ($i+1);
$options = [
'entPhysicalIndex_measured' => $index,
'entPhysicalIndex' => $item,
'sensor_unit' => $unit,
'limit_high' => snmp_fix_numeric($entry['enclCurSensorsOverCurFailThr'], $unit),
'limit_high_warn' => snmp_fix_numeric($entry['enclCurSensorsOverCurWarnThr'], $unit),
];
// NETAPP-MIB::enclCurSensorsMaximum.1 = INTEGER: 4
// NETAPP-MIB::enclCurSensorsPresent.1 = STRING: 1, 2, 3, 4
// NETAPP-MIB::enclCurSensorsOverCurFail.1 = STRING:
// NETAPP-MIB::enclCurSensorsOverCurWarn.1 = STRING:
// NETAPP-MIB::enclCurSensorsCurrentCur.1 = STRING: 6090 mA, 8710 mA, 6670 mA, 8280 mA
// NETAPP-MIB::enclCurSensorsOverCurFailThr.1 = STRING:
// NETAPP-MIB::enclCurSensorsOverCurWarnThr.1 = STRING:
discover_sensor_ng($device, 'current', $mib, $oid_name, $oid, $index, NULL, $descr, 0.001, $value, $options);
}
$oid = ".1.3.6.1.4.1.789.1.21.1.2.1.49.$index";
$oid_name = 'enclCurSensorsCurrentCur';
$value = $entry[$oid_name];
// NETAPP-MIB::enclFansMaximum.1 = INTEGER: 4
// NETAPP-MIB::enclFansPresent.1 = STRING: 1, 2, 3, 4
// NETAPP-MIB::enclFansFailed.1 = STRING:
// NETAPP-MIB::enclFansSpeed.1 = STRING: 2970 RPM, 3000 RPM, 3030 RPM, 3030 RPM
$items = explode(', ', $entry['enclCurSensorsPresent']);
$values = explode(', ', $value);
$oid = ".1.3.6.1.4.1.789.1.21.1.2.1.62.$index";
$oid_name = 'enclFansSpeed';
$value = $entry[$oid_name];
foreach ($items as $i => $item) {
$items = explode(', ', $entry['enclFansPresent']);
$values = explode(', ', $value);
[, , $extra] = explode(' ', $values[$i]);
if (safe_empty($extra)) {
$descr = "Enclosure $index Sensor $item";
} else {
$descr = "Enclosure $index " . nicecase($extra);
}
$descr .= " ($enclosure)";
foreach ($items as $i => $item) {
$unit = 'split' . ($i + 1);
$options = [
'entPhysicalIndex_measured' => $index,
'entPhysicalIndex' => $item,
'sensor_unit' => $unit,
'limit_high' => snmp_fix_numeric($entry['enclCurSensorsOverCurFailThr'], $unit),
'limit_high_warn' => snmp_fix_numeric($entry['enclCurSensorsOverCurWarnThr'], $unit),
];
list(,, $extra) = explode(' ', $values[$i]);
if (safe_empty($extra)) {
$descr = "Enclosure $index Fan $item";
} else {
$descr = "Enclosure $index " . nicecase($extra);
discover_sensor_ng($device, 'current', $mib, $oid_name, $oid, $index, $descr, 0.001, $value, $options);
}
$descr .= " ($enclosure)";
$unit = 'split' . ($i+1);
$options = [
'entPhysicalIndex_measured' => $index,
'entPhysicalIndex' => $item,
'sensor_unit' => $unit,
];
// NETAPP-MIB::enclFansMaximum.1 = INTEGER: 4
// NETAPP-MIB::enclFansPresent.1 = STRING: 1, 2, 3, 4
// NETAPP-MIB::enclFansFailed.1 = STRING:
// NETAPP-MIB::enclFansSpeed.1 = STRING: 2970 RPM, 3000 RPM, 3030 RPM, 3030 RPM
discover_sensor_ng($device, 'fanspeed', $mib, $oid_name, $oid, $index, NULL, $descr, 1, $value, $options);
}
$oid = ".1.3.6.1.4.1.789.1.21.1.2.1.62.$index";
$oid_name = 'enclFansSpeed';
$value = $entry[$oid_name];
$items = explode(', ', $entry['enclFansPresent']);
$values = explode(', ', $value);
foreach ($items as $i => $item) {
[, , $extra] = explode(' ', $values[$i]);
if (safe_empty($extra)) {
$descr = "Enclosure $index Fan $item";
} else {
$descr = "Enclosure $index " . nicecase($extra);
}
$descr .= " ($enclosure)";
$unit = 'split' . ($i + 1);
$options = [
'entPhysicalIndex_measured' => $index,
'entPhysicalIndex' => $item,
'sensor_unit' => $unit,
];
discover_sensor_ng($device, 'fanspeed', $mib, $oid_name, $oid, $index, $descr, 1, $value, $options);
}
}
// EOF

View File

@ -1,91 +0,0 @@
<?php
/**
* Observium
*
* This file is part of Observium.
*
* @package observium
* @subpackage discovery
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2019 Observium Limited
*
*/
// Temperature Table
$data = snmpwalk_cache_oid($device, "tempSensorEntry", array(), "NETBOTZ410-MIB");
foreach($data as $index => $entry)
{
$oid = '.1.3.6.1.4.1.5528.100.4.1.1.1.2.' . $index;
discover_sensor('temperature', $device, $oid, $index, 'tempSensor', $entry['tempSensorLabel'], 0.1, $entry['tempSensorValue']);
}
unset($data, $index, $entry);
// Humidity Table
$data = snmpwalk_cache_oid($device, "humiSensorEntry", array(), "NETBOTZ410-MIB");
foreach($data as $index => $entry)
{
$oid = '.1.3.6.1.4.1.5528.100.4.1.2.1.2.' . $index;
discover_sensor('humidity', $device, $oid, $index, 'humiSensor', $entry['humiSensorLabel'], 0.1, $entry['humiSensorValue']);
}
unset($data, $index, $entry);
// Dew Point Table
$data = snmpwalk_cache_oid($device, "dewPointSensorEntry", array(), "NETBOTZ410-MIB");
foreach($data as $index => $entry)
{
$oid = '.1.3.6.1.4.1.5528.100.4.1.3.1.2.' . $index;
discover_sensor('dewpoint', $device, $oid, $index, 'dewPointSensor', $entry['dewPointSensorLabel'], 0.1, $entry['dewPointSensorValue']);
}
unset($data, $index, $entry);
/** Currently Disabled because the unit isn't reported
// Audio Sensor Table
$data = snmpwalk_cache_oid($device, "audioSensorEntry", array(), "NETBOTZ410-MIB");
foreach($data as $index => $entry)
{
$oid = '.1.3.6.1.4.1.5528.100.4.1.4.1.2.' . $index;
discover_sensor('sound', $device, $oid, $index, 'audioPointSensor', $entry['audioPointSensorLabel'], 0.1, $entry['audioPointSensorValue']);
}
unset($data, $index, $entry);
*/
// Airflow Table
$data = snmpwalk_cache_oid($device, "airFlowSensorEntry", array(), "NETBOTZ410-MIB");
foreach($data as $index => $entry)
{
$oid = '.1.3.6.1.4.1.5528.100.4.1.5.1.2.' . $index;
//discover_sensor('airflow', $device, $oid, $index, 'airFlowSensor', $entry['dewPointSensorLabel'], 3.531466672, $entry['airFlowSensorValue']);
// I not keep compatibility, because previously used incorrect class and unit
discover_sensor_ng($device, 'velocity', 'NETBOTZ410-MIB', 'airFlowSensorValue', $oid, $index, NULL, $entry['airFlowSensorLabel'], 0.1, $entry['airFlowSensorValue'], ['sensor_unit' => 'm/min']);
}
unset($data, $index, $entry);
// Amperes Table
$data = snmpwalk_cache_oid($device, "ampDetectSensorEntry", array(), "NETBOTZ410-MIB");
foreach($data as $index => $entry)
{
$oid = '.1.3.6.1.4.1.5528.100.4.1.6.1.2.' . $index;
discover_sensor('current', $device, $oid, $index, 'ampDetectSensor', $entry['ampDetectSensorLabel'], 0.1, $entry['ampDetectSensorValue']);
}
unset($data, $index, $entry);
// EOF

View File

@ -6,7 +6,7 @@
*
* @package observium
* @subpackage definitions
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2019 Observium Limited
* @copyright (C) Adam Armstrong
*
*/
@ -18,9 +18,8 @@ $oid = ".1.3.6.1.4.1.47952.1.2.1";
$descr = "Input";
$value = snmp_get_oid($device, $oid, $mib);
if(is_numeric($value))
{
discover_sensor('voltage', $device, $oid, "netioVoltage", $mib, $descr, 0.001, $value);
if (is_numeric($value)) {
discover_sensor('voltage', $device, $oid, "netioVoltage", $mib, $descr, 0.001, $value);
}
// Input Frequency
@ -28,9 +27,8 @@ $oid = ".1.3.6.1.4.1.47952.1.2.2";
$descr = "Input";
$value = snmp_get_oid($device, $oid, $mib);
if(is_numeric($value))
{
discover_sensor('frequency', $device, $oid, "netioFrequency", $mib, $descr, 0.001, $value);
if (is_numeric($value)) {
discover_sensor('frequency', $device, $oid, "netioFrequency", $mib, $descr, 0.001, $value);
}
// Input Current
@ -38,9 +36,8 @@ $oid = ".1.3.6.1.4.1.47952.1.2.3";
$descr = "Input";
$value = snmp_get_oid($device, $oid, $mib);
if(is_numeric($value))
{
discover_sensor('current', $device, $oid, "netioTotalCurrent", $mib, $descr, 0.001, $value);
if (is_numeric($value)) {
discover_sensor('current', $device, $oid, "netioTotalCurrent", $mib, $descr, 0.001, $value);
}
// Input Current
@ -48,9 +45,8 @@ $oid = ".1.3.6.1.4.1.47952.1.2.4";
$descr = "Input";
$value = snmp_get_oid($device, $oid, $mib);
if(is_numeric($value))
{
discover_sensor('powerfactor', $device, $oid, "netioOverallPowerFactor", $mib, $descr, 0.001, $value);
if (is_numeric($value)) {
discover_sensor('powerfactor', $device, $oid, "netioOverallPowerFactor", $mib, $descr, 0.001, $value);
}
// Input Current
@ -58,9 +54,8 @@ $oid = ".1.3.6.1.4.1.47952.1.2.5";
$descr = "Input";
$value = snmp_get_oid($device, $oid, $mib);
if(is_numeric($value))
{
discover_sensor('power', $device, $oid, "netioTotalLoad", $mib, $descr, 1, $value);
if (is_numeric($value)) {
discover_sensor('power', $device, $oid, "netioTotalLoad", $mib, $descr, 1, $value);
}

Some files were not shown because too many files have changed in this diff Show More