Пример #1
0
 /**
  * Declares an association between this object and a AutodiscoveryJob object.
  *
  * @param      AutodiscoveryJob $v
  * @return     AutodiscoveryDevice The current object (for fluent API support)
  * @throws     PropelException
  */
 public function setAutodiscoveryJob(AutodiscoveryJob $v = null)
 {
     if ($v === null) {
         $this->setJobId(NULL);
     } else {
         $this->setJobId($v->getId());
     }
     $this->aAutodiscoveryJob = $v;
     // Add binding for other direction of this n:n relationship.
     // If this object has already been added to the AutodiscoveryJob object, it will not be re-added.
     if ($v !== null) {
         $v->addAutodiscoveryDevice($this);
     }
     return $this;
 }
Пример #2
0
             ksort($_POST['target']);
             $config = new AutodiscoveryConfig("NmapAutoDiscoveryEngine");
             $config->setVar("targets", $_POST['target']);
             $config->setVar("nmap_binary", $_POST['nmap_binary']);
             $config->setVar("traceroute_enabled", empty($_POST['traceroute_enabled']) ? true : true);
             $config->setVar("default_template", $_POST['default_template']);
             $autodiscoveryJob = new AutodiscoveryJob();
             $autodiscoveryJob->setName($_POST['job_name']);
             $autodiscoveryJob->setDescription($_POST['job_description']);
             $autodiscoveryJob->setCmd(AutodiscoveryJob::CMD_START);
             $autodiscoveryJob->setConfig(serialize($config));
             $autodiscoveryJob->setStatus("Starting...");
             $autodiscoveryJob->setStatusCode(AutodiscoveryJob::STATUS_STARTING);
             $autodiscoveryJob->save();
             // Attempt to execute the external auto-discovery script, fork it, and love it.
             exec("php autodiscovery/autodiscover.php " . $autodiscoveryJob->getId() . " > /dev/null", $tempOutput, $retVal);
             if ($retVal != 42) {
                 $status_msg = "Failed to run external Autodiscovery script. Return value: " . $retVal . "<br /> Error:";
                 foreach ($tempOutput as $output) {
                     $status_msg .= $output . "<br />";
                 }
             }
         }
     }
 } else {
     if ($_POST['request'] == "updateGeneral") {
         if (trim($_POST['name']) != '' && trim($_POST['description']) != '') {
             // Check to see first if a host or auto discovery device has that potential name
             $c = new Criteria();
             $c->add(NagiosHostPeer::NAME, trim($_POST['name']));
             $c->setIgnoreCase(true);
Пример #3
0
 /**
  * Adds an object to the instance pool.
  *
  * Propel keeps cached copies of objects in an instance pool when they are retrieved
  * from the database.  In some cases -- especially when you override doSelect*()
  * methods in your stub classes -- you may need to explicitly add objects
  * to the cache in order to ensure that the same objects are always returned by doSelect*()
  * and retrieveByPK*() calls.
  *
  * @param      AutodiscoveryJob $value A AutodiscoveryJob object.
  * @param      string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
  */
 public static function addInstanceToPool(AutodiscoveryJob $obj, $key = null)
 {
     if (Propel::isInstancePoolingEnabled()) {
         if ($key === null) {
             $key = (string) $obj->getId();
         }
         // if key === null
         self::$instances[$key] = $obj;
     }
 }