DocsIfCmts.php 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  1. <?php
  2. namespace OSS_SNMP\MIBS;
  3. class DocsIfCmts extends \OSS_SNMP\MIB {
  4. const OID_docsIfCmtsCmStatusMacAddress = "1.3.6.1.2.1.10.127.1.3.3.1.2";
  5. //const OID_docsIfCmtsCmStatusTable = "1.3.6.1.2.1.10.127.1.3.3";
  6. const OID_docsIfCmtsCmStatusUpChannelIfIndex = "1.3.6.1.2.1.10.127.1.3.3.1.5";
  7. const OID_docsIfCmtsCmStatusDownChannelIfIndex = "1.3.6.1.2.1.10.127.1.3.3.1.4";
  8. const OID_docsIfCmtsCmStatusIpAddress = "1.3.6.1.2.1.10.127.1.3.3.1.3";
  9. const OID_docsQosCmtsIfIndex = "1.3.6.1.2.1.10.127.7.1.11.1.3";
  10. const OID_docsIfCmtsCmStatusIndex = "1.3.6.1.2.1.10.127.1.3.3.1.1";
  11. const OID_docsQosServiceFlowOctets = "1.3.6.1.2.1.10.127.7.1.4.1.2";
  12. const OID_docsQosServiceFlowDirection = "1.3.6.1.2.1.10.127.7.1.3.1.7";
  13. const OID_docsIfCmtsCmStatusRxPower = "1.3.6.1.2.1.10.127.1.3.3.1.6";
  14. const OID_docsIfCmtsCmStatusValue = "1.3.6.1.2.1.10.127.1.3.3.1.9";
  15. const OID_docsQos3CmtsIfIndex = "1.3.6.1.4.1.4491.2.1.21.1.11.1.3";
  16. const OID_docsQos3ServiceFlowOctets = "1.3.6.1.4.1.4491.2.1.21.1.4.1.2";
  17. const OID_docsQos3ServiceFlowDirection = "1.3.6.1.4.1.4491.2.1.21.1.3.1.7";
  18. const OID_docsIfSigQSignalNoise = "1.3.6.1.2.1.10.127.1.1.4.1.5";
  19. const OID_docsIfSigQMicroreflections = "1.3.6.1.2.1.10.127.1.1.4.1.6";
  20. const docsIfCmtsChannelUtilization = "1.3.6.1.2.1.10.127.1.3.9.1.3";
  21. public function docsQos3ServiceFlowDirection(){
  22. try{
  23. $rtr = array();
  24. foreach($this->getSNMP()->realWalk(self::OID_docsQos3ServiceFlowDirection) as $k => $v){
  25. $k_prim = preg_split("|\.|",$k);
  26. $rtr[$k_prim[15].".".$k_prim[16]] = $this->getSNMP()->parseSnmpValue($v);
  27. }
  28. return $rtr;
  29. }catch (\Exception $e){
  30. echo "ouch!".$e->getMessage()."\n";
  31. return array();
  32. }
  33. }
  34. public function docsQos3CmtsIfIndex(){
  35. try{
  36. $rtr = array();
  37. foreach($this->getSNMP()->realWalk(self::OID_docsQos3CmtsIfIndex) as $k => $v){
  38. $k_prim = preg_split("|\.|",$k);
  39. $k_mac = sprintf("%02x:%02x:%02x:%02x:%02x:%02x",
  40. $k_prim[15], $k_prim[16], $k_prim[17], $k_prim[18], $k_prim[19], $k_prim[20]);
  41. $rtr[$k_mac][] = $this->getSNMP()->parseSnmpValue($v). ".".$k_prim[21];
  42. }
  43. return $rtr;
  44. }catch (\Exception $e){
  45. echo "ouch!".$e->getMessage()."\n";
  46. return array();
  47. }
  48. }
  49. public function docsQos3ServiceFlowOctets(){
  50. try{
  51. $rtr = array();
  52. foreach($this->getSNMP()->realWalk(self::OID_docsQos3ServiceFlowOctets) as $k => $v){
  53. $k_prim = preg_split("|\.|",$k);
  54. $rtr[$k_prim[15].".".$k_prim[16]] = $this->getSNMP()->parseSnmpValue($v);
  55. }
  56. return $rtr;
  57. }catch (\Exception $e){
  58. echo "ouch! ".$e->getMessage()."\n";
  59. return array();
  60. }
  61. }
  62. public function docsQosServiceFlowDirection(){
  63. return $this->getSNMP()->walk1d(self::OID_docsQosServiceFlowDirection);
  64. }
  65. public function docsQosCmtsIfIndex(){
  66. try{
  67. $rtr = array();
  68. foreach($this->getSNMP()->realWalk(self::OID_docsQosCmtsIfIndex) as $k => $v){
  69. $k_prim = preg_split("|\.|",$k);
  70. $k_mac = sprintf("%02x:%02x:%02x:%02x:%02x:%02x",
  71. $k_prim[14], $k_prim[15], $k_prim[16], $k_prim[17], $k_prim[18], $k_prim[19]);
  72. $rtr[$k_mac][] = $k_prim[20]; //$this->getSNMP()->parseSnmpValue($v);
  73. }
  74. return $rtr;
  75. }catch (\Exception $e){
  76. echo "ouch!".$e->getMessage()."\n";
  77. return array();
  78. }
  79. }
  80. public function docsQosServiceFlowOctets(){
  81. return $this->getSNMP()->walk1d(self::OID_docsQosServiceFlowOctets);
  82. }
  83. /**
  84. other(1)   Any state other than below.
  85. ranging(2)   The CMTS has received an Initial Ranging Request   message from the CM, and the ranging process is not  yet   complete.
  86. rangingAborted(3)   The CMTS has sent a Ranging Abort message to the CM.
  87. rangingComplete(4)   The CMTS has sent a Ranging Complete message to the CM.
  88. ipComplete(5)   The CMTS has received a DHCP reply message and forwarded   it to the CM.
  89. registrationComplete(6)   The CMTS has sent a Registration Response message to the CM.
  90. accessDenied(7)   The CMTS has sent a Registration Aborted message   to the CM.
  91. **/
  92. public function docsIfCmtsCmStatusMacAddress()
  93. {
  94. $rtr = $this->getSNMP()->walk1d(self::OID_docsIfCmtsCmStatusMacAddress);
  95. return $rtr;
  96. }
  97. //public function docsIfCmtsCmStatusIndex(){
  98. // return $this->getSNMP()->walk1d(self::OID_docsIfCmtsCmStatusDownChannelIfIndex);
  99. //}
  100. public function docsIfCmtsCmStatusUpChannelIfIndex(){
  101. return $this->getSNMP()->walk1d(self::OID_docsIfCmtsCmStatusUpChannelIfIndex);
  102. }
  103. public function docsIfCmtsCmStatusDownChannelIfIndex(){
  104. return $this->getSNMP()->walk1d(self::OID_docsIfCmtsCmStatusDownChannelIfIndex);
  105. }
  106. //public function docsIfCmtsCmStatusIpAddress(){
  107. // return $this->getSNMP()->walk1d(self::OID_docsIfCmtsCmStatusIpAddress);
  108. //}
  109. public function docsIfCmtsCmStatusValue(){
  110. $rtr = $this->getSNMP()->walk1d(self::OID_docsIfCmtsCmStatusValue);
  111. $replace = array(1 => 'other' , 2 => 'ranging', 3 => 'rangingAborted', 4 => 'rangingComplete', 5 => 'ipComplete',
  112. 6 => 'registrationComplete', 7 => 'accessDenied');
  113. foreach($rtr as $k => $v){ $rtr[$k] = $replace[$v]; }
  114. return $rtr;
  115. }
  116. public function docsIfCmtsCmStatusRxPower(){
  117. return $this->getSNMP()->walk1d(self::OID_docsIfCmtsCmStatusRxPower);
  118. }
  119. public function docsIfSigQSignalNoise(){
  120. $rtr = array();
  121. foreach($this->getSNMP()->realWalk(self::OID_docsIfSigQSignalNoise) as $oid => $val){
  122. sscanf($val,"INTEGER: %f TenthdB", $readval);
  123. $rtr[substr($oid,strlen(self::OID_docsIfSigQSignalNoise)+2)] = $readval;
  124. }
  125. return $rtr;
  126. }
  127. public function docsIfSigQMicroreflections(){
  128. return $this->getSNMP()->walk1d(self::OID_docsIfSigQMicroreflections);
  129. }
  130. public function docsIfCmtsChannelUtilization(){
  131. return $this->getSNMP()->realWalk(self::docsIfCmtsChannelUtilization);
  132. }
  133. }