Fix AOS 7 sensors (#12599)

* AOS7 WIP

* Fix AOS 7 sensors

* TX Bias -> TX Power

* Fixes
This commit is contained in:
Tony Murray 2021-03-08 22:50:34 -06:00 committed by GitHub
parent 9e10b757fa
commit 242b8747fb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 5864 additions and 1722 deletions

View File

@ -186,10 +186,6 @@ class YamlDiscovery
*/
public static function getValueFromData($name, $index, $discovery_data, $pre_cache, $default = null)
{
//create the sub-index values in order to try to match them with precache
foreach (explode('.', $index) as $pos => $sindex) {
$subindex[$pos] = $sindex;
}
if (isset($discovery_data[$name])) {
$name = $discovery_data[$name];
}
@ -202,6 +198,15 @@ class YamlDiscovery
return $pre_cache[$index][$name];
}
//create the sub-index values in order to try to match them with precache
$sub_indexes = explode('.', $index);
// parse sub_index options name with trailing colon and index
$sub_index = 0;
if (preg_match('/^(.+):(\d+)$/', $name, $matches)) {
$name = $matches[1];
$sub_index = $matches[2];
}
if (isset($pre_cache[$name]) && ! is_numeric($name)) {
if (is_array($pre_cache[$name])) {
if (isset($pre_cache[$name][$index][$name])) {
@ -210,8 +215,8 @@ class YamlDiscovery
return $pre_cache[$name][$index];
} elseif (count($pre_cache[$name]) === 1) {
return current($pre_cache[$name]);
} elseif (isset($pre_cache[$name][$subindex[0]][$name])) {
return $pre_cache[$name][$subindex[0]][$name];
} elseif (isset($pre_cache[$name][$sub_indexes[$sub_index]][$name])) {
return $pre_cache[$name][$sub_indexes[$sub_index]][$name];
}
} else {
return $pre_cache[$name];

View File

@ -1,4 +1,4 @@
mib: ALCATEL-IND1-CHASSIS-MIB:ALCATEL-IND1-HEALTH-MIB:ALCATEL-IND1-PORT-MIB
mib: ALCATEL-IND1-CHASSIS-MIB:ALCATEL-IND1-HEALTH-MIB:ALCATEL-IND1-PORT-MIB:ALCATEL-IND1-VIRTUAL-CHASSIS-MIB:ALCATEL-IND1-LAG-MIB
modules:
mempools:
data:
@ -25,9 +25,192 @@ modules:
data:
-
oid:
- ifDescr
- ifName
- entPhysicalName
- alclnkaggAggNumber
current:
data:
-
oid: ddmPortInfoTable
value: ddmPortTxBiasCurrent
num_oid: '.1.3.6.1.4.1.6486.801.1.2.1.5.1.1.2.6.1.12.{{ $index }}'
descr: '{{ $ifName }} TX Bias'
divisor: 1000
low_limit: ddmPortTxBiasCurrentLowAlarm
low_warn_limit: ddmPortTxBiasCurrentLowWarning
high_limit: ddmPortTxBiasCurrentHiAlarm
warn_limit: ddmPortTxBiasCurrentHiWarning
entPhysicalIndex_measured: ports
entPhysicalIndex: '{{ $subindex0 }}'
skip_values: 0
dbm:
data:
-
oid: ddmPortInfoTable
value: ddmPortRxOpticalPower
num_oid: '.1.3.6.1.4.1.6486.801.1.2.1.5.1.1.2.6.1.22.{{ $index }}'
descr: '{{ $ifName }} RX Power'
divisor: 1000
index: 'rx-{{ $index }}'
low_limit: ddmPortRxOpticalPowerLowAlarm
low_warn_limit: ddmPortRxOpticalPowerLowWarning
high_limit: ddmPortRxOpticalPowerHiAlarm
warn_limit: ddmPortRxOpticalPowerHiWarning
entPhysicalIndex_measured: ports
entPhysicalIndex: '{{ $subindex0 }}'
skip_values:
-
oid: ddmPortRxOpticalPower
op: '='
value: 0
-
oid: ddmPortTxOutputPower
op: '='
value: 0
-
oid: ddmPortInfoTable
value: ddmPortTxOutputPower
num_oid: '.1.3.6.1.4.1.6486.801.1.2.1.5.1.1.2.6.1.17.{{ $index }}'
descr: '{{ $ifName }} TX Power'
divisor: 1000
index: 'tx-{{ $index }}'
low_limit: ddmPortTxOutputPowerLowAlarm
low_warn_limit: ddmPortTxOutputPowerLowWarning
high_limit: ddmPortTxOutputPowerHiAlarm
warn_limit: ddmPortTxOutputPowerHiWarning
entPhysicalIndex_measured: ports
entPhysicalIndex: '{{ $subindex0 }}'
skip_values:
-
oid: ddmPortRxOpticalPower
op: '='
value: 0
-
oid: ddmPortTxOutputPower
op: '='
value: 0
fanspeed:
data:
-
oid: alaChasEntPhysFanTable
value: alaChasEntPhysFanSpeed
num_oid: '.1.3.6.1.4.1.6486.801.1.1.1.3.1.1.11.1.4.{{ $index }}'
descr: 'CHASSIS-{{ $entPhysicalName }} Fan {{ $subindex1 }}'
low_limit: 1000
high_limit: 15000
skip_values:
-
oid: alaChasEntPhysFanAirflow
op: '='
value: 2
state:
data:
-
oid: chasControlModuleTable
value: chasControlCertifyStatus
num_oid: '.1.3.6.1.4.1.6486.801.1.1.1.3.1.1.1.1.4.{{ $index }}'
descr: 'Certify/Restore Status'
group: Chassis
index: 'chasControlCertifyStatus.1'
state_name: chasControlCertifyStatus
states:
- { value: 1, generic: 2, graph: 1, descr: Unknown }
- { value: 2, generic: 1, graph: 1, descr: Need Certify }
- { value: 3, generic: 0, graph: 1, descr: Certified }
-
oid: chasControlModuleTable
value: chasControlSynchronizationStatus
num_oid: '.1.3.6.1.4.1.6486.801.1.1.1.3.1.1.1.1.4.{{ $index }}'
descr: 'Flash Between CMMs'
group: Chassis
index: 'chasControlSynchronizationStatus.1'
state_name: chasControlSynchronizationStatus
states:
- { value: 1, generic: 2, graph: 1, descr: Unknown }
- { value: 2, generic: 1, graph: 1, descr: Mono Control Module }
- { value: 3, generic: 1, graph: 1, descr: Not Synchronized }
- { value: 4, generic: 0, graph: 1, descr: Synchronized }
-
oid: alclnkaggAggNbrAttachedPorts
value: alclnkaggAggNbrAttachedPorts
num_oid: '.1.3.6.1.4.1.6486.801.1.2.1.13.1.1.1.1.1.19.{{ $index }}'
descr: 'LACP Number {{ $alclnkaggAggNumber }}'
index: 'alclnkaggAggNbrAttachedPorts.{{ $index }}'
group: LACP
state_name: alclnkaggAggNbrAttachedPorts
states:
- { value: 1, generic: 1, graph: 1, descr: Not Redundant }
- { value: 2, generic: 0, graph: 1, descr: Redundant (2) }
- { value: 3, generic: 0, graph: 1, descr: Redundant (3) }
- { value: 4, generic: 0, graph: 1, descr: Redundant (4) }
- { value: 5, generic: 0, graph: 1, descr: Redundant (5) }
- { value: 6, generic: 0, graph: 1, descr: Redundant (6) }
- { value: 7, generic: 0, graph: 1, descr: Redundant (7) }
- { value: 8, generic: 0, graph: 1, descr: Redundant (8) }
-
oid: alaChasEntPhysFanTable
value: alaChasEntPhysFanStatus
num_oid: '.1.3.6.1.4.1.6486.801.1.1.1.3.1.1.11.1.2.{{ $index }}'
descr: 'CHASSIS-{{ $entPhysicalName }} Fan {{ $subindex1 }}'
group: Fans
index: 'alaChasEntPhysFanStatus.{{ $index }}'
state_name: alaChasEntPhysFanStatus
states:
- { value: 0, generic: 2, graph: 1, descr: no-error }
- { value: 1, generic: 1, graph: 1, descr: notRunning }
- { value: 2, generic: 0, graph: 1, descr: running }
-
oid: chasEntPhysOperStatus
num_oid: '.1.3.6.1.4.1.6486.801.1.1.1.1.1.1.1.2.{{ $index }}'
descr: '{{ $entPhysicalName }}'
group: Components
index: 'chasEntPhysOperStatus.{{ $index }}'
states:
- { value: 1, generic: 0, graph: 1, descr: Up }
- { value: 2, generic: 2, graph: 1, descr: Down }
- { value: 3, generic: 3, graph: 1, descr: Testing }
- { value: 4, generic: 3, graph: 1, descr: Unknown }
- { value: 5, generic: 0, graph: 1, descr: Secondary }
- { value: 6, generic: 2, graph: 1, descr: NotPresent }
- { value: 7, generic: 2, graph: 1, descr: UnPowered }
- { value: 8, generic: 0, graph: 1, descr: Master }
- { value: 9, generic: 0, graph: 1, descr: Idle }
- { value: 10, generic: 0, graph: 1, descr: PwrSave }
-
oid: virtualChassisStatus
num_oid: '.1.3.6.1.4.1.6486.801.1.2.1.69.1.1.2.1.5.{{ $index }}'
descr: 'Virtual-Chassis Unit {{ $index }}'
group: Virtual Chassis
index: 'virtualChassisStatus.{{ $index }}'
states:
- { value: 0, generic: 0, graph: 1, descr: Init }
- { value: 1, generic: 0, graph: 1, descr: Running }
- { value: 2, generic: 2, graph: 1, descr: Invalid Chassis Id }
- { value: 3, generic: 2, graph: 1, descr: Hello Down }
- { value: 4, generic: 2, graph: 1, descr: Duplicate Chassis Id }
- { value: 5, generic: 2, graph: 1, descr: Mismatch Image }
- { value: 6, generic: 2, graph: 1, descr: Mismatch Chassis Type }
- { value: 7, generic: 2, graph: 1, descr: Mismatch Hello Interval }
- { value: 8, generic: 2, graph: 1, descr: Mismatch Control Vlan }
- { value: 9, generic: 2, graph: 1, descr: Mismatch Group }
- { value: 10, generic: 2, graph: 1, descr: Mismatch License Config }
- { value: 11, generic: 2, graph: 1, descr: Invalid License }
- { value: 12, generic: 2, graph: 1, descr: Split Topology }
- { value: 13, generic: 2, graph: 1, descr: Command Shutdown }
- { value: 14, generic: 2, graph: 1, descr: Failure Shutdown }
-
oid: virtualChassisVflMemberPortOperStatus
num_oid: '.1.3.6.1.4.1.6486.801.1.2.1.69.1.1.7.1.3.{{ $index }}'
descr: 'Virtual-Chassis Port {{ $ifName:2 }}'
group: Virtual Chassis
index: 'virtualChassisVflMemberPortOperStatus.{{ $index }}'
states:
- { value: 0, generic: 1, graph: 1, descr: Disabled }
- { value: 2, generic: 2, graph: 1, descr: Down }
- { value: 1, generic: 0, graph: 1, descr: Up }
entPhysicalIndex_measured: ports
entPhysicalIndex: '{{ $subindex2 }}'
temperature:
data:
-
@ -35,4 +218,36 @@ modules:
value: chasCPMAHardwareBoardTemp
num_oid: '.1.3.6.1.4.1.6486.801.1.1.1.3.1.1.3.1.8.{{ $index }}'
descr: '{{ $entPhysicalName }} Temperature'
group: Chassis
index: 'chasCPMAHardwareBoardTemp.{{ $index }}'
-
oid: ddmPortInfoTable
value: ddmPortTemperature
num_oid: '.1.3.6.1.4.1.6486.801.1.2.1.5.1.1.2.6.1.2.{{ $index }}'
low_limit: ddmPortTempLowAlarm
low_warn_limit: ddmPortTempLowWarning
high_limit: ddmPortTempHiAlarm
warn_limit: ddmPortTempHiWarning
divisor: 1000
descr: '{{ $ifName }} DDM Temperature'
group: DDM
index: 'rx.{{ $index }}'
entPhysicalIndex_measured: ports
entPhysicalIndex: '{{ $subindex0 }}'
skip_values: 0
voltage:
data:
-
oid: ddmPortInfoTable
value: ddmPortSupplyVoltage
num_oid: '.1.3.6.1.4.1.6486.801.1.2.1.5.1.1.2.6.1.7.{{ $index }}'
descr: '{{ $ifName }} TX Voltage'
divisor: 1000
low_limit: ddmPortSupplyVoltageLowAlarm
low_warn_limit: ddmPortSupplyVoltageLowWarning
high_limit: ddmPortSupplyVoltageHiAlarm
warn_limit: ddmPortSupplyVoltageHiWarning
entPhysicalIndex_measured: ports
entPhysicalIndex: '{{ $subindex0 }}'
skip_values: 0

View File

@ -1002,10 +1002,6 @@ function discovery_process(&$valid, $device, $sensor_class, $pre_cache)
}
}
echo "Cur $value, Low: $low_limit, Low Warn: $low_warn_limit, Warn: $warn_limit, High: $high_limit" . PHP_EOL;
$entPhysicalIndex = YamlDiscovery::replaceValues('entPhysicalIndex', $index, null, $data, $pre_cache) ?: null;
$entPhysicalIndex_measured = isset($data['entPhysicalIndex_measured']) ? $data['entPhysicalIndex_measured'] : null;
$sensor_name = $device['os'];
if ($sensor_class === 'state') {
@ -1016,6 +1012,10 @@ function discovery_process(&$valid, $device, $sensor_class, $pre_cache)
$value = ($value / $divisor) * $multiplier;
}
echo "Cur $value, Low: $low_limit, Low Warn: $low_warn_limit, Warn: $warn_limit, High: $high_limit" . PHP_EOL;
$entPhysicalIndex = YamlDiscovery::replaceValues('entPhysicalIndex', $index, null, $data, $pre_cache) ?: null;
$entPhysicalIndex_measured = isset($data['entPhysicalIndex_measured']) ? $data['entPhysicalIndex_measured'] : null;
//user_func must be applied after divisor/multiplier
if (isset($user_function) && is_callable($user_function)) {
$value = $user_function($value);
@ -1056,7 +1056,7 @@ function sensors($types, $device, $valid, $pre_cache = [])
}
}
discovery_process($valid, $device, $sensor_class, $pre_cache);
d_echo($valid['sensor'][$sensor_class]);
d_echo($valid['sensor'][$sensor_class] ?? []);
check_valid_sensors($device, $sensor_class, $valid['sensor']);
echo "\n";
}

