public function run_deployment()
 {
     if (!ALLOW_DEPLOYMENT) {
         echo NConf_HTML::limit_space(NConf_HTML::show_error('ERROR', 'Deployment functionality is currently disabled.'));
     } elseif (ALLOW_DEPLOYMENT && (!ALLOW_DIRECT_DEPLOYMENT && empty($_POST["status"]))) {
         echo NConf_HTML::limit_space(NConf_HTML::show_error('ERROR', 'Please first run the "Generate Nagios config".'));
     } elseif (ALLOW_DEPLOYMENT && ALLOW_DIRECT_DEPLOYMENT || ALLOW_DEPLOYMENT && (!ALLOW_DIRECT_DEPLOYMENT && (!empty($_POST["status"]) && $_POST["status"] == "OK"))) {
         echo NConf_HTML::table_begin('class="table_checks"', array(170, 50, ''));
         // DEPLOY
         // First do the local module
         $local_module = $this->modules["local"];
         if ($local_module->configured()) {
             NConf_DEBUG::set('', 'DEBUG', 'Deploying ' . $local_module->name);
             echo NConf_HTML::table_row_text(NConf_HTML::title($local_module->name, '', 'class="content_header"'));
             NConf_DEBUG::set($local_module->destinations, 'DEBUG', $local_module->name);
             $local_module->deploy();
             echo NConf_HTML::table_row_text(NConf_HTML::line(), '', 'colspan=3');
         }
         // Then do all other modules if they are configured
         foreach ($this->modules as $module) {
             // Dont do the "local" module
             // Check also if module is configured
             if ($module->name == "local" or !$module->configured()) {
                 continue;
             }
             NConf_DEBUG::set('', 'DEBUG', 'Deploying ' . $module->name);
             echo NConf_HTML::table_row_text(NConf_HTML::title($module->name, '', 'class="content_header"'));
             NConf_DEBUG::set($module->destinations, 'DEBUG', $module->name);
             // run the deploy
             $module->deploy();
             echo NConf_HTML::table_row_text(NConf_HTML::line(), '', 'colspan=3');
         }
         echo NConf_HTML::table_end();
     } else {
         echo NConf_HTML::text('Deployment is enabled, but your configuration seems to have errors.', TRUE, 'div', 'class="attention"');
     }
 }
Beispiel #2
0
    });

</script>


<?php 
echo NConf_HTML::ui_box_header("Configuration Deployment");
echo NConf_HTML::ui_box_content();
echo '<div style="height: 20px;">
            <div id="loading">
                <img src="img/working_small.gif"> in progress...
            </div>
          </div>';
// Load deployment class and create object
require_once "class.deployment.php";
require_once "class.deployment.modules.php";
// Load the NConf Deployment class
// It loads all the modules and handles the deployment basic stuff
$deployment = new NConf_Deployment();
// Loads the configuration of the user
// nconf/conf/deployment.ini
$deployment->import_config();
if (NConf_DEBUG::status('ERROR')) {
    // Show error if set
    echo NConf_HTML::limit_space(NConf_HTML::show_error());
} else {
    // Start deploying the files
    $deployment->run_deployment();
}
echo '</div>';
Beispiel #3
0
                    <br>any asscociated data will be lost!
                    <br><br>Are you <b>ABSOLUTELY SURE</b> you want to proceed?
                <br><br>List of attributes defined for this class:<br>(items using these attributes are not listed here explicitly)
            <br>
                   ';
        $content .= '<ul>';
        foreach ($attr as $item) {
            $content .= '<li>' . $item["attr_name"] . '</li>';
        }
        $content .= '</ul>';
    } else {
        $content = 'No attributes defined for this class.<br>You may safely delete the &quot;<b>' . $class_name . '</b>&quot; class.';
    }
    // Buttons
    $content_button = '
        <form name="delete_class" action="delete_class.php" method="post">
            <input type="hidden" name="id" value="' . $_GET["id"] . '">
            <input type="hidden" name="class_name" value="' . $class_name . '">
            <input type="hidden" name="delete" value="yes">
    ';
    if (!empty($_GET["from"])) {
        $content_button .= '<input type="hidden" name="from" value="' . $_GET["from"] . '">';
    }
    $content_button .= '<br><div id=buttons>';
    $content_button .= '<input type="Submit" value="Delete" name="submit" align="middle">&nbsp;';
    $content_button .= '<input type=button onClick="window.location.href=\'' . $_SESSION["go_back_page"] . '\'" value="Back">';
    $content_button .= '</form>';
    echo NConf_HTML::limit_space(NConf_HTML::show_highlight('WARNING', $content . $content_button));
}
mysql_close($dbh);
require_once 'include/foot.php';
Beispiel #4
0
# Show class selection
$show_class_select = "yes";
if (isset($_GET["class"])) {
    $class = $_GET["class"];
} else {
    $class = "host";
}
// Page output begin
echo NConf_HTML::title('Show attributes: ' . $class);
$content = 'This mask allows administrators to modify the data schema of the NConf application.
            There is no need to make any changes to the schema for ordinary operation.
            Users are strictly discouraged from changing any attribute names, datatypes, from modifying classes in any way, 
            and from any other changes to the schema.
            Disregarding this may result in unexpected behavour of the application, failure to generate the Nagios configuration properly 
            and may under certain circumstances <b>result in data corruption or loss!</b>';
