Merge branch '2007-Monitorizacion_de_cluster_fase_2_get_cluster_status' into 'develop'
Change id_os number refence and add get_cluster status function in api and CLI - #2007 See merge request artica/pandorafms!1443
This commit is contained in:
commit
522684ad22
|
@ -568,7 +568,7 @@ if ($agents !== false) {
|
|||
|
||||
echo '</span><div class="left actions" style="visibility: hidden; clear: left">';
|
||||
if (check_acl ($config["id_user"], $agent["id_grupo"], "AW")) {
|
||||
if($agent["id_os"] == 21){
|
||||
if($agent["id_os"] == 100){
|
||||
$cluster = db_get_row_sql('select id from tcluster where id_agent = '.$agent['id_agente']);
|
||||
echo '<a href="index.php?sec=reporting&sec2=enterprise/godmode/reporting/cluster_builder&id_cluster='.$cluster['id'].'&step=1&update=1">'.__('Edit').'</a>';
|
||||
echo ' | ';
|
||||
|
@ -580,7 +580,7 @@ if ($agents !== false) {
|
|||
echo ' | ';
|
||||
}
|
||||
}
|
||||
if($agent["id_os"] != 21){
|
||||
if($agent["id_os"] != 100){
|
||||
echo '<a href="index.php?sec=gagente&
|
||||
sec2=godmode/agentes/configurar_agente&tab=module&
|
||||
id_agente='.$agent["id_agente"].'">'.__('Modules').'</a>';
|
||||
|
@ -592,7 +592,7 @@ if ($agents !== false) {
|
|||
id_agente='.$agent["id_agente"].'">'.__('Alerts').'</a>';
|
||||
echo ' | ';
|
||||
|
||||
if($agent["id_os"] == 21){
|
||||
if($agent["id_os"] == 100){
|
||||
echo '<a href="index.php?sec=reporting&sec2=enterprise/godmode/reporting/cluster_view&id='.$cluster['id'].'">'.__('View').'</a>';
|
||||
}
|
||||
else{
|
||||
|
@ -650,7 +650,7 @@ if ($agents !== false) {
|
|||
echo "<a href='index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&
|
||||
enable_agent=".$agent["id_agente"]."&group_id=$ag_group&recursion=$recursion&search=$search&offset=$offsetArg&sort_field=$sortField&sort=$sort&disabled=$disabled'";
|
||||
|
||||
if($agent["id_os"] != 21){
|
||||
if($agent["id_os"] != 100){
|
||||
echo ">";
|
||||
}
|
||||
else{
|
||||
|
@ -662,7 +662,7 @@ if ($agents !== false) {
|
|||
else {
|
||||
echo "<a href='index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&
|
||||
disable_agent=".$agent["id_agente"]."&group_id=$ag_group&recursion=$recursion&search=$search&offset=$offsetArg&sort_field=$sortField&sort=$sort&disabled=$disabled'";
|
||||
if($agent["id_os"] != 21){
|
||||
if($agent["id_os"] != 100){
|
||||
echo ">";
|
||||
}
|
||||
else{
|
||||
|
@ -676,7 +676,7 @@ if ($agents !== false) {
|
|||
echo " <a href='index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&
|
||||
borrar_agente=".$agent["id_agente"]."&group_id=$ag_group&recursion=$recursion&search=$search&offset=$offsetArg&sort_field=$sortField&sort=$sort&disabled=$disabled'";
|
||||
|
||||
if($agent["id_os"] != 21){
|
||||
if($agent["id_os"] != 100){
|
||||
echo ' onClick="if (!confirm(\' '.__('Are you sure?').'\')) return false;">';
|
||||
}
|
||||
else{
|
||||
|
|
|
@ -116,7 +116,7 @@ if ($correctLogin) {
|
|||
|
||||
$id_os = db_get_value_sql('select id_os from tagente where id_agente = '.$id);
|
||||
|
||||
if($id_os == 21){
|
||||
if($id_os == 100){
|
||||
returnError('not_allowed_operation_cluster', $returnType);
|
||||
return false;
|
||||
}
|
||||
|
@ -135,7 +135,7 @@ if ($correctLogin) {
|
|||
|
||||
html_debug($id_os);
|
||||
|
||||
if($id_os == 21){
|
||||
if($id_os == 100){
|
||||
returnError('not_allowed_operation_cluster', $returnType);
|
||||
return false;
|
||||
}
|
||||
|
@ -149,7 +149,7 @@ if ($correctLogin) {
|
|||
|
||||
$id_os = db_get_value_sql('select id_os from tagente where id_agente = (select id_agente from tagente_modulo where id_agente_modulo ='.$id.')');
|
||||
|
||||
if($id_os == 21){
|
||||
if($id_os == 100){
|
||||
returnError('not_allowed_operation_cluster', $returnType);
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -10614,4 +10614,22 @@ function api_set_apply_module_template($id_template, $id_agent, $thrash3, $thras
|
|||
|
||||
}
|
||||
|
||||
?>
|
||||
function api_get_cluster_status($id_cluster, $trash1, $trash2, $returnType) {
|
||||
if (defined ('METACONSOLE')) {
|
||||
return;
|
||||
}
|
||||
|
||||
$sql = "select estado from tagente_estado INNER JOIN tagente_modulo ON tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo and tagente_modulo.nombre = 'Cluster status' and tagente_modulo.id_agente = (select id_agent from tcluster where id = ".$id_cluster.")";
|
||||
|
||||
$value = db_get_value_sql($sql);
|
||||
|
||||
if ($value === false) {
|
||||
returnError('id_not_found', $returnType);
|
||||
}
|
||||
|
||||
$data = array('type' => 'string', 'data' => $value);
|
||||
|
||||
returnData($returnType, $data);
|
||||
}
|
||||
|
||||
?>
|
|
@ -623,7 +623,7 @@ function treeview_printTable($id_agente, $server_data = array(), $no_head = fals
|
|||
if ( $user_access_node && check_acl ($config["id_user"], $agent["id_grupo"], "AW")) {
|
||||
$go_to_agent = '<div style="text-align: right;">';
|
||||
|
||||
if($agent["id_os"] != 21){
|
||||
if($agent["id_os"] != 100){
|
||||
$go_to_agent .= '<a target=_blank href="' . $console_url . 'index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&id_agente='.$id_agente.$url_hash.'">';
|
||||
$go_to_agent .= html_print_submit_button (__('Go to agent edition'), 'upd_button', false, 'class="sub config"', true);
|
||||
}
|
||||
|
|
|
@ -641,7 +641,7 @@ foreach ($agents as $agent) {
|
|||
|
||||
$data[0] .= '<div class="agentleft_' . $agent["id_agente"] . '" style="visibility: hidden; clear: left;">';
|
||||
|
||||
if($agent["id_os"] == 21){
|
||||
if($agent["id_os"] == 100){
|
||||
$data[0] .= '<a href="index.php?sec=reporting&sec2=enterprise/godmode/reporting/cluster_view&id='.$cluster['id'].'">'.__('View').'</a>';
|
||||
}
|
||||
else{
|
||||
|
@ -651,7 +651,7 @@ foreach ($agents as $agent) {
|
|||
if (check_acl ($config['id_user'], $agent["id_grupo"], "AW")) {
|
||||
$data[0] .= ' | ';
|
||||
|
||||
if($agent["id_os"] == 21){
|
||||
if($agent["id_os"] == 100){
|
||||
$data[0] .= '<a href="index.php?sec=reporting&sec2=enterprise/godmode/reporting/cluster_builder&id_cluster='.$cluster['id'].'&step=1&update=1">'.__('Edit').'</a>';
|
||||
}
|
||||
else{
|
||||
|
|
|
@ -135,6 +135,7 @@ sub help_screen{
|
|||
help_screen_line('--delete_cluster', '<id_cluster>', 'Deleting cluster');
|
||||
help_screen_line('--delete_cluster_agent', '<id_agent> <id_cluster>', 'Deleting cluster agent');
|
||||
help_screen_line('--delete_cluster_item', '<id_item>', 'Deleting cluster item');
|
||||
help_screen_line('--get_cluster_status', '<id_cluster>', 'Getting cluster status');
|
||||
print "\nMODULES:\n\n" unless $param ne '';
|
||||
help_screen_line('--create_data_module', "<module_name> <module_type> <agent_name> [<description> <module_group> \n\t <min> <max> <post_process> <interval> <warning_min> <warning_max> <critical_min> <critical_max> \n\t <history_data> <definition_file> <warning_str> <critical_str>\n\t <unknown_events> <ff_threshold> <each_ff> <ff_threshold_normal>\n\t <ff_threshold_warning> <ff_threshold_critical> <ff_timeout> <warning_inverse> <critical_inverse>\n\t <critical_instructions> <warning_instructions> <unknown_instructions>]", 'Add data server module to agent');
|
||||
help_screen_line('--create_web_module', "<module_name> <module_type> <agent_name> [<description> <module_group> \n\t <min> <max> <post_process> <interval> <warning_min> <warning_max> <critical_min> <critical_max> \n\t <history_data> <retries> <requests> <agent_browser_id> <auth_server> <auth_realm> <definition_file>\n\t <proxy_url> <proxy_auth_login> <proxy_auth_password> <warning_str> <critical_str>\n\t <unknown_events> <ff_threshold> <each_ff> <ff_threshold_normal>\n\t <ff_threshold_warning> <ff_threshold_critical> <ff_timeout> <warning_inverse> <critical_inverse>\n\t <critical_instructions> <warning_instructions> <unknown_instructions>].\n\t The valid data types are web_data, web_proc, web_content_data or web_content_string", 'Add web server module to agent');
|
||||
|
@ -6112,7 +6113,10 @@ sub pandora_manage_main ($$$) {
|
|||
param_check($ltotal, 1, 0);
|
||||
cli_delete_cluster_item();
|
||||
}
|
||||
|
||||
elsif ($param eq '--get_cluster_status') {
|
||||
param_check($ltotal, 1, 0);
|
||||
cli_cluster_status();
|
||||
}
|
||||
elsif ($param eq '--migration_agent_queue') {
|
||||
param_check($ltotal, 4, 1);
|
||||
cli_migration_agent_queue();
|
||||
|
@ -6687,3 +6691,22 @@ sub cli_delete_cluster_item() {
|
|||
print "\n0\n";
|
||||
}
|
||||
}
|
||||
|
||||
##############################################################################
|
||||
# get cluster status.
|
||||
# Related option: --get_cluster_status
|
||||
##############################################################################
|
||||
|
||||
sub cli_get_cluster_status() {
|
||||
my ($id) = @ARGV[2..2];
|
||||
|
||||
# Call the API.
|
||||
my $result = api_call( $conf, 'get', 'cluster_status', $id);
|
||||
|
||||
if( defined($result) && "$result" ne "" ){
|
||||
print "\n1\n";
|
||||
}
|
||||
else{
|
||||
print "\n0\n";
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue