$host->setDisplayName(null); } if (!empty($_POST['host_manage']['parents'])) { $host->setParentHost($parentHost->getId()); } if ($host->save()) { $success = "Host modified."; unset($_GET['edit']); } else { $error = "Error: modify_host failed."; } } } } else { if ($_POST['request'] == "add_template_command") { $template = NagiosHostTemplatePeer::retrieveByPK($_POST['hostmanage']['template_add']['template_id']); if (!$template) { $error = "That host template is not found."; } else { // We need to get the count of templates already inherited $templateList = $host->getNagiosHostTemplateInheritances(); foreach ($templateList as $tempTemplate) { if ($tempTemplate->getId() == $_POST['hostmanage']['template_add']['template_id']) { $error = "That template already exists in the inheritance chain."; } } if (empty($error)) { $newInheritance = new NagiosHostTemplateInheritance(); $newInheritance->setNagiosHost($host); $newInheritance->setNagiosHostTemplateRelatedByTargetTemplate($template); $newInheritance->setOrder(count($templateList));
?> </td> <td><?php echo $device->getOsgen(); ?> </td> <td><?php echo $device->getOsvendor(); ?> </td> <td> <?php if (!$device->getHostTemplate()) { ?> None Assigned<?php } else { $hostTemplate = NagiosHostTemplatePeer::retrieveByPK($device->getHostTemplate()); if (!empty($hostTemplate)) { print $hostTemplate->getName(); } else { print "Template Not Found"; } } ?> </td> </tr> </table> <br /> <h3>Update General Information</h3> <form action="autodiscovery.php?id=<?php echo $_GET['id']; ?>
print "No job id provided.\n"; exit(10); } $autodiscoveryJob->addNotice("Starting Background Auto Discovery Process for Job: " . $autodiscoveryJob->getName()); $autodiscoveryJob->setStatus("Running"); $autodiscoveryJob->setStatusCode(AutodiscoveryJob::STATUS_RUNNING); $autodiscoveryJob->save(); $autodiscoveryJob->addNotice("Removing old devices found in this job."); $devices = $autodiscoveryJob->getAutodiscoveryDevices(); foreach ($devices as $device) { $device->delete(); } $defaultTemplateId = $config->getVar("default_template"); if (!empty($defaultTemplateId)) { $autodiscoveryJob->addNotice("Fetching Default Template..."); $defaultTemplate = NagiosHostTemplatePeer::retrieveByPK($defaultTemplateId); if (!$defaultTemplate) { $autodiscoveryJob->addNotice("Failed to find default template requested. Will not be able to assign a default template."); } } $autodiscoveryJob->addNotice("Initializing Auto Discovery Engine: " . $engineClass); $engine = new $engineClass($autodiscoveryJob); if (!$engine->init()) { $autodiscoveryJob->addError("Engine failed to initialize."); $importJob->addError("Auto Discovery Engine of type " . $engineClass . " not found."); $autodiscoveryJob->setStatusCode(AutodiscoveryJob::STATUS_FAILED); $autodiscoveryJob->save(); exit(40); } if (!$engine->discover()) { $autodiscoveryJob->addError("Engine autodiscovery process failed to complete successfully.");
GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ /* * host_template.php * Author: Taylor Dondich (tdondich at gmail.com) * Description: * Provides interface to maintain host templates * */ include_once 'includes/config.inc'; if (isset($_GET['host_template_id'])) { $tempSource = NagiosHostTemplatePeer::retrieveByPK($_GET['host_template_id']); $link = "host_template.php"; $fieldName = "host_template_id"; if (!$tempSource) { header("Location: welcome.php"); } $type = "hosttemplate"; $title = "Host Template"; } else { if (isset($_GET['host_id'])) { $tempSource = NagiosHostPeer::retrieveByPK($_GET['host_id']); $fieldName = "host_id"; $link = "hosts.php"; if (!$tempSource) { header("Location: welcome.php"); }