Index: includes/definitions/mibs/bdcom.inc.php
===================================================================
--- includes/definitions/mibs/bdcom.inc.php	(revision 11015)
+++ includes/definitions/mibs/bdcom.inc.php	(working copy)
@@ -528,13 +528,69 @@
 $config['mibs'][$mib]['mib_dir'] = 'bdcom';
 $config['mibs'][$mib]['descr'] = '';
 
+//NMS-EPON-ONU::nmsepononuTable
+//NMS-EPON-ONU::onuVendorID.15 = STRING: "QTEC"
+//NMS-EPON-ONU::onuModuleID.15 = STRING: "QENT"
+//NMS-EPON-ONU::onuID.15 = Hex-STRING: 08 C6 B3 B5 94 BC 
+//NMS-EPON-ONU::onuHardwareVersion.15 = STRING: "HZ660.2A"
+//NMS-EPON-ONU::onuSoftwareVersion.15 = Hex-STRING: 56 32 2E 31 2E 33 00 00 00 00 00 00 00 00 00 00 
+//NMS-EPON-ONU::onuFirmwareVersion.15 = Hex-STRING: 01 01 01 
+//NMS-EPON-ONU::onuChipVendorID.15 = Hex-STRING: 03 8C 
+//NMS-EPON-ONU::onuChipModuleID.15 = Hex-STRING: 91 25 
+//NMS-EPON-ONU::onuChipRevision.15 = STRING: "("
+//NMS-EPON-ONU::onuIcVersion.15 = Hex-STRING: 16 06 14 
+//NMS-EPON-ONU::onuServiceSupported.15 = BITS: 00 
+//NMS-EPON-ONU::onuGePortCount.15 = INTEGER: 0
+//NMS-EPON-ONU::onuGePortDistributing.15 = BITS: 00 00 00 00 00 00 00 00 
+//NMS-EPON-ONU::onuFePortCount.15 = INTEGER: 0
+//NMS-EPON-ONU::onuFePortDistributing.15 = BITS: 00 00 00 00 00 00 00 00 
+//NMS-EPON-ONU::onuPotsPortCount.15 = INTEGER: 0
+//NMS-EPON-ONU::onuE1PortCount.15 = INTEGER: 0
+//NMS-EPON-ONU::onuUsQueueCount.15 = INTEGER: 0
+//NMS-EPON-ONU::onuUsQueueMaxCount.15 = INTEGER: 0
+//NMS-EPON-ONU::onuDsQueueCount.15 = INTEGER: 0
+//NMS-EPON-ONU::onuDsQueueMaxCount.15 = INTEGER: 0
+//NMS-EPON-ONU::onuIsBakupBattery.15 = INTEGER: yes(0)
+//NMS-EPON-ONU::onuADSL2PlusPortCount.15 = INTEGER: 0
+//NMS-EPON-ONU::onuVDSL2PortCount.15 = INTEGER: 0
+//NMS-EPON-ONU::onuLLIDCount.15 = INTEGER: 0
+//NMS-EPON-ONU::onuStatus.15 = INTEGER: auto_config(3)
+//NMS-EPON-ONU::onuDistance.15 = INTEGER: 647
+//NMS-EPON-ONU::onuBindStatus.15 = INTEGER: static(0)
+//NMS-EPON-ONU::onuReset.15 = INTEGER: no-reset(1)
+//NMS-EPON-ONU::onuUpdateImage.15 = Hex-STRING: 00 00 00 00 
+//NMS-EPON-ONU::onuUpdateEepromImage.15 = Hex-STRING: 00 00 00 00 
+//NMS-EPON-ONU::onuEncryptionStatus.15 = INTEGER: true(1)
+//NMS-EPON-ONU::onuEncryptionMode.15 = INTEGER: ctc-churning(2)
+//NMS-EPON-ONU::onuIgmpSnoopingStatus.15 = INTEGER: true(1)
+//NMS-EPON-ONU::onuMcstMode.15 = INTEGER: igmp-snooping(0)
+//NMS-EPON-ONU::OnuAFastLeaveAbility.15 = INTEGER: multicast-non-fast-leave(0)
+//NMS-EPON-ONU::onuAcFastLeaveAdminControl.15 = INTEGER: 0
+//NMS-EPON-ONU::onuAFastLeaveAdminState.15 = INTEGER: enable(2)
+//NMS-EPON-ONU::onuInFecStatus.15 = INTEGER: false(2)
+//NMS-EPON-ONU::onuOutFecStatus.15 = INTEGER: false(2)
+//NMS-EPON-ONU::onuIfProtectedStatus.15 = INTEGER: true(1)
+//NMS-EPON-ONU::onuSehedulePolicy.15 = INTEGER: sp(1)
+//NMS-EPON-ONU::onuDynamicMacLearningStatus.15 = INTEGER: on(2)
+//NMS-EPON-ONU::onuDynamicMacAgingTime.15 = INTEGER: 300
+//NMS-EPON-ONU::onuPriorityQueueMapping.15 = Hex-STRING: 01 01 02 02 03 03 04 04 
+//NMS-EPON-ONU::onuIpAddressMode.15 = INTEGER: dhcp(1)
+//NMS-EPON-ONU::onuStaticIpAddress.15 = IpAddress: 0.0.0.0
+//NMS-EPON-ONU::onuStaticIpMask.15 = IpAddress: 0.0.0.0
+//NMS-EPON-ONU::onuStaticIpGateway.15 = IpAddress: 0.0.0.0
+//NMS-EPON-ONU::onuMgmtVlan.15 = INTEGER: 0
+//NMS-EPON-ONU::onuStaticIpAddressRowStatus.15 = INTEGER: 0
+//NMS-EPON-ONU::onuIfMacACL.15 = ""
+//NMS-EPON-ONU::onuIfIpACL.15 = ""
+
 $config['mibs'][$mib]['status'][] = array(
   'oid'            => 'onuStatus',
+  'table'          => 'nmsepononuTable',
   'type'           => 'onuStatus',
-  'descr'          => '%port_label% Status',
-  'oid_extra'      => 'opIfIndex',
+  'descr'          => '%port_label% ONU Status (%onuVendorID%)',
+  'oid_extra'      => 'onuVendorID',
   'oid_num'        => '.1.3.6.1.4.1.3320.101.10.1.1.26',
-  'measured_match' => [ ['entity_type' => 'port', 'field' => 'ifIndex', 'match' => '%opIfIndex%' ] ]
+  'measured_match' => [ ['entity_type' => 'port', 'field' => 'ifIndex', 'match' => '%index%' ] ]
 );
 
 $type = 'onuStatus';