View File

@ -1,19 +0,0 @@
<?php
$multiplier = 1;
$divisor = 1000;
foreach ($pre_cache['aos7_oids'] as $index => $entry) {
if (is_numeric($entry['ddmPortTxBiasCurrent']) && $entry['ddmPortTxBiasCurrent'] != 0) {
$oid = '.1.3.6.1.4.1.6486.801.1.2.1.5.1.1.2.6.1.12.' . $index;
$limit_low = ($entry['ddmPortTxBiasCurrentLowAlarm'] / $divisor);
$warn_limit_low = ($entry['ddmPortTxBiasCurrentLowWarning'] / $divisor);
$limit = ($entry['ddmPortTxBiasCurrentHiAlarm'] / $divisor);
$warn_limit = ($entry['ddmPortTxBiasCurrentHiWarning'] / $divisor);
$value = $entry['ddmPortTxBiasCurrent'] / $divisor;
$entPhysicalIndex = $index;
$entPhysicalIndex_measured = 'ports';
$port_descr = get_port_by_index_cache($device['device_id'], str_replace(['.1', '.2', '.3', '.4'], '', $index));
$descr = $port_descr['ifName'] . ' TX Bias';
discover_sensor($valid['sensor'], 'current', $device, $oid, $index, 'aos7', $descr, $divisor, $multiplier, $limit_low, $warn_limit_low, $warn_limit, $limit, $value, 'snmp', $entPhysicalIndex, $entPhysicalIndex_measured);
}
}

