OIDSHuaweiV1.php 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195
  1. <?php
  2. namespace HuaweiBundle\SNMP\MIBS;
  3. // https://ixnfo.com/oid-i-mib-dlya-huawei-olt-i-onu.html
  4. // https://translate.google.com/translate?hl=en&sl=auto&tl=en&u=https%3A%2F%2Fixnfo.com%2Foid-i-mib-dlya-huawei-olt-i-onu.html
  5. // https://github.com/chinnurtb/xiaoli/tree/master/node/monitd/include/mib
  6. class OIDSHuaweiV1 extends \HuaweiBundle\SNMP\MIB {
  7. const OID_authOnuListSlot = "1.3.6.1.4.1.5875.800.3.10.1.1.2";
  8. const OID_authOnuListPon = "1.3.6.1.4.1.5875.800.3.10.1.1.3";
  9. const OID_authOnuListOnuid = "1.3.6.1.4.1.5875.800.3.10.1.1.4";
  10. // 1.3.6.1.4.1.2011.6.128.1.1.4.42.1.3
  11. const OID_authOnuListMac = "1.3.6.1.4.1.2011.6.128.1.1.2.43.1.3";
  12. const OID_onuPonRxOpticalPower = "1.3.6.1.4.1.2011.6.128.1.1.2.51.1.4";
  13. const OID_onuPonTxOpticalPower = "1.3.6.1.4.1.2011.6.128.1.1.2.51.1.3";
  14. const OID_onuPonOpticalVltage = "1.3.6.1.4.1.2011.6.128.1.1.2.51.1.5";
  15. const OID_onuPonOpticalTemperature = "1.3.6.1.4.1.2011.6.128.1.1.2.51.1.1";
  16. const OID_onuPonOpticalCurrent = "1.3.6.1.4.1.2011.6.128.1.1.2.51.1.2";
  17. const OID_onuCatvRxOpticalPower = "1.3.6.1.4.1.2011.6.128.1.1.2.51.1.7";
  18. const OID_onuStatus = "1.3.6.1.4.1.5875.800.3.10.1.1.11";
  19. const OID_oltPonDesc = "1.3.6.1.2.1.31.1.1.1.1";
  20. const OID_oltPonEnableStatus = "1.3.6.1.4.1.5875.800.3.9.3.4.1.4";
  21. const OID_oltPonRxOpticalPower = "1.3.6.1.4.1.2011.6.128.1.1.2.51.1.6"; // (value - 10000) * 0.01
  22. const OID_oltPonTxOpticalPower = "1.3.6.1.4.1.2011.6.128.1.1.2.23.1.4";
  23. const OID_oltPonOpticalVltage = "1.3.6.1.4.1.2011.6.128.1.1.2.23.1.2";
  24. const OID_oltPonOpticalCurrent = "1.3.6.1.4.1.2011.6.128.1.1.2.23.1.3";
  25. const OID_oltPonOpticalTemperature = "1.3.6.1.4.1.2011.6.128.1.1.2.23.1.1";
  26. //1.3.6.1.4.1.2011.6.128.1.1.4.42.1.3
  27. //Genericos
  28. const OID_ifHCInOctets = "1.3.6.1.2.1.31.1.1.1.6";
  29. const OID_ifHCOutOctets = "1.3.6.1.2.1.31.1.1.1.10";
  30. const OID_ifInOctets = "1.3.6.1.2.1.2.2.1.10";
  31. const OID_ifOutOctets = "1.3.6.1.2.1.2.2.1.16";
  32. const OID_ifDescr = "1.3.6.1.2.1.2.2.1.2";
  33. const OID_cardCpu = "1.3.6.1.4.1.2011.2.6.7.1.1.2.1.5";
  34. const OID_cardMemory = "1.3.6.1.4.1.2011.2.6.7.1.1.2.1.6";
  35. const OID_hwGponOntStatisticUpBytes = "1.3.6.1.4.1.2011.6.128.1.1.4.23.1.3"; //Counter64
  36. const OID_hwGponOntStatisticDownBytes = "1.3.6.1.4.1.2011.6.128.1.1.4.23.1.4"; //Counter64
  37. function convertIndex($index, $values) {
  38. $data = array();
  39. foreach($values as $i => $v) {
  40. if(isset($index[$i])) {
  41. $data[$index[$i]] = $v;
  42. }
  43. }
  44. if(!empty($index)) return $data;
  45. return $values;
  46. }
  47. public function onuSlot() {
  48. return $this->getSNMP()->lastOidWalk(self::OID_authOnuListSlot,14);
  49. }
  50. public function onuPon() {
  51. return $this->getSNMP()->lastOidWalk(self::OID_authOnuListPon,14);
  52. }
  53. public function onuOnuid() {
  54. return $this->getSNMP()->lastOidWalk(self::OID_authOnuListOnuid,14);
  55. }
  56. public function onuSerialNumber($index = null) {
  57. if(is_null($index)) {
  58. return $this->getSNMP()->lastOidWalk(self::OID_authOnuListMac,16);
  59. }
  60. $values = $this->getSNMP()->lastOidWalk(self::OID_authOnuListMac,16);
  61. return $this->convertIndex($index, $values);
  62. }
  63. public function onuCatvRxOpticalPower($index = null) {
  64. if(is_null($index)) {
  65. return $this->getSNMP()->lastOidWalk(self::OID_onuCatvRxOpticalPower,16);
  66. }
  67. $values = $this->getSNMP()->lastOidWalk(self::OID_onuCatvRxOpticalPower,16);
  68. return $this->convertIndex($index, $values);
  69. }
  70. public function onuPonRxOpticalPower($index = null) {
  71. if(is_null($index)) {
  72. return $this->getSNMP()->lastOidWalk(self::OID_onuPonRxOpticalPower,16);
  73. }
  74. $values = $this->getSNMP()->lastOidWalk(self::OID_onuPonRxOpticalPower,16);
  75. return $this->convertIndex($index, $values);
  76. }
  77. public function onuPonTxOpticalPower($index = null) {
  78. if(is_null($index)) {
  79. return $this->getSNMP()->lastOidWalk(self::OID_onuPonTxOpticalPower,16);
  80. }
  81. $values = $this->getSNMP()->lastOidWalk(self::OID_onuPonTxOpticalPower,16);
  82. return $this->convertIndex($index, $values);
  83. }
  84. public function onuPonOpticalVltage($index = null) {
  85. $values = $this->getSNMP()->lastOidWalk(self::OID_onuPonOpticalVltage,16);
  86. return $this->convertIndex($index, $values);
  87. }
  88. public function onuPonOpticalTemperature($index = null) {
  89. $values = $this->getSNMP()->lastOidWalk(self::OID_onuPonOpticalTemperature,16);
  90. return $this->convertIndex($index, $values);
  91. }
  92. public function onuStatus($index = null) {
  93. $values = $this->getSNMP()->lastOidWalk(self::OID_onuStatus,14);
  94. return $this->convertIndex($index, $values);
  95. }
  96. /* OLT PON */
  97. public function oltPonDesc($index = null) {
  98. return $this->getSNMP()->lastOidWalk(self::OID_oltPonDesc,12);
  99. }
  100. public function oltPonEnableStatus($index = null) {
  101. return $this->getSNMP()->lastOidWalk(self::OID_oltPonEnableStatus,15);
  102. // return $this->convertIndex($index, $values);
  103. }
  104. public function oltPonRxOpticalPower($index = null) {
  105. return $this->getSNMP()->lastOidWalk(self::OID_oltPonRxOpticalPower,16);
  106. // return $this->convertIndex($index, $values);
  107. }
  108. public function oltPonTxOpticalPower($index = null) {
  109. return $this->getSNMP()->lastOidWalk(self::OID_oltPonTxOpticalPower,16);
  110. // return $this->convertIndex($index, $values);
  111. }
  112. public function oltPonOpticalVltage($index = null) {
  113. return $this->getSNMP()->lastOidWalk(self::OID_oltPonOpticalVltage,16);
  114. // return $this->convertIndex($index, $values);
  115. }
  116. public function oltPonOpticalCurrent($index = null) {
  117. return $this->getSNMP()->lastOidWalk(self::OID_oltPonOpticalCurrent,16);
  118. // return $this->convertIndex($index, $values);
  119. }
  120. public function oltPonOpticalTemperature($index = null) {
  121. return $this->getSNMP()->lastOidWalk(self::OID_oltPonOpticalTemperature,16);
  122. // return $this->convertIndex($index, $values);
  123. }
  124. public function ifInOctets() {
  125. return $this->getSNMP()->lastOidWalk(self::OID_ifInOctets,11);
  126. }
  127. public function ifOutOctets() {
  128. return $this->getSNMP()->lastOidWalk(self::OID_ifOutOctets,11);
  129. }
  130. public function ifHCInOctets() {
  131. return $this->getSNMP()->lastOidWalk(self::OID_ifHCInOctets,12);
  132. }
  133. public function ifHCOutOctets() {
  134. return $this->getSNMP()->lastOidWalk(self::OID_ifHCOutOctets,12);
  135. }
  136. public function ifDescr() {
  137. return $this->getSNMP()->lastOidWalk(self::OID_ifDescr,11);
  138. }
  139. public function oltCardCpu($index = null) {
  140. return $this->getSNMP()->lastOidWalk(self::OID_cardCpu,16);
  141. }
  142. public function oltCardMemory($index = null) {
  143. return $this->getSNMP()->lastOidWalk(self::OID_cardMemory,16);
  144. }
  145. public function onuInOctets($index = null) {
  146. return $this->getSNMP()->lastOidWalk(self::OID_hwGponOntStatisticUpBytes,16);
  147. }
  148. public function onuOutOctets($index = null) {
  149. return $this->getSNMP()->lastOidWalk(self::OID_hwGponOntStatisticDownBytes,16);
  150. }
  151. }