mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-30 01:05:39 +02:00
#10598 show error on create web and check
This commit is contained in:
parent
5964cdecc0
commit
fb4ac30b57
@ -65,8 +65,8 @@ if ($check_web) {
|
|||||||
__('Agent Web monitoring created on welcome'),
|
__('Agent Web monitoring created on welcome'),
|
||||||
];
|
];
|
||||||
|
|
||||||
$id_agent = api_set_new_agent(0, '', $array_other, '', true);
|
$id_agent = api_set_new_agent(0, '', $array_other, '', true, true);
|
||||||
if ($id_agent > 0) {
|
if (is_integer($id_agent)) {
|
||||||
$module_name = get_parameter('module_name', 'Web_monitoring_module');
|
$module_name = get_parameter('module_name', 'Web_monitoring_module');
|
||||||
$text_to_search = get_parameter('text_to_search', '');
|
$text_to_search = get_parameter('text_to_search', '');
|
||||||
$url_goliat = get_parameter('url_goliat', 'https://pandorafms.com/en/');
|
$url_goliat = get_parameter('url_goliat', 'https://pandorafms.com/en/');
|
||||||
@ -76,7 +76,7 @@ if ($check_web) {
|
|||||||
ui_print_success_message(__('Your check has been created, <a href='.ui_get_full_url('index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=module&id_agente='.$id_agent).'>click here to view the data</a>. Please note that it may take a few seconds to see data if your server is busy'));
|
ui_print_success_message(__('Your check has been created, <a href='.ui_get_full_url('index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=module&id_agente='.$id_agent).'>click here to view the data</a>. Please note that it may take a few seconds to see data if your server is busy'));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
ui_print_error_message(__('The Name is not valid for the modules.'));
|
ui_print_error_message(__($id_agent));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
ui_print_error_message(__('Web server is not enabled.'));
|
ui_print_error_message(__('Web server is not enabled.'));
|
||||||
@ -110,8 +110,8 @@ if ($check_connectivity) {
|
|||||||
__('Basic connectivity'),
|
__('Basic connectivity'),
|
||||||
];
|
];
|
||||||
|
|
||||||
$id_agent = api_set_new_agent(0, '', $array_other, '', true);
|
$id_agent = api_set_new_agent(0, '', $array_other, '', true, true);
|
||||||
if ($id_agent > 0) {
|
if (is_integer($id_agent)) {
|
||||||
$ip_target = get_parameter('ip_target', '127.0.0.1');
|
$ip_target = get_parameter('ip_target', '127.0.0.1');
|
||||||
$basic_network = create_module_basic_network($id_agent, $id_group, $ip_target);
|
$basic_network = create_module_basic_network($id_agent, $id_group, $ip_target);
|
||||||
$latency_network = create_module_latency_network($id_agent, $id_group, $ip_target);
|
$latency_network = create_module_latency_network($id_agent, $id_group, $ip_target);
|
||||||
@ -120,7 +120,7 @@ if ($check_connectivity) {
|
|||||||
ui_print_success_message(__('Your check has been created, <a href='.ui_get_full_url('index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=module&id_agente='.$id_agent).'>click here to view the data</a>. Please note that it may take a few seconds to see data if your server is busy'));
|
ui_print_success_message(__('Your check has been created, <a href='.ui_get_full_url('index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=module&id_agente='.$id_agent).'>click here to view the data</a>. Please note that it may take a few seconds to see data if your server is busy'));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
ui_print_error_message(__('The Name is not valid for the modules.'));
|
ui_print_error_message(__($id_agent));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
ui_print_error_message(__('Web server is not enabled.'));
|
ui_print_error_message(__('Web server is not enabled.'));
|
||||||
|
@ -1916,7 +1916,7 @@ function api_set_update_agent_field($id_agent, $use_agent_alias, $params)
|
|||||||
*
|
*
|
||||||
* @param $thrash3 Don't use.
|
* @param $thrash3 Don't use.
|
||||||
*/
|
*/
|
||||||
function api_set_new_agent($id_node, $thrash2, $other, $trhash3, $return=false)
|
function api_set_new_agent($id_node, $thrash2, $other, $trhash3, $return=false, $message=false)
|
||||||
{
|
{
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
@ -2009,16 +2009,40 @@ function api_set_new_agent($id_node, $thrash2, $other, $trhash3, $return=false)
|
|||||||
|
|
||||||
// Check if agent exists (BUG WC-50518-2).
|
// Check if agent exists (BUG WC-50518-2).
|
||||||
if ($alias == '' && $alias_as_name === 0) {
|
if ($alias == '' && $alias_as_name === 0) {
|
||||||
|
if ($message === true) {
|
||||||
|
return 'No agent alias specified';
|
||||||
|
}
|
||||||
|
|
||||||
returnError('No agent alias specified');
|
returnError('No agent alias specified');
|
||||||
} else if (agents_get_agent_id($nombre_agente)) {
|
} else if (agents_get_agent_id($nombre_agente)) {
|
||||||
|
if ($message === true) {
|
||||||
|
return 'The agent name already exists in DB.';
|
||||||
|
}
|
||||||
|
|
||||||
returnError('The agent name already exists in DB.');
|
returnError('The agent name already exists in DB.');
|
||||||
} else if (db_get_value_sql('SELECT id_grupo FROM tgrupo WHERE id_grupo = '.$grupo) === false) {
|
} else if (db_get_value_sql('SELECT id_grupo FROM tgrupo WHERE id_grupo = '.$grupo) === false) {
|
||||||
|
if ($message === true) {
|
||||||
|
return 'The group does not exist.';
|
||||||
|
}
|
||||||
|
|
||||||
returnError('The group does not exist.');
|
returnError('The group does not exist.');
|
||||||
} else if (group_allow_more_agents($grupo, true, 'create') === false) {
|
} else if (group_allow_more_agents($grupo, true, 'create') === false) {
|
||||||
|
if ($message === true) {
|
||||||
|
return 'Agent cannot be created due to the maximum agent limit for this group';
|
||||||
|
}
|
||||||
|
|
||||||
returnError('Agent cannot be created due to the maximum agent limit for this group');
|
returnError('Agent cannot be created due to the maximum agent limit for this group');
|
||||||
} else if (db_get_value_sql('SELECT id_os FROM tconfig_os WHERE id_os = '.$id_os) === false) {
|
} else if (db_get_value_sql('SELECT id_os FROM tconfig_os WHERE id_os = '.$id_os) === false) {
|
||||||
|
if ($message === true) {
|
||||||
|
return 'The OS does not exist.';
|
||||||
|
}
|
||||||
|
|
||||||
returnError('The OS does not exist.');
|
returnError('The OS does not exist.');
|
||||||
} else if ($server_name === false) {
|
} else if ($server_name === false) {
|
||||||
|
if ($message === true) {
|
||||||
|
return 'The '.get_product_name().' Server does not exist.';
|
||||||
|
}
|
||||||
|
|
||||||
returnError('The '.get_product_name().' Server does not exist.');
|
returnError('The '.get_product_name().' Server does not exist.');
|
||||||
} else {
|
} else {
|
||||||
if ($alias_as_name === 1) {
|
if ($alias_as_name === 1) {
|
||||||
@ -13122,7 +13146,7 @@ function api_set_create_event($id, $trash1, $other, $returnType)
|
|||||||
$ack_utimestamp = $val['ack_utimestamp'];
|
$ack_utimestamp = $val['ack_utimestamp'];
|
||||||
$values['id_usuario'] = $val['id_usuario'];
|
$values['id_usuario'] = $val['id_usuario'];
|
||||||
}
|
}
|
||||||
|
|
||||||
api_set_validate_event_by_id($val['id_evento']);
|
api_set_validate_event_by_id($val['id_evento']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user