Commit version 24.12.13800
This commit is contained in:
@ -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
|
||||
|
Reference in New Issue
Block a user