mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-29 08:45:12 +02:00
Cluster view, change creation and delete agent module method - #1748
This commit is contained in:
parent
c14e68e0e8
commit
0808b2bf07
@ -24,6 +24,7 @@ if (! check_acl ($config['id_user'], 0, "RW") && ! check_acl ($config['id_user']
|
||||
}
|
||||
|
||||
require_once ('include/functions_agents.php');
|
||||
require_once ('include/functions_modules.php');
|
||||
require_once('include/functions_clusters.php');
|
||||
|
||||
$step = get_parameter('step',0);
|
||||
@ -53,7 +54,9 @@ if ($add_cluster) {
|
||||
|
||||
if (trim($name) != "") {
|
||||
|
||||
$id_agent = db_process_sql_insert('tagente',$values_agent);
|
||||
// $id_agent = db_process_sql_insert('tagente',$values_agent);
|
||||
|
||||
$id_agent = agents_create_agent($values_agent['nombre'],$values_agent['id_grupo'],300,'127.0.0.1',$values_agent);
|
||||
|
||||
// Create cluster
|
||||
$values_cluster = array(
|
||||
@ -75,6 +78,8 @@ if ($add_cluster) {
|
||||
'custom_integer_1' =>$id_cluster
|
||||
);
|
||||
|
||||
$id_module = modules_create_agent_module($values_module['id_agente'],$values_module['nombre'],$values_module);
|
||||
|
||||
$id_module = db_process_sql_insert('tagente_modulo', $values_module);
|
||||
|
||||
if ($id_cluster !== false)
|
||||
@ -177,8 +182,11 @@ elseif ($step == 3) {
|
||||
'custom_integer_2' =>$tcluster_module
|
||||
);
|
||||
|
||||
$id_module = db_process_sql_insert('tagente_modulo', $values_module);
|
||||
|
||||
$id_module = modules_create_agent_module($values_module['id_agente'],$values_module['nombre'],$values_module);
|
||||
|
||||
// $id_module = db_process_sql_insert('tagente_modulo', $values_module);
|
||||
|
||||
if ($tcluster_module !== false){
|
||||
db_pandora_audit("Report management", "Module #$value assigned to cluster #$id_cluster");
|
||||
}
|
||||
@ -191,7 +199,15 @@ elseif ($step == 3) {
|
||||
foreach ($modules_preasigned as $key => $value) {
|
||||
|
||||
if(!in_array($value['name'],$cluster_modules)){
|
||||
$tcluster_module_delete = db_process_sql('delete from tcluster_item where name = "'.$value['name'].'" and id_cluster = '.$id_cluster);
|
||||
|
||||
$tcluster_agent_module_delete_id = db_process_sql('select id_agente_modulo from tagente_modulo where nombre = "'.$value['name'].'" and custom_integer_1 = '.$id_cluster.' and prediction_module = 6');
|
||||
|
||||
$tcluster_agent_module_delete_id_value = $tcluster_agent_module_delete_id[0]['id_agente_modulo'];
|
||||
|
||||
$tcluster_agent_module_delete_result = modules_delete_agent_module($tcluster_agent_module_delete_id_value);
|
||||
|
||||
$tcluster_module_delete = db_process_sql('delete from tcluster_item where name = "'.$value['name'].'" and id_cluster = '.$id_cluster.' and item_type = "AA"');
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@ -286,7 +302,9 @@ elseif ($step == 3) {
|
||||
'custom_integer_2' => $tcluster_balanced_module
|
||||
);
|
||||
|
||||
$id_module = db_process_sql_insert('tagente_modulo', $values_module);
|
||||
// $id_module = db_process_sql_insert('tagente_modulo', $values_module);
|
||||
|
||||
$id_module = modules_create_agent_module($values_module['id_agente'],$values_module['nombre'],$values_module);
|
||||
|
||||
if ($tcluster_balanced_module !== false){
|
||||
db_pandora_audit("Report management", "Module #$value assigned to cluster #$id_cluster");
|
||||
@ -300,6 +318,13 @@ elseif ($step == 3) {
|
||||
foreach ($balanced_modules_preasigned as $key => $value) {
|
||||
|
||||
if(!in_array($value['name'],$balanced_modules)){
|
||||
|
||||
$tcluster_agent_module_delete_id = db_process_sql('select id_agente_modulo from tagente_modulo where nombre = "'.$value['name'].'" and custom_integer_1 = '.$id_cluster.' and prediction_module = 7');
|
||||
|
||||
$tcluster_agent_module_delete_id_value = $tcluster_agent_module_delete_id[0]['id_agente_modulo'];
|
||||
|
||||
$tcluster_agent_module_delete_result = modules_delete_agent_module($tcluster_agent_module_delete_id_value);
|
||||
|
||||
$tcluster_balanced_module_delete = db_process_sql('delete from tcluster_item where name = "'.$value['name'].'" and id_cluster = '.$id_cluster.' and item_type = "AP"');
|
||||
}
|
||||
|
||||
|
@ -77,7 +77,8 @@ ui_pagination (count($clusters));
|
||||
foreach ($clusters as $cluster) {
|
||||
$data = array ();
|
||||
|
||||
$data[0] = '<a href="index.php?sec=reporting&sec2=godmode/reporting/cluster_view&id='.$cluster["id"].'">'.$cluster["name"].'</a>';
|
||||
$data[0] = '<a href="index.php?sec=reporting&sec2=godmode/reporting/cluster_view&id='.$cluster["id"].'">'.$cluster["name"].' - Enlace Map Dani (Mapa de red)</a><br><br>'.
|
||||
'<a href="index.php?sec=reporting&sec2=godmode/reporting/cluster_view_2&id='.$cluster["id"].'">'.$cluster["name"].' - Enlace Enrique (pantalla informativa)</a>';
|
||||
$data[1] = ui_print_truncate_text($cluster["description"], 70);
|
||||
|
||||
$data[2] = ui_print_group_icon($cluster['group'],true);
|
||||
@ -88,19 +89,32 @@ ui_pagination (count($clusters));
|
||||
|
||||
$data[4] = $nodes_cluster[0]['number'];
|
||||
|
||||
//agent status - open
|
||||
|
||||
$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']);
|
||||
|
||||
switch ($cluster_agent_status) {
|
||||
//agent status - close
|
||||
|
||||
|
||||
//cluster module status - open
|
||||
|
||||
$cluster_module = db_process_sql('select id_agente_modulo from tagente_modulo where id_agente = (select id_agent from tcluster where id = '.$cluster['id'].') and nombre = "Cluster status"');
|
||||
|
||||
$cluster_module_status = modules_get_status($cluster_module[0]['id_agente_modulo']);
|
||||
|
||||
//cluster module status - close
|
||||
|
||||
switch ($cluster_module_status) {
|
||||
case 1:
|
||||
|
||||
$data[5] = '<div title="'.__('Critical').'" style="width:35px;height:20px;background-color:red;"></div>';
|
||||
|
||||
break;
|
||||
case 1:
|
||||
case 2:
|
||||
|
||||
$data[5] = '<div title="'.__('Warning').'" style="width:35px;height:20px;background-color:red;"></div>';
|
||||
$data[5] = '<div title="'.__('Warning').'" style="width:35px;height:20px;background-color:yellow;"></div>';
|
||||
|
||||
break;
|
||||
case 3:
|
||||
|
91
pandora_console/godmode/reporting/cluster_view_2.php
Normal file
91
pandora_console/godmode/reporting/cluster_view_2.php
Normal file
@ -0,0 +1,91 @@
|
||||
<?php
|
||||
|
||||
global $config;
|
||||
|
||||
check_login ();
|
||||
|
||||
if (! check_acl ($config['id_user'], 0, "AR")) {
|
||||
db_pandora_audit("ACL Violation", "Trying to access agent main list view");
|
||||
require ("general/noaccess.php");
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
require_once ('include/functions_agents.php');
|
||||
require_once('include/functions_clusters.php');
|
||||
|
||||
$id_cluster = get_parameter('id',0);
|
||||
|
||||
$buttons['list'] = array('active' => false,
|
||||
'text' => '<a href="index.php?sec=estado&sec2=enterprise/operation/cluster/cluster">' .
|
||||
html_print_image("images/list.png", true, array ("title" => __('Clusters list'))) .'</a>');
|
||||
|
||||
|
||||
$buttons['editor'] = array('active' => false,
|
||||
'text' => '<a href="index.php?sec=estado&sec2=godmode/reporting/cluster_builder.cluster_editor&id='.$id_cluster.'">' .
|
||||
html_print_image("images/gm_setup.png", true, array ("title" => __('Cluster editor'))) .'</a>');
|
||||
|
||||
|
||||
ui_print_page_header ( __("Cluster detail").' » '.clusters_get_name($id_cluster), "images/agent_mc.png", false, "agent_status", false, $buttons);
|
||||
|
||||
|
||||
|
||||
echo "<table style='width:100%;border: 1px black solid;'>";
|
||||
echo "<tr>";
|
||||
|
||||
echo "<td style='border:1px solid black;min-width:800px;min-height:800px;vertical-align: top;'>";
|
||||
echo "<div id='cluster_map' style='width:600px;height:600px;'></div>";
|
||||
echo "</td>";
|
||||
|
||||
|
||||
|
||||
|
||||
echo "<td style='min-width:600px;min-height:600px;vertical-align: top;background-color:blue;'>";
|
||||
|
||||
echo "<div style='width:50%;min-width:400px;background-color:red;float:left;'>";
|
||||
|
||||
echo "<div style='float:left;width:100px;margin-left:20px;margin-top:20px;font-size:2em;text-align:center;'>".__('CLUSTER STATUS')."</div>";
|
||||
echo "<div style='float:left;width:100px;margin-left:20px;margin-top:20px;height:50px;background-color:#82b92e;'></div>";
|
||||
|
||||
echo "<div style='border:1px solid lightgray;float:left;width:350px;margin-left:20px;margin-top:20px;height:200px;margin-bottom:20px;'>";
|
||||
|
||||
echo "<div style='float:left;width:100%;height:25px;background-color:#373737;text-align:center;'><span style='color:#e7e9ea;display:block;margin:5px;font-size:1.5em;'>".__('Balanced modules')."</span></div>";
|
||||
|
||||
echo "<div style='float:left;width:100%;height:175px;background-color:orange;text-align:center;'>";
|
||||
|
||||
$balanced_modules_in = items_get_cluster_items_id_name($id_cluster,'AP');
|
||||
|
||||
html_debug($balanced_modules_in);
|
||||
|
||||
echo "</div>";
|
||||
|
||||
echo "</div>";
|
||||
|
||||
echo "</div>";
|
||||
|
||||
echo "<div style='width:50%;background-color:orange;float:right;'>";
|
||||
//
|
||||
// echo "<div style='float:left;width:100px;px;margin-top:20px;font-size:2em;text-align:center;'>".__('LAST UPDATE')."</div>";
|
||||
// echo "<div style='float:left;width:220px;margin-left:20px;margin-top:30px;font-size:1.5em;text-align:center;'>88 Hours 88 Min 88 sec ago</div>";
|
||||
|
||||
echo "</div>";
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
echo "</td>";
|
||||
|
||||
echo "</tr>";
|
||||
|
||||
echo "<tr>";
|
||||
echo "<td colspan='2' style='min-width:600px;min-height:600px;vertical-align: top;'>
|
||||
<div id='cluster_modules' style='min-height:150px;'></div>
|
||||
</td>";
|
||||
echo "</tr>";
|
||||
echo "</table>";
|
||||
|
||||
|
||||
echo 'El estado del modulo del cluster '.clusters_get_name($id_cluster).' es '.agents_get_status(40);
|
||||
|
||||
?>
|
Loading…
x
Reference in New Issue
Block a user