Exemplo n.º 1
0
    }
    $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");
        }
        $type = "host";
        $title = "Host";
    } else {
        if (isset($_GET['service_template_id'])) {
            $tempSource = NagiosServiceTemplatePeer::retrieveByPK($_GET['service_template_id']);
            $fieldName = "service_template_id";
            $link = "service_template.php";
            if (!$tempSource) {
                header("Location: welcome.php");
            }
            $type = "servicetemplate";
            $title = "Service Template";
        } else {
            if (isset($_GET['service_id'])) {
                $tempSource = NagiosServicePeer::retrieveByPK($_GET['service_id']);
                $fieldName = "service_id";
                $link = "service.php";
                if (!$tempSource) {
                    header("Location: welcome.php");
                }
Exemplo n.º 2
0
             }
         }
         if ($modifiedData['service_description'] == '') {
             $addError = 1;
             $error = "Incorrect values for fields.  Please verify.";
         } else {
             $service->setDescription($modifiedData['service_description']);
             $service->setDisplayName($modifiedData['display_name']);
             $service->save();
             unset($_GET['edit']);
             $success = "Service modified.";
         }
     }
 } else {
     if ($_POST['request'] == "add_template_command") {
         $template = NagiosServiceTemplatePeer::retrieveByPK($_POST['servicemanage']['template_add']['template_id']);
         if (!$template) {
             $error = "That service template is not found.";
         } else {
             // We need to get the count of templates already inherited
             $templateList = $service->getNagiosServiceTemplateInheritances();
             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 NagiosServiceTemplateInheritance();
                 $newInheritance->setNagiosService($service);
                 $newInheritance->setNagiosServiceTemplateRelatedByTargetTemplate($template);
                 $newInheritance->setOrder(count($templateList));
Exemplo n.º 3
0
                            // All is well for error checking, modify the command.
                            $param = new NagiosServiceCheckCommandParameter();
                            $param->setTemplate($serviceTemplate->getId());
                            $param->setParameter($_POST['service_manage']['parameter']);
                            $param->save();
                            $success = "Command Parameter added.";
                        }
                    }
                }
            }
        }
    }
}
if (isset($_GET['id'])) {
    // Load template.
    $serviceTemplate = NagiosServiceTemplatePeer::retrieveByPK($_GET['id']);
    if (!$serviceTemplate) {
        header("Location: templates.php");
        die;
    } else {
        // GET VALUES
        $templateValues = $serviceTemplate->getValues();
    }
}
// To create a "default" command
$command_list[] = array("command_id" => 0, "command_name" => "None");
$lilac->return_command_list($tempList);
foreach ($tempList as $command) {
    $command_list[] = array("command_id" => $command->getId(), "command_name" => $command->getName());
}
$period_list = array();