View File

@ -1,34 +0,0 @@
<?php
$multiplier = 1;
$divisor = 1000;
foreach ($pre_cache['aos7_oids'] as $index => $entry) {
if (is_numeric($entry['ddmPortRxOpticalPower']) && $entry['ddmPortRxOpticalPower'] != 0 && $entry['ddmPortTxOutputPower'] != 0) {
$oid = '.1.3.6.1.4.1.6486.801.1.2.1.5.1.1.2.6.1.22.' . $index;
// $oidRx = snmp_get($device, $oid, '-Oqv', 'ddmRxOpticalPower', '/opt/librenms/mibs/nokia/aos7/ALCATEL-IND1-PORT-MIB');
$limit_low = ($entry['ddmPortRxOpticalPowerLowAlarm'] / $divisor);
$warn_limit_low = ($entry['ddmPortRxOpticalPowerLowWarning'] / $divisor);
$limit = ($entry['ddmPortRxOpticalPowerHiAlarm'] / $divisor);
$warn_limit = ($entry['ddmPortRxOpticalPowerHiWarningh'] / $divisor);
$value = $entry['ddmPortRxOpticalPower'] / $divisor;
$entPhysicalIndex = $index;
$entPhysicalIndex_measured = 'ports';
$port_descr = get_port_by_index_cache($device['device_id'], str_replace(['.1', '.2', '.3', '.4'], '', $index));
$descr = $port_descr['ifName'] . ' RX Power';
discover_sensor($valid['sensor'], 'dbm', $device, $oid, 'rx-' . $index, 'aos7', $descr, $divisor, $multiplier, $limit_low, $warn_limit_low, $warn_limit, $limit, $value, 'snmp', $entPhysicalIndex, $entPhysicalIndex_measured);
}
if (is_numeric($entry['ddmPortTxOutputPower'])) {
$oid = '.1.3.6.1.4.1.6486.801.1.2.1.5.1.1.2.6.1.17.' . $index;
// $oidTx = snmp_get($device, $oid, '-Oqv', 'ddmTxOutputPower', '/opt/librenms/mibs/nokia/aos7/ALCATEL-IND1-PORT-MIB');
$limit_low = ($entry['ddmPortTxOutputPowerLowAlarm'] / $divisor);
$warn_limit_low = ($entry['ddmPortTxOutputPowerLowWarning'] / $divisor);
$limit = ($entry['ddmPortTxOutputPowerHiAlarm'] / $divisor);
$warn_limit = ($entry['ddmPortTxOutputPowerHiWarningh'] / $divisor);
$value = $entry['ddmPortTxOutputPower'] / $divisor;
$entPhysicalIndex = $index;
$entPhysicalIndex_measured = 'ports';
$port_descr = get_port_by_index_cache($device['device_id'], str_replace(['.1', '.2', '.3', '.4'], '', $index));
$descr = $port_descr['ifName'] . ' TX Power';
discover_sensor($valid['sensor'], 'dbm', $device, $oid, 'tx-' . $index, 'aos7', $descr, $divisor, $multiplier, $limit_low, $warn_limit_low, $warn_limit, $limit, $value, 'snmp', $entPhysicalIndex, $entPhysicalIndex_measured);
}
}

