Merge branch 'ent-3770-texto-del-pandora-diag' into 'develop'
Ent 3770 texto del pandora diag Closes pandora_enterprise#3529, pandora_enterprise#1744, pandora_enterprise#3305, pandora_enterprise#3121, and pandora_enterprise#3252 See merge request artica/pandorafms!2393 Former-commit-id: d78409acd362ebc5308495c359344f5b706685cd
This commit is contained in:
commit
7c3e883c01
|
@ -122,7 +122,7 @@ function execution_time()
|
|||
if ($times[0]['datos'] > ($times[1]['datos'] * 1.2)) {
|
||||
return "<a class= 'content' style= 'color: red;'>Warning Status</a><a>   The execution time could be degrading. For a more extensive information of this data consult the Execution Time graph</a>";
|
||||
} else {
|
||||
return "<a style ='color: green;'>Normal Status</a><a>   The execution time is correct. For a more extensive information of this data consult the Execution Time graph</a>";
|
||||
return "<a style ='color: green;'>Normal Status</a><a>   The execution time is correct. For more information about this data, check the Execution Time graph</a>";
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -173,9 +173,9 @@ function license_capacity()
|
|||
$status_license_capacity = '';
|
||||
$current_count = db_get_value_sql('SELECT count(*) FROM tagente');
|
||||
if ($current_count > ($license_limit * 90 / 100)) {
|
||||
$status_license_capacity = "<a class= 'content' style= 'color: red;text-decoration: none;'>Warning Status</a><a style ='text-decoration: none;'>   The license capacity is more than 90 percent</a>";
|
||||
$status_license_capacity = "<a class= 'content' style= 'color: red;text-decoration: none;'>Warning Status</a><a style ='text-decoration: none;'>   License capacity exceeds 90 percent</a>";
|
||||
} else {
|
||||
$status_license_capacity = "<a style= 'color: green;text-decoration: none;'>Normal Status</a><a style ='text-decoration: none;'>   The license capacity is less than 90 percent</a>";
|
||||
$status_license_capacity = "<a style= 'color: green;text-decoration: none;'>Normal Status</a><a style ='text-decoration: none;'>   License capacity is less than 90 percent</a>";
|
||||
}
|
||||
|
||||
return $status_license_capacity;
|
||||
|
@ -202,9 +202,9 @@ function interval_average_of_network_modules()
|
|||
$average_time = ((int) $total_module_interval_time / $total_network_modules);
|
||||
|
||||
if ($average_time < 180) {
|
||||
$status_average_modules = "<a class= 'content' style= 'color: red;text-decoration: none;'>Warning Status</a><a style ='text-decoration: none;'>   The system has a lot of load (average time $average_time) and a very fine configuration is required</a>";
|
||||
$status_average_modules = "<a class= 'content' style= 'color: red;text-decoration: none;'>Warning Status</a><a style ='text-decoration: none;'>   The system is overloaded (average time $average_time) and a very fine configuration is required</a>";
|
||||
} else {
|
||||
$status_average_modules = "<a style ='color: green;text-decoration: none;'>Normal Status</a><a style ='text-decoration: none;'>   The system has an acceptable charge (average time $average_time) </a>";
|
||||
$status_average_modules = "<a style ='color: green;text-decoration: none;'>Normal Status</a><a style ='text-decoration: none;'>   The system is not overloaded (average time $average_time) </a>";
|
||||
}
|
||||
|
||||
if ($average_time == 0) {
|
||||
|
@ -221,9 +221,9 @@ $attachment_total_files = count(glob($config['homedir'].'/attachment/{*.*}', GLO
|
|||
function files_attachment_folder($total_files)
|
||||
{
|
||||
if ($total_files <= 700) {
|
||||
$status_total_files = "<a style ='color: green;text-decoration: none;'>Normal Status</a><a style ='text-decoration: none;'>   The attachment folder has less than 700 files.</a>";
|
||||
$status_total_files = "<a style ='color: green;text-decoration: none;'>Normal Status</a><a style ='text-decoration: none;'>   The attached folder contains less than 700 files.</a>";
|
||||
} else {
|
||||
$status_total_files = "<a class= 'content' style= 'color: red;text-decoration: none;'>Warning Status</a><a style ='text-decoration: none;'>   The attachment folder has more than 700 files.</a>";
|
||||
$status_total_files = "<a class= 'content' style= 'color: red;text-decoration: none;'>Warning Status</a><a style ='text-decoration: none;'>   The attached folder contains more than 700 files.</a>";
|
||||
}
|
||||
|
||||
return $status_total_files;
|
||||
|
@ -236,9 +236,9 @@ $tagente_datos_size = db_get_value_sql('SELECT COUNT(*) FROM tagente_datos');
|
|||
function status_tagente_datos($tagente_datos_size)
|
||||
{
|
||||
if ($tagente_datos_size <= 3000000) {
|
||||
$tagente_datos_size = "<a style ='color: green;text-decoration: none;'>Normal Status</a><a style ='text-decoration: none;'>   The tagente_datos table has an acceptable amount of data.</a>";
|
||||
$tagente_datos_size = "<a style ='color: green;text-decoration: none;'>Normal Status</a><a style ='text-decoration: none;'>   The tagente_datos table contains an acceptable amount of data.</a>";
|
||||
} else {
|
||||
$tagente_datos_size = "<a class= 'content' style ='color: red;text-decoration: none;'>Warning Status</a><a>   The tagente_datos table has too much data. A historical database is recommended.</a>";
|
||||
$tagente_datos_size = "<a class= 'content' style ='color: red;text-decoration: none;'>Warning Status</a><a>   The tagente_datos table contains too much data. A historical database is recommended.</a>";
|
||||
}
|
||||
|
||||
return $tagente_datos_size;
|
||||
|
@ -302,9 +302,9 @@ function status_fragmentation_tables($tables_fragmentation_max_rec_value, $table
|
|||
{
|
||||
$status_tables_frag = '';
|
||||
if ($tables_fragmentation > $tables_fragmentation_max_rec_value) {
|
||||
$status_tables_frag = "<a class= 'content' style ='color: red; text-decoration: none;'>Warning Status</a><a style ='text-decoration: none;'>   The fragmentation tables is higher than recommended. You should defragment them.</a>";
|
||||
$status_tables_frag = "<a class= 'content' style ='color: red; text-decoration: none;'>Warning Status</a><a style ='text-decoration: none;'>   Table fragmentation is higher than recommended. They should be defragmented.</a>";
|
||||
} else {
|
||||
$status_tables_frag = "<a style ='color: green; text-decoration: none;'>Normal Status</a><a style ='text-decoration: none;'>   The fragmentation tables is correct.</a>";
|
||||
$status_tables_frag = "<a style ='color: green; text-decoration: none;'>Normal Status</a><a style ='text-decoration: none;'>   Table fragmentation is correct.</a>";
|
||||
}
|
||||
|
||||
return $status_tables_frag;
|
||||
|
@ -320,9 +320,9 @@ if ($console_mode == 1) {
|
|||
echo "\nPandora FMS PHP diagnostic tool v3.2 (c) Artica ST 2009-2010 \n";
|
||||
|
||||
if ($argc == 1 || in_array($argv[1], ['--help', '-help', '-h', '-?'])) {
|
||||
echo "\nThis command line script gives information about Pandora FMS database.
|
||||
This program only can be executed from console, and need a parameter, the
|
||||
full path to Pandora FMS 'config.php' file.
|
||||
echo "\nThis command line script contains information about Pandora FMS database.
|
||||
This program can only be executed from the console, and it needs a parameter, the
|
||||
full path to Pandora FMS 'config.php' file.
|
||||
|
||||
Usage:
|
||||
php pandora_diag.php path_to_pandora_console
|
||||
|
@ -705,7 +705,7 @@ render_info_data(
|
|||
|
||||
render_row($tables_fragmentation_max_rec_value.'%', 'Tables fragmentation (maximum recommended value)');
|
||||
render_row(number_format($tables_fragmentation, 2).'%', 'Tables fragmentation (current value)');
|
||||
render_row(status_fragmentation_tables($tables_fragmentation_max_rec_value, $tables_fragmentation), 'Status fragmentation tables');
|
||||
render_row(status_fragmentation_tables($tables_fragmentation_max_rec_value, $tables_fragmentation), 'Table fragmentation status');
|
||||
|
||||
echo "<tr><th style='background-color:#b1b1b1;font-weight:bold;font-style:italic;border-radius:2px;' align=center colspan='2'>".__(' Pandora FMS logs dates').'</th></tr>';
|
||||
|
||||
|
@ -734,14 +734,14 @@ render_info_data(
|
|||
|
||||
echo "<tr><th style='background-color:#b1b1b1;font-weight:bold;font-style:italic;border-radius:2px;' align=center colspan='2'>".__(' Status of the attachment folder').'</th></tr>';
|
||||
|
||||
render_row($attachment_total_files, 'Total files in the attachment folder');
|
||||
render_row($attachment_total_files, 'Total files in the attached folder');
|
||||
render_row(files_attachment_folder($attachment_total_files), 'Status of the attachment folder');
|
||||
|
||||
echo "<tr><th style='background-color:#b1b1b1;font-weight:bold;font-style:italic;border-radius:2px;' align=center colspan='2'>".__(' Information from the tagente_datos table').'</th></tr>';
|
||||
|
||||
render_row($tagente_datos_size, 'Total data in the tagente_datos table');
|
||||
render_row(status_tagente_datos($tagente_datos_size), 'Status of the tagente_datos table');
|
||||
render_row(execution_time(), 'Degradation of the execution time when executing a count');
|
||||
render_row($tagente_datos_size, 'Total data in tagente_datos table');
|
||||
render_row(status_tagente_datos($tagente_datos_size), 'Tangente_datos table status');
|
||||
render_row(execution_time(), 'Execution time degradation when executing a count');
|
||||
|
||||
echo "<tr><th style='background-color:#b1b1b1;font-weight:bold;font-style:italic;border-radius:2px;' align=center colspan='2'>".__(' Pandora FMS server threads').'</th></tr>';
|
||||
|
||||
|
@ -784,6 +784,6 @@ render_info_data(
|
|||
echo "<hr color='#b1b1b1' size=1 width=1000 align=left>";
|
||||
|
||||
echo '<span>'.__(
|
||||
'(*) Please check your Pandora Server setup and be sure that database maintenance daemon is running. It\' very important to
|
||||
keep up-to-date database to get the best performance and results in Pandora'
|
||||
'(*) Please check your Pandora Server setup and make sure that the database maintenance daemon is running. It\' is very important to
|
||||
keep the database up-to-date to get the best performance and results in Pandora'
|
||||
).'</span><br><br><br>';
|
||||
|
|
|
@ -594,11 +594,11 @@ class HostDevices extends Wizard
|
|||
if (isset($this->page) === false
|
||||
|| $this->page == 0
|
||||
) {
|
||||
|
||||
// Comment input
|
||||
$comment_input ='<div class="label_select"><label>'.__('Comment').':</label></div>';
|
||||
$comment_input = '<div class="label_select"><label>'.__('Comment').':</label></div>';
|
||||
|
||||
$comment_input .= $this->printInput([
|
||||
$comment_input .= $this->printInput(
|
||||
[
|
||||
'name' => 'comment',
|
||||
'rows' => 1,
|
||||
'columns' => 1,
|
||||
|
@ -606,36 +606,41 @@ class HostDevices extends Wizard
|
|||
'type' => 'textarea',
|
||||
'size' => 25,
|
||||
'class' => 'discovery_textarea_input',
|
||||
'return' => true
|
||||
]);
|
||||
'return' => true,
|
||||
]
|
||||
);
|
||||
|
||||
// Task input
|
||||
$taskname_input_label = '<div class="label_select"><label>'.__('Task name').':</label></div>';
|
||||
|
||||
$taskname_input = $this->printInput([
|
||||
$taskname_input = $this->printInput(
|
||||
[
|
||||
'name' => 'taskname',
|
||||
'value' => $this->task['name'],
|
||||
'type' => 'text',
|
||||
'size' => 25,
|
||||
'class' => 'discovery_full_width_input'
|
||||
]);
|
||||
'class' => 'discovery_full_width_input',
|
||||
]
|
||||
);
|
||||
|
||||
// Network input
|
||||
$network_input_label .= '<div class="label_select discovery_label_hint"><label>'.__('Network').':</label>'.ui_print_help_tip(__('You can specify several networks, separated by commas, for example: 192.168.50.0/24,192.168.60.0/24'), true).'</div>';
|
||||
|
||||
$network_input = $this->printInput([
|
||||
$network_input = $this->printInput(
|
||||
[
|
||||
'name' => 'network',
|
||||
'value' => $this->task['subnet'],
|
||||
'type' => 'text',
|
||||
'size' => 25,
|
||||
'class' => 'discovery_full_width_input',
|
||||
]);
|
||||
|
||||
]
|
||||
);
|
||||
|
||||
// Discovery server input
|
||||
$discovery_server_select_label = '<div class="label_select discovery_label_hint"><label>'.__('Discovery server').':</label>'.ui_print_help_tip(__('You must select a Discovery Server to run the Task, otherwise the Recon Task will never run'), true).'</div>';
|
||||
|
||||
$discovery_server_select = $this->printInput([
|
||||
$discovery_server_select = $this->printInput(
|
||||
[
|
||||
'type' => 'select_from_sql',
|
||||
'sql' => sprintf(
|
||||
'SELECT id_server, name
|
||||
|
@ -648,7 +653,8 @@ class HostDevices extends Wizard
|
|||
'selected' => $this->task['id_recon_server'],
|
||||
'return' => true,
|
||||
'style' => 'width: 100%',
|
||||
]);
|
||||
]
|
||||
);
|
||||
|
||||
// Interval input
|
||||
$interv_manual = 0;
|
||||
|
@ -658,7 +664,8 @@ class HostDevices extends Wizard
|
|||
|
||||
$interval_input_label = '<div class="label_select discovery_label_hint" style="padding-top: 6px;"><label>'.__('Interval').':</label>'.ui_print_help_tip(__('Manual interval means that it will run only on demand.'), true).'</div>';
|
||||
|
||||
$interval_input = $this->printInput([
|
||||
$interval_input = $this->printInput(
|
||||
[
|
||||
'type' => 'select',
|
||||
'selected' => $interv_manual,
|
||||
'fields' => [
|
||||
|
@ -667,8 +674,9 @@ class HostDevices extends Wizard
|
|||
],
|
||||
'name' => 'interval_manual_defined',
|
||||
'return' => true,
|
||||
'style' => 'float: right;'
|
||||
]);
|
||||
'style' => 'float: right;',
|
||||
]
|
||||
);
|
||||
|
||||
$interval_input_extra = '<span id="interval_manual_container">'.html_print_extended_select_for_time(
|
||||
'interval',
|
||||
|
@ -685,11 +693,11 @@ class HostDevices extends Wizard
|
|||
true
|
||||
).'</span>';
|
||||
|
||||
|
||||
// Group select
|
||||
$group_select = '<div class="label_select"><label>'.__('Group').':</label></div>';
|
||||
|
||||
$group_select .= $this->printInput([
|
||||
$group_select .= $this->printInput(
|
||||
[
|
||||
'name' => 'id_group',
|
||||
'returnAllGroup' => false,
|
||||
'privilege' => 'PM',
|
||||
|
@ -699,15 +707,18 @@ class HostDevices extends Wizard
|
|||
'class' => 'discovery_list_input',
|
||||
'size' => 9,
|
||||
'simple_multiple_options' => true,
|
||||
]);
|
||||
]
|
||||
);
|
||||
|
||||
if (isset($this->task['id_rt']) === true) {
|
||||
//Propagate ID
|
||||
$task_hidden = $this->printInput([
|
||||
// Propagate ID
|
||||
$task_hidden = $this->printInput(
|
||||
[
|
||||
'name' => 'task',
|
||||
'value' => $this->task['id_rt'],
|
||||
'type' => 'hidden'
|
||||
]);
|
||||
'type' => 'hidden',
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
$task_url = '';
|
||||
|
@ -725,32 +736,20 @@ class HostDevices extends Wizard
|
|||
|
||||
// XXX: Could be improved validating inputs before continue (JS)
|
||||
// Print NetScan page 0.
|
||||
//$this->printForm($form);
|
||||
|
||||
// $this->printForm($form);
|
||||
echo '<form action="'.$this->url.'&mode=netscan&page='.($this->page + 1).$task_url.'" method="POST">';
|
||||
echo $task_hidden;
|
||||
|
||||
echo '<div class="white_box">
|
||||
<div class="edit_discovery_info" style="margin-bottom: 15px;">
|
||||
<div style="width: 25%; padding: 9px;">'
|
||||
.'<div style="height: 50%; margin-bottom: 35px;">'.html_print_image ("images/wizard/netscan_green.png", true, array ("title" => __('Close'), "style" => 'width: 60%;'), false).'</div>'
|
||||
.'<div class="edit_discovery_input"><div style="display: flex;">'.$interval_input_label.'<div style="margin-left: 15 px; width: 50%;">'.$interval_input.'</div></div>'.$interval_input_extra.'</div>'
|
||||
.'</div>
|
||||
<div style="width: 25%; padding: 9px;">'.'<div style="height: 50%; margin-bottom: 35px;">'.html_print_image('images/wizard/netscan_green.png', true, ['title' => __('Close'), 'style' => 'width: 60%;'], false).'</div>'.'<div class="edit_discovery_input"><div style="display: flex;">'.$interval_input_label.'<div style="margin-left: 15 px; width: 50%;">'.$interval_input.'</div></div>'.$interval_input_extra.'</div>'.'</div>
|
||||
|
||||
<div style="width: 40%; padding-left: 5%; padding-right: 12%;">
|
||||
<div class="edit_discovery_input">'.$taskname_input_label.'<div class="discovery_text_input">'.$taskname_input.'</div></div>'
|
||||
.'<div class="edit_discovery_input discovery_select_input">'.$discovery_server_select_label.$discovery_server_select.'<div class="discovery_hint"></div></div>'
|
||||
.'<div class="edit_discovery_input">'.$network_input_label.'<div class="discovery_text_input">'.$network_input.'</div></div>'
|
||||
.'</div>'
|
||||
.'<div style="width: 35%;">'.$group_select.'</div>'
|
||||
.'</div>'
|
||||
|
||||
.'<div class="edit_discovery_info">
|
||||
<div class="edit_discovery_input">'.$taskname_input_label.'<div class="discovery_text_input">'.$taskname_input.'</div></div>'.'<div class="edit_discovery_input discovery_select_input">'.$discovery_server_select_label.$discovery_server_select.'<div class="discovery_hint"></div></div>'.'<div class="edit_discovery_input">'.$network_input_label.'<div class="discovery_text_input">'.$network_input.'</div></div>'.'</div>'.'<div style="width: 35%;">'.$group_select.'</div>'.'</div>'.'<div class="edit_discovery_info">
|
||||
<div style="width: 100%;">
|
||||
'.$comment_input.'
|
||||
</div>
|
||||
</div>'
|
||||
.'</div>';
|
||||
</div>'.'</div>';
|
||||
|
||||
$str = __('Next');
|
||||
|
||||
|
@ -778,7 +777,6 @@ class HostDevices extends Wizard
|
|||
}).change();
|
||||
|
||||
</script>';
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -661,22 +661,25 @@ class Wizard
|
|||
$output_submit = '';
|
||||
$output = '';
|
||||
|
||||
if ($print_white_box === true)
|
||||
if ($print_white_box === true) {
|
||||
$output .= '<div class="white_box">';
|
||||
}
|
||||
|
||||
$output .= '<ul class="wizard">';
|
||||
|
||||
foreach ($inputs as $input) {
|
||||
if ($input['arguments']['type']!='submit')
|
||||
if ($input['arguments']['type'] != 'submit') {
|
||||
$output .= $this->printBlock($input, true);
|
||||
else
|
||||
} else {
|
||||
$output_submit .= $this->printBlock($input, true);
|
||||
}
|
||||
}
|
||||
|
||||
$output .= '</ul>';
|
||||
|
||||
if ($print_white_box === true)
|
||||
if ($print_white_box === true) {
|
||||
$output .= '</div>';
|
||||
}
|
||||
|
||||
$output .= '<ul class="wizard">'.$output_submit.'</ul>';
|
||||
$output .= '</form>';
|
||||
|
|
|
@ -37,6 +37,9 @@ $api_password = get_parameter('apipass', '');
|
|||
$password = get_parameter('pass', '');
|
||||
$user = get_parameter('user', '');
|
||||
$info = get_parameter('info', '');
|
||||
|
||||
$other = parseOtherParameter($otherSerialize, $otherMode);
|
||||
|
||||
$other = parseOtherParameter($otherSerialize, $otherMode);
|
||||
$apiPassword = io_output_password(db_get_value_filter('value', 'tconfig', ['token' => 'api_password']));
|
||||
|
||||
|
@ -104,6 +107,7 @@ if ($correctLogin) {
|
|||
if ($op == 'set' && $id) {
|
||||
switch ($op2) {
|
||||
case 'update_agent':
|
||||
|
||||
case 'add_module_in_conf':
|
||||
case 'update_module_in_conf':
|
||||
case 'delete_module_in_conf':
|
||||
|
@ -184,6 +188,7 @@ if ($correctLogin) {
|
|||
break;
|
||||
|
||||
default:
|
||||
|
||||
// break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,36 +1,19 @@
|
|||
<?php
|
||||
/**
|
||||
* Extension to manage a list of gateways and the node address where they should
|
||||
* point to.
|
||||
*
|
||||
* @category API
|
||||
* @package Pandora FMS
|
||||
* @subpackage Community
|
||||
* @version 1.0.0
|
||||
* @license See below
|
||||
*
|
||||
* ______ ___ _______ _______ ________
|
||||
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
|
||||
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
|
||||
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
|
||||
*
|
||||
* ============================================================================
|
||||
* Copyright (c) 2005-2019 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-2009 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 Lesser General Public License
|
||||
// as published by the Free Software Foundation; 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;
|
||||
|
||||
// Set character encoding to UTF-8
|
||||
// fixes a lot of multibyte character headaches.
|
||||
// Set character encoding to UTF-8 - fixes a lot of multibyte character headaches
|
||||
require_once 'functions_agents.php';
|
||||
require_once 'functions_modules.php';
|
||||
require_once $config['homedir'].'/include/functions_profile.php';
|
||||
|
@ -254,7 +237,7 @@ function returnData($returnType, $data, $separator=';')
|
|||
case 'json':
|
||||
$data = array_apply_io_safe_output($data);
|
||||
header('Content-type: application/json');
|
||||
// Allows extra parameters to json_encode, like JSON_FORCE_OBJECT.
|
||||
// Allows extra parameters to json_encode, like JSON_FORCE_OBJECT
|
||||
if ($separator == ';') {
|
||||
$separator = null;
|
||||
}
|
||||
|
@ -559,6 +542,7 @@ $module_field_column_mampping = [
|
|||
'module_critical_inverse' => 'critical_inverse as module_critical_inverse',
|
||||
'module_warning_inverse' => 'warning_inverse as module_warning_inverse',
|
||||
];
|
||||
|
||||
// module related field mappings 2/2 (output field => column for 'tagente_estado')
|
||||
// module_id_agent_modulo is not in this list
|
||||
$estado_fields_to_columns_mapping = [
|
||||
|
@ -3030,20 +3014,21 @@ function api_get_policy_modules($thrash1, $thrash2, $other, $thrash3)
|
|||
|
||||
|
||||
/**
|
||||
* Create a network module in agent.
|
||||
* And return the id_agent_module of new module.
|
||||
* Create a network module in agent. And return the id_agent_module of new module.
|
||||
*
|
||||
* @param string $id Name of agent to add the module.
|
||||
* @param string $thrash1 Don't use.
|
||||
* @param array $other It's array, $other as param is <name_module>;<disabled>;<id_module_type>;
|
||||
* @param $thrash1 Don't use.
|
||||
* @param array $other it's array, $other as param is <name_module>;<disabled>;<id_module_type>;
|
||||
* <id_module_group>;<min_warning>;<max_warning>;<str_warning>;<min_critical>;<max_critical>;<str_critical>;<ff_threshold>;
|
||||
* <history_data>;<ip_target>;<module_port>;<snmp_community>;<snmp_oid>;<module_interval>;<post_process>;
|
||||
* <min>;<max>;<custom_id>;<description>;<disabled_types_event>;<module_macros>;
|
||||
* <each_ff>;<ff_threshold_normal>;<ff_threshold_warning>;<ff_threshold_critical>; in this order
|
||||
* and separator char (after text ; ) and separator (pass in param othermode as othermode=url_encode_separator_<separator>).
|
||||
* @param string $thrash3 Don't use.
|
||||
* @example: api.php?op=set&op2=create_network_module&id=pepito&other=prueba|0|7|1|10|15|0|16|18|0|15|0|www.google.es|0||0|180|0|0|0|0|latency%20ping&other_mode=url_encode_separator_|*
|
||||
* @return mixed Return.
|
||||
* and separator char (after text ; ) and separator (pass in param othermode as othermode=url_encode_separator_<separator>)
|
||||
* example:
|
||||
*
|
||||
* api.php?op=set&op2=create_network_module&id=pepito&other=prueba|0|7|1|10|15|0|16|18|0|15|0|www.google.es|0||0|180|0|0|0|0|latency%20ping&other_mode=url_encode_separator_|
|
||||
*
|
||||
* @param $thrash3 Don't use
|
||||
*/
|
||||
function api_set_create_network_module($id, $thrash1, $other, $thrash3)
|
||||
{
|
||||
|
@ -3105,23 +3090,22 @@ function api_set_create_network_module($id, $thrash1, $other, $thrash3)
|
|||
'min_ff_event_critical' => $other['data'][27],
|
||||
'critical_inverse' => $other['data'][28],
|
||||
'warning_inverse' => $other['data'][29],
|
||||
'ff_type' => $other['data'][30],
|
||||
];
|
||||
|
||||
if (! $values['descripcion']) {
|
||||
$values['descripcion'] = '';
|
||||
// Column 'descripcion' cannot be null.
|
||||
// Column 'descripcion' cannot be null
|
||||
}
|
||||
|
||||
if (! $values['module_macros']) {
|
||||
$values['module_macros'] = '';
|
||||
// Column 'module_macros' cannot be null.
|
||||
// Column 'module_macros' cannot be null
|
||||
}
|
||||
|
||||
$idModule = modules_create_agent_module($idAgent, $name, $values, true);
|
||||
|
||||
if (is_error($idModule)) {
|
||||
// TODO: Improve the error returning more info.
|
||||
// TODO: Improve the error returning more info
|
||||
returnError('error_create_network_module', __('Error in creation network module.'));
|
||||
} else {
|
||||
returnData('string', ['type' => 'string', 'data' => $idModule]);
|
||||
|
@ -3238,7 +3222,6 @@ function api_set_update_network_module($id_module, $thrash1, $other, $thrash3)
|
|||
'critical_inverse',
|
||||
'warning_inverse',
|
||||
'policy_linked',
|
||||
'ff_type',
|
||||
];
|
||||
|
||||
$values = [];
|
||||
|
@ -3343,23 +3326,22 @@ function api_set_create_plugin_module($id, $thrash1, $other, $thrash3)
|
|||
'min_ff_event_critical' => $other['data'][32],
|
||||
'critical_inverse' => $other['data'][33],
|
||||
'warning_inverse' => $other['data'][34],
|
||||
'ff_type' => $other['data'][35],
|
||||
];
|
||||
|
||||
if (! $values['descripcion']) {
|
||||
$values['descripcion'] = '';
|
||||
// Column 'descripcion' cannot be null.
|
||||
// Column 'descripcion' cannot be null
|
||||
}
|
||||
|
||||
if (! $values['module_macros']) {
|
||||
$values['module_macros'] = '';
|
||||
// Column 'module_macros' cannot be null.
|
||||
// Column 'module_macros' cannot be null
|
||||
}
|
||||
|
||||
$idModule = modules_create_agent_module($idAgent, $name, $values, true);
|
||||
|
||||
if (is_error($idModule)) {
|
||||
// TODO: Improve the error returning more info.
|
||||
// TODO: Improve the error returning more info
|
||||
returnError('error_create_plugin_module', __('Error in creation plugin module.'));
|
||||
} else {
|
||||
returnData('string', ['type' => 'string', 'data' => $idModule]);
|
||||
|
@ -3405,7 +3387,7 @@ function api_set_update_plugin_module($id_module, $thrash1, $other, $thrash3)
|
|||
return;
|
||||
}
|
||||
|
||||
// If we want to change the module to a new agent.
|
||||
// If we want to change the module to a new agent
|
||||
if ($other['data'][0] != '') {
|
||||
if (!util_api_check_agent_and_print_error($other['data'][0], 'string', 'AW')) {
|
||||
return;
|
||||
|
@ -3422,7 +3404,7 @@ function api_set_update_plugin_module($id_module, $thrash1, $other, $thrash3)
|
|||
}
|
||||
}
|
||||
|
||||
// Check if agent exists.
|
||||
// Check if agent exists
|
||||
$check_id_agent = db_get_value('id_agente', 'tagente', 'id_agente', $other['data'][0]);
|
||||
if (!$check_id_agent) {
|
||||
returnError('error_update_data_module', __('Error updating plugin module. Id_agent doesn\'t exist.'));
|
||||
|
@ -3466,7 +3448,6 @@ function api_set_update_plugin_module($id_module, $thrash1, $other, $thrash3)
|
|||
'critical_inverse',
|
||||
'warning_inverse',
|
||||
'policy_linked',
|
||||
'ff_type',
|
||||
];
|
||||
|
||||
$values = [];
|
||||
|
@ -3565,23 +3546,22 @@ function api_set_create_data_module($id, $thrash1, $other, $thrash3)
|
|||
'ff_timeout' => $other['data'][23],
|
||||
'critical_inverse' => $other['data'][24],
|
||||
'warning_inverse' => $other['data'][25],
|
||||
'ff_type' => $other['data'][26],
|
||||
];
|
||||
|
||||
if (! $values['descripcion']) {
|
||||
$values['descripcion'] = '';
|
||||
// Column 'descripcion' cannot be null.
|
||||
// Column 'descripcion' cannot be null
|
||||
}
|
||||
|
||||
if (! $values['module_macros']) {
|
||||
$values['module_macros'] = '';
|
||||
// Column 'module_macros' cannot be null.
|
||||
// Column 'module_macros' cannot be null
|
||||
}
|
||||
|
||||
$idModule = modules_create_agent_module($idAgent, $name, $values, true);
|
||||
|
||||
if (is_error($idModule)) {
|
||||
// TODO: Improve the error returning more info.
|
||||
// TODO: Improve the error returning more info
|
||||
returnError('error_create_data_module', __('Error in creation data module.'));
|
||||
} else {
|
||||
returnData('string', ['type' => 'string', 'data' => $idModule]);
|
||||
|
@ -3838,7 +3818,7 @@ function api_set_update_data_module($id_module, $thrash1, $other, $thrash3)
|
|||
return;
|
||||
}
|
||||
|
||||
// If we want to change the module to a new agent.
|
||||
// If we want to change the module to a new agent
|
||||
if ($other['data'][0] != '') {
|
||||
if (!util_api_check_agent_and_print_error($other['data'][0], 'string', 'AW')) {
|
||||
return;
|
||||
|
@ -3855,7 +3835,7 @@ function api_set_update_data_module($id_module, $thrash1, $other, $thrash3)
|
|||
}
|
||||
}
|
||||
|
||||
// Check if agent exists.
|
||||
// Check if agent exists
|
||||
$check_id_agent = db_get_value('id_agente', 'tagente', 'id_agente', $other['data'][0]);
|
||||
if (!$check_id_agent) {
|
||||
returnError('error_update_data_module', __('Error updating data module. Id_agent doesn\'t exist.'));
|
||||
|
@ -3890,7 +3870,6 @@ function api_set_update_data_module($id_module, $thrash1, $other, $thrash3)
|
|||
'critical_inverse',
|
||||
'warning_inverse',
|
||||
'policy_linked',
|
||||
'ff_type',
|
||||
];
|
||||
|
||||
$values = [];
|
||||
|
@ -3968,7 +3947,7 @@ function api_set_create_snmp_module($id, $thrash1, $other, $thrash3)
|
|||
$disabled_types_event[EVENTS_GOING_UNKNOWN] = (int) !$other['data'][27];
|
||||
$disabled_types_event = json_encode($disabled_types_event);
|
||||
|
||||
// SNMP version 3.
|
||||
// SNMP version 3
|
||||
if ($other['data'][14] == '3') {
|
||||
if ($other['data'][23] != 'AES' and $other['data'][23] != 'DES') {
|
||||
returnError('error_create_snmp_module', __('Error in creation SNMP module. snmp3_priv_method doesn\'t exist. Set it to \'AES\' or \'DES\'. '));
|
||||
|
@ -4021,7 +4000,6 @@ function api_set_create_snmp_module($id, $thrash1, $other, $thrash3)
|
|||
'min_ff_event_normal' => $other['data'][31],
|
||||
'min_ff_event_warning' => $other['data'][32],
|
||||
'min_ff_event_critical' => $other['data'][33],
|
||||
'ff_type' => $other['data'][34],
|
||||
];
|
||||
} else {
|
||||
$values = [
|
||||
|
@ -4054,19 +4032,18 @@ function api_set_create_snmp_module($id, $thrash1, $other, $thrash3)
|
|||
'min_ff_event_normal' => $other['data'][25],
|
||||
'min_ff_event_warning' => $other['data'][26],
|
||||
'min_ff_event_critical' => $other['data'][27],
|
||||
'ff_type' => $other['data'][28],
|
||||
];
|
||||
}
|
||||
|
||||
if (! $values['descripcion']) {
|
||||
$values['descripcion'] = '';
|
||||
// Column 'descripcion' cannot be null.
|
||||
// Column 'descripcion' cannot be null
|
||||
}
|
||||
|
||||
$idModule = modules_create_agent_module($idAgent, $name, $values, true);
|
||||
|
||||
if (is_error($idModule)) {
|
||||
// TODO: Improve the error returning more info.
|
||||
// TODO: Improve the error returning more info
|
||||
returnError('error_create_snmp_module', __('Error in creation SNMP module.'));
|
||||
} else {
|
||||
returnData('string', ['type' => 'string', 'data' => $idModule]);
|
||||
|
@ -4114,7 +4091,7 @@ function api_set_update_snmp_module($id_module, $thrash1, $other, $thrash3)
|
|||
return;
|
||||
}
|
||||
|
||||
// If we want to change the module to a new agent.
|
||||
// If we want to change the module to a new agent
|
||||
if ($other['data'][0] != '') {
|
||||
if (!util_api_check_agent_and_print_error($other['data'][0], 'string', 'AW')) {
|
||||
return;
|
||||
|
@ -4131,7 +4108,7 @@ function api_set_update_snmp_module($id_module, $thrash1, $other, $thrash3)
|
|||
}
|
||||
}
|
||||
|
||||
// Check if agent exists.
|
||||
// Check if agent exists
|
||||
$check_id_agent = db_get_value('id_agente', 'tagente', 'id_agente', $other['data'][0]);
|
||||
if (!$check_id_agent) {
|
||||
returnError('error_update_data_module', __('Error updating snmp module. Id_agent doesn\'t exist.'));
|
||||
|
@ -4139,7 +4116,7 @@ function api_set_update_snmp_module($id_module, $thrash1, $other, $thrash3)
|
|||
}
|
||||
}
|
||||
|
||||
// SNMP version 3.
|
||||
// SNMP version 3
|
||||
if ($other['data'][13] == '3') {
|
||||
if ($other['data'][22] != 'AES' and $other['data'][22] != 'DES') {
|
||||
returnError(
|
||||
|
@ -4203,7 +4180,6 @@ function api_set_update_snmp_module($id_module, $thrash1, $other, $thrash3)
|
|||
'min_ff_event_warning',
|
||||
'min_ff_event_critical',
|
||||
'policy_linked',
|
||||
'ff_type',
|
||||
];
|
||||
} else {
|
||||
$snmp_module_fields = [
|
||||
|
@ -4235,7 +4211,6 @@ function api_set_update_snmp_module($id_module, $thrash1, $other, $thrash3)
|
|||
'min_ff_event_warning',
|
||||
'min_ff_event_critical',
|
||||
'policy_linked',
|
||||
'ff_type',
|
||||
];
|
||||
}
|
||||
|
||||
|
@ -4333,7 +4308,6 @@ function api_set_new_network_component($id, $thrash1, $other, $thrash2)
|
|||
'min_ff_event_normal' => $other['data'][20],
|
||||
'min_ff_event_warning' => $other['data'][21],
|
||||
'min_ff_event_critical' => $other['data'][22],
|
||||
'ff_type' => $other['data'][23],
|
||||
];
|
||||
|
||||
$name_check = db_get_value('name', 'tnetwork_component', 'name', $id);
|
||||
|
@ -4434,7 +4408,6 @@ function api_set_new_plugin_component($id, $thrash1, $other, $thrash2)
|
|||
'min_ff_event_normal' => $other['data'][24],
|
||||
'min_ff_event_warning' => $other['data'][25],
|
||||
'min_ff_event_critical' => $other['data'][26],
|
||||
'ff_type' => $other['data'][27],
|
||||
];
|
||||
|
||||
$name_check = db_get_value('name', 'tnetwork_component', 'name', $id);
|
||||
|
@ -4570,7 +4543,6 @@ function api_set_new_snmp_component($id, $thrash1, $other, $thrash2)
|
|||
'min_ff_event_normal' => $other['data'][29],
|
||||
'min_ff_event_warning' => $other['data'][30],
|
||||
'min_ff_event_critical' => $other['data'][31],
|
||||
'ff_type' => $other['data'][32],
|
||||
];
|
||||
} else {
|
||||
$values = [
|
||||
|
@ -4602,7 +4574,6 @@ function api_set_new_snmp_component($id, $thrash1, $other, $thrash2)
|
|||
'min_ff_event_normal' => $other['data'][25],
|
||||
'min_ff_event_warning' => $other['data'][26],
|
||||
'min_ff_event_critical' => $other['data'][27],
|
||||
'ff_type' => $other['data'][28],
|
||||
];
|
||||
}
|
||||
|
||||
|
@ -4683,7 +4654,6 @@ function api_set_new_local_component($id, $thrash1, $other, $thrash2)
|
|||
'min_ff_event_warning' => $other['data'][8],
|
||||
'min_ff_event_critical' => $other['data'][9],
|
||||
'ff_timeout' => $other['data'][10],
|
||||
'ff_type' => $other['data'][11],
|
||||
];
|
||||
|
||||
$name_check = enterprise_hook(
|
||||
|
@ -6439,7 +6409,6 @@ function api_set_add_data_module_policy($id, $thrash1, $other, $thrash3)
|
|||
$values['min_ff_event_warning'] = $other['data'][21];
|
||||
$values['min_ff_event_critical'] = $other['data'][22];
|
||||
$values['ff_timeout'] = $other['data'][23];
|
||||
$values['ff_type'] = $other['data'][24];
|
||||
|
||||
if ($name_module_policy !== false) {
|
||||
if ($name_module_policy[0]['name'] == $other['data'][0]) {
|
||||
|
@ -6681,7 +6650,6 @@ function api_set_add_network_module_policy($id, $thrash1, $other, $thrash3)
|
|||
$values['min_ff_event_normal'] = $other['data'][24];
|
||||
$values['min_ff_event_warning'] = $other['data'][25];
|
||||
$values['min_ff_event_critical'] = $other['data'][26];
|
||||
$values['ff_type'] = $other['data'][27];
|
||||
|
||||
if ($name_module_policy !== false) {
|
||||
if ($name_module_policy[0]['name'] == $other['data'][0]) {
|
||||
|
@ -6891,7 +6859,6 @@ function api_set_add_plugin_module_policy($id, $thrash1, $other, $thrash3)
|
|||
$values['min_ff_event_normal'] = $other['data'][29];
|
||||
$values['min_ff_event_warning'] = $other['data'][30];
|
||||
$values['min_ff_event_critical'] = $other['data'][31];
|
||||
$values['ff_type'] = $other['data'][32];
|
||||
|
||||
if ($name_module_policy !== false) {
|
||||
if ($name_module_policy[0]['name'] == $other['data'][0]) {
|
||||
|
@ -7309,7 +7276,6 @@ function api_set_add_snmp_module_policy($id, $thrash1, $other, $thrash3)
|
|||
'min_ff_event_normal' => $other['data'][30],
|
||||
'min_ff_event_warning' => $other['data'][31],
|
||||
'min_ff_event_critical' => $other['data'][32],
|
||||
'ff_type' => $other['data'][33],
|
||||
];
|
||||
} else {
|
||||
$values = [
|
||||
|
@ -7339,7 +7305,6 @@ function api_set_add_snmp_module_policy($id, $thrash1, $other, $thrash3)
|
|||
'min_ff_event_normal' => $other['data'][24],
|
||||
'min_ff_event_warning' => $other['data'][25],
|
||||
'min_ff_event_critical' => $other['data'][26],
|
||||
'ff_type' => $other['data'][27],
|
||||
];
|
||||
}
|
||||
|
||||
|
@ -8829,14 +8794,7 @@ function api_set_alert_actions($id, $id2, $other, $trash1)
|
|||
}
|
||||
|
||||
$firesMin = $other['data'][2];
|
||||
if (!$firesMin) {
|
||||
$firesMin = 0;
|
||||
}
|
||||
|
||||
$firesMax = $other['data'][3];
|
||||
if (!$firesMax) {
|
||||
$firesMax = 0;
|
||||
}
|
||||
|
||||
$values = [
|
||||
'id_alert_template_module' => $idAlertTemplateModule,
|
||||
|
@ -13311,7 +13269,6 @@ function api_set_apply_module_template($id_template, $id_agent, $thrash3, $thras
|
|||
'min_ff_event_normal' => $row2['min_ff_event_normal'],
|
||||
'min_ff_event_warning' => $row2['min_ff_event_warning'],
|
||||
'min_ff_event_critical' => $row2['min_ff_event_critical'],
|
||||
'ff_type' => $row2['ff_type'],
|
||||
];
|
||||
|
||||
$name = $row2['name'];
|
||||
|
|
|
@ -1790,7 +1790,6 @@ function html_print_button($label='OK', $name='', $disabled=false, $script='', $
|
|||
*/
|
||||
function html_print_textarea($name, $rows, $columns, $value='', $attributes='', $return=false, $class='')
|
||||
{
|
||||
|
||||
$output = '<textarea id="textarea_'.$name.'" name="'.$name.'" cols="'.$columns.'" rows="'.$rows.'" '.$attributes.'" class="'.$class.'">';
|
||||
// $output .= io_safe_input ($value);
|
||||
$output .= ($value);
|
||||
|
|
Loading…
Reference in New Issue