/**
  * Will generate traps from a mib file
  *
  * @param string $parameters
  * @return void
  */
 public function generatetraps($parameters = null)
 {
     $params = explode($this->delim, $parameters);
     if (count($params) < 2) {
         throw new CentreonClapiException(self::MISSINGPARAMETER);
     }
     $vendorId = $this->getId($params[0]);
     $mibFile = $params[1];
     $tmpMibFile = "/tmp/" . basename($mibFile);
     if (!is_file($mibFile)) {
         throw new CentreonClapiException(self::FILE_NOT_FOUND . ": " . $mibFile);
     }
     copy($mibFile, $tmpMibFile);
     $centreonDir = CentreonUtils::getCentreonDir();
     passthru("export MIBS=ALL && {$centreonDir}/bin/snmpttconvertmib --in={$tmpMibFile} --out={$tmpMibFile}.conf");
     passthru("{$centreonDir}/bin/centFillTrapDB -f {$tmpMibFile}.conf -m {$vendorId}");
     unlink($tmpMibFile);
     unlink($tmpMibFile . ".conf");
 }
 /**
  * Send Trap configuration files to poller
  *
  * @param int $pollerId
  * @return void
  * @throws CentreonClapiException
  */
 public function sendTrapCfg($pollerId = null)
 {
     if (is_null($pollerId)) {
         throw new CentreonClapiException(self::MISSING_POLLER_ID);
     }
     $this->testPollerId($pollerId);
     $centreonDir = CentreonUtils::getCentreonDir();
     passthru("{$centreonDir}/bin/centGenSnmpttConfFile 2>&1");
     exec("echo 'SYNCTRAP:" . $pollerId . "' >> " . $this->centcore_pipe, $stdout, $return);
     return $return;
 }