View File

@ -1,34 +0,0 @@
<?php
$rpm = [];
$rpm_oid = '.1.3.6.1.4.1.6486.801.1.1.1.3.1.1.11.1'; // alaChasEntPhysFanTable
$data = snmp_walk($device, 'alaChasEntPhysFanTable', '-OQUn', 'ALCATEL-IND1-CHASSIS-MIB', ':mibs/nokia/aos7:mibs');
foreach (explode("\n", $data) as $entry) {
[$oid,$value] = explode('=', $entry, 2);
$oid = trim($oid);
$value = trim($value, "\" \\\n\r");
[$revindex, $revchass, $revdata,] = explode('.', strrev($oid), 4);
//we don't care if the value is 0, the other fan status sensor will tell us if the fan is broken
if (! strstr($value, 'at this OID') && ! empty($oid) && $value > 0) {
$chassis = strrev($revchass);
$index = strrev($revindex);
$data = strrev($revdata);
$rpm[$chassis][$index][$data] = $value;
}
}
foreach ($rpm as $chassis => $entry) {
foreach ($entry as $index => $data) {
//$descr = 'Chassis '.($chassis-450). " Fan $index";
$descr_oid = '.1.3.6.1.2.1.47.1.1.1.1.7.' . $chassis;
$chas_descr = (string) snmp_get($device, $descr_oid, '-Oqv');
$descr = 'CHASSIS-' . substr($chas_descr, 0, strpos($chas_descr, '/')) . " Fan $index";
$value = $data[4];
$low_limit = '1000'; //guessing to ignore any alarm
$high_limit = '15000'; //guessing to ignore any alarm
$id = "$chassis.$index";
$oid = "$rpm_oid.4.$chassis.$index";
discover_sensor($valid['sensor'], 'fanspeed', $device, $oid, $id, 'alcatel-lucent', $descr, '1', '1', $low_limit, null, null, $high_limit, $value);
}
}

