From Walloping Eider, 5 Years ago, written in Plain Text.
Embed
  1. class Smartax extends OS implements ProcessorDiscovery
  2. {
  3.     /**
  4.      * Discover processors.
  5.      * Returns an array of LibreNMS\Device\Processor objects that have been discovered
  6.      *
  7.      * @return array Processors
  8.      */
  9.     public function discoverProcessors()
  10.     {
  11.         $data = snmpwalk_group($this->getDevice(), 'enterprises.2011.2.6.7.1.1.2.1.5.0', ' SNMPv2-SMI');
  12.         //$proc_descr = snmpwalk_group($this->getDevice(), '1.3.6.1.4.1.2011.2.6.7.1.1.2.1.7.0');
  13.  
  14.         $processors = array();
  15.         $count = 1;
  16.         foreach ($data as $index => $entry) {
  17.             if ($entry != -1) {
  18.                 $processors[] = Processor::discover(
  19.                     "smartax",
  20.                     $this->getDeviceId(),
  21.                     "enterprises.2011.2.6.7.1.1.2.1.5.0.$count",
  22.                     $count,
  23.                     "Unit $count processor",
  24.                     1,
  25.                     $entry
  26.                 );
  27.             }
  28.  
  29.             $count++;
  30.         }
  31.  
  32.  
  33.         return $processors;
  34.     }
  35. }