From none, 4 Years ago, written in PHP.
Embed
  1. <?php
  2. private function fetchData()
  3.     {
  4.         if (is_null($this->data)) {
  5.             // wAP 60G device uses the mtxrWl60GTable and mtxrwl60GStaTable
  6.             // (does not use normal mtxrWlApTable or mtxrWlStatTable).
  7.             // https://wiki.mikrotik.com/wiki/Manual:Interface/W60G#SNMP_OIDs_for_monitoring
  8.  
  9.             // Try to walk a wAP 60G table
  10.             $wl60 = snmpwalk_cache_oid(
  11.                 $this->getDevice(),
  12.                 'mtxrWl60GTable',
  13.                 array(),
  14.                 'MIKROTIK-MIB'
  15.             );
  16.  
  17.             if ( !empty($wl60) ) {
  18.                 // This is a wAP 60G, get only the wAP 60G tables
  19.                 $wl60sta = snmpwalk_cache_oid(
  20.                     $this->getDevice(),
  21.                     'mtxrWl60GStaTable',
  22.                     array(),
  23.                     'MIKROTIK-MIB'
  24.                 );
  25.                 $this->data = $wl60+$wl60sta;
  26.             } else {
  27.                 // Get regular AP + Station tables
  28.                 // Device may be in both AP and Station mode using multiple
  29.                 // radios (or one radio with Virtual AP/STA feature)
  30.                 $wlap = snmpwalk_cache_oid(
  31.                     $this->getDevice(),
  32.                     'mtxrWlApTable',
  33.                     array(),
  34.                     'MIKROTIK-MIB'
  35.                 );
  36.                 $wlsta = snmpwalk_cache_oid(
  37.                     $this->getDevice(),
  38.                     'mtxrWlStatTable',
  39.                     array(),
  40.                     'MIKROTIK-MIB'
  41.                 );
  42.                 $this->data = $wlap+$wlsta;
  43.             }
  44.         }
  45.         return $this->data;
  46.     }
  47. ?>