@@ -545,49 +601,81 @@
 $config['mibs'][$mib]['states'][$type][4] = array('name' => 'lost',           'event' => 'alert');
 $config['mibs'][$mib]['states'][$type][5] = array('name' => 'standby',        'event' => 'ignore');
 
-$config['mibs'][$mib]['sensor'][]     = array('oid'            => 'opModuleTemp',
-                                              'table'          => 'nmsepononuopticalportTable',
-                                              'descr'          => '%port_label% Temperature',
-                                              'class'          => 'temperature',
-                                              'scale'          => 0.00390625, // 1/256th
-                                              'invalid'        => -65535,
-                                              'oid_num'        => '.1.3.6.1.4.1.3320.101.10.5.1.2',
-                                              'measured_match' => [ ['entity_type' => 'port', 'field' => 'ifIndex', 'match' => '%opIfIndex%' ] ]);
 
-$config['mibs'][$mib]['sensor'][]     = array('oid'            => 'opModuleVolt',
-                                              'table'          => 'nmsepononuopticalportTable',
-                                              'descr'          => '%port_label% Voltage',
-                                              'class'          => 'voltage',
-                                              'scale'          => 0.0001,
-                                              'invalid'        => -65535,
-                                              'oid_num'        => '.1.3.6.1.4.1.3320.101.10.5.1.3',
-                                              'measured_match' => [ ['entity_type' => 'port', 'field' => 'ifIndex', 'match' => '%opIfIndex%' ] ]);
+// NEED new sensor class = distance
+$config['mibs'][$mib]['sensor'][] = array(
+  'oid'             => 'onuDistance',
+  'table'           => 'nmsepononuTable',
+  'descr'           => '%port_label% distance',
+  'class'           => 'other',
+  'unit'            => 'm',
+  'oid_num'         => '.1.3.6.1.4.1.3320.101.10.1.1.27',
+  'measured_match'  => [ ['entity_type' => 'port', 'field' => 'ifIndex', 'match' => '%index%' ] ]
+);
 
-$config['mibs'][$mib]['sensor'][]     = array('oid'            => 'opModuleCurrent',
-                                              'table'          => 'nmsepononuopticalportTable',
-                                              'descr'          => '%port_label% TX Bias',
-                                              'class'          => 'current',
-                                              'scale'          => 0.000002,
-                                              'invalid'        => -65535,
-                                              'oid_num'        => '.1.3.6.1.4.1.3320.101.10.5.1.4',
-                                              'measured_match' => [ ['entity_type' => 'port', 'field' => 'ifIndex', 'match' => '%opIfIndex%' ] ]);
+//NMS-EPON-ONU::opIfIndex.15 = INTEGER: 15
+//NMS-EPON-ONU::opModuleTemp.15 = INTEGER: 8327
+//NMS-EPON-ONU::opModuleVolt.15 = INTEGER: 33520
+//NMS-EPON-ONU::opModuleCurrent.15 = INTEGER: 6900
+//NMS-EPON-ONU::opModuleRxPower.15 = INTEGER: -199
+//NMS-EPON-ONU::opModuleTxPower.15 = INTEGER: 16
 