echo NConf_HTML::limit_space(NConf_HTML::show_error('WARNING', $content), 'style="float: right; width: 555px;"');
echo '<form name="filter" action="' . $request_url . '" method="get">
<fieldset class="inline">
<legend>Select class</legend>
      <table>';
// Class Filter
if (isset($show_class_select)) {
    echo '<tr>';
    $result = db_handler('SELECT config_class FROM ConfigClasses ORDER BY config_class', "result", "Get Config Classes");
    echo '</tr>';
    echo '<tr>';
    echo '<td><select name="class" style="width:192px" onchange="document.filter.submit()">';
    //echo '<option value="">'.SELECT_EMPTY_FIELD.'</option>';
    while ($row = mysql_fetch_row($result)) {
        echo "<option value={$row['0']}";
        if (isset($class) and $row[0] == $class) {
Beispiel #5
0
    if (constant("VERSION_NOT_FINAL_WARNING") !== '') {
        echo "<br>";
        echo NConf_HTML::limit_space(NConf_HTML::show_error('Attention', VERSION_NOT_FINAL_WARNING));
    }
    # new nconf version info
    if (defined('CHECK_UPDATE') and CHECK_UPDATE == 1 and $_SESSION["group"] == "admin") {
        echo '<script src="include/js/jquery_plugins/jquery.nconf_check_update.js" type="text/javascript"></script>';
        echo js_prepare('
                                              $(document).ready(function(){
                                                $.nconf_check_update("' . VERSION_NUMBER . '");
                                              });
                                         ');
        # html container
        echo "<br>";
        echo '<div id="check_update" style="display:none">';
        echo NConf_HTML::limit_space(NConf_HTML::show_highlight('<span id="check_update_title"></span>', '<div id="check_update_content"></div>'));
        echo '</div>';
    }
    echo "<br>" . DISCLAIMER_STRING . "<br><br>";
    echo POWERED_BY_LOGOS;
} else {
    # This will be displayed on the login screen
    echo "<br><br>" . POWERED_BY_LOGOS;
}
?>
                    </td>
                </tr>
            </table>
        </td>
    </tr>
</table>
Beispiel #6
0
            $name = db_templates("naming_attr", $item_ID);
            if ($item_class == "service") {
                # get host name of service
                $hostID = db_templates("hostID_of_service", $item_ID);
                $hostname = db_templates("naming_attr", $hostID);
                $name = $hostname . ":" . $name;
            }
            if (!empty($name) or $name === "0") {
                $content .= "<li>{$name}</li>";
            }
        }
        $content .= '</ul>';
        echo '<br>';
        echo '<div id="info_box">';
        $title = 'Old value will be overwritten for the following item(s):';
        echo NConf_HTML::limit_space(NConf_HTML::show_highlight($title, $content));
        echo '</div>';
    }
    echo '</form>';
}
if (NConf_DEBUG::status('ERROR')) {
    echo NConf_HTML::show_error();
}
// Run the Autocomplete function
if (isset($prepare_status) and $prepare_status == 1) {
    # only run if prepare was ok
    js_Autocomplete_run('email', 'emaillist');
    js_Autocomplete_run('pager', 'pagerlist');
}
# close content box
echo '</div>';
        if ($deployment_info) {
            $content = 'The generated configuration has been written to the "nconf/output/" directory.<br>
                            To set up more sophisticated deployment functionality, please edit your "config/deployment.ini" file accordingly.<br>
                            For a complete list of available deployment options, refer to the online documentation on 
                            <a href="http://www.nconf.org" target="_blank">www.nconf.org</a>.';
            system("bash  /var/www/nconf/ADD-ONS/deploy_local.sh");
            echo NConf_HTML::limit_space(NConf_HTML::show_highlight('Note', $content));
        } else {
            // Show deployment button
            echo "<form method=\"POST\" action=\"call_file.php?module_file=deployment/main.php\" id=buttons>";
            echo '<input type=hidden name=status value="' . $status . '">';
            echo '<br><input type="submit" name="submit" value="Deploy" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only">';
            echo "</form><br>";
        }
    } else {
        // Simply show success message
        echo "<b>Changes updated successfully.</b><br><br>";
    }
} else {
    history_add("general", "config", "generate failed with syntax errors");
    // Remove generated config - syntax check has failed
    if (DEBUG_MODE == 1) {
        // Move generated config to "output" dir, but tag it as FAILED
        system("mv " . NCONFDIR . "/temp/NagiosConfig.tgz " . NCONFDIR . "/output/NagiosConfig_FAILED.tgz." . time());
    }
    // Remove generated config
    system("rm -rf " . NCONFDIR . "/temp/*");
    $content = "Deployment not possible due to errors in configuration.";
    echo NConf_HTML::limit_space(NConf_HTML::show_error('Error', $content));
}
mysql_close($dbh);
    }
    echo "</ul>";
}
# show inheritance
if ($config_class == "host") {
    # Ask for make the changes also to the linked services
    if ($ask_vererben) {
        echo '<form name="vererben" action="' . $_SERVER["PHP_SELF"] . '" method="post">';
        $update_button = '<input name="HIDDEN_modify_ids" type="hidden" value="' . $_POST["HIDDEN_modify_ids"] . '">';
        $update_button .= '<input name="HIDDEN_config_class" type="hidden" value="' . $_POST["HIDDEN_config_class"] . '">';
        $update_button .= '<input name="HIDDEN_selected_attr" type="hidden" value="' . $HIDDEN_selected_attr . '">';
        $update_button .= '<br><div id=buttons>';
        $update_button .= '<input type="Submit" value="yes" name="vererben" align="middle">';
        $update_button .= '&nbsp;<input type=button name="no" onClick="window.location.href=\'' . $_SESSION["go_back_page_ok"] . '\'" value="no">';
        $update_button .= '</div>';
        echo NConf_HTML::limit_space(NConf_HTML::show_highlight('Attention', TXT_UPDATE_SERVICES . '<br>' . $update_button));
        echo "<br>";
        # show inheritance tables
        echo '<div style="float: left; margin-right: 5px;">';
        echo NConf_HTML::title('Show detailed inheritance information');
        echo '</div>';
        echo '<div name="help_inheritance"></div>';
        echo '<div style="clear: both"></div>';
        echo '<div id="page_content"></div>';
        $inheritance_details = '';
        foreach ($preview as $server_name => $service_table) {
            $title = '<span class="ui-icon ui-icon-triangle-1-e"></span><a href="#">' . $server_name . '</a>';
            $inheritance_details .= NConf_HTML::title($title, 3, 'class="accordion_title ui-accordion-header ui-helper-reset ui-state-default"');
            $inheritance_details .= '<div class="accordion_content" style="display:none;">' . $service_table . '</div>';
        }
        # print tables
Beispiel #9
0
###
require_once NCONFDIR . '/include/access_rules.php';
# Show page or EXIT the script ? (based on above auth-checks)
if ($NConf_PERMISSIONS->checkPageAccess() === TRUE and $NConf_PERMISSIONS->checkIdAuthorization() !== FALSE) {
    NConf_DEBUG::set("Access granted", 'DEBUG', "ACL");
    # go ahead in file
} elseif (!isset($_SESSION["group"]) and empty($_GET["goto"])) {
    # not logged in
    # Go to login page, and redirect it to called page
    $url = 'index.php?goto=' . urlencode($_SERVER['REQUEST_URI']);
    # Redirect to login page with url as goto
    echo '<meta http-equiv="refresh" content="0; url=' . $url . '">';
    message($info, '<b>redirecting to:</b> <a href="' . $url . '"> [ this page ] </a>');
    require_once NCONFDIR . '/include/foot.php';
    exit;
} elseif (!isset($_SESSION["group"]) and !empty($_GET["goto"])) {
    # do nothing, login page will be displayed
    message($debug, "display login page");
} else {
    $message = $NConf_PERMISSIONS->message;
    NConf_DEBUG::set($message, 'INFO');
    NConf_DEBUG::set("Access denied", 'DEBUG', "ACL");
    //echo $message;
    echo NConf_HTML::limit_space(NConf_HTML::show_error('Error', $message));
    require_once NCONFDIR . '/include/foot.php';
    # EXIT because of no access
    exit;
}
# close header-part in DEBUG section
$debug_entry = NConf_HTML::line() . NConf_HTML::text("Page specific debugging:", FALSE, 'b');
NConf_DEBUG::set($debug_entry);