View File

@ -1,35 +0,0 @@
<?php
/*
* LibreNMS
*
* Copyright (c) 2016 Neil Lathwood <neil@lathwood.co.uk>
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation, either version 3 of the License, or (at your
* option) any later version. Please see LICENSE.txt at the top level of
* the source code distribution for details.
*/
echo 'ddmPortInfoEntry ';
$pre_cache['aos7_oids'] = snmpwalk_cache_multi_oid($device, 'ddmPortInfoEntry', [], 'ALCATEL-IND1-PORT-MIB', 'aos7');
echo 'alaChasEntPhysFanTable ';
$pre_cache['aos7_fan_oids'] = snmpwalk_cache_multi_oid($device, 'alaChasEntPhysFanTable', [], 'ALCATEL-IND1-CHASSIS-MIB', 'aos7', '-OQUse');
echo 'chasEntPhysOperStatus ';
$pre_cache['aos7_chas_oids'] = snmpwalk_cache_multi_oid($device, 'chasEntPhysOperStatus', [], 'ALCATEL-IND1-CHASSIS-MIB', 'aos7', '-OQUse');
echo 'entPhysicalName';
$pre_cache['aos7_phys_oids'] = snmpwalk_cache_multi_oid($device, 'entPhysicalName', [], 'ALCATEL-IND1-HEALTH-MIB', 'aos7', '-OQUse');
echo 'virtualChassisVflTable';
$pre_cache['aos7_vcstack_oids'] = snmpwalk_cache_multi_oid($device, 'virtualChassisVflMemberPortOperStatus', [], 'ALCATEL-IND1-VIRTUAL-CHASSIS-MIB', 'aos7', '-OQUse');
echo 'VirtualChassisStatus';
$pre_cache['aos7_vcstatus_oids'] = snmpwalk_cache_multi_oid($device, 'VirtualChassisStatus', [], 'ALCATEL-IND1-VIRTUAL-CHASSIS-MIB', 'aos7', '-OQUse');
echo 'ChasControlModuleEntry';
$pre_cache['aos7_sync_oids'] = snmpwalk_cache_multi_oid($device, 'ChasControlModuleEntry', [], 'ALCATEL-IND1-CHASSIS-MIB', 'aos7', '-OQUse');
echo 'alclnkaggAggEntry';
$pre_cache['aos7_lag_oids'] = snmpwalk_cache_multi_oid($device, 'alclnkaggAggEntry', [], 'ALCATEL-IND1-LAG-MIB', 'aos7', '-OQUse');

View File

