/** * Přiřadí služby k hostům podle výsledků scannu */ public function assignServices() { $success = 0; $hostmod = false; foreach ($this->results as $port) { switch ($port) { case 80: if ($this->host->favToIcon()) { $hostmod = true; } break; case 5666: $this->host->setDataValue('platform', 'linux'); $hostmod = true; break; case 12489: $this->host->setDataValue('platform', 'windows'); $hostmod = true; break; default: break; } $this->service->setmyKeyColumn('tcp_port'); $this->service->loadFromMySQL($port); $this->service->setmyKeyColumn('service_id'); $this->service->addMember('host_name', $this->host->getId(), $this->host->getName()); if ($this->service->saveToMySQL()) { $this->addStatusMessage(sprintf(_('Přidána sledovaná služba: %s'), $this->service->getName()), 'success'); $success++; } else { $this->addStatusMessage(sprintf(_('Přidání sledované služby: %s se nezdařilo'), $this->service->getName()), 'error'); } } if ($hostmod) { $this->host->saveToMySQL(); } return $success; }
*/ require_once 'includes/IEInit.php'; require_once 'classes/IEHost.php'; require_once 'classes/IEFXPreloader.php'; $oPage->onlyForLogged(); $hostId = $oPage->getRequestValue('host_id', 'int'); if ($hostId == 0) { $oPage->redirect('hosts.php'); exit; } $host = new IEHost($hostId); $operation = $oPage->getRequestValue('operation'); switch ($operation) { case 'confirm': $state = $oPage->getRequestValue('confirm'); if ($state == 'on') { $host->setDataValue('config_hash', $host->getConfigHash()); } else { $host->setDataValue('config_hash', null); } if ($host->saveToMySQL()) { $host->addStatusMessage(_('Stav nasazení senzoru byl nastaven ručně.')); } break; default: break; } $oPage->addItem(new IEPageTop(_('Sensor'))); $oPage->container->addItem(new IESensorTool($host)); $oPage->addItem(new IEPageBottom()); $oPage->draw();
<?php /** * Icinga Editor - potvrzení nasazení konfigurace * * @package IcingaEditor * @subpackage WebUI * @author Vitex <*****@*****.**> * @copyright 2012 Vitex@hippy.cz (G) */ require_once 'includes/IEInit.php'; $host_id = $oPage->getRequestValue('host_id', 'int'); $hash = $oPage->getRequestValue('hash'); if ($host_id && $hash) { $host = new IEHost($host_id); $host->setDataValue('config_hash', $hash); if ($host->saveToMySQL()) { echo sprintf(_('Konfigurace %s potvrzena'), $host->getName()); } else { echo sprintf(_('Chyba potvrzení konfigurace'), $host->getName()); } echo "\n<br>" . _('Sledovat cestu k hostu') . ":\n"; if (isset($_SERVER['REQUEST_SCHEME'])) { $scheme = $_SERVER['REQUEST_SCHEME']; } else { $scheme = 'http'; } $enterPoint = $scheme . '://' . $_SERVER['SERVER_NAME'] . dirname($_SERVER['REQUEST_URI']) . '/'; $enterPoint = str_replace('\\', '', $enterPoint); //Win Hack $confirmUrl = $enterPoint . 'watchroute.php?action=parent&host_id=' . $host_id . '&ip=' . $_SERVER['REMOTE_ADDR'];