Exemplo n.º 1
0
 public function export(Service $entity)
 {
     $contacts = array_map(function (Contact $contact) {
         return $this->contactBridge->export($contact);
     }, $entity->getContacts());
     return array('id' => (string) $entity->getId(), 'enabled' => $entity->isEnabled(), 'name' => $entity->getName(), 'host' => $this->hostBridge->export($entity->getHost()), 'contacts' => $contacts);
 }
 private function isMasterService(Service $service)
 {
     $name = $service->getName();
     foreach ($this->masterServicesRegexes as $regex) {
         if (preg_match($regex, $name)) {
             return true;
         }
     }
     return false;
 }
Exemplo n.º 3
0
 public function scheduleServiceCheck(Service $service)
 {
     $timeNow = time();
     $command = sprintf('[%d] SCHEDULE_SVC_CHECK;%s;%s;%d', $timeNow, $service->getHost()->getName(), $service->getName(), $timeNow);
     $this->submitter->submit($command);
 }
Exemplo n.º 4
0
 /**
  * @param Service $service
  * @return \Devture\Bundle\NagiosBundle\Status\ServiceStatus|NULL
  */
 public function getServiceStatus(Service $service)
 {
     $this->load();
     $serviceIdentifier = $service->getHost()->getName() . '/' . $service->getName();
     return isset($this->servicesStatusMap[$serviceIdentifier]) ? $this->servicesStatusMap[$serviceIdentifier] : null;
 }