@ -1,216 +0,0 @@
<?php
foreach ($pre_cache['aos7_fan_oids'] as $index => $data) {
if (is_array($data)) {
$oid = '.1.3.6.1.4.1.6486.801.1.1.1.3.1.1.11.1.2.' . $index;
$state_name = 'alaChasEntPhysFanStatus';
$current = $data['alaChasEntPhysFanStatus'];
[$revindex, $revchass, $revdata,] = explode('.', strrev($oid), 4);
$chassis = strrev($revchass);
$indexName = strrev($revindex);
$descr_oid = '.1.3.6.1.2.1.47.1.1.1.1.7.' . $chassis;
$chas_descr = (string) snmp_get($device, $descr_oid, '-Oqv');
$descr = 'CHASSIS-' . substr($chas_descr, 0, strpos($chas_descr, '/')) . " Fan $indexName";
$states = [
['value' => 0, 'generic' => 2, 'graph' => 1, 'descr' => 'no-error'],
['value' => 1, 'generic' => 1, 'graph' => 1, 'descr' => 'notRunning'],
['value' => 2, 'generic' => 0, 'graph' => 1, 'descr' => 'running'],
];
create_state_index($state_name, $states);
discover_sensor($valid['sensor'], 'state', $device, $oid, $index, $state_name, $descr, 1, 1, null, null, null, null, $current);
create_sensor_to_state_index($device, $state_name, $index);
}
}
unset(
$index,
$data,
$descr
);
$chas_oid = '.1.3.6.1.4.1.6486.801.1.1.1.1.1.1.1.2.'; // chasEntPhysOperStatus
$oids = snmp_walk($device, 'chasEntPhysOperStatus', '-OQUse', 'ALCATEL-IND1-CHASSIS-MIB', 'nokia/aos7');
foreach (explode("\n", $oids) as $chas_entry) {
preg_match('/chasEntPhysOperStatus.(2.+) = (.+)/', $chas_entry, $data2); // entPhysicalName.284 = "5/PS-2"
if (! empty($data2)) {
$number = $data2[1];
$value = $data2[2];
$chas_oid_index = $chas_oid . $number;
$chas_current = "chasEntPhysOperStatus.$number";
$descr_oid = '.1.3.6.1.2.1.47.1.1.1.1.7.' . $number;
$chas_descr = (string) snmp_get($device, $descr_oid, '-Oqv');
$chas_state_name = 'chasEntPhysOperStatus';
$chas_states = [
['value' => 1, 'generic' => 0, 'graph' => 1, 'descr' => 'Up'],
['value' => 2, 'generic' => 2, 'graph' => 1, 'descr' => 'Down'],
['value' => 3, 'generic' => 3, 'graph' => 1, 'descr' => 'Testing'],
['value' => 4, 'generic' => 3, 'graph' => 1, 'descr' => 'Unknown'],
['value' => 5, 'generic' => 0, 'graph' => 1, 'descr' => 'Secondary'],
['value' => 6, 'generic' => 2, 'graph' => 1, 'descr' => 'NotPresent'],
['value' => 7, 'generic' => 2, 'graph' => 1, 'descr' => 'UnPowered'],
['value' => 8, 'generic' => 0, 'graph' => 1, 'descr' => 'Master'],
['value' => 9, 'generic' => 0, 'graph' => 1, 'descr' => 'Idle'],
['value' => 10, 'generic' => 0, 'graph' => 1, 'descr' => 'PwrSave'],
];
create_state_index($chas_state_name, $chas_states);
discover_sensor($valid['sensor'], 'state', $device, $chas_oid_index, $number, $chas_state_name, $chas_descr, 1, 1, null, null, null, null, $value);
create_sensor_to_state_index($device, $chas_state_name, $number);
}
}
unset(
$index,
$data,
$descr,
$states,
$current
);
$vc_current = [];
foreach ($pre_cache['aos7_vcstack_oids'] as $index => $data) {
if (is_array($data)) {
$oid = ".1.3.6.1.4.1.6486.801.1.2.1.69.1.1.7.1.3.$index";
$index = preg_match('/^(.*)[.]([^.]+)$/', $index, $data2);
if (! empty($data2)) {
$number = $data2[1];
$index = $data2[2];
$state_name_vc = 'virtualChassisVflMemberPortOperStatus';
$vc_current = "virtualChassisVflMemberPortOperStatus.$number";
$entPhysicalIndex = $index;
$entPhysicalIndex_measured = 'ports';
$port_descr = get_port_by_index_cache($device['device_id'], $index);
$descr = 'Virtual-Chassis Port ' . $port_descr['ifName'];
$states = [
['value' => 0, 'generic' => 1, 'graph' => 1, 'descr' => 'Disabled'],
['value' => 2, 'generic' => 2, 'graph' => 1, 'descr' => 'Down'],
['value' => 1, 'generic' => 0, 'graph' => 1, 'descr' => 'Up'],
];
create_state_index($state_name_vc, $states);
discover_sensor($valid['sensor'], 'state', $device, $oid, $index, $state_name_vc, $descr, 1, 1, null, null, null, null, $vc_current, 'snmp', $entPhysicalIndex, $entPhysicalIndex_measured);
create_sensor_to_state_index($device, $state_name_vc, $index);
}
}
}
unset(
$index,
$data,
$descr,
$states,
$current
);
foreach ($pre_cache['aos7_vcstatus_oids'] as $index => $data) {
if (is_array($data)) {
$vc_chas_oid = '.1.3.6.1.4.1.6486.801.1.2.1.69.1.1.2.1.5.' . $index;
$vc_state = 'virtualChassisStatus';
$vc_value = "virtualChassisStatus.$index";
$descr_vc = 'Virtual-Chassis Unit ' . $index;
$vc_chas_states = [
['value' => 0, 'generic' => 0, 'graph' => 1, 'descr' => 'Init'],
['value' => 1, 'generic' => 0, 'graph' => 1, 'descr' => 'Running'],
['value' => 2, 'generic' => 2, 'graph' => 1, 'descr' => 'Invalid Chassis Id'],
['value' => 3, 'generic' => 2, 'graph' => 1, 'descr' => 'Hello Down'],
['value' => 4, 'generic' => 2, 'graph' => 1, 'descr' => 'Duplicate Chassis Id'],
['value' => 5, 'generic' => 2, 'graph' => 1, 'descr' => 'Mismatch Image'],
['value' => 6, 'generic' => 2, 'graph' => 1, 'descr' => 'Mismatch Chassis Type'],
['value' => 7, 'generic' => 2, 'graph' => 1, 'descr' => 'Mismatch Hello Interval'],
['value' => 8, 'generic' => 2, 'graph' => 1, 'descr' => 'Mismatch Control Vlan'],
['value' => 9, 'generic' => 2, 'graph' => 1, 'descr' => 'Mismatch Group'],
['value' => 10, 'generic' => 2, 'graph' => 1, 'descr' => 'Mismatch License Config'],
['value' => 11, 'generic' => 2, 'graph' => 1, 'descr' => 'Invalid License'],
['value' => 12, 'generic' => 2, 'graph' => 1, 'descr' => 'Split Topology'],
['value' => 13, 'generic' => 2, 'graph' => 1, 'descr' => 'Command Shutdown'],
['value' => 14, 'generic' => 2, 'graph' => 1, 'descr' => 'Failure Shutdown'],
];
create_state_index($vc_state, $vc_chas_states);
discover_sensor($valid['sensor'], 'state', $device, $vc_chas_oid, $index, $vc_state, $descr_vc, 1, 1, null, null, null, null, $vc_value);
create_sensor_to_state_index($device, $vc_state, $index);
}
}
unset(
$index,
$data,
$descr,
$states,
$current
);
foreach ($pre_cache['aos7_sync_oids'] as $index => $data) {
if (is_array($data)) {
$sync_chas_oid = '.1.3.6.1.4.1.6486.801.1.1.1.3.1.1.1.1.4.' . $index;
$sync_state = 'chasControlCertifyStatus';
$sync_value = 'chasControlCertifyStatus.1';
$descr_sync = 'Certify/Restore Status';
$sync_chas_states = [
['value' => 1, 'generic' => 2, 'graph' => 1, 'descr' => 'Unknown'],
['value' => 2, 'generic' => 1, 'graph' => 1, 'descr' => 'Need Certify'],
['value' => 3, 'generic' => 0, 'graph' => 1, 'descr' => 'Certified'],
];
create_state_index($sync_state, $sync_chas_states);
discover_sensor($valid['sensor'], 'state', $device, $sync_chas_oid, 1, $sync_state, $descr_sync, 1, 1, null, null, null, null, $sync_value);
create_sensor_to_state_index($device, $sync_state, 1);
}
}
unset(
$sync_chas_oid,
$sync_state,
$sync_value,
$descr_sync,
$sync_chas_states,
$data,
$index
);
foreach ($pre_cache['aos7_sync_oids'] as $index => $data) {
if (is_array($data)) {
$sync_chas_oid = '.1.3.6.1.4.1.6486.801.1.1.1.3.1.1.1.1.5.' . $index;
$sync_state = 'chasControlSynchronizationStatus';
$sync_value = 'chasControlSynchronizationStatus.1';
$descr_sync = 'Flash Between CMMs';
$sync_chas_states = [
['value' => 1, 'generic' => 2, 'graph' => 1, 'descr' => 'Unknown'],
['value' => 2, 'generic' => 1, 'graph' => 1, 'descr' => 'Mono Control Module'],
['value' => 3, 'generic' => 1, 'graph' => 1, 'descr' => 'Not Synchronized'],
['value' => 4, 'generic' => 0, 'graph' => 1, 'descr' => 'Synchronized'],
];
create_state_index($sync_state, $sync_chas_states);
discover_sensor($valid['sensor'], 'state', $device, $sync_chas_oid, 1, $sync_state, $descr_sync, 1, 1, null, null, null, null, $sync_value);
create_sensor_to_state_index($device, $sync_state, 1);
}
}
unset(
$sync_chas_oid,
$sync_state,
$sync_value,
$descr_sync,
$sync_chas_states,
$data,
$index
);
$type = 'alclnkaggAggNbrAttachedPorts';
foreach ($pre_cache['aos7_lag_oids'] as $index => $entry) {
$oid_size = $entry['alclnkaggAggSize'];
$oid_mem = $entry['alclnkaggAggNbrAttachedPorts'];
$lag_state = '.1.3.6.1.4.1.6486.801.1.2.1.13.1.1.1.1.1.19.' . $index;
// $oid_state = "alclnkaggAggNbrAttachedPorts.$index";
$lag_number = $entry['alclnkaggAggNumber'];
if (! empty($oid_mem)) {
if ($oid_size == $oid_mem) {
$current = 1;
}
if ($oid_size > $oid_mem) {
$current = 2;
}
}
$descr_lag = 'LACP Number ' . $lag_number;
$lag_states = [
['value' => 1, 'generic' => 0, 'graph' => 1, 'descr' => 'Redundant'],
['value' => 2, 'generic' => 1, 'graph' => 1, 'descr' => 'Not Redundant'],
];
if (! empty($oid_mem)) {
create_state_index($type, $lag_states);
discover_sensor($valid['sensor'], 'state', $device, $lag_state, $index, $type, $descr_lag, 1, 1, null, null, null, null, $current);
create_sensor_to_state_index($device, $type, $index);
}
}

View File

@ -1,20 +0,0 @@
<?php
$multiplier = 1;
$divisor = 1000;
foreach ($pre_cache['aos7_oids'] as $index => $entry) {
if (is_numeric($entry['ddmPortTemperature']) && $entry['ddmPortTemperature'] != 0) {
$oid = '.1.3.6.1.4.1.6486.801.1.2.1.5.1.1.2.6.1.2.' . $index;
$limit_low = $entry['ddmPortTempLowAlarm'] / $divisor;
$warn_limit_low = $entry['ddmPortTempLowWarning'] / $divisor;
$limit = $entry['ddmPortTempHiAlarm'] / $divisor;
$warn_limit = $entry['ddmPortTempHiWarning'] / $divisor;
$value = $entry['ddmPortTemperature'] / $divisor;
$curent = $entry['ddmPortTemperature'];
$entPhysicalIndex = $index;
$entPhysicalIndex_measured = 'ports';
$port_descr = get_port_by_index_cache($device['device_id'], str_replace(['.1', '.2', '.3', '.4'], '', $index));
$descr = $port_descr['ifName'] . ' DDM Temperature';
discover_sensor($valid['sensor'], 'temperature', $device, $oid, 'rx-' . $index, 'aos7', $descr, $divisor, $multiplier, $limit_low, $warn_limit_low, $warn_limit, $limit, $value, 'snmp', $entPhysicalIndex, $entPhysicalIndex_measured);
}
}