-$config['mibs'][$mib]['sensor'][]     = array('oid'            => 'opModuleRxPower',
-                                              'table'          => 'nmsepononuopticalportTable',
-                                              'descr'          => '%port_label% RX Power',
-                                              'class'          => 'dbm',
-                                              'scale'          => 0.1,
-                                              'invalid'        => -65535,
-                                              'oid_num'        => '.1.3.6.1.4.1.3320.101.10.5.1.5',
-                                              'measured_match' => [ ['entity_type' => 'port', 'field' => 'ifIndex', 'match' => '%index%' ] ]);
+$config['mibs'][$mib]['sensor'][] = array(
+  'oid'             => 'opModuleTemp',
+  'table'           => 'nmsepononuopticalportTable',
+  'descr'           => '%port_label% Temperature',
+  'class'           => 'temperature',
+  'scale'           => 0.00390625, // 1/256th
+  'invalid'         => -65535,
+  'oid_num'         => '.1.3.6.1.4.1.3320.101.10.5.1.2',
+  'measured_match'  => [ ['entity_type' => 'port', 'field' => 'ifIndex', 'match' => '%opIfIndex%' ] ]
+);
 
-$config['mibs'][$mib]['sensor'][]     = array('oid'            => 'opModuleTxPower',
-                                              'table'          => 'nmsepononuopticalportTable',
-                                              'descr'          => '%port_label% TX Power',
-                                              'class'          => 'dbm',
-                                              'scale'          => 0.1,
-                                              'invalid'        => -65535,
-                                              'oid_num'        => '.1.3.6.1.4.1.3320.101.10.5.1.6',
-                                              'measured_match' => [ ['entity_type' => 'port', 'field' => 'ifIndex', 'match' => '%opIfIndex%' ] ]);
+$config['mibs'][$mib]['sensor'][] = array(
+  'oid'             => 'opModuleVolt',
+  'table'           => 'nmsepononuopticalportTable',
+  'descr'           => '%port_label% Voltage',
+  'class'           => 'voltage',
+  'scale'           => 0.0001,
+  'invalid'         => -65535,
+  'oid_num'         => '.1.3.6.1.4.1.3320.101.10.5.1.3',
+  'measured_match'  => [ ['entity_type' => 'port', 'field' => 'ifIndex', 'match' => '%opIfIndex%' ] ]
+);
 
+$config['mibs'][$mib]['sensor'][] = array(
+  'oid'             => 'opModuleCurrent',
+  'table'           => 'nmsepononuopticalportTable',
+  'descr'           => '%port_label% TX Bias',
+  'class'           => 'current',
+  'scale'           => 0.000002,
+  'invalid'         => -65535,
+  'oid_num'         => '.1.3.6.1.4.1.3320.101.10.5.1.4',
+  'measured_match'  => [ ['entity_type' => 'port', 'field' => 'ifIndex', 'match' => '%opIfIndex%' ] ]
+);
+
+// static limits from ONU specification (other ONU have the same limits): https://shop.nag.ru/catalog/03903.gpon--gepon/33751.abonentskie-ustrojstva-ontonu/22022.snr-onu-epon-1g#link-params
+$config['mibs'][$mib]['sensor'][] = array(
+  'oid'             => 'opModuleRxPower',
+  'table'           => 'nmsepononuopticalportTable',
+  'descr'           => '%port_label% RX Power',
+  'class'           => 'dbm',
+  'scale'           => 0.1,
+  'invalid'         => -65535,
+  'oid_num'         => '.1.3.6.1.4.1.3320.101.10.5.1.5',
+  'limit_low'       => -8,
+  'limit_high'      => -27,
+  'measured_match'  => [ ['entity_type' => 'port', 'field' => 'ifIndex', 'match' => '%opIfIndex%' ] ]
+);
+
+$config['mibs'][$mib]['sensor'][] = array(
+  'oid'            => 'opModuleTxPower',
+  'table'           => 'nmsepononuopticalportTable',
+  'descr'           => '%port_label% TX Power',
+  'class'           => 'dbm',
+  'scale'           => 0.1,
+  'invalid'         => -65535,
+  'oid_num'         => '.1.3.6.1.4.1.3320.101.10.5.1.6',
+  'measured_match'  => [ ['entity_type' => 'port', 'field' => 'ifIndex', 'match' => '%opIfIndex%' ] ]
+);
+
 // EOF

