Delete clusters, agents and modules - #1748
This commit is contained in:
parent
5dbf0eabbd
commit
4358f37e07
|
@ -40,7 +40,7 @@ ui_print_info_message ( array('no_close'=>true, 'message'=> __('There are no cl
|
|||
echo __('<b>Clusters to guarantee service</b>: these are active - passive (A/P) mode clusters. It means that one of the nodes (or machines that make up the cluster) will be running (primary) and another won\'t (secondary). When the primary goes down, the secondary must take over and give the service instead. Although many of the elements of this cluster are active-passive, it will also have active elements in both of them that indicate that the passive node is "online", so that in the case of a service failure in the master, the active node collects this information.');
|
||||
|
||||
?></p>
|
||||
<form action="index.php?sec=reporting&sec2=godmode/reporting/cluster_builder" method="post">
|
||||
<form action="index.php?sec=reporting&sec2=godmode/reporting/cluster_builder&step=1" method="post">
|
||||
<input type="submit" class="button_task" value="<?php echo __('Create Cluster'); ?>" />
|
||||
</form>
|
||||
</div>
|
||||
|
|
|
@ -157,10 +157,7 @@ echo '<div id="steps_clean"> </div>';
|
|||
|
||||
if($step == 1){
|
||||
|
||||
if ($edit_cluster)
|
||||
echo "<form method='post' action='index.php?sec=reporting&sec2=godmode/reporting/cluster_builder&edit_cluster=1&update_cluster=1&id=" . $id_cluster . "'>";
|
||||
else
|
||||
echo "<form method='post' action='index.php?sec=reporting&sec2=godmode/reporting/cluster_builder&edit_cluster=1&add_cluster=1'>";
|
||||
echo "<form method='post' action='index.php?sec=reporting&sec2=godmode/reporting/cluster_builder&add_cluster=1&step=1'>";
|
||||
|
||||
echo "<table width='40%' cellpadding=4 cellspacing=4 class='databox filters'>";
|
||||
echo "<tr>";
|
||||
|
@ -222,7 +219,7 @@ elseif($step == 2){
|
|||
|
||||
echo "<tr>";
|
||||
echo "<td class='datos'>";
|
||||
// $attr = array('id' => 'image-select_all_available', 'title' => __('Select all'), 'style' => 'cursor: pointer;');
|
||||
$attr = array('id' => 'select_all_left_agents', 'title' => __('Select all'), 'style' => 'cursor: pointer;');
|
||||
echo "<b>" . __('Agents')."</b> " . html_print_image ('images/tick.png', true, $attr, false, true);
|
||||
echo "</td>";
|
||||
|
||||
|
@ -230,7 +227,7 @@ elseif($step == 2){
|
|||
echo "</td>";
|
||||
|
||||
echo "<td class='datos'>";
|
||||
// $attr = array('id' => 'image-select_all_apply', 'title' => __('Select all'), 'style' => 'cursor: pointer;');
|
||||
$attr = array('id' => 'select_all_right_agents', 'title' => __('Select all'), 'style' => 'cursor: pointer;');
|
||||
echo "<b>" . __('Agents in Cluster')."</b> " . html_print_image ('images/tick.png', true, $attr, false, true);
|
||||
echo "</td>";
|
||||
echo "<tr>";
|
||||
|
@ -293,7 +290,7 @@ elseif ($step == 3) {
|
|||
|
||||
echo "<tr>";
|
||||
echo "<td class='datos'>";
|
||||
// $attr = array('id' => 'image-select_all_available', 'title' => __('Select all'), 'style' => 'cursor: pointer;');
|
||||
$attr = array('id' => 'select_all_left_modules', 'title' => __('Select all'), 'style' => 'cursor: pointer;');
|
||||
echo "<b>" . __('Common in agents')."</b> " . html_print_image ('images/tick.png', true, $attr, false, true);
|
||||
echo "</td>";
|
||||
|
||||
|
@ -301,7 +298,7 @@ elseif ($step == 3) {
|
|||
echo "</td>";
|
||||
|
||||
echo "<td class='datos'>";
|
||||
// $attr = array('id' => 'image-select_all_apply', 'title' => __('Select all'), 'style' => 'cursor: pointer;');
|
||||
$attr = array('id' => 'select_all_right_modules', 'title' => __('Select all'), 'style' => 'cursor: pointer;');
|
||||
echo "<b>" . __('Added common modules')."</b> " . html_print_image ('images/tick.png', true, $attr, false, true);
|
||||
echo "</td>";
|
||||
echo "<tr>";
|
||||
|
@ -408,7 +405,7 @@ elseif ($step == 5) {
|
|||
|
||||
echo "<tr>";
|
||||
echo "<td class='datos'>";
|
||||
// $attr = array('id' => 'image-select_all_available', 'title' => __('Select all'), 'style' => 'cursor: pointer;');
|
||||
$attr = array('id' => 'select_all_left_modules', 'title' => __('Select all'), 'style' => 'cursor: pointer;');
|
||||
echo "<b>" . __('Modules')."</b> " . html_print_image ('images/tick.png', true, $attr, false, true);
|
||||
echo "</td>";
|
||||
|
||||
|
@ -416,7 +413,7 @@ elseif ($step == 5) {
|
|||
echo "</td>";
|
||||
|
||||
echo "<td class='datos'>";
|
||||
// $attr = array('id' => 'image-select_all_apply', 'title' => __('Select all'), 'style' => 'cursor: pointer;');
|
||||
$attr = array('id' => 'select_all_right_modules', 'title' => __('Select all'), 'style' => 'cursor: pointer;');
|
||||
echo "<b>" . __('Added balanced modules')."</b> " . html_print_image ('images/tick.png', true, $attr, false, true);
|
||||
echo "</td>";
|
||||
echo "<tr>";
|
||||
|
@ -713,20 +710,35 @@ elseif ($step == 6) {
|
|||
refresh_agents($(this).val(), agents_out_keys, agents_out, $("#id_agents"), <?php if (is_metaconsole()) echo 1; else echo 0; ?>);
|
||||
});
|
||||
|
||||
$("input[name='select_all_left']").click(function () {
|
||||
$("#select_all_left_agents").click(function () {
|
||||
$('#id_agents option').map(function() {
|
||||
$(this).prop('selected', true);
|
||||
});
|
||||
|
||||
return false;
|
||||
});
|
||||
$("input[name='select_all_right']").click(function () {
|
||||
$("#select_all_right_agents").click(function () {
|
||||
$('#id_agents2 option').map(function() {
|
||||
$(this).prop('selected', true);
|
||||
});
|
||||
|
||||
return false;
|
||||
});
|
||||
|
||||
$("#select_all_left_modules").click(function () {
|
||||
$('#name_modules option').map(function() {
|
||||
$(this).prop('selected', true);
|
||||
});
|
||||
|
||||
return false;
|
||||
});
|
||||
$("#select_all_right_modules").click(function () {
|
||||
$('#name_modules2 option').map(function() {
|
||||
$(this).prop('selected', true);
|
||||
});
|
||||
|
||||
return false;
|
||||
});
|
||||
|
||||
$("#agent_right").click (function () {
|
||||
jQuery.each($("select[name='id_agents[]'] option:selected"), function (key, value) {
|
||||
|
@ -902,9 +914,9 @@ elseif ($step == 6) {
|
|||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
});
|
||||
|
|
|
@ -26,11 +26,12 @@ if (! check_acl ($config['id_user'], 0, "RW") && ! check_acl ($config['id_user']
|
|||
require_once ('include/functions_agents.php');
|
||||
require_once('include/functions_clusters.php');
|
||||
|
||||
$step = get_parameter('step',1);
|
||||
$step = get_parameter('step',0);
|
||||
$id_cluster = get_parameter('id_cluster',0);
|
||||
$delete_cluster = get_parameter('delete_cluster',0);
|
||||
|
||||
if($step == 1){
|
||||
|
||||
|
||||
$add_cluster = (bool) get_parameter('add_cluster', false);
|
||||
$update_cluster = (bool) get_parameter('update_cluster', false);
|
||||
|
||||
|
@ -70,7 +71,8 @@ if ($add_cluster) {
|
|||
'nombre' => 'Cluster status',
|
||||
'id_modulo' => 5,
|
||||
'prediction_module' => 5,
|
||||
'id_agente' =>$id_agent
|
||||
'id_agente' =>$id_agent,
|
||||
'custom_integer_1' =>$id_cluster
|
||||
);
|
||||
|
||||
$id_module = db_process_sql_insert('tagente_modulo', $values_module);
|
||||
|
@ -168,7 +170,8 @@ elseif ($step == 3) {
|
|||
'id_modulo' => 5,
|
||||
'prediction_module' => 6,
|
||||
'id_agente' => $id_agent[0]['id_agent'],
|
||||
'parent_module_id' => $id_parent_modulo[0]['id_agente_modulo']
|
||||
'parent_module_id' => $id_parent_modulo[0]['id_agente_modulo'],
|
||||
'custom_integer_1' =>$id_cluster
|
||||
);
|
||||
|
||||
$id_module = db_process_sql_insert('tagente_modulo', $values_module);
|
||||
|
@ -239,7 +242,7 @@ elseif ($step == 3) {
|
|||
header ("Location: index.php?sec=reporting&sec2=godmode/reporting/cluster_builder&step=5&id_cluster=".$id_cluster);
|
||||
}
|
||||
elseif ($cluster_type[$id_cluster] == 'AA') {
|
||||
header ("Location: index.php?sec=estado&sec2=enterprise/operation/cluster/cluster");
|
||||
header ("Location: index.php?sec=reporting&sec2=godmode/reporting/cluster_view&id=".$id_cluster);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -273,7 +276,8 @@ elseif ($step == 3) {
|
|||
'id_modulo' => 5,
|
||||
'prediction_module' => 7,
|
||||
'id_agente' => $id_agent[0]['id_agent'],
|
||||
'parent_module_id' => $id_parent_modulo[0]['id_agente_modulo']
|
||||
'parent_module_id' => $id_parent_modulo[0]['id_agente_modulo'],
|
||||
'custom_integer_1' =>$id_cluster
|
||||
);
|
||||
|
||||
$id_module = db_process_sql_insert('tagente_modulo', $values_module);
|
||||
|
@ -335,9 +339,22 @@ elseif ($step == 3) {
|
|||
ui_print_page_header (__('Cluster')." » ".__('New'), "images/chart.png", false, "", false, $buttons);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
elseif ($delete_cluster){
|
||||
|
||||
$temp_id_cluster = db_process_sql('select id_agent from tcluster where id ='.$delete_cluster);
|
||||
|
||||
$tcluster_modules_delete = db_process_sql('delete from tagente_modulo where custom_integer_1 = '.$delete_cluster);
|
||||
|
||||
$tcluster_items_delete = db_process_sql('delete from tcluster_item where id_cluster = '.$delete_cluster);
|
||||
|
||||
$tcluster_agents_delete = db_process_sql('delete from tcluster_agent where id_cluster = '.$delete_cluster);
|
||||
|
||||
$tcluster_delete = db_process_sql('delete from tcluster where id = '.$delete_cluster);
|
||||
|
||||
$tcluster_agent_delete = db_process_sql('delete from tagente where id_agente = '.$temp_id_cluster[0]['id_agent']);
|
||||
|
||||
header ("Location: index.php?sec=reporting&sec2=enterprise/operation/cluster/cluster");
|
||||
}
|
||||
|
||||
$active_tab = get_parameter('tab', 'main');
|
||||
|
||||
|
|
|
@ -34,20 +34,41 @@ ui_pagination (count($clusters));
|
|||
$table->class = 'databox data';
|
||||
$table->align = array ();
|
||||
$table->head = array ();
|
||||
$table->head[0] = __('Cluster name');
|
||||
$table->head[1] = __('Description');
|
||||
$table->head[2] = __('Cluster type');
|
||||
$table->head[3] = __('Number of A/A modules');
|
||||
$table->head[4] = __('Number of A/P modules');
|
||||
$table->head[5] = __('Group');
|
||||
$table->head[6] = __('Actions');
|
||||
$table->size[0] = '25%';
|
||||
$table->head[0] = __('Cluster name') . ' ' .
|
||||
'<a href="index.php?sec=estado&sec2=enterprise/operation/cluster/cluster&offset=' . $offset . '&group_id=' . $group_id . '&recursion=' . $recursion . '&search=' . $search . '&status='. $status . '&sort_field=name&sort=up">' . html_print_image("images/sort_up.png", true, array("style" => $selectNameUp, "alt" => "up")) . '</a>' .
|
||||
'<a href="index.php?sec=estado&sec2=enterprise/operation/cluster/cluster&offset=' . $offset . '&group_id=' . $group_id . '&recursion=' . $recursion . '&search=' . $search . '&status='. $status . '&sort_field=name&sort=down">' . html_print_image("images/sort_down.png", true, array("style" => $selectNameDown, "alt" => "down")) . '</a>';
|
||||
$table->head[1] = __('Description') . ' ' .
|
||||
'<a href="index.php?sec=estado&sec2=enterprise/operation/cluster/cluster&offset=' . $offset . '&group_id=' . $group_id . '&recursion=' . $recursion . '&search=' . $search . '&status='. $status . '&sort_field=description&sort=up">' . html_print_image("images/sort_up.png", true, array("style" => $selectNameUp, "alt" => "up")) . '</a>' .
|
||||
'<a href="index.php?sec=estado&sec2=enterprise/operation/cluster/cluster&offset=' . $offset . '&group_id=' . $group_id . '&recursion=' . $recursion . '&search=' . $search . '&status='. $status . '&sort_field=description&sort=down">' . html_print_image("images/sort_down.png", true, array("style" => $selectNameDown, "alt" => "down")) . '</a>';
|
||||
|
||||
$table->head[2] = __('Group') . ' ' .
|
||||
'<a href="index.php?sec=estado&sec2=enterprise/operation/cluster/cluster&offset=' . $offset . '&group_id=' . $group_id . '&recursion=' . $recursion . '&search=' . $search . '&status='. $status . '&sort_field=group&sort=up">' . html_print_image("images/sort_up.png", true, array("style" => $selectNameUp, "alt" => "up")) . '</a>' .
|
||||
'<a href="index.php?sec=estado&sec2=enterprise/operation/cluster/cluster&offset=' . $offset . '&group_id=' . $group_id . '&recursion=' . $recursion . '&search=' . $search . '&status='. $status . '&sort_field=group&sort=down">' . html_print_image("images/sort_down.png", true, array("style" => $selectNameDown, "alt" => "down")) . '</a>';
|
||||
|
||||
$table->head[3] = __('Type') . ' ' .
|
||||
'<a href="index.php?sec=estado&sec2=enterprise/operation/cluster/cluster&offset=' . $offset . '&group_id=' . $group_id . '&recursion=' . $recursion . '&search=' . $search . '&status='. $status . '&sort_field=type&sort=up">' . html_print_image("images/sort_up.png", true, array("style" => $selectNameUp, "alt" => "up")) . '</a>' .
|
||||
'<a href="index.php?sec=estado&sec2=enterprise/operation/cluster/cluster&offset=' . $offset . '&group_id=' . $group_id . '&recursion=' . $recursion . '&search=' . $search . '&status='. $status . '&sort_field=type&sort=down">' . html_print_image("images/sort_down.png", true, array("style" => $selectNameDown, "alt" => "down")) . '</a>';
|
||||
|
||||
|
||||
$table->head[4] = __('Nodes') . ' ' .
|
||||
'<a href="index.php?sec=estado&sec2=enterprise/operation/cluster/cluster&offset=' . $offset . '&group_id=' . $group_id . '&recursion=' . $recursion . '&search=' . $search . '&status='. $status . '&sort_field=name&sort=up">' . html_print_image("images/sort_up.png", true, array("style" => $selectNameUp, "alt" => "up")) . '</a>' .
|
||||
'<a href="index.php?sec=estado&sec2=enterprise/operation/cluster/cluster&offset=' . $offset . '&group_id=' . $group_id . '&recursion=' . $recursion . '&search=' . $search . '&status='. $status . '&sort_field=name&sort=down">' . html_print_image("images/sort_down.png", true, array("style" => $selectNameDown, "alt" => "down")) . '</a>';
|
||||
|
||||
$table->head[5] = __('Status') . ' ' .
|
||||
'<a href="index.php?sec=estado&sec2=enterprise/operation/cluster/cluster&offset=' . $offset . '&group_id=' . $group_id . '&recursion=' . $recursion . '&search=' . $search . '&status='. $status . '&sort_field=name&sort=up">' . html_print_image("images/sort_up.png", true, array("style" => $selectNameUp, "alt" => "up")) . '</a>' .
|
||||
'<a href="index.php?sec=estado&sec2=enterprise/operation/cluster/cluster&offset=' . $offset . '&group_id=' . $group_id . '&recursion=' . $recursion . '&search=' . $search . '&status='. $status . '&sort_field=name&sort=down">' . html_print_image("images/sort_down.png", true, array("style" => $selectNameDown, "alt" => "down")) . '</a>';
|
||||
|
||||
$table->head[6] = __('Actions') . ' ' .
|
||||
'<a href="index.php?sec=estado&sec2=enterprise/operation/cluster/cluster&offset=' . $offset . '&group_id=' . $group_id . '&recursion=' . $recursion . '&search=' . $search . '&status='. $status . '&sort_field=actions&sort=up">' . html_print_image("images/sort_up.png", true, array("style" => $selectNameUp, "alt" => "up")) . '</a>' .
|
||||
'<a href="index.php?sec=estado&sec2=enterprise/operation/cluster/cluster&offset=' . $offset . '&group_id=' . $group_id . '&recursion=' . $recursion . '&search=' . $search . '&status='. $status . '&sort_field=action&sort=down">' . html_print_image("images/sort_down.png", true, array("style" => $selectNameDown, "alt" => "down")) . '</a>';
|
||||
|
||||
$table->size[0] = '25%';
|
||||
$table->size[1] = '25%';
|
||||
$table->size[2] = '10%';
|
||||
$table->size[3] = '10%';
|
||||
$table->size[4] = '15%';
|
||||
$table->size[5] = '10%';
|
||||
$table->size[5] = '5%';
|
||||
$table->size[6] = '5%';
|
||||
$table->align[2] = 'left';
|
||||
$table->align[3] = 'left';
|
||||
|
||||
|
@ -58,32 +79,30 @@ ui_pagination (count($clusters));
|
|||
|
||||
$data[0] = '<a href="index.php?sec=reporting&sec2=godmode/reporting/cluster_view&id='.$cluster["id"].'">'.$cluster["name"].'</a>';
|
||||
$data[1] = ui_print_truncate_text($cluster["description"], 70);
|
||||
$data[2] = $cluster["cluster_type"];
|
||||
|
||||
$data[2] = ui_print_group_icon($cluster['group'],true);
|
||||
|
||||
$data[3] = $cluster["cluster_type"];
|
||||
|
||||
$aa_modules_cluster = db_process_sql('select count(*) as number from tcluster_item where id_cluster = '.$cluster['id'].' and item_type = "AA"');
|
||||
|
||||
$data[3] = $aa_modules_cluster[0]['number'];
|
||||
$nodes_cluster = db_process_sql('select count(*) as number from tcluster_agent where id_cluster = '.$cluster['id']);
|
||||
|
||||
$data[4] = $nodes_cluster[0]['number'];
|
||||
|
||||
$cluster_agent = db_process_sql('select id_agente from tagente where id_agente = (select id_agent from tcluster where id = '.$cluster['id'].')');
|
||||
|
||||
$cluster_agent_status = agents_get_status($cluster_agent[0]['id_agente']);
|
||||
|
||||
$data[5] = $cluster_agent_status;
|
||||
|
||||
if($cluster['cluster_type'] == 'AP'){
|
||||
$ap_modules_cluster = db_process_sql('select count(*) as number from tcluster_item where id_cluster = '.$cluster['id'].' and item_type = "AP"');
|
||||
|
||||
$data[4] = $ap_modules_cluster[0]['number'];
|
||||
}
|
||||
else{
|
||||
$data[4] = 'AA clusters do not have AP modules';
|
||||
}
|
||||
|
||||
$data[5] = ui_print_group_icon($cluster['group'],true);
|
||||
|
||||
$data[6] = "<a href='index.php?sec=reporting&sec2=godmode/reporting/cluster_builder&step=4&delete_module=".$key."&id_cluster=".$id_cluster."'><img src='images/cross.png'></a>
|
||||
<a href='index.php?sec=reporting&sec2=godmode/reporting/cluster_builder&step=4&delete_module=".$key."&id_cluster=".$id_cluster."'><img src='images/builder.png'></a>";
|
||||
$data[6] = "<a href='index.php?sec=reporting&sec2=godmode/reporting/cluster_builder&delete_cluster=".$cluster["id"]."'><img src='images/cross.png'></a>
|
||||
<a href='index.php?sec=reporting&sec2=godmode/reporting/cluster_builder.cluster_editor&id=".$cluster["id"]."'><img src='images/builder.png'></a>";
|
||||
|
||||
array_push ($table->data, $data);
|
||||
}
|
||||
|
||||
html_print_table($table);
|
||||
|
||||
echo '<form method="post" style="float:right;" action="index.php?sec=reporting&sec2=godmode/reporting/cluster_builder">';
|
||||
echo '<form method="post" style="float:right;" action="index.php?sec=reporting&sec2=godmode/reporting/cluster_builder&step=1">';
|
||||
html_print_submit_button (__('Create cluster'), 'create', false, 'class="sub next" style="margin-right:5px;"');
|
||||
echo "</form>";
|
||||
|
||||
|
|
|
@ -71,6 +71,6 @@ echo "<table style='width:100%;'>";
|
|||
echo "</table>";
|
||||
|
||||
|
||||
echo 'El estado del modulo del cluster '.clusters_get_name($id_cluster).' es '.modules_get_agentmodule_last_status(40);
|
||||
echo 'El estado del modulo del cluster '.clusters_get_name($id_cluster).' es '.agents_get_status(40);
|
||||
|
||||
?>
|
|
@ -269,8 +269,6 @@ INSERT INTO `ttipo_modulo` VALUES
|
|||
(31,'web_proc',9,'Remote HTTP module to check server response','mod_web_proc.png'),
|
||||
(32,'web_content_data',9,'Remote HTTP module to retrieve numeric data','mod_web_data.png'),
|
||||
(33,'web_content_string',9,'Remote HTTP module to retrieve string data','mod_web_data.png'),
|
||||
(34,'cluster_proc',69,'Boolean cluster module','mod_cluster_proc.png'),
|
||||
(35,'cluster_data',69,'Numeric cluster module','mod_cluster_data.png'),
|
||||
(100,'keep_alive',-1,'KeepAlive','mod_keepalive.png');
|
||||
|
||||
--
|
||||
|
|
Loading…
Reference in New Issue