View File

@ -1,19 +0,0 @@
<?php
$multiplier = 1;
$divisor = 1000;
foreach ($pre_cache['aos7_oids'] as $index => $entry) {
if (is_numeric($entry['ddmPortSupplyVoltage']) && $entry['ddmPortSupplyVoltage'] != 0) {
$oid = '.1.3.6.1.4.1.6486.801.1.2.1.5.1.1.2.6.1.7.' . $index;
$limit_low = ($entry['ddmPortSupplyVoltageLowAlarm'] / $divisor);
$warn_limit_low = ($entry['ddmPortSupplyVoltageLowWarning'] / $divisor);
$limit = ($entry['ddmPortSupplyVoltageHiAlarm'] / $divisor);
$warn_limit = ($entry['ddmPortSupplyVoltageHiWarning'] / $divisor);
$value = $entry['ddmPortSupplyVoltage'] / $divisor;
$entPhysicalIndex = $index;
$entPhysicalIndex_measured = 'ports';
$port_descr = get_port_by_index_cache($device['device_id'], str_replace(['.1', '.2', '.3', '.4'], '', $index));
$descr = $port_descr['ifName'] . ' TX Voltage';
discover_sensor($valid['sensor'], 'voltage', $device, $oid, $index, 'aos7', $descr, $divisor, $multiplier, $limit_low, $warn_limit_low, $warn_limit, $limit, $value, 'snmp', $entPhysicalIndex, $entPhysicalIndex_measured);
}
}

View File

@ -1,9 +0,0 @@
<?php
if (($device['os'] == 'aos7') && ($sensor['sensor_type'] === 'alclnkaggAggNbrAttachedPorts')) {
if (($sensor_value == 2) || ($sensor_value == 4) || ($sensor_value == 6) || ($sensor_value == 8)) {
$sensor_value = 1;
} else {
$sensor_value = 2;
}
}

File diff suppressed because it is too large Load Diff