Minor fixes and solve issues with module templates
This commit is contained in:
parent
4cb5055488
commit
118099cd24
|
@ -1,20 +1,35 @@
|
|||
<?php
|
||||
/**
|
||||
* Agent Modules Templates.
|
||||
*
|
||||
* @category Module
|
||||
* @package Pandora FMS
|
||||
* @subpackage Agent Configuration
|
||||
* @version 1.0.0
|
||||
* @license See below
|
||||
*
|
||||
* ______ ___ _______ _______ ________
|
||||
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
|
||||
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
|
||||
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
|
||||
*
|
||||
* ============================================================================
|
||||
* Copyright (c) 2005-2023 Artica Soluciones Tecnologicas
|
||||
* Please see http://pandorafms.org for full contribution list
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation for version 2.
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
* ============================================================================
|
||||
*/
|
||||
|
||||
// Pandora FMS - http://pandorafms.com
|
||||
// ==================================================
|
||||
// Copyright (c) 2005-2021 Artica Soluciones Tecnologicas
|
||||
// Please see http://pandorafms.org for full contribution list
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation for version 2.
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
global $config;
|
||||
|
||||
// Load global vars
|
||||
if (!isset($id_agente)) {
|
||||
// Load global vars.
|
||||
if (isset($id_agente) === false) {
|
||||
die('Not Authorized');
|
||||
}
|
||||
|
||||
|
@ -23,8 +38,8 @@ require_once $config['homedir'].'/include/functions_modules.php';
|
|||
// ==========================
|
||||
// TEMPLATE ASSIGMENT LOGIC
|
||||
// ==========================
|
||||
if (isset($_POST['template_id'])) {
|
||||
// Take agent data
|
||||
if (isset($_POST['template_id']) === true) {
|
||||
// Take agent data.
|
||||
$row = db_get_row('tagente', 'id_agente', $id_agente);
|
||||
if ($row !== false) {
|
||||
$intervalo = $row['intervalo'];
|
||||
|
@ -49,7 +64,8 @@ if (isset($_POST['template_id'])) {
|
|||
$npc = [];
|
||||
}
|
||||
|
||||
$success_count = $error_count = 0;
|
||||
$success_count = 0;
|
||||
$error_count = 0;
|
||||
$modules_already_added = [];
|
||||
|
||||
foreach ($npc as $row) {
|
||||
|
@ -60,7 +76,7 @@ if (isset($_POST['template_id'])) {
|
|||
}
|
||||
|
||||
foreach ($nc as $row2) {
|
||||
// Insert each module from tnetwork_component into agent
|
||||
// Insert each module from tnetwork_component into agent.
|
||||
$values = [
|
||||
'id_agente' => $id_agente,
|
||||
'id_tipo_modulo' => $row2['type'],
|
||||
|
@ -113,14 +129,14 @@ if (isset($_POST['template_id'])) {
|
|||
|
||||
$name = $row2['name'];
|
||||
|
||||
// Put tags in array if the component has to add them later
|
||||
if (!empty($row2['tags'])) {
|
||||
// Put tags in array if the component has to add them later.
|
||||
if (empty($row2['tags']) === false) {
|
||||
$tags = explode(',', $row2['tags']);
|
||||
} else {
|
||||
$tags = [];
|
||||
}
|
||||
|
||||
// Check if this module exists in the agent
|
||||
// Check if this module exists in the agent.
|
||||
$module_name_check = db_get_value_filter('id_agente_modulo', 'tagente_modulo', ['delete_pending' => 0, 'nombre' => $name, 'id_agente' => $id_agente]);
|
||||
|
||||
if ($module_name_check !== false) {
|
||||
|
@ -132,13 +148,13 @@ if (isset($_POST['template_id'])) {
|
|||
if ($id_agente_modulo === false) {
|
||||
$error_count++;
|
||||
} else {
|
||||
if (!empty($tags)) {
|
||||
// Creating tags
|
||||
if (empty($tags) === false) {
|
||||
// Creating tags.
|
||||
$tag_ids = [];
|
||||
foreach ($tags as $tag_name) {
|
||||
$tag_id = tags_get_id($tag_name);
|
||||
|
||||
// If tag exists in the system we store to create it
|
||||
// If tag exists in the system we store to create it.
|
||||
$tag_ids[] = $tag_id;
|
||||
}
|
||||
|
||||
|
@ -152,7 +168,7 @@ if (isset($_POST['template_id'])) {
|
|||
}
|
||||
|
||||
if ($error_count > 0) {
|
||||
if (empty($modules_already_added)) {
|
||||
if (empty($modules_already_added) === true) {
|
||||
ui_print_error_message(__('Error adding modules').sprintf(' (%s)', $error_count));
|
||||
} else {
|
||||
ui_print_error_message(__('Error adding modules. The following errors already exists: ').implode(', ', $modules_already_added));
|
||||
|
@ -168,7 +184,7 @@ if (isset($_POST['template_id'])) {
|
|||
// ==========================
|
||||
// TEMPLATE ASSIGMENT FORM
|
||||
// ==========================
|
||||
echo '<form method="post" action="index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=template&id_agente='.$id_agente.'">';
|
||||
echo '<form style="margin: 10px" method="post" action="index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=template&id_agente='.$id_agente.'">';
|
||||
|
||||
$nps = db_get_all_fields_in_table('tnetwork_profile', 'name');
|
||||
if ($nps === false) {
|
||||
|
@ -194,7 +210,7 @@ html_print_div(
|
|||
false,
|
||||
[
|
||||
'icon' => 'wand',
|
||||
'mode' => 'mini',
|
||||
'mode' => 'secondary mini',
|
||||
],
|
||||
true
|
||||
),
|
||||
|
@ -209,35 +225,20 @@ echo '</form>';
|
|||
// ==========================
|
||||
// MODULE VISUALIZATION TABLE
|
||||
// ==========================
|
||||
switch ($config['dbtype']) {
|
||||
case 'mysql':
|
||||
case 'postgresql':
|
||||
$sql = sprintf(
|
||||
'SELECT *
|
||||
FROM tagente_modulo
|
||||
WHERE id_agente = %d AND delete_pending = false
|
||||
ORDER BY id_module_group, nombre',
|
||||
$id_agente
|
||||
);
|
||||
break;
|
||||
|
||||
case 'oracle':
|
||||
$sql = sprintf(
|
||||
'SELECT *
|
||||
FROM tagente_modulo
|
||||
WHERE id_agente = %d
|
||||
AND (delete_pending <> 1 AND delete_pending IS NOT NULL)
|
||||
ORDER BY id_module_group, dbms_lob.substr(nombre,4000,1)',
|
||||
$id_agente
|
||||
);
|
||||
break;
|
||||
}
|
||||
$sql = sprintf(
|
||||
'SELECT *
|
||||
FROM tagente_modulo
|
||||
WHERE id_agente = %d AND delete_pending = false
|
||||
ORDER BY id_module_group, nombre',
|
||||
$id_agente
|
||||
);
|
||||
|
||||
$result = db_get_all_rows_sql($sql);
|
||||
if ($result === false) {
|
||||
$result = [];
|
||||
}
|
||||
|
||||
$table = new stdClass();
|
||||
$table->width = '100%';
|
||||
$table->cellpadding = 0;
|
||||
$table->cellspacing = 0;
|
||||
|
@ -246,10 +247,10 @@ $table->head = [];
|
|||
$table->data = [];
|
||||
$table->align = [];
|
||||
|
||||
$table->head[0] = __('Module name');
|
||||
$table->head[1] = __('Type');
|
||||
$table->head[2] = __('Description');
|
||||
$table->head[3] = __('Action');
|
||||
$table->head[0] = '<span>'.__('Module name').'</span>';
|
||||
$table->head[1] = '<span>'.__('Type').'</span>';
|
||||
$table->head[2] = '<span>'.__('Description').'</span>';
|
||||
$table->head[3] = '<span>'.__('Action').'</span>';
|
||||
|
||||
$table->align[1] = 'left';
|
||||
$table->align[3] = 'left';
|
||||
|
@ -258,25 +259,35 @@ $table->size[1] = '5%';
|
|||
$table->size[3] = '8%';
|
||||
|
||||
foreach ($result as $row) {
|
||||
$table->cellclass[][3] = 'table_action_buttons';
|
||||
|
||||
$data = [];
|
||||
|
||||
$data[0] = '<span>'.$row['nombre'];
|
||||
if ($row['id_tipo_modulo'] > 0) {
|
||||
$data[1] = html_print_image('images/'.modules_show_icon_type($row['id_tipo_modulo']), true, ['border' => '0', 'class' => 'invert_filter']);
|
||||
} else {
|
||||
$data[1] = '';
|
||||
}
|
||||
|
||||
$data[1] = ($row['id_tipo_modulo'] > 0) ? ui_print_moduletype_icon($row['id_tipo_modulo'], true, false, true) : '';
|
||||
$data[2] = mb_substr($row['descripcion'], 0, 60);
|
||||
|
||||
$table->cellclass[][3] = 'table_action_buttons';
|
||||
$data[3] = '<a href="index.php?sec=gagente&tab=module&sec2=godmode/agentes/configurar_agente&tab=template&id_agente='.$id_agente.'&delete_module='.$row['id_agente_modulo'].'">'.html_print_image('images/cross.png', true, ['class' => 'invert_filter', 'border' => '0', 'alt' => __('Delete'), 'onclick' => "if (!confirm('".__('Are you sure?')."')) return false;"]).'</a>';
|
||||
$data[3] .= '<a href="index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&id_agente='.$id_agente.'&tab=module&edit_module=1&id_agent_module='.$row['id_agente_modulo'].'">'.html_print_image('images/config.png', true, ['class' => 'invert_filter', 'border' => '0', 'alt' => __('Update')]).'</a>';
|
||||
$data[3] = html_print_menu_button(
|
||||
[
|
||||
'href' => 'index.php?sec=gagente&tab=module&sec2=godmode/agentes/configurar_agente&tab=template&id_agente='.$id_agente.'&delete_module='.$row['id_agente_modulo'],
|
||||
'image' => 'images/delete.svg',
|
||||
'title' => __('Delete'),
|
||||
'onClick' => 'if (!confirm(\''.__('Are you sure?').'\')) return false;',
|
||||
],
|
||||
true
|
||||
);
|
||||
$data[3] .= html_print_menu_button(
|
||||
[
|
||||
'href' => 'index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&id_agente='.$id_agente.'&tab=module&edit_module=1&id_agent_module='.$row['id_agente_modulo'],
|
||||
'image' => 'images/edit.svg',
|
||||
'title' => __('Edit'),
|
||||
],
|
||||
true
|
||||
);
|
||||
|
||||
array_push($table->data, $data);
|
||||
}
|
||||
|
||||
if (!empty($table->data)) {
|
||||
if (empty($table->data) === false) {
|
||||
html_print_table($table);
|
||||
unset($table);
|
||||
} else {
|
||||
|
|
|
@ -55,26 +55,25 @@ $sec2 = (string) get_parameter('sec2');
|
|||
$filterTable = new stdClass();
|
||||
$filterTable->class = 'fixed_filter_bar';
|
||||
$filterTable->data = [];
|
||||
$filterTable->cellstyle[0][0] = 'flex: 0 1 20%;align-items: center;';
|
||||
$filterTable->data[0][0] = html_print_div([ 'content' => __('Search') ], true);
|
||||
$filterTable->data[0][0] .= html_print_input_text(
|
||||
$filterTable->cellstyle[0][0] = 'width:0';
|
||||
$filterTable->data[0][0] = __('Search');
|
||||
$filterTable->data[1][0] .= html_print_input_text(
|
||||
'search_string',
|
||||
$search_string,
|
||||
'',
|
||||
0,
|
||||
30,
|
||||
255,
|
||||
true,
|
||||
false,
|
||||
false,
|
||||
'',
|
||||
'w100p'
|
||||
''
|
||||
);
|
||||
$filterTable->data[0][0] .= html_print_input_hidden('search', 1, true);
|
||||
|
||||
if ((bool) $policy_page === false) {
|
||||
$filterTable->cellstyle[0][1] = 'flex: 0 1 20%';
|
||||
$filterTable->data[0][1] = html_print_div([ 'content' => __('Show in hierachy mode') ], true);
|
||||
$filterTable->data[0][1] .= html_print_checkbox_switch(
|
||||
$filterTable->data[0][1] = __('Show in hierachy mode');
|
||||
$filterTable->data[1][1] = html_print_checkbox_switch(
|
||||
'status_hierachy_mode',
|
||||
'',
|
||||
((string) $checked === 'true'),
|
||||
|
@ -84,8 +83,7 @@ if ((bool) $policy_page === false) {
|
|||
);
|
||||
}
|
||||
|
||||
$filterTable->cellstyle[0][2] = 'flex: 0 1 60%; justify-content: flex-end;';
|
||||
$filterTable->data[0][2] .= html_print_submit_button(
|
||||
$filterTable->data[1][2] = html_print_submit_button(
|
||||
__('Filter'),
|
||||
'filter',
|
||||
false,
|
||||
|
@ -782,7 +780,7 @@ $url_interval = $url.'&sort_field=interval&sort=';
|
|||
|
||||
$table = new stdClass();
|
||||
$table->width = '100%';
|
||||
$table->class = 'info_table';
|
||||
$table->class = 'tactical_table info_table';
|
||||
$table->head = [];
|
||||
$table->head['checkbox'] = html_print_checkbox(
|
||||
'all_delete',
|
||||
|
@ -791,7 +789,7 @@ $table->head['checkbox'] = html_print_checkbox(
|
|||
true,
|
||||
false
|
||||
);
|
||||
$table->head[0] = __('Name').ui_get_sorting_arrows(
|
||||
$table->head[0] = '<span>'.__('Name').'</span>'.ui_get_sorting_arrows(
|
||||
$url_name.'up',
|
||||
$url_name.'down',
|
||||
$selectNameUp,
|
||||
|
@ -799,40 +797,42 @@ $table->head[0] = __('Name').ui_get_sorting_arrows(
|
|||
);
|
||||
|
||||
// The access to the policy is granted only with AW permission.
|
||||
if ($isFunctionPolicies !== ENTERPRISE_NOT_HOOK && check_acl(
|
||||
if ($isFunctionPolicies !== ENTERPRISE_NOT_HOOK && (bool) check_acl(
|
||||
$config['id_user'],
|
||||
$agent['id_grupo'],
|
||||
'AW'
|
||||
)
|
||||
) === true
|
||||
) {
|
||||
$table->head[1] = "<span title='".__('Policy')."'>".__('P.').'</span>';
|
||||
$table->head[1] = "<span title='".__('Policy')."'>".__('P').'</span>';
|
||||
$table->headstyle[1] = 'width: 4%';
|
||||
}
|
||||
|
||||
$table->head[2] = "<span title='".__('Server')."'>".__('S.').'</span>'.ui_get_sorting_arrows(
|
||||
$table->head[2] = '<span title=\''.__('Server').'\'>'.__('S').'</span>'.ui_get_sorting_arrows(
|
||||
$url_server.'up',
|
||||
$url_server.'down',
|
||||
$selectServerUp,
|
||||
$selectServerDown
|
||||
);
|
||||
$table->head[3] = __('Type').ui_get_sorting_arrows(
|
||||
$table->headstyle[2] = 'width: 8%';
|
||||
$table->head[3] = '<span>'.__('Type').'</span>'.ui_get_sorting_arrows(
|
||||
$url_type.'up',
|
||||
$url_type.'down',
|
||||
$selectTypeUp,
|
||||
$selectTypeDown
|
||||
);
|
||||
$table->head[4] = __('Interval').ui_get_sorting_arrows(
|
||||
$table->headstyle[3] = 'width: 10%';
|
||||
$table->head[4] = '<span>'.__('Interval').'</span>'.ui_get_sorting_arrows(
|
||||
$url_interval.'up',
|
||||
$url_interval.'down',
|
||||
$selectIntervalUp,
|
||||
$selectIntervalDown
|
||||
);
|
||||
$table->head[5] = __('Description');
|
||||
$table->head[6] = __('Status');
|
||||
$table->head[7] = __('Warn');
|
||||
|
||||
|
||||
$table->head[8] = __('Action');
|
||||
$table->head[9] = '<span title="'.__('Delete').'">'.__('Del.').'</span>';
|
||||
$table->headstyle[4] = 'width: 100px';
|
||||
$table->head[5] = '<span>'.__('Description').'</span>';
|
||||
$table->head[6] = '<span>'.__('Status').'</span>';
|
||||
$table->head[7] = '<span>'.__('Warn').'</span>';
|
||||
$table->head[8] = '<span>'.__('Action').'</span>';
|
||||
$table->headstyle[8] = 'width: 15%';
|
||||
|
||||
$table->rowstyle = [];
|
||||
$table->style = [];
|
||||
|
@ -860,7 +860,7 @@ foreach ($tempRows as $row) {
|
|||
$numericModules[$row['id_tipo']] = true;
|
||||
}
|
||||
|
||||
if ($checked) {
|
||||
if ($checked === true) {
|
||||
$modules_hierachy = [];
|
||||
$modules_hierachy = get_hierachy_modules_tree($modules);
|
||||
|
||||
|
@ -892,13 +892,13 @@ foreach ($modules as $module) {
|
|||
$module_interval2 = $module['module_interval'];
|
||||
$module_group2 = $module['id_module_group'];
|
||||
|
||||
if ($module['id_modulo'] == MODULE_DATA && $module['id_policy_module'] != 0) {
|
||||
if ((int) $module['id_modulo'] === MODULE_DATA && (int) $module['id_policy_module'] !== 0) {
|
||||
$nombre_modulo = utf8_decode($module['nombre']);
|
||||
}
|
||||
|
||||
$data = [];
|
||||
|
||||
if (!$checked) {
|
||||
if ($checked === false) {
|
||||
if ($module['id_module_group'] != $last_modulegroup) {
|
||||
$last_modulegroup = $module['id_module_group'];
|
||||
$data[0] = '<strong>'.modules_get_modulegroup_name(
|
||||
|
@ -917,7 +917,7 @@ foreach ($modules as $module) {
|
|||
}
|
||||
}
|
||||
|
||||
if (check_acl_one_of_groups($config['id_user'], $all_groups, 'AW')) {
|
||||
if (check_acl_one_of_groups($config['id_user'], $all_groups, 'AW') === true) {
|
||||
$data['checkbox'] = html_print_checkbox(
|
||||
'id_delete[]',
|
||||
$module['id_agente_modulo'],
|
||||
|
@ -931,7 +931,7 @@ foreach ($modules as $module) {
|
|||
|
||||
$data[0] = '';
|
||||
|
||||
if (isset($module['deep']) && ($module['deep'] != 0)) {
|
||||
if (isset($module['deep']) === true && ((int) $module['deep'] !== 0)) {
|
||||
$data[0] .= str_repeat(' ', $module['deep']);
|
||||
$data[0] .= html_print_image(
|
||||
'images/icono_escuadra.png',
|
||||
|
@ -943,7 +943,7 @@ foreach ($modules as $module) {
|
|||
).' ';
|
||||
}
|
||||
|
||||
if ($module['quiet']) {
|
||||
if ((bool) $module['quiet'] === true) {
|
||||
$data[0] .= html_print_image(
|
||||
'images/dot_blue.png',
|
||||
true,
|
||||
|
@ -955,11 +955,11 @@ foreach ($modules as $module) {
|
|||
).' ';
|
||||
}
|
||||
|
||||
if (check_acl_one_of_groups($config['id_user'], $all_groups, 'AW')) {
|
||||
if (check_acl_one_of_groups($config['id_user'], $all_groups, 'AW') === true) {
|
||||
$data[0] .= '<a href="index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&id_agente='.$id_agente.'&tab=module&edit_module=1&id_agent_module='.$module['id_agente_modulo'].'">';
|
||||
}
|
||||
|
||||
if ($module['disabled']) {
|
||||
if ((bool) $module['disabled'] === true) {
|
||||
$dt_disabled_icon = '';
|
||||
|
||||
$in_planned_downtime = db_get_sql(
|
||||
|
@ -999,30 +999,26 @@ foreach ($modules as $module) {
|
|||
);
|
||||
}
|
||||
|
||||
if (check_acl_one_of_groups($config['id_user'], $all_groups, 'AW')) {
|
||||
if (check_acl_one_of_groups($config['id_user'], $all_groups, 'AW') === true) {
|
||||
$data[0] .= '</a>';
|
||||
}
|
||||
|
||||
// The access to the policy is granted only with AW permission.
|
||||
if ($isFunctionPolicies !== ENTERPRISE_NOT_HOOK && check_acl(
|
||||
if ($isFunctionPolicies !== ENTERPRISE_NOT_HOOK && (bool) check_acl(
|
||||
$config['id_user'],
|
||||
$agent['id_grupo'],
|
||||
'AW'
|
||||
)
|
||||
) === true
|
||||
) {
|
||||
$policyInfo = policies_info_module_policy($module['id_agente_modulo']);
|
||||
if ($policyInfo === false) {
|
||||
$data[1] = '';
|
||||
} else {
|
||||
$linked = policies_is_module_linked($module['id_agente_modulo']);
|
||||
$adopt = policies_is_module_adopt($module['id_agente_modulo']);
|
||||
|
||||
$adopt = false;
|
||||
if (policies_is_module_adopt($module['id_agente_modulo'])) {
|
||||
$adopt = true;
|
||||
}
|
||||
|
||||
if ($linked) {
|
||||
if ($adopt) {
|
||||
if ($linked !== false) {
|
||||
if ($adopt === true) {
|
||||
$img = 'images/policies_brick.png';
|
||||
$title = '('.__('Adopted').') '.$policyInfo['name_policy'];
|
||||
} else {
|
||||
|
@ -1030,7 +1026,7 @@ foreach ($modules as $module) {
|
|||
$title = $policyInfo['name_policy'];
|
||||
}
|
||||
} else {
|
||||
if ($adopt) {
|
||||
if ($adopt === true) {
|
||||
$img = 'images/policies_not_brick.png';
|
||||
$title = '('.__('Unlinked').') ('.__('Adopted').') '.$policyInfo['name_policy'];
|
||||
} else {
|
||||
|
@ -1064,7 +1060,7 @@ foreach ($modules as $module) {
|
|||
);
|
||||
|
||||
// This module is initialized ? (has real data).
|
||||
if ($status == STATUS_MODULE_NO_DATA) {
|
||||
if ($status === STATUS_MODULE_NO_DATA) {
|
||||
$data[2] .= html_print_image(
|
||||
'images/error.png',
|
||||
true,
|
||||
|
@ -1085,7 +1081,7 @@ foreach ($modules as $module) {
|
|||
$data[4] = human_time_description_raw($agent_interval);
|
||||
}
|
||||
|
||||
if ($module['id_modulo'] == MODULE_DATA && $module['id_policy_module'] != 0) {
|
||||
if ((int) $module['id_modulo'] === MODULE_DATA && (int) $module['id_policy_module'] !== 0) {
|
||||
$data[4] .= ui_print_help_tip(
|
||||
__('The policy modules of data type will only update their intervals when policy is applied.'),
|
||||
true
|
||||
|
@ -1152,32 +1148,6 @@ foreach ($modules as $module) {
|
|||
);
|
||||
|
||||
// Make a data normalization.
|
||||
/*
|
||||
if (isset($numericModules[$type]) === true) {
|
||||
if ($numericModules[$type] === true) {
|
||||
$data[8] .= html_print_menu_button(
|
||||
[
|
||||
'href' => 'index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&id_agente='.$id_agente.'&tab=module&fix_module='.$module['id_agente_modulo'],
|
||||
'onClick' => "if (!confirm(\' '.__('Are you sure?').'\')) return false;",
|
||||
'image' => 'images/module-graph.svg',
|
||||
'title' => __('Normalize'),
|
||||
'image_class' => (isset($numericModules[$type]) === false || $numericModules[$type] === false) ? 'alpha50' : 'invert_filter main_menu_icon',
|
||||
],
|
||||
true
|
||||
);
|
||||
}
|
||||
} else {
|
||||
$data[8] .= html_print_image(
|
||||
'images/svg/module-graph.svg',
|
||||
true,
|
||||
[
|
||||
'title' => __('Normalize (Disabled)'),
|
||||
'image_class' => 'opacity: 0.5;',
|
||||
]
|
||||
);
|
||||
$data[8] .= ' ';
|
||||
}
|
||||
*/
|
||||
$data[8] .= html_print_menu_button(
|
||||
[
|
||||
'href' => 'index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&id_agente='.$id_agente.'&tab=module&fix_module='.$module['id_agente_modulo'],
|
||||
|
@ -1191,30 +1161,6 @@ foreach ($modules as $module) {
|
|||
);
|
||||
|
||||
// Create network component action.
|
||||
/*
|
||||
if ((is_user_admin($config['id_user']) === true)
|
||||
&& ((int) $module['id_modulo'] === MODULE_NETWORK)
|
||||
) {
|
||||
$data[8] .= '<a href="index.php?sec=gmodules&sec2=godmode/modules/manage_network_components&create_network_from_module=1&id_agente='.$id_agente.'&create_module_from='.$module['id_agente_modulo'].'"
|
||||
onClick="if (!confirm(\' '.__('Are you sure?').'\')) return false;">';
|
||||
$data[8] .= html_print_image(
|
||||
'images/op_network.png',
|
||||
true,
|
||||
[
|
||||
'title' => __('Create network component'),
|
||||
'class' => 'invert_filter',
|
||||
]
|
||||
);
|
||||
$data[8] .= '</a> ';
|
||||
} else {
|
||||
$data[8] .= html_print_image(
|
||||
'images/network.disabled.png',
|
||||
true,
|
||||
['title' => __('Create network component (Disabled)')]
|
||||
);
|
||||
$data[8] .= ' ';
|
||||
}
|
||||
*/
|
||||
$data[8] .= html_print_menu_button(
|
||||
[
|
||||
'href' => 'index.php?sec=gmodules&sec2=godmode/modules/manage_network_components&create_network_from_module=1&id_agente='.$id_agente.'&create_module_from='.$module['id_agente_modulo'],
|
||||
|
@ -1230,7 +1176,7 @@ foreach ($modules as $module) {
|
|||
|
||||
if (check_acl_one_of_groups($config['id_user'], $all_groups, 'AW') === true) {
|
||||
// Delete module.
|
||||
$data[9] = html_print_menu_button(
|
||||
$data[8] .= html_print_menu_button(
|
||||
[
|
||||
'href' => 'index.php?sec=gagente&tab=module&sec2=godmode/agentes/configurar_agente&id_agente='.$id_agente.'&delete_module='.$module['id_agente_modulo'],
|
||||
'onClick' => "if (!confirm(\' '.__('Are you sure?').'\')) return false;",
|
||||
|
@ -1241,15 +1187,10 @@ foreach ($modules as $module) {
|
|||
);
|
||||
}
|
||||
|
||||
$table->cellclass[] = [
|
||||
8 => 'table_action_buttons',
|
||||
9 => 'table_action_buttons',
|
||||
];
|
||||
// TODO. REVIEW THIS ANNOYING BEHAVIOR.
|
||||
$table->cellclass[] = [8 => 'table_action_buttons'];
|
||||
array_push($table->data, $data);
|
||||
$table->cellclass[] = [
|
||||
8 => 'table_action_buttons',
|
||||
9 => 'table_action_buttons',
|
||||
];
|
||||
$table->cellclass[] = [8 => 'table_action_buttons'];
|
||||
}
|
||||
|
||||
if (check_acl_one_of_groups($config['id_user'], $all_groups, 'AW')) {
|
||||
|
|
|
@ -952,10 +952,9 @@ if (check_login()) {
|
|||
$url_down_status = $url.'&sort_field=status&sort=down&refr=&filter_monitors=1&status_filter_monitor='.$status_filter_monitor.' &status_text_monitor='.$status_text_monitor.'&status_module_group= '.$status_module_group;
|
||||
$url_up_last = $url.'&sort_field=last_contact&sort=up&refr=&filter_monitors=1&status_filter_monitor='.$status_filter_monitor.' &status_text_monitor='.$status_text_monitor.'&status_module_group= '.$status_module_group;
|
||||
$url_down_last = $url.'&sort_field=last_contact&sort=down&refr=&filter_monitors=1&status_filter_monitor='.$status_filter_monitor.' &status_text_monitor='.$status_text_monitor.'&status_module_group= '.$status_module_group;
|
||||
|
||||
// Enterprise policies functions included.
|
||||
$isFunctionPolicies = enterprise_include_once('include/functions_policies.php');
|
||||
|
||||
|
||||
// Table.
|
||||
$table = new stdClass();
|
||||
$table->width = '100%';
|
||||
$table->styleTable = 'border: 0;border-radius: 0;vertical-align: baseline;';
|
||||
|
@ -1083,12 +1082,10 @@ if (check_login()) {
|
|||
}
|
||||
|
||||
// Module server type.
|
||||
// $table->cellstyle[$rowIndex][1] = 'width: 1%;';
|
||||
$data[1] = '';
|
||||
$data[1] .= ui_print_servertype_icon((int) $module['id_modulo']);
|
||||
|
||||
// Module name.
|
||||
// $table->cellstyle[$rowIndex][2] = 'width: 1%;';
|
||||
$data[2] = '';
|
||||
if (isset($module['deep']) === true && ((int) $module['deep'] !== 0)) {
|
||||
$data[2] .= str_repeat(' ', $module['deep']);
|
||||
|
@ -1118,7 +1115,7 @@ if (check_login()) {
|
|||
}
|
||||
|
||||
// Adds relations context information.
|
||||
if (modules_relation_exists($module['id_agente_modulo'])) {
|
||||
if (modules_relation_exists($module['id_agente_modulo']) === true) {
|
||||
$data[2] .= ' <a class="relations_details" href="ajax.php?page=operation/agentes/estado_monitores&get_relations_tooltip=1&id_agente_modulo='.$module['id_agente_modulo'].'">'.html_print_image('images/link2.png', true, ['id' => 'relations-details-'.$module['id_agente_modulo'], 'class' => 'img_help']).'</a> ';
|
||||
}
|
||||
|
||||
|
@ -1127,7 +1124,6 @@ if (check_login()) {
|
|||
$data[3] .= ui_print_string_substr($module['descripcion'], 60, true, 9);
|
||||
|
||||
// Module status.
|
||||
// $table->cellstyle[$rowIndex][4] = 'width: 5%;';
|
||||
$data[4] = '';
|
||||
if ($module['datos'] !== strip_tags($module['datos'])) {
|
||||
$module_value = io_safe_input($module['datos']);
|
||||
|
@ -1156,7 +1152,6 @@ if (check_login()) {
|
|||
}
|
||||
|
||||
// Module thresholds.
|
||||
// $table->cellstyle[$rowIndex][5] = 'width: 10%;';
|
||||
$data[5] = '';
|
||||
if ((int) $module['id_tipo_modulo'] !== 25) {
|
||||
$data[5] = ui_print_module_warn_value($module['max_warning'], $module['min_warning'], $module['str_warning'], $module['max_critical'], $module['min_critical'], $module['str_critical'], $module['warning_inverse'], $module['critical_inverse'], 'class="font_9pt"');
|
||||
|
@ -1165,12 +1160,10 @@ if (check_login()) {
|
|||
}
|
||||
|
||||
// Module last value.
|
||||
// $table->cellstyle[$rowIndex][6] = 'width: 10%;';
|
||||
$data[6] = '';
|
||||
$data[6] .= '<span class="inherited_text_data_for_humans">'.modules_get_agentmodule_data_for_humans($module).'</span>';
|
||||
|
||||
// Last contact.
|
||||
// $table->cellstyle[$rowIndex][7] = 'width: 10%;';
|
||||
$data[7] = '';
|
||||
if ((int) $module['estado'] === 3) {
|
||||
$timestampClass = 'redb font_9pt';
|
||||
|
@ -1181,7 +1174,6 @@ if (check_login()) {
|
|||
$data[7] .= ui_print_timestamp($module['utimestamp'], true, ['class' => $timestampClass ]);
|
||||
|
||||
// Graph buttons.
|
||||
// $table->cellstyle[$rowIndex][8] = 'width: 100px;';
|
||||
$data[8] = '';
|
||||
if ((int) $module['history_data'] === 1) {
|
||||
if (empty((float) $module['min_warning']) === true
|
||||
|
@ -1346,16 +1338,17 @@ if (check_login()) {
|
|||
/* ]]> */
|
||||
</script>
|
||||
<?php
|
||||
if (empty($table->data)) {
|
||||
if ($filter_monitors) {
|
||||
ui_print_info_message([ 'no_close' => true, 'message' => __('Any monitors aren\'t with this filter.') ]);
|
||||
} else {
|
||||
ui_print_info_message([ 'no_close' => true, 'message' => __('This agent doesn\'t have any active monitors.') ]);
|
||||
}
|
||||
if (empty($table->data) === true) {
|
||||
ui_print_info_message(
|
||||
[
|
||||
'no_close' => true,
|
||||
'message' => ($filter_monitors === true) ? __('Any monitors aren\'t with this filter.') : __('This agent doesn\'t have any active monitors.'),
|
||||
]
|
||||
);
|
||||
} else {
|
||||
$url = 'index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente='.$id_agente.'&refr=&filter_monitors=1&status_filter_monitor='.$status_filter_monitor.'&status_text_monitor='.$status_text_monitor.'&status_module_group='.$status_module_group;
|
||||
|
||||
if ($paginate_module) {
|
||||
if ($paginate_module === true) {
|
||||
ui_pagination(
|
||||
$count_modules,
|
||||
false,
|
||||
|
@ -1375,7 +1368,7 @@ if (check_login()) {
|
|||
|
||||
html_print_table($table);
|
||||
|
||||
if ($paginate_module) {
|
||||
if ($paginate_module === true) {
|
||||
ui_pagination(
|
||||
$count_modules,
|
||||
false,
|
||||
|
@ -1398,7 +1391,7 @@ if (check_login()) {
|
|||
unset($table_data);
|
||||
}
|
||||
|
||||
if ($get_type) {
|
||||
if ($get_type === true) {
|
||||
$id_module = (int) get_parameter('id_module');
|
||||
$module = modules_get_agentmodule($id_module);
|
||||
$graph_type = return_graphtype($module['id_tipo_modulo']);
|
||||
|
@ -1652,7 +1645,7 @@ if (check_login()) {
|
|||
|
||||
// If not valid it will throw an exception.
|
||||
json_decode($response);
|
||||
if (json_last_error() == JSON_ERROR_NONE) {
|
||||
if (json_last_error() === JSON_ERROR_NONE) {
|
||||
// If valid dump.
|
||||
echo $response;
|
||||
} else {
|
||||
|
|
|
@ -10764,6 +10764,7 @@ pre.external_tools_output {
|
|||
width: -moz-fill-available;
|
||||
}
|
||||
|
||||
/*
|
||||
.fixed_filter_bar tr {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
|
@ -10777,7 +10778,7 @@ pre.external_tools_output {
|
|||
align-self: center;
|
||||
justify-content: flex-start;
|
||||
}
|
||||
|
||||
*/
|
||||
.fixed_filter_bar td > div {
|
||||
margin-right: 10px;
|
||||
font-size: 10pt;
|
||||
|
|
Loading…
Reference in New Issue