mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-28 08:14:38 +02:00
Merge branch 'ent-10598-nuevo-wizard-de-bienvenida' into 'develop'
Ent 10598 nuevo wizard de bienvenida See merge request artica/pandorafms!6043
This commit is contained in:
commit
d860d613d6
@ -34,6 +34,22 @@ echo sprintf('<div id="header_table" class="header_table_%s">', $menuTypeClass);
|
|||||||
$notifications_numbers['notifications'],
|
$notifications_numbers['notifications'],
|
||||||
$notifications_numbers['last_id']
|
$notifications_numbers['last_id']
|
||||||
).'</div>';
|
).'</div>';
|
||||||
|
$header_welcome = '';
|
||||||
|
if (check_acl($config['id_user'], $group, 'AW')) {
|
||||||
|
$header_welcome .= '<div id="welcome-icon-header">';
|
||||||
|
$header_welcome .= html_print_image(
|
||||||
|
'images/wizard@svg.svg',
|
||||||
|
true,
|
||||||
|
[
|
||||||
|
'class' => 'main_menu_icon invert_filter',
|
||||||
|
'title' => __('Welcome dialog'),
|
||||||
|
'id' => 'Welcome-dialog',
|
||||||
|
'alt' => __('Welcome dialog'),
|
||||||
|
'style' => 'cursor: pointer;',
|
||||||
|
]
|
||||||
|
);
|
||||||
|
$header_welcome .= '</div>';
|
||||||
|
}
|
||||||
|
|
||||||
// ======= Servers List ===============================================
|
// ======= Servers List ===============================================
|
||||||
if ((bool) check_acl($config['id_user'], 0, 'AW') !== false) {
|
if ((bool) check_acl($config['id_user'], 0, 'AW') !== false) {
|
||||||
@ -461,7 +477,7 @@ echo sprintf('<div id="header_table" class="header_table_%s">', $menuTypeClass);
|
|||||||
} else {
|
} else {
|
||||||
echo '<div class="header_left"><span class="header_title">'.$config['custom_title_header'].'</span><span class="header_subtitle">'.$config['custom_subtitle_header'].'</span></div>
|
echo '<div class="header_left"><span class="header_title">'.$config['custom_title_header'].'</span><span class="header_subtitle">'.$config['custom_subtitle_header'].'</span></div>
|
||||||
<div class="header_center">'.$header_searchbar.'</div>
|
<div class="header_center">'.$header_searchbar.'</div>
|
||||||
<div class="header_right">'.$header_autorefresh, $header_autorefresh_counter, $header_discovery, $servers_list, $header_feedback, $header_support, $header_docu, $header_user, $header_logout.'</div>';
|
<div class="header_right">'.$header_autorefresh, $header_autorefresh_counter, $header_discovery, $header_welcome, $servers_list, $header_feedback, $header_support, $header_docu, $header_user, $header_logout.'</div>';
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
</div> <!-- Closes #table_header_inner -->
|
</div> <!-- Closes #table_header_inner -->
|
||||||
@ -904,6 +920,44 @@ echo sprintf('<div id="header_table" class="header_table_%s">', $menuTypeClass);
|
|||||||
$("#agent_access").css("display","");
|
$("#agent_access").css("display","");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$("#welcome-icon-header").click(function () {
|
||||||
|
if (!$('#welcome_modal_window').length){
|
||||||
|
$(document.body).append('<div id="welcome_modal_window"></div>');
|
||||||
|
$(document.body).append( $('<link rel="stylesheet" type="text/css" />').attr('href', 'include/styles/new_installation_welcome_window.css') );
|
||||||
|
}
|
||||||
|
// Clean DOM.
|
||||||
|
load_modal({
|
||||||
|
target: $('#welcome_modal_window'),
|
||||||
|
url: '<?php echo ui_get_full_url('ajax.php', false, false, false); ?>',
|
||||||
|
modal: {
|
||||||
|
title: "<?php echo __('Welcome to').' '.io_safe_output(get_product_name()); ?>",
|
||||||
|
cancel: '<?php echo __('Do not show anymore'); ?>',
|
||||||
|
ok: '<?php echo __('Close'); ?>'
|
||||||
|
},
|
||||||
|
onshow: {
|
||||||
|
page: 'include/ajax/welcome_window',
|
||||||
|
method: 'loadWelcomeWindow',
|
||||||
|
},
|
||||||
|
oncancel: {
|
||||||
|
page: 'include/ajax/welcome_window',
|
||||||
|
title: "<?php echo __('Cancel Configuration Window'); ?>",
|
||||||
|
method: 'cancelWelcome',
|
||||||
|
confirm: function (fn) {
|
||||||
|
confirmDialog({
|
||||||
|
title: '<?php echo __('Are you sure?'); ?>',
|
||||||
|
message: '<?php echo __('Are you sure you want to cancel this tutorial?'); ?>',
|
||||||
|
ok: '<?php echo __('OK'); ?>',
|
||||||
|
cancel: '<?php echo __('Cancel'); ?>',
|
||||||
|
onAccept: function() {
|
||||||
|
// Continue execution.
|
||||||
|
fn();
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
<?php if (enterprise_installed()) { ?>
|
<?php if (enterprise_installed()) { ?>
|
||||||
// Feedback.
|
// Feedback.
|
||||||
$("#feedback-header").click(function () {
|
$("#feedback-header").click(function () {
|
||||||
|
@ -100,6 +100,7 @@ if ($initial && users_is_admin()) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (check_acl($config['id_user'], 0, 'AW')) {
|
||||||
$welcome = !$initial;
|
$welcome = !$initial;
|
||||||
try {
|
try {
|
||||||
$welcome_window = new WelcomeWindow($welcome);
|
$welcome_window = new WelcomeWindow($welcome);
|
||||||
@ -109,6 +110,7 @@ try {
|
|||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
$welcome = false;
|
$welcome = false;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (isset($_SESSION['showed_tips_window']) === false) {
|
if (isset($_SESSION['showed_tips_window']) === false) {
|
||||||
|
@ -1083,5 +1083,9 @@ if ((bool) check_acl($config['id_user'], 0, 'AW') === true) {
|
|||||||
$(this).css ("width", "100px");
|
$(this).css ("width", "100px");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
var show_deploy_agent = "<?php echo get_parameter('show_deploy_agent', 0); ?>";
|
||||||
|
if (show_deploy_agent !== '0'){
|
||||||
|
$('#button-modal_deploy_agent').click();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
@ -174,6 +174,13 @@ if ($access_console_node === true) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$sub = [];
|
$sub = [];
|
||||||
|
if ((bool) check_acl($config['id_user'], 0, 'AW') === true) {
|
||||||
|
$sub['wizard']['text'] = __('Configuration wizard');
|
||||||
|
$sub['wizard']['id'] = 'conf_wizard';
|
||||||
|
$sub['wizard']['type'] = 'direct';
|
||||||
|
$sub['wizard']['subtype'] = 'nolink_no_arrow';
|
||||||
|
}
|
||||||
|
|
||||||
if ((bool) check_acl($config['id_user'], 0, 'PM') === true) {
|
if ((bool) check_acl($config['id_user'], 0, 'PM') === true) {
|
||||||
$sub['templates']['text'] = __('Templates');
|
$sub['templates']['text'] = __('Templates');
|
||||||
$sub['templates']['id'] = 'Templates';
|
$sub['templates']['id'] = 'Templates';
|
||||||
@ -620,3 +627,55 @@ if ((bool) $config['pure'] === false) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
echo '<div id="about-div"></div>';
|
echo '<div id="about-div"></div>';
|
||||||
|
// Need to be here because the translate string.
|
||||||
|
if (check_acl($config['id_user'], $group, 'AW')) {
|
||||||
|
?>
|
||||||
|
<script type="text/javascript">
|
||||||
|
$("#conf_wizard").click(function() {
|
||||||
|
$("#conf_wizard").addClass("selected");
|
||||||
|
|
||||||
|
if (!$("#welcome_modal_window").length) {
|
||||||
|
$(document.body).append('<div id="welcome_modal_window"></div>');
|
||||||
|
$(document.body).append(
|
||||||
|
$('<link rel="stylesheet" type="text/css" />').attr(
|
||||||
|
"href",
|
||||||
|
"include/styles/new_installation_welcome_window.css"
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
load_modal({
|
||||||
|
target: $('#welcome_modal_window'),
|
||||||
|
url: '<?php echo ui_get_full_url('ajax.php', false, false, false); ?>',
|
||||||
|
modal: {
|
||||||
|
title: "<?php echo __('Welcome to').' '.io_safe_output(get_product_name()); ?>",
|
||||||
|
cancel: '<?php echo __('Do not show anymore'); ?>',
|
||||||
|
ok: '<?php echo __('Close'); ?>'
|
||||||
|
},
|
||||||
|
onshow: {
|
||||||
|
page: 'include/ajax/welcome_window',
|
||||||
|
method: 'loadWelcomeWindow',
|
||||||
|
},
|
||||||
|
oncancel: {
|
||||||
|
page: 'include/ajax/welcome_window',
|
||||||
|
title: "<?php echo __('Cancel Configuration Window'); ?>",
|
||||||
|
method: 'cancelWelcome',
|
||||||
|
confirm: function (fn) {
|
||||||
|
confirmDialog({
|
||||||
|
title: '<?php echo __('Are you sure?'); ?>',
|
||||||
|
message: '<?php echo __('Are you sure you want to cancel this tutorial?'); ?>',
|
||||||
|
ok: '<?php echo __('OK'); ?>',
|
||||||
|
cancel: '<?php echo __('Cancel'); ?>',
|
||||||
|
onAccept: function() {
|
||||||
|
// Continue execution.
|
||||||
|
fn();
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
19
pandora_console/images/circle_title.svg
Normal file
19
pandora_console/images/circle_title.svg
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<svg width="12px" height="12px" viewBox="0 0 12 12" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||||
|
<title>EB094270-FB38-4A58-BE94-D40EA44EA568</title>
|
||||||
|
<g id="Agentes" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
||||||
|
<g id="1.a1-Agentes---Listado" transform="translate(-362.500000, -268.000000)" fill="#C1CCDC">
|
||||||
|
<g id="Contenido" transform="translate(310.000000, 188.000000)">
|
||||||
|
<g transform="translate(20.000000, 20.000000)" id="Agentes">
|
||||||
|
<g id="Content" transform="translate(29.308511, 20.000000)">
|
||||||
|
<g id="Top" transform="translate(0.191489, 0.000000)">
|
||||||
|
<g id="Icons/Light/24/example" transform="translate(3.000000, 40.000000)">
|
||||||
|
<circle id="Oval" cx="6" cy="6" r="6"></circle>
|
||||||
|
</g>
|
||||||
|
</g>
|
||||||
|
</g>
|
||||||
|
</g>
|
||||||
|
</g>
|
||||||
|
</g>
|
||||||
|
</g>
|
||||||
|
</svg>
|
After Width: | Height: | Size: 1.1 KiB |
190
pandora_console/include/ajax/task_to_perform.php
Normal file
190
pandora_console/include/ajax/task_to_perform.php
Normal file
@ -0,0 +1,190 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Extension to schedule tasks on Pandora FMS Console
|
||||||
|
*
|
||||||
|
* @category Wizard
|
||||||
|
* @package Pandora FMS
|
||||||
|
* @subpackage Host&Devices
|
||||||
|
* @version 1.0.0
|
||||||
|
* @license See below
|
||||||
|
*
|
||||||
|
* ______ ___ _______ _______ ________
|
||||||
|
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
|
||||||
|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
|
||||||
|
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
|
||||||
|
*
|
||||||
|
* ============================================================================
|
||||||
|
* Copyright (c) 2005-2023 PandoraFMS S.L.
|
||||||
|
* 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.
|
||||||
|
* ============================================================================
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Begin.
|
||||||
|
require_once '../functions.php';
|
||||||
|
require_once '../functions_welcome_wizard.php';
|
||||||
|
global $config;
|
||||||
|
|
||||||
|
$check_web = get_parameter('check_web', 0);
|
||||||
|
$check_connectivity = get_parameter('check_connectivity', 0);
|
||||||
|
$create_net_scan = get_parameter('create_net_scan', 0);
|
||||||
|
$create_mail_alert = get_parameter('create_mail_alert', 0);
|
||||||
|
$create_unknown_template_alert = get_parameter('create_unknown_template_alert', 0);
|
||||||
|
|
||||||
|
// Begin.
|
||||||
|
global $config;
|
||||||
|
|
||||||
|
if ($check_web) {
|
||||||
|
include_once '../functions_api.php';
|
||||||
|
include_once '../functions_servers.php';
|
||||||
|
|
||||||
|
$status_webserver = db_get_row_filter('tserver', ['server_type' => SERVER_TYPE_WEB], 'status')['status'];
|
||||||
|
if ($status_webserver === '1') {
|
||||||
|
$name = array_keys(servers_get_names())[0];
|
||||||
|
$id_group = get_parameter('id_group', 4);
|
||||||
|
|
||||||
|
$array_other['data'] = [
|
||||||
|
'Web monitoring',
|
||||||
|
'',
|
||||||
|
2,
|
||||||
|
$id_group,
|
||||||
|
0,
|
||||||
|
30,
|
||||||
|
30,
|
||||||
|
9,
|
||||||
|
$name,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
__('Agent Web monitoring created on welcome'),
|
||||||
|
];
|
||||||
|
|
||||||
|
$id_agent = api_set_new_agent(0, '', $array_other, '', true);
|
||||||
|
if ($id_agent > 0) {
|
||||||
|
$module_name = get_parameter('module_name', 'Web_monitoring_module');
|
||||||
|
$text_to_search = get_parameter('text_to_search', '');
|
||||||
|
$url_goliat = get_parameter('url_goliat', 'https://pandorafms.com/en/');
|
||||||
|
$module_latency = create_module_latency_goliat($id_agent, $module_name, $id_group, $url_goliat, $text_to_search);
|
||||||
|
$module_status = create_module_status_goliat($id_agent, $module_name, $id_group, $url_goliat, $text_to_search);
|
||||||
|
if ($module_latency > 0 && $module_status > 0) {
|
||||||
|
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 {
|
||||||
|
ui_print_error_message(__('The Name is not valid for the modules.'));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
ui_print_error_message(__('Web server is not enabled.'));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($check_connectivity) {
|
||||||
|
include_once '../functions_api.php';
|
||||||
|
include_once '../functions_servers.php';
|
||||||
|
|
||||||
|
$status_newtwork = db_get_row_filter('tserver', ['server_type' => SERVER_TYPE_NETWORK], 'status')['status'];
|
||||||
|
$status_pluggin = db_get_row_filter('tserver', ['server_type' => SERVER_TYPE_PLUGIN], 'status')['status'];
|
||||||
|
if ($status_newtwork === '1' && $status_pluggin === '1') {
|
||||||
|
$name = array_keys(servers_get_names())[0];
|
||||||
|
$id_group = get_parameter('id_group', 4);
|
||||||
|
$agent_name = get_parameter('agent_name', __('Agent check connectivity'));
|
||||||
|
|
||||||
|
$array_other['data'] = [
|
||||||
|
$agent_name,
|
||||||
|
'',
|
||||||
|
2,
|
||||||
|
$id_group,
|
||||||
|
0,
|
||||||
|
30,
|
||||||
|
30,
|
||||||
|
9,
|
||||||
|
$name,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
__('Basic connectivity'),
|
||||||
|
];
|
||||||
|
|
||||||
|
$id_agent = api_set_new_agent(0, '', $array_other, '', true);
|
||||||
|
if ($id_agent > 0) {
|
||||||
|
$ip_target = get_parameter('ip_target', '127.0.0.1');
|
||||||
|
$basic_network = create_module_basic_network($id_agent, $id_group, $ip_target);
|
||||||
|
$latency_network = create_module_latency_network($id_agent, $id_group, $ip_target);
|
||||||
|
$packet_lost = create_module_packet_lost($id_agent, $id_group, $ip_target);
|
||||||
|
if ($basic_network > 0 && $latency_network > 0 && $packet_lost > 0) {
|
||||||
|
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 {
|
||||||
|
ui_print_error_message(__('The Name is not valid for the modules.'));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
ui_print_error_message(__('Web server is not enabled.'));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($create_net_scan) {
|
||||||
|
$ip_target = get_parameter('ip_target', '192.168.10.0/24');
|
||||||
|
$id_net_scan = create_net_scan($ip_target);
|
||||||
|
if ($id_net_scan > 0) {
|
||||||
|
$id_recon_server = db_get_row_filter('tserver', ['server_type' => SERVER_TYPE_DISCOVERY], 'id_server')['id_server'];
|
||||||
|
ui_print_success_message(__('Basic net created and scan in progress. <a href='.ui_get_full_url('index.php?sec=gservers&sec2=godmode/servers/discovery&wiz=tasklist&server_id='.$id_recon_server.'&force='.$id_net_scan).'>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 {
|
||||||
|
ui_print_error_message(__('Basic net already exists. <a href='.ui_get_full_url('index.php?sec=gservers&sec2=godmode/servers/discovery&wiz=tasklist').'>Click here to view the data</a>'));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($create_mail_alert) {
|
||||||
|
include_once '../functions_alerts.php';
|
||||||
|
$id_action = db_get_row_filter('talert_actions', ['name' => 'Email to '.$config['id_user']], 'id')['id'];
|
||||||
|
if (!$id_action) {
|
||||||
|
$al_action = alerts_get_alert_action($id);
|
||||||
|
$id_action = alerts_clone_alert_action(1, $al_action['id_group'], 'Email to '.$config['id_user']);
|
||||||
|
}
|
||||||
|
|
||||||
|
$id_alert_template = get_parameter('id_condition', 0);
|
||||||
|
$id_agent_module = get_parameter('id_agent_module', 0);
|
||||||
|
|
||||||
|
$exist = db_get_value_sql(
|
||||||
|
sprintf(
|
||||||
|
'SELECT COUNT(id)
|
||||||
|
FROM talert_template_modules
|
||||||
|
WHERE id_agent_module = %d
|
||||||
|
AND id_alert_template = %d
|
||||||
|
AND id_policy_alerts = 0
|
||||||
|
',
|
||||||
|
$id_agent_module,
|
||||||
|
$id_alert_template
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
if ($exist > 0) {
|
||||||
|
ui_print_error_message(__('Alert already exists. <a href='.ui_get_full_url('index.php?sec=galertas&sec2=godmode/alerts/alert_list&tab=list&pure=0').'>Click here to view the data</a>'));
|
||||||
|
} else {
|
||||||
|
$id = alerts_create_alert_agent_module($id_agent_module, $id_alert_template);
|
||||||
|
if ($id !== false) {
|
||||||
|
$values = [];
|
||||||
|
$values['fires_min'] = (int) get_parameter('fires_min');
|
||||||
|
$values['fires_max'] = (int) get_parameter('fires_max');
|
||||||
|
$values['module_action_threshold'] = (int) 300;
|
||||||
|
|
||||||
|
$alert_created = alerts_add_alert_agent_module_action($id, $id_action, $values);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($alert_created === true) {
|
||||||
|
ui_print_success_message(__('Congratulations, you have already created a simple alert. <a href='.ui_get_full_url('index.php?sec=galertas&sec2=godmode/alerts/alert_list&tab=list&pure=0').'>You can see it.</a> Pandora FMS alerts are very flexible, you can do many more things with them, we recommend you to read the <a href="https://pandorafms.com/manual/start?id=en/documentation/04_using/01_alerts">documentation</a> for more information. You can create advanced alerts from <a href='.ui_get_full_url('index.php?sec=galertas&sec2=godmode/alerts/alert_actions').'>here</a>.'));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($create_unknown_template_alert) {
|
||||||
|
if (is_array(alerts_get_alert_templates(['name' => io_safe_input('Unknown condition')]))) {
|
||||||
|
echo 1;
|
||||||
|
} else {
|
||||||
|
echo create_template_alert_unknown();
|
||||||
|
}
|
||||||
|
}
|
@ -35,6 +35,13 @@ if (is_ajax() === false) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$ajaxPage = 'include/ajax/welcome_window';
|
$ajaxPage = 'include/ajax/welcome_window';
|
||||||
|
// Ajax controller.
|
||||||
|
$method = get_parameter('method', '');
|
||||||
|
|
||||||
|
if ($method === 'loadWelcomeWindow') {
|
||||||
|
unset($config['welcome_state']);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Control call flow.
|
// Control call flow.
|
||||||
try {
|
try {
|
||||||
@ -44,9 +51,6 @@ try {
|
|||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ajax controller.
|
|
||||||
$method = get_parameter('method', '');
|
|
||||||
|
|
||||||
if (method_exists($welcome_actions, $method) === true) {
|
if (method_exists($welcome_actions, $method) === true) {
|
||||||
if ($welcome_actions->ajaxMethod($method) === true) {
|
if ($welcome_actions->ajaxMethod($method) === true) {
|
||||||
$welcome_actions->{$method}();
|
$welcome_actions->{$method}();
|
||||||
|
@ -336,54 +336,7 @@ class WelcomeWindow extends Wizard
|
|||||||
public function loadWelcomeWindow()
|
public function loadWelcomeWindow()
|
||||||
{
|
{
|
||||||
global $config;
|
global $config;
|
||||||
|
$flag_task = false;
|
||||||
$btn_configure_mail_class = 'pending';
|
|
||||||
$btn_create_agent_class = 'pending';
|
|
||||||
$btn_create_module_class = '';
|
|
||||||
$btn_create_alert_class = '';
|
|
||||||
$btn_create_discovery_class = 'pending';
|
|
||||||
|
|
||||||
$li_configure_mail_class = 'row_green';
|
|
||||||
$li_create_agent_class = 'row_green';
|
|
||||||
$li_create_module_class = 'row_grey';
|
|
||||||
$li_create_alert_class = 'row_grey';
|
|
||||||
$li_create_discovery_class = 'row_green';
|
|
||||||
|
|
||||||
if (empty($config['welcome_mail_configured']) === false) {
|
|
||||||
$btn_configure_mail_class = ' completed';
|
|
||||||
}
|
|
||||||
|
|
||||||
if (empty($config['welcome_id_agent']) === false) {
|
|
||||||
$btn_create_agent_class = ' completed';
|
|
||||||
$btn_create_module_class = ' pending';
|
|
||||||
$li_create_module_class = 'row_green';
|
|
||||||
}
|
|
||||||
|
|
||||||
if (empty($config['welcome_module']) === false) {
|
|
||||||
$btn_create_module_class = ' completed';
|
|
||||||
$btn_create_alert_class = ' pending';
|
|
||||||
$li_create_module_class = 'row_green';
|
|
||||||
}
|
|
||||||
|
|
||||||
if (empty($config['welcome_alert']) === false) {
|
|
||||||
$btn_create_alert_class = ' completed';
|
|
||||||
$li_create_alert_class = 'row_green';
|
|
||||||
}
|
|
||||||
|
|
||||||
if (empty($config['welcome_task']) === false) {
|
|
||||||
$btn_create_discovery_class = ' completed';
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((int) $config['welcome_state'] === WELCOME_FINISHED) {
|
|
||||||
// Nothing left to do.
|
|
||||||
$btn_configure_mail_class = ' completed';
|
|
||||||
$btn_create_agent_class = ' completed';
|
|
||||||
$btn_create_module_class = ' completed';
|
|
||||||
$btn_create_alert_class = ' completed';
|
|
||||||
$btn_create_discovery_class = ' completed';
|
|
||||||
$li_create_module_class = 'row_green';
|
|
||||||
$li_create_alert_class = 'row_green';
|
|
||||||
}
|
|
||||||
|
|
||||||
$form = [
|
$form = [
|
||||||
'action' => '#',
|
'action' => '#',
|
||||||
@ -392,35 +345,124 @@ class WelcomeWindow extends Wizard
|
|||||||
'class' => 'modal',
|
'class' => 'modal',
|
||||||
];
|
];
|
||||||
|
|
||||||
$logo_url = 'images/custom_logo/pandora_logo_head_white_bg.png';
|
|
||||||
|
|
||||||
if (enterprise_installed() === true) {
|
if (enterprise_installed() === true) {
|
||||||
$logo_url = ENTERPRISE_DIR.'/'.$logo_url;
|
$logo_url = ENTERPRISE_DIR.'/'.$logo_url;
|
||||||
}
|
}
|
||||||
|
|
||||||
$inputs = [
|
if (check_acl($config['id_user'], 0, 'PM')) {
|
||||||
[
|
$flag_um = false;
|
||||||
'class' => 'white_box',
|
$flag_cm = false;
|
||||||
|
$flag_su = false;
|
||||||
|
$flag_lv = false;
|
||||||
|
|
||||||
|
$btn_update_manager_class = ' fail';
|
||||||
|
$btn_configure_mail_class = ' fail';
|
||||||
|
$btn_servers_up_class = ' fail';
|
||||||
|
$btn_license_valid_class = ' fail';
|
||||||
|
|
||||||
|
$li_update_manager_class = 'row_grey';
|
||||||
|
$li_configure_mail_class = 'row_grey';
|
||||||
|
$li_servers_up_class = 'row_grey';
|
||||||
|
$li_license_valid_class = 'row_grey';
|
||||||
|
|
||||||
|
include_once 'include/functions_update_manager.php';
|
||||||
|
if (update_manager_verify_registration()) {
|
||||||
|
$btn_update_manager_class = '';
|
||||||
|
$li_update_manager_class = 'row_green';
|
||||||
|
$flag_um = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (empty($config['welcome_mail_configured']) === false) {
|
||||||
|
$btn_configure_mail_class = '';
|
||||||
|
$li_configure_mail_class = 'row_green';
|
||||||
|
$flag_cm = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
include_once 'include/functions_servers.php';
|
||||||
|
if (check_all_servers_up() === true) {
|
||||||
|
$btn_servers_up_class = '';
|
||||||
|
$li_servers_up_class = 'row_green';
|
||||||
|
$flag_su = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (enterprise_installed()) {
|
||||||
|
$license_valid = true;
|
||||||
|
enterprise_include_once('include/functions_license.php');
|
||||||
|
$license = enterprise_hook('license_get_info');
|
||||||
|
$days_to_expiry = ((strtotime($license['expiry_date']) - time()) / (60 * 60 * 24));
|
||||||
|
if ($license === ENTERPRISE_NOT_HOOK || $days_to_expiry <= 30) {
|
||||||
|
$license_valid = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($license_valid === true) {
|
||||||
|
$btn_license_valid_class = '';
|
||||||
|
$li_license_valid_class = 'row_green';
|
||||||
|
$flag_lv = true;
|
||||||
|
} else {
|
||||||
|
$btn_license_valid_class = 'fail';
|
||||||
|
$li_license_valid_class = 'row_grey';
|
||||||
|
$flag_lv = false;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$btn_license_valid_class = 'fail';
|
||||||
|
$li_license_valid_class = 'row_grey';
|
||||||
|
$flag_lv = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$inputs[] = [
|
||||||
|
'wrapper' => 'div',
|
||||||
|
'block_id' => 'div_diagnosis',
|
||||||
|
'class' => 'flex-row flex-items-center w98p ',
|
||||||
|
'direct' => 1,
|
||||||
'block_content' => [
|
'block_content' => [
|
||||||
[
|
[
|
||||||
'class' => 'centered_full',
|
'label' => __('Post-installation status diagnostic'),
|
||||||
'arguments' => [
|
'arguments' => [
|
||||||
'type' => 'image',
|
'class' => 'first_lbl',
|
||||||
'src' => $logo_url,
|
'name' => 'lbl_diagnosis',
|
||||||
'value' => 1,
|
'id' => 'lbl_diagnosis',
|
||||||
'return' => true,
|
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
|
];
|
||||||
|
|
||||||
|
if ($flag_um === false || $flag_cm === false || $flag_su === false || $flag_lv === false) {
|
||||||
|
$inputs[] = [
|
||||||
|
'wrapper' => 'div',
|
||||||
|
'block_id' => 'div_update_manager',
|
||||||
|
'class' => 'hole flex-row flex-items-center w98p '.$li_update_manager_class,
|
||||||
|
'direct' => 1,
|
||||||
|
'block_content' => [
|
||||||
|
[
|
||||||
|
'label' => __('Warp Update registration'),
|
||||||
|
'arguments' => [
|
||||||
|
'class' => 'first_lbl',
|
||||||
|
'name' => 'lbl_update_manager',
|
||||||
|
'id' => 'lbl_update_manager',
|
||||||
|
],
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
|
'arguments' => [
|
||||||
|
'label' => '',
|
||||||
|
'type' => 'button',
|
||||||
|
'attributes' => [
|
||||||
|
'class' => (empty($btn_update_manager_class) === false) ? $btn_update_manager_class : 'invisible_important',
|
||||||
|
'mode' => 'onlyIcon',
|
||||||
|
],
|
||||||
|
'name' => 'btn_update_manager_conf',
|
||||||
|
'id' => 'btn_update_manager_conf',
|
||||||
|
],
|
||||||
|
],
|
||||||
|
],
|
||||||
|
];
|
||||||
|
$inputs[] = [
|
||||||
'wrapper' => 'div',
|
'wrapper' => 'div',
|
||||||
'block_id' => 'div_configure_mail',
|
'block_id' => 'div_configure_mail',
|
||||||
'class' => 'hole flex-row flex-items-center w98p '.$li_configure_mail_class,
|
'class' => 'hole flex-row flex-items-center w98p '.$li_configure_mail_class,
|
||||||
'direct' => 1,
|
'direct' => 1,
|
||||||
'block_content' => [
|
'block_content' => [
|
||||||
[
|
[
|
||||||
'label' => __('Please ensure mail configuration matches your needs'),
|
'label' => __('Default mail to send alerts'),
|
||||||
'arguments' => [
|
'arguments' => [
|
||||||
'class' => 'first_lbl',
|
'class' => 'first_lbl',
|
||||||
'name' => 'lbl_create_agent',
|
'name' => 'lbl_create_agent',
|
||||||
@ -440,28 +482,19 @@ class WelcomeWindow extends Wizard
|
|||||||
],
|
],
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
],
|
];
|
||||||
[
|
$inputs[] = [
|
||||||
'label' => 'Learn to monitor',
|
|
||||||
'class' => 'extra',
|
|
||||||
'arguments' => [
|
|
||||||
'class' => 'class="lbl_learn"',
|
|
||||||
'name' => 'lbl_learn',
|
|
||||||
'id' => 'lbl_learn',
|
|
||||||
],
|
|
||||||
],
|
|
||||||
[
|
|
||||||
'wrapper' => 'div',
|
'wrapper' => 'div',
|
||||||
'block_id' => 'div_create_agent',
|
'block_id' => 'div_servers_up',
|
||||||
'class' => 'learn_content_indented flex-row flex-items-center w98p '.$li_create_agent_class,
|
'class' => 'hole flex-row flex-items-center w98p '.$li_servers_up_class,
|
||||||
'direct' => 1,
|
'direct' => 1,
|
||||||
'block_content' => [
|
'block_content' => [
|
||||||
[
|
[
|
||||||
'label' => __('Create an agent'),
|
'label' => __('All servers running'),
|
||||||
'arguments' => [
|
'arguments' => [
|
||||||
'class' => 'first_lbl',
|
'class' => 'first_lbl',
|
||||||
'name' => 'lbl_create_agent',
|
'name' => 'lbl_servers_up',
|
||||||
'id' => 'lbl_create_agent',
|
'id' => 'lbl_servers_up',
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
@ -469,131 +502,123 @@ class WelcomeWindow extends Wizard
|
|||||||
'label' => '',
|
'label' => '',
|
||||||
'type' => 'button',
|
'type' => 'button',
|
||||||
'attributes' => [
|
'attributes' => [
|
||||||
'class' => (empty($btn_create_agent_class) === false) ? $btn_create_agent_class : 'invisible_important',
|
'class' => (empty($btn_servers_up_class) === false) ? $btn_servers_up_class : 'invisible_important',
|
||||||
'mode' => 'onlyIcon',
|
'mode' => 'onlyIcon',
|
||||||
],
|
],
|
||||||
'name' => 'btn_create_agent',
|
'name' => 'btn_servers_up_conf',
|
||||||
'id' => 'btn_create_agent',
|
'id' => 'btn_servers_up_conf',
|
||||||
],
|
|
||||||
],
|
|
||||||
],
|
|
||||||
],
|
|
||||||
[
|
|
||||||
'wrapper' => 'div',
|
|
||||||
'block_id' => 'div_monitor_actions',
|
|
||||||
'class' => 'learn_content_indented flex-row flex-items-center w98p '.$li_create_module_class,
|
|
||||||
'direct' => 1,
|
|
||||||
'block_content' => [
|
|
||||||
[
|
|
||||||
'label' => __('Create a module to check if an agent is online'),
|
|
||||||
'arguments' => [
|
|
||||||
'class' => 'second_lbl',
|
|
||||||
'name' => 'lbl_check_agent',
|
|
||||||
'id' => 'lbl_check_agent',
|
|
||||||
],
|
|
||||||
],
|
|
||||||
[
|
|
||||||
'arguments' => [
|
|
||||||
'label' => '',
|
|
||||||
'type' => 'button',
|
|
||||||
'attributes' => [
|
|
||||||
'class' => (empty($btn_create_module_class) === false) ? $btn_create_module_class : 'invisible_important',
|
|
||||||
'mode' => 'onlyIcon',
|
|
||||||
],
|
|
||||||
'name' => 'btn_create_module',
|
|
||||||
'id' => 'btn_create_module',
|
|
||||||
],
|
|
||||||
],
|
|
||||||
],
|
|
||||||
],
|
|
||||||
[
|
|
||||||
'wrapper' => 'div',
|
|
||||||
'block_id' => 'div_monitor_actions',
|
|
||||||
'class' => 'hole learn_content_indented flex-row flex-items-center w98p '.$li_create_alert_class,
|
|
||||||
'direct' => 1,
|
|
||||||
'block_content' => [
|
|
||||||
[
|
|
||||||
'label' => __('Be warned if something is wrong, create an alert on the module'),
|
|
||||||
'arguments' => [
|
|
||||||
'class' => 'second_lbl',
|
|
||||||
'name' => 'lbl_create_alert',
|
|
||||||
'id' => 'lbl_create_alert',
|
|
||||||
],
|
|
||||||
],
|
|
||||||
[
|
|
||||||
'arguments' => [
|
|
||||||
'label' => '',
|
|
||||||
'type' => 'button',
|
|
||||||
'attributes' => [
|
|
||||||
'class' => (empty($btn_create_alert_class) === false) ? $btn_create_alert_class : 'invisible_important',
|
|
||||||
'mode' => 'onlyIcon',
|
|
||||||
],
|
|
||||||
'name' => 'btn_create_alert',
|
|
||||||
'id' => 'btn_create_alert',
|
|
||||||
],
|
|
||||||
],
|
|
||||||
],
|
|
||||||
],
|
|
||||||
[
|
|
||||||
'wrapper' => 'div',
|
|
||||||
'block_id' => 'div_discover',
|
|
||||||
'class' => 'hole flex-row flex-items-center w98p '.$li_create_discovery_class,
|
|
||||||
'direct' => 1,
|
|
||||||
'block_content' => [
|
|
||||||
[
|
|
||||||
'label' => __('Discover hosts and devices in your network'),
|
|
||||||
'arguments' => [
|
|
||||||
'class' => 'first_lbl',
|
|
||||||
'name' => 'lbl_discover_devices',
|
|
||||||
'id' => 'lbl_discover_devices',
|
|
||||||
],
|
|
||||||
],
|
|
||||||
[
|
|
||||||
'arguments' => [
|
|
||||||
'label' => '',
|
|
||||||
'type' => 'button',
|
|
||||||
'attributes' => [
|
|
||||||
'class' => (empty($btn_create_discovery_class) === false) ? $btn_create_discovery_class : 'invisible_important',
|
|
||||||
'mode' => 'onlyIcon',
|
|
||||||
],
|
|
||||||
'name' => 'btn_discover_devices',
|
|
||||||
'id' => 'btn_discover_devices',
|
|
||||||
],
|
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
|
|
||||||
if (enterprise_installed() === true) {
|
|
||||||
$inputs[] = [
|
$inputs[] = [
|
||||||
'wrapper' => 'div',
|
'wrapper' => 'div',
|
||||||
'block_id' => 'div_not_working',
|
'block_id' => 'div_license_valid',
|
||||||
|
'class' => 'hole flex-row flex-items-center w98p '.$li_license_valid_class,
|
||||||
|
'direct' => 1,
|
||||||
|
'block_content' => [
|
||||||
|
[
|
||||||
|
'label' => __('Enterprise licence valid'),
|
||||||
|
'arguments' => [
|
||||||
|
'class' => 'first_lbl',
|
||||||
|
'name' => 'lbl_license_valid',
|
||||||
|
'id' => 'lbl_license_valid',
|
||||||
|
],
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'arguments' => [
|
||||||
|
'label' => '',
|
||||||
|
'type' => 'button',
|
||||||
|
'attributes' => [
|
||||||
|
'class' => (empty($btn_license_valid_class) === false) ? $btn_license_valid_class : 'invisible_important',
|
||||||
|
'mode' => 'onlyIcon',
|
||||||
|
],
|
||||||
|
'name' => 'btn_license_valid_conf',
|
||||||
|
'id' => 'btn_license_valid_conf',
|
||||||
|
],
|
||||||
|
],
|
||||||
|
],
|
||||||
|
];
|
||||||
|
} else {
|
||||||
|
$inputs[] = [
|
||||||
|
'wrapper' => 'div',
|
||||||
|
'block_id' => 'div_all_correct',
|
||||||
'class' => 'hole flex-row flex-items-center w98p',
|
'class' => 'hole flex-row flex-items-center w98p',
|
||||||
'direct' => 1,
|
'direct' => 1,
|
||||||
'block_content' => [
|
'block_content' => [
|
||||||
[
|
[
|
||||||
'label' => __('If something is not working as expected, look for this icon and report!'),
|
'label' => __('It seems that your Pandora FMS is working correctly and registered with ID:<br> #'.$config['pandora_uid'].'.<br>For more information use the self-diagnosis tool.'),
|
||||||
'arguments' => [
|
'arguments' => [
|
||||||
'class' => 'first_lbl',
|
'class' => 'first_lbl w98p',
|
||||||
'name' => 'lbl_not_working',
|
'name' => 'lbl_all_correct',
|
||||||
'id' => 'lbl_not_working',
|
'id' => 'lbl_all_correct',
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
[
|
|
||||||
'label' => html_print_image(
|
|
||||||
'images/feedback-header.png',
|
|
||||||
true,
|
|
||||||
[
|
|
||||||
'onclick' => '$(\'#feedback-header\').click()',
|
|
||||||
'style' => 'cursor: pointer;',
|
|
||||||
]
|
|
||||||
),
|
|
||||||
|
|
||||||
],
|
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($flag_um === false || $flag_cm === false || $flag_su === false || $flag_lv === false) {
|
||||||
|
$flag_task = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Task to do.
|
||||||
|
$inputs[] = [
|
||||||
|
'wrapper' => 'div',
|
||||||
|
'block_id' => 'div_task_todo',
|
||||||
|
'class' => 'flex-row flex-items-center w98p',
|
||||||
|
'direct' => 1,
|
||||||
|
'block_content' => [
|
||||||
|
[
|
||||||
|
'label' => __('Task to perform'),
|
||||||
|
'arguments' => [
|
||||||
|
'class' => 'first_lbl',
|
||||||
|
'name' => 'lbl_task_todo',
|
||||||
|
'id' => 'lbl_task_todo',
|
||||||
|
],
|
||||||
|
],
|
||||||
|
],
|
||||||
|
];
|
||||||
|
|
||||||
|
$fields['wizard_agent'] = __('Agent installation wizard');
|
||||||
|
$fields['check_web'] = __('Create WEB monitoring');
|
||||||
|
$fields['check_connectivity'] = __('Create network monitoring');
|
||||||
|
$fields['check_net'] = __('Discover my network');
|
||||||
|
$fields['check_mail_alert'] = __('Create email alert');
|
||||||
|
|
||||||
|
$inputs[] = [
|
||||||
|
'wrapper' => 'div',
|
||||||
|
'block_id' => 'div_wizard_agent',
|
||||||
|
'class' => 'flex space-between w98p',
|
||||||
|
'direct' => 1,
|
||||||
|
'block_content' => [
|
||||||
|
[
|
||||||
|
'arguments' => [
|
||||||
|
'type' => 'select',
|
||||||
|
'fields' => $fields,
|
||||||
|
'name' => 'task_to_perform',
|
||||||
|
'selected' => '',
|
||||||
|
'return' => true,
|
||||||
|
'nothing' => \__('Please select one'),
|
||||||
|
'nothing_value' => '',
|
||||||
|
],
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'arguments' => [
|
||||||
|
'label' => __("Let's do it!"),
|
||||||
|
'type' => 'button',
|
||||||
|
'attributes' => [
|
||||||
|
'class' => 'secondary',
|
||||||
|
'icon' => 'next',
|
||||||
|
],
|
||||||
|
'name' => 'go_wizard',
|
||||||
|
'id' => 'go_wizard',
|
||||||
|
],
|
||||||
|
],
|
||||||
|
],
|
||||||
|
];
|
||||||
|
|
||||||
$output = $this->printForm(
|
$output = $this->printForm(
|
||||||
[
|
[
|
||||||
'form' => $form,
|
'form' => $form,
|
||||||
@ -602,9 +627,235 @@ class WelcomeWindow extends Wizard
|
|||||||
true
|
true
|
||||||
);
|
);
|
||||||
|
|
||||||
$output .= $this->loadJS();
|
$output .= $this->loadJS($flag_task);
|
||||||
echo $output;
|
echo $output;
|
||||||
|
?>
|
||||||
|
<div id="dialog_goliat" class="invisible">
|
||||||
|
<?php
|
||||||
|
echo html_print_input_hidden('check_web', 1);
|
||||||
|
echo html_print_label_input_block(
|
||||||
|
__('URL'),
|
||||||
|
html_print_input_text(
|
||||||
|
'url_goliat',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
false,
|
||||||
|
255,
|
||||||
|
true,
|
||||||
|
false,
|
||||||
|
true,
|
||||||
|
'',
|
||||||
|
'w100p'
|
||||||
|
)
|
||||||
|
);
|
||||||
|
echo html_print_label_input_block(
|
||||||
|
__('Text to search'),
|
||||||
|
html_print_input_text(
|
||||||
|
'text_to_search',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
false,
|
||||||
|
255,
|
||||||
|
true,
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
'',
|
||||||
|
'w100p'
|
||||||
|
)
|
||||||
|
);
|
||||||
|
echo html_print_label_input_block(
|
||||||
|
__('Modules name'),
|
||||||
|
html_print_input_text(
|
||||||
|
'module_name',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
false,
|
||||||
|
255,
|
||||||
|
true,
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
'',
|
||||||
|
'w100p'
|
||||||
|
)
|
||||||
|
);
|
||||||
|
echo html_print_label_input_block(
|
||||||
|
__('Module group'),
|
||||||
|
html_print_select_from_sql(
|
||||||
|
'SELECT * FROM tgrupo ORDER BY nombre',
|
||||||
|
'id_group',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
false,
|
||||||
|
true,
|
||||||
|
false,
|
||||||
|
true,
|
||||||
|
false,
|
||||||
|
'width: 100%;'
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
echo html_print_submit_button(__('Create'), 'create_goliat', false, ['icon' => 'next', 'style' => 'margin-top:15px; float:right;']);
|
||||||
|
?>
|
||||||
|
</div>
|
||||||
|
<div id="dialog_connectivity" class="invisible">
|
||||||
|
<?php
|
||||||
|
echo html_print_input_hidden('check_connectivity', 1);
|
||||||
|
echo html_print_label_input_block(
|
||||||
|
__('Ip target'),
|
||||||
|
html_print_input_text(
|
||||||
|
'ip_target',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
false,
|
||||||
|
15,
|
||||||
|
true,
|
||||||
|
false,
|
||||||
|
true,
|
||||||
|
'',
|
||||||
|
'w100p'
|
||||||
|
)
|
||||||
|
);
|
||||||
|
echo html_print_label_input_block(
|
||||||
|
__('Agent name'),
|
||||||
|
html_print_input_text(
|
||||||
|
'agent_name',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
false,
|
||||||
|
255,
|
||||||
|
true,
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
'',
|
||||||
|
'w100p'
|
||||||
|
)
|
||||||
|
);
|
||||||
|
echo html_print_label_input_block(
|
||||||
|
__('Module group'),
|
||||||
|
html_print_select_from_sql(
|
||||||
|
'SELECT * FROM tgrupo ORDER BY nombre',
|
||||||
|
'id_group',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
false,
|
||||||
|
true,
|
||||||
|
false,
|
||||||
|
true,
|
||||||
|
false,
|
||||||
|
'width: 100%;'
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
echo html_print_submit_button(__('Create'), 'create_conectivity', false, ['icon' => 'next', 'style' => 'margin-top:15px; float:right;']);
|
||||||
|
?>
|
||||||
|
</div>
|
||||||
|
<div id="dialog_basic_net" class="invisible">
|
||||||
|
<?php
|
||||||
|
echo html_print_input_hidden('create_net_scan', 1);
|
||||||
|
echo html_print_label_input_block(
|
||||||
|
__('Ip target'),
|
||||||
|
html_print_input_text(
|
||||||
|
'ip_target_discovery',
|
||||||
|
'192.168.10.0/24',
|
||||||
|
'192.168.10.0/24',
|
||||||
|
false,
|
||||||
|
18,
|
||||||
|
true,
|
||||||
|
false,
|
||||||
|
true,
|
||||||
|
'',
|
||||||
|
'w100p',
|
||||||
|
'',
|
||||||
|
'off',
|
||||||
|
false,
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
false,
|
||||||
|
'',
|
||||||
|
'192.168.10.0/24'
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
echo html_print_submit_button(__('Create'), 'basic_net', false, ['icon' => 'next', 'style' => 'margin-top:15px; float:right;']);
|
||||||
|
?>
|
||||||
|
</div>
|
||||||
|
<div id="dialog_alert_mail" class="invisible">
|
||||||
|
<?php
|
||||||
|
echo html_print_input_hidden('create_mail_alert', 1);
|
||||||
|
$params = [];
|
||||||
|
$params['return'] = true;
|
||||||
|
$params['show_helptip'] = true;
|
||||||
|
$params['input_name'] = 'id_agent';
|
||||||
|
$params['selectbox_id'] = 'id_agent_module';
|
||||||
|
$params['javascript_is_function_select'] = true;
|
||||||
|
$params['metaconsole_enabled'] = false;
|
||||||
|
$params['use_hidden_input_idagent'] = true;
|
||||||
|
$params['print_hidden_input_idagent'] = true;
|
||||||
|
echo html_print_label_input_block(
|
||||||
|
__('Agent'),
|
||||||
|
ui_print_agent_autocomplete_input($params)
|
||||||
|
);
|
||||||
|
echo html_print_label_input_block(
|
||||||
|
__('Module'),
|
||||||
|
html_print_select(
|
||||||
|
$modules,
|
||||||
|
'id_agent_module',
|
||||||
|
'',
|
||||||
|
true,
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
true,
|
||||||
|
false,
|
||||||
|
true,
|
||||||
|
'w100p',
|
||||||
|
false,
|
||||||
|
'width: 100%;',
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
'',
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
true
|
||||||
|
).'<span id="latest_value" class="invisible">'.__('Latest value').':
|
||||||
|
<span id="value"> </span></span>
|
||||||
|
<span id="module_loading" class="invisible">'.html_print_image('images/spinner.gif', true).'</span>'
|
||||||
|
);
|
||||||
|
|
||||||
|
$condition = alerts_get_alert_templates(['(id IN (1,3) OR name = "'.io_safe_input('Unknown condition').'")'], ['id', 'name']);
|
||||||
|
|
||||||
|
echo html_print_label_input_block(
|
||||||
|
__('Contition'),
|
||||||
|
html_print_select(
|
||||||
|
index_array($condition, 'id', 'name'),
|
||||||
|
'id_condition',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
__('Select'),
|
||||||
|
'',
|
||||||
|
true,
|
||||||
|
false,
|
||||||
|
true,
|
||||||
|
'w100p',
|
||||||
|
false,
|
||||||
|
'width: 100%;',
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
'',
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
true
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
echo html_print_submit_button(__('Create'), 'alert_mail', false, ['icon' => 'next', 'style' => 'margin-top:15px; float:right;']);
|
||||||
|
?>
|
||||||
|
</div>
|
||||||
|
<?php
|
||||||
// Ajax methods does not continue.
|
// Ajax methods does not continue.
|
||||||
exit();
|
exit();
|
||||||
}
|
}
|
||||||
@ -830,82 +1081,257 @@ class WelcomeWindow extends Wizard
|
|||||||
*
|
*
|
||||||
* @return string HTML code for javascript functionality.
|
* @return string HTML code for javascript functionality.
|
||||||
*/
|
*/
|
||||||
public function loadJS()
|
public function loadJS($flag_task=false)
|
||||||
{
|
{
|
||||||
ob_start();
|
ob_start();
|
||||||
?>
|
?>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
<?php
|
$('#div_all_correct').children().attr('class','w100p').attr('style', 'overflow-wrap: break-word;');
|
||||||
if ($this->step > W_CREATE_AGENT) {
|
<?php if ($flag_task === true) { ?>
|
||||||
switch ($this->step) {
|
document.getElementById("button-btn_update_manager_conf").setAttribute(
|
||||||
case W_CREATE_MODULE:
|
|
||||||
?>
|
|
||||||
document.getElementById("button-btn_create_module").setAttribute(
|
|
||||||
'onclick',
|
'onclick',
|
||||||
'checkAgentOnline()'
|
'configureUpdateManager()'
|
||||||
);
|
);
|
||||||
<?php
|
|
||||||
break;
|
|
||||||
|
|
||||||
case W_CREATE_ALERT:
|
|
||||||
?>
|
|
||||||
document.getElementById("button-btn_create_alert").setAttribute(
|
|
||||||
'onclick',
|
|
||||||
'createAlertModule()'
|
|
||||||
);
|
|
||||||
<?php
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
// Ignore.
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
|
|
||||||
document.getElementById("button-btn_email_conf").setAttribute(
|
document.getElementById("button-btn_email_conf").setAttribute(
|
||||||
'onclick',
|
'onclick',
|
||||||
'configureEmail()'
|
'configureEmail()'
|
||||||
);
|
);
|
||||||
document.getElementById("button-btn_create_agent").setAttribute(
|
document.getElementById("button-btn_servers_up_conf").setAttribute(
|
||||||
'onclick',
|
'onclick',
|
||||||
'createNewAgent()'
|
'serversUp()'
|
||||||
);
|
);
|
||||||
document.getElementById("button-btn_discover_devices").setAttribute(
|
document.getElementById("button-btn_license_valid_conf").setAttribute(
|
||||||
'onclick',
|
'onclick',
|
||||||
'discoverDevicesNetwork()'
|
'messageLicense()'
|
||||||
);
|
);
|
||||||
|
<?php } ?>
|
||||||
|
|
||||||
|
// Task to do buttons.
|
||||||
|
$('#button-go_wizard').click(function(){
|
||||||
|
if ($('#task_to_perform :selected').val() === '') {
|
||||||
|
alert("<?php echo __('You must chose an option'); ?>");
|
||||||
|
} else {
|
||||||
|
switch($('#task_to_perform :selected').val()) {
|
||||||
|
case 'wizard_agent':
|
||||||
|
deployAgent();
|
||||||
|
break;
|
||||||
|
case 'check_mail_alert':
|
||||||
|
openCreateAlertMailDialog();
|
||||||
|
break;
|
||||||
|
case 'check_connectivity':
|
||||||
|
openCreateConnectivityDialog();
|
||||||
|
break;
|
||||||
|
case 'check_web':
|
||||||
|
openCreateModulesDialog();
|
||||||
|
break;
|
||||||
|
case 'check_net':
|
||||||
|
openCreateBasicNetDialog();
|
||||||
|
break;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
function configureUpdateManager() {
|
||||||
|
window.location = '<?php echo ui_get_full_url('index.php?sec=messages&sec2=godmode/update_manager/update_manager&tab=online'); ?>';
|
||||||
|
}
|
||||||
|
|
||||||
function configureEmail() {
|
function configureEmail() {
|
||||||
window.location = '<?php echo ui_get_full_url('index.php?sec=general&sec2=godmode/setup/setup§ion=general#table3'); ?>';
|
window.location = '<?php echo ui_get_full_url('index.php?sec=general&sec2=godmode/setup/setup§ion=general#table3'); ?>';
|
||||||
}
|
}
|
||||||
|
|
||||||
function createNewAgent() {
|
function serversUp() {
|
||||||
window.location = '<?php echo ui_get_full_url('index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&new_agent=1&crt-2=Create+agent'); ?>';
|
window.location = '<?php echo ui_get_full_url('index.php?sec=gservers&sec2=godmode/servers/modificar_server&refr=60'); ?>';
|
||||||
}
|
}
|
||||||
|
|
||||||
function checkAgentOnline() {
|
function messageLicense() {
|
||||||
window.location = '<?php echo ui_get_full_url('index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=module&id_agente='.$this->getWelcomeAgent().''); ?>';
|
window.location = '<?php echo ui_get_full_url('index.php?sec=message_list&sec2=operation/messages/message_list'); ?>';
|
||||||
}
|
}
|
||||||
|
|
||||||
function createAlertModule() {
|
// Task to do actions.
|
||||||
window.location = '<?php echo ui_get_full_url('index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=alert&id_agente='.$this->getWelcomeAgent().''); ?>';
|
function deployAgent() {
|
||||||
|
window.location = '<?php echo ui_get_full_url('index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&show_deploy_agent=1'); ?>';
|
||||||
}
|
}
|
||||||
|
|
||||||
function monitorRemoteCommands() {
|
function openCreateModulesDialog() {
|
||||||
window.location = '<?php echo ui_get_full_url(''); ?>';
|
$('#dialog_goliat').dialog({
|
||||||
|
title: '<?php echo __('Create WEB monitoring'); ?>',
|
||||||
|
resizable: true,
|
||||||
|
draggable: true,
|
||||||
|
modal: true,
|
||||||
|
close: false,
|
||||||
|
height: 375,
|
||||||
|
width: 480,
|
||||||
|
overlay: {
|
||||||
|
opacity: 0.5,
|
||||||
|
background: "black"
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
function discoverDevicesNetwork() {
|
function openCreateConnectivityDialog() {
|
||||||
window.location = '<?php echo ui_get_full_url('index.php?sec=gservers&sec2=godmode/servers/discovery&wiz=hd&mode=netscan'); ?>';
|
$('#dialog_connectivity').dialog({
|
||||||
|
title: '<?php echo __('Create network monitoring'); ?>',
|
||||||
|
resizable: true,
|
||||||
|
draggable: true,
|
||||||
|
modal: true,
|
||||||
|
close: false,
|
||||||
|
height: 350,
|
||||||
|
width: 480,
|
||||||
|
overlay: {
|
||||||
|
opacity: 0.5,
|
||||||
|
background: "black"
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
function reportIsNotWorking() {
|
function openCreateBasicNetDialog() {
|
||||||
|
$('#dialog_basic_net').dialog({
|
||||||
|
title: '<?php echo __('Discover my network'); ?>',
|
||||||
|
resizable: true,
|
||||||
|
draggable: true,
|
||||||
|
modal: true,
|
||||||
|
close: false,
|
||||||
|
height: 200,
|
||||||
|
width: 480,
|
||||||
|
overlay: {
|
||||||
|
opacity: 0.5,
|
||||||
|
background: "black"
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
function cierre_dialog(){
|
function openCreateAlertMailDialog() {
|
||||||
this.dialog("close");
|
$.ajax({
|
||||||
|
async: false,
|
||||||
|
type: "POST",
|
||||||
|
url: "include/ajax/task_to_perform.php",
|
||||||
|
data: {
|
||||||
|
create_unknown_template_alert: 1,
|
||||||
|
},
|
||||||
|
success: function(data) {
|
||||||
|
$('#dialog_alert_mail').dialog({
|
||||||
|
title: '<?php echo __('Create email alert'); ?>',
|
||||||
|
resizable: true,
|
||||||
|
draggable: true,
|
||||||
|
modal: true,
|
||||||
|
close: false,
|
||||||
|
height: 350,
|
||||||
|
width: 480,
|
||||||
|
overlay: {
|
||||||
|
opacity: 0.5,
|
||||||
|
background: "black"
|
||||||
}
|
}
|
||||||
|
})
|
||||||
|
.show();
|
||||||
|
|
||||||
|
$('#text-id_agent').autocomplete({
|
||||||
|
appendTo: '#dialog_alert_mail'
|
||||||
|
});
|
||||||
|
|
||||||
|
$("#id_agent_module").select2({
|
||||||
|
dropdownParent: $("#dialog_alert_mail")
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
$('#button-create_goliat').click(function(){
|
||||||
|
$.ajax({
|
||||||
|
async: false,
|
||||||
|
type: "POST",
|
||||||
|
url: "include/ajax/task_to_perform.php",
|
||||||
|
data: {
|
||||||
|
check_web: 1,
|
||||||
|
id_group: $('#id_group :selected').val(),
|
||||||
|
module_name: $('#text-module_name').val(),
|
||||||
|
text_to_search: $('#text-text_to_search').val(),
|
||||||
|
url_goliat: $('#text-url_goliat').val(),
|
||||||
|
},
|
||||||
|
success: function(data) {
|
||||||
|
if (data !== 0) {
|
||||||
|
data = data.replace(/(\r\n|\n|\r)/gm, "");
|
||||||
|
console.log(data);
|
||||||
|
$('body').append(data);
|
||||||
|
// Close dialog
|
||||||
|
$('.ui-dialog-titlebar-close').trigger('click');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#button-create_conectivity').click(function(){
|
||||||
|
$.ajax({
|
||||||
|
async: false,
|
||||||
|
type: "POST",
|
||||||
|
url: "include/ajax/task_to_perform.php",
|
||||||
|
data: {
|
||||||
|
check_connectivity: 1,
|
||||||
|
id_group: $('#id_group :selected').val(),
|
||||||
|
ip_target: $('#text-ip_target').val(),
|
||||||
|
agent_name: $('#text-agent_name').val(),
|
||||||
|
},
|
||||||
|
success: function(data) {
|
||||||
|
if (data !== 0) {
|
||||||
|
data = data.replace(/(\r\n|\n|\r)/gm, "");
|
||||||
|
console.log(data);
|
||||||
|
$('body').append(data);
|
||||||
|
// Close dialog
|
||||||
|
$('.ui-dialog-titlebar-close').trigger('click');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#button-basic_net').click(function(){
|
||||||
|
$.ajax({
|
||||||
|
async: false,
|
||||||
|
type: "POST",
|
||||||
|
url: "include/ajax/task_to_perform.php",
|
||||||
|
data: {
|
||||||
|
create_net_scan: 1,
|
||||||
|
ip_target: $('#text-ip_target_discovery').val(),
|
||||||
|
},
|
||||||
|
success: function(data) {
|
||||||
|
if (data !== 0) {
|
||||||
|
data = data.replace(/(\r\n|\n|\r)/gm, "");
|
||||||
|
console.log(data);
|
||||||
|
$('body').append(data);
|
||||||
|
// Close dialog
|
||||||
|
$('.ui-dialog-titlebar-close').trigger('click');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#button-alert_mail').click(function(){
|
||||||
|
$.ajax({
|
||||||
|
async: false,
|
||||||
|
type: "POST",
|
||||||
|
url: "include/ajax/task_to_perform.php",
|
||||||
|
data: {
|
||||||
|
create_mail_alert: 1,
|
||||||
|
id_condition: $('#id_condition').val(),
|
||||||
|
id_agent_module: $('#id_agent_module').val(),
|
||||||
|
},
|
||||||
|
success: function(data) {
|
||||||
|
if (data !== 0) {
|
||||||
|
data = data.replace(/(\r\n|\n|\r)/gm, "");
|
||||||
|
console.log(data);
|
||||||
|
$('body').append(data);
|
||||||
|
// Close dialog
|
||||||
|
$('.ui-dialog-titlebar-close').trigger('click');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
<?php
|
<?php
|
||||||
return ob_get_clean();
|
return ob_get_clean();
|
||||||
|
@ -455,7 +455,7 @@ function alerts_delete_alert_action($id_alert_action)
|
|||||||
*
|
*
|
||||||
* @return mixed Id of the cloned action or false in case of fail.
|
* @return mixed Id of the cloned action or false in case of fail.
|
||||||
*/
|
*/
|
||||||
function alerts_clone_alert_action($id_alert_action, $id_group)
|
function alerts_clone_alert_action($id_alert_action, $id_group, $copy_name='')
|
||||||
{
|
{
|
||||||
$id_alert_action = safe_int($id_alert_action, 1);
|
$id_alert_action = safe_int($id_alert_action, 1);
|
||||||
if (empty($id_alert_action)) {
|
if (empty($id_alert_action)) {
|
||||||
@ -474,7 +474,13 @@ function alerts_clone_alert_action($id_alert_action, $id_group)
|
|||||||
|
|
||||||
unset($action['id']);
|
unset($action['id']);
|
||||||
|
|
||||||
return alerts_create_alert_action($action['name'].' '.__('copy'), $action['id_alert_command'], $action);
|
if ($copy_name !== '') {
|
||||||
|
$copy_name = $copy_name;
|
||||||
|
} else {
|
||||||
|
$copy_name = $action['name'].' '.__('copy');
|
||||||
|
}
|
||||||
|
|
||||||
|
return alerts_create_alert_action($copy_name, $action['id_alert_command'], $action);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -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)
|
function api_set_new_agent($id_node, $thrash2, $other, $trhash3, $return=false)
|
||||||
{
|
{
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
@ -2038,6 +2038,7 @@ function api_set_new_agent($id_node, $thrash2, $other, $trhash3)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($return === false) {
|
||||||
returnData(
|
returnData(
|
||||||
'string',
|
'string',
|
||||||
[
|
[
|
||||||
@ -2045,6 +2046,9 @@ function api_set_new_agent($id_node, $thrash2, $other, $trhash3)
|
|||||||
'data' => $id_agente,
|
'data' => $id_agente,
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
} else {
|
||||||
|
return $id_agente;
|
||||||
|
}
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
returnError($e->getMessage());
|
returnError($e->getMessage());
|
||||||
return;
|
return;
|
||||||
|
@ -7144,3 +7144,44 @@ function html_print_code_picker(
|
|||||||
echo $output;
|
echo $output;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function html_print_wizard_diagnosis(
|
||||||
|
$title,
|
||||||
|
$id_button,
|
||||||
|
$description='',
|
||||||
|
$status=true,
|
||||||
|
$return=false,
|
||||||
|
) {
|
||||||
|
$button = '';
|
||||||
|
if ($status === true) {
|
||||||
|
$status = 'Connected';
|
||||||
|
$img = '/images/configuration@svg.svg';
|
||||||
|
} else {
|
||||||
|
$status = 'Disconnected';
|
||||||
|
$img = '/images/change-active.svg';
|
||||||
|
}
|
||||||
|
|
||||||
|
$button = html_print_image(
|
||||||
|
$img,
|
||||||
|
true,
|
||||||
|
[
|
||||||
|
'class' => 'main_menu_icon invert_filter float-right mrgn_right_10px',
|
||||||
|
'id' => $id_button,
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
$output = '<div class="rectangle rectangle_'.$status.'">
|
||||||
|
<span class="status '.$status.'">'.__($status).$button.'</span>
|
||||||
|
<div class="title">'.html_print_image('/images/circle_title.svg', true, ['class' => 'invert_filter']).'<span>'.$title.'</span></div>
|
||||||
|
<div class="description">
|
||||||
|
<span>'.$description.'</span>
|
||||||
|
</div>
|
||||||
|
</div>';
|
||||||
|
|
||||||
|
if ($return === true) {
|
||||||
|
return $output;
|
||||||
|
} else {
|
||||||
|
echo $output;
|
||||||
|
}
|
||||||
|
}
|
@ -324,6 +324,8 @@ function menu_print_menu(&$menu)
|
|||||||
|
|
||||||
if (isset($sub['subtype']) && $sub['subtype'] == 'nolink') {
|
if (isset($sub['subtype']) && $sub['subtype'] == 'nolink') {
|
||||||
$submenu_output .= '<div class=" SubNoLink '.$sub_tree_class.'"><span class="w70p span_has_menu_text">'.$sub['text'].'</span><div class="w21p arrow_menu_down"></div></div>';
|
$submenu_output .= '<div class=" SubNoLink '.$sub_tree_class.'"><span class="w70p span_has_menu_text">'.$sub['text'].'</span><div class="w21p arrow_menu_down"></div></div>';
|
||||||
|
} else if (isset($sub['subtype']) && $sub['subtype'] == 'nolink_no_arrow') {
|
||||||
|
$submenu_output .= '<div class=" SubNoLink '.$sub_tree_class.'"><span class="w70p span_has_menu_text">'.$sub['text'].'</span><div class="w21p"></div></div>';
|
||||||
} else if (isset($sub['subtype']) && $sub['subtype'] == 'new_blank') {
|
} else if (isset($sub['subtype']) && $sub['subtype'] == 'new_blank') {
|
||||||
$submenu_output .= '<a href="'.$subsec2.'" target="_blank"><div class="'.$sub_tree_class.'">'.$sub['text'].'</div></a>';
|
$submenu_output .= '<a href="'.$subsec2.'" target="_blank"><div class="'.$sub_tree_class.'">'.$sub['text'].'</div></a>';
|
||||||
} else {
|
} else {
|
||||||
|
@ -1411,3 +1411,24 @@ function servers_get_master()
|
|||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return true if all servers are up.
|
||||||
|
*
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
function check_all_servers_up()
|
||||||
|
{
|
||||||
|
$status = true;
|
||||||
|
|
||||||
|
$servers = servers_get_info();
|
||||||
|
|
||||||
|
foreach ($servers as $server) {
|
||||||
|
if ($server['status'] !== '1') {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $status;
|
||||||
|
}
|
||||||
|
@ -3324,6 +3324,32 @@ function ui_print_module_status(
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns html code to print a shape for a module.
|
||||||
|
*
|
||||||
|
* @param integer $color Hex color.
|
||||||
|
* @param boolean $return True or false.
|
||||||
|
* @param string $class Custom class or use defined.
|
||||||
|
* @param string $div_content Content.
|
||||||
|
*
|
||||||
|
* @return string HTML code for shape.
|
||||||
|
*/
|
||||||
|
function ui_print_diagnosis_status(
|
||||||
|
$color,
|
||||||
|
$return=false,
|
||||||
|
$class='status_rounded_rectangles',
|
||||||
|
$div_content=''
|
||||||
|
) {
|
||||||
|
$output = '<div style="background: '.$color.'" class="'.$class.'">'.$div_content.'</div>';
|
||||||
|
|
||||||
|
if ($return === false) {
|
||||||
|
echo $output;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $output;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the shape of an image by assigning it a CSS class. Prints an image with CSS representing a status.
|
* Get the shape of an image by assigning it a CSS class. Prints an image with CSS representing a status.
|
||||||
*
|
*
|
||||||
|
568
pandora_console/include/functions_welcome_wizard.php
Normal file
568
pandora_console/include/functions_welcome_wizard.php
Normal file
@ -0,0 +1,568 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Agents Functions.
|
||||||
|
*
|
||||||
|
* @category Agents functions.
|
||||||
|
* @package Pandora FMS
|
||||||
|
* @subpackage User interface.
|
||||||
|
* @version 1.0.0
|
||||||
|
* @license See below
|
||||||
|
*
|
||||||
|
* ______ ___ _______ _______ ________
|
||||||
|
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
|
||||||
|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
|
||||||
|
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
|
||||||
|
*
|
||||||
|
* ============================================================================
|
||||||
|
* Copyright (c) 2005-2023 PandoraFMS 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.
|
||||||
|
* ============================================================================
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Begin.
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create_module_latency_goliat and return module id.
|
||||||
|
*
|
||||||
|
* @param mixed $id_agent Id agent.
|
||||||
|
* @param mixed $module_name Module name.
|
||||||
|
* @param mixed $id_group Id group.
|
||||||
|
* @param mixed $url_search Url to search.
|
||||||
|
* @param mixed $string_search Text to search.
|
||||||
|
*
|
||||||
|
* @return interger Module id.
|
||||||
|
*/
|
||||||
|
function create_module_latency_goliat($id_agent, $module_name, $id_group, $url_search, $string_search='')
|
||||||
|
{
|
||||||
|
if ($string_search !== '') {
|
||||||
|
$str_search = 'check_string '.$string_search.'';
|
||||||
|
}
|
||||||
|
|
||||||
|
include_once 'include/functions_modules.php';
|
||||||
|
|
||||||
|
$array_values = [
|
||||||
|
'id_tipo_modulo' => '30',
|
||||||
|
'descripcion' => '',
|
||||||
|
'max' => '0',
|
||||||
|
'min' => '0',
|
||||||
|
'snmp_oid' => '',
|
||||||
|
'snmp_community' => 'public',
|
||||||
|
'id_module_group' => $id_group,
|
||||||
|
'module_interval' => '300',
|
||||||
|
'module_ff_interval' => '0',
|
||||||
|
'ip_target' => '',
|
||||||
|
'tcp_port' => '0',
|
||||||
|
'tcp_rcv' => '',
|
||||||
|
'tcp_send' => '',
|
||||||
|
'id_export' => '0',
|
||||||
|
'plugin_user' => '',
|
||||||
|
'plugin_pass' => '0',
|
||||||
|
'plugin_parameter' => 'task_begin
|
||||||
|
get '.$url_search.'
|
||||||
|
resource 1
|
||||||
|
'.$str_search.'
|
||||||
|
task_end',
|
||||||
|
'id_plugin' => '0',
|
||||||
|
'post_process' => '0',
|
||||||
|
'prediction_module' => '0',
|
||||||
|
'max_timeout' => '0',
|
||||||
|
'max_retries' => '0',
|
||||||
|
'disabled' => '',
|
||||||
|
'id_modulo' => '7',
|
||||||
|
'custom_id' => '',
|
||||||
|
'history_data' => '1',
|
||||||
|
'dynamic_interval' => '0',
|
||||||
|
'dynamic_max' => '0',
|
||||||
|
'dynamic_min' => '0',
|
||||||
|
'dynamic_two_tailed' => '0',
|
||||||
|
'parent_module_id' => '0',
|
||||||
|
'min_warning' => '0',
|
||||||
|
'max_warning' => '0',
|
||||||
|
'str_warning' => '',
|
||||||
|
'min_critical' => '0',
|
||||||
|
'max_critical' => '0',
|
||||||
|
'str_critical' => '',
|
||||||
|
'custom_string_1' => '',
|
||||||
|
'custom_string_2' => '',
|
||||||
|
'custom_string_3' => '',
|
||||||
|
'custom_integer_1' => '0',
|
||||||
|
'custom_integer_2' => '0',
|
||||||
|
'min_ff_event' => '0',
|
||||||
|
'min_ff_event_normal' => '0',
|
||||||
|
'min_ff_event_warning' => '0',
|
||||||
|
'min_ff_event_critical' => '0',
|
||||||
|
'ff_type' => '0',
|
||||||
|
'each_ff' => '0',
|
||||||
|
'ff_timeout' => '0',
|
||||||
|
'unit' => '',
|
||||||
|
'macros' => '',
|
||||||
|
'quiet' => '0',
|
||||||
|
'cps' => '0',
|
||||||
|
'critical_instructions' => '',
|
||||||
|
'warning_instructions' => '',
|
||||||
|
'unknown_instructions' => '',
|
||||||
|
'critical_inverse' => '0',
|
||||||
|
'warning_inverse' => '0',
|
||||||
|
'percentage_critical' => '0',
|
||||||
|
'percentage_warning' => '0',
|
||||||
|
'cron_interval' => '* * * * *',
|
||||||
|
'id_category' => '0',
|
||||||
|
'disabled_types_event' => '{\"going_unknown\":0}',
|
||||||
|
'module_macros' => 'W10=',
|
||||||
|
'warning_time' => '0',
|
||||||
|
];
|
||||||
|
return modules_create_agent_module($id_agent, $module_name.'_latency', $array_values);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create_module_status_goliat and return module id.
|
||||||
|
*
|
||||||
|
* @param mixed $id_agent Id agent.
|
||||||
|
* @param mixed $module_name Module name.
|
||||||
|
* @param mixed $id_group Id group.
|
||||||
|
* @param mixed $url_search Url to search.
|
||||||
|
* @param mixed $string_search Text to search.
|
||||||
|
*
|
||||||
|
* @return interger Module id.
|
||||||
|
*/
|
||||||
|
function create_module_status_goliat($id_agent, $module_name, $id_group, $url_search, $string_search='')
|
||||||
|
{
|
||||||
|
if ($string_search !== '') {
|
||||||
|
$str_search = 'check_string '.$string_search.' ';
|
||||||
|
}
|
||||||
|
|
||||||
|
include_once 'include/functions_modules.php';
|
||||||
|
|
||||||
|
$array_values = [
|
||||||
|
'id_tipo_modulo' => '31',
|
||||||
|
'descripcion' => '',
|
||||||
|
'max' => '0',
|
||||||
|
'min' => '0',
|
||||||
|
'snmp_oid' => '',
|
||||||
|
'snmp_community' => 'public',
|
||||||
|
'id_module_group' => $id_group,
|
||||||
|
'module_interval' => '300',
|
||||||
|
'module_ff_interval' => '0',
|
||||||
|
'ip_target' => '',
|
||||||
|
'tcp_port' => '0',
|
||||||
|
'tcp_rcv' => '',
|
||||||
|
'tcp_send' => '',
|
||||||
|
'id_export' => '0',
|
||||||
|
'plugin_user' => '',
|
||||||
|
'plugin_pass' => '0',
|
||||||
|
'plugin_parameter' => 'task_begin
|
||||||
|
get '.$url_search.'
|
||||||
|
resource 1
|
||||||
|
'.$str_search.'
|
||||||
|
task_end',
|
||||||
|
'id_plugin' => '0',
|
||||||
|
'post_process' => '0',
|
||||||
|
'prediction_module' => '0',
|
||||||
|
'max_timeout' => '0',
|
||||||
|
'max_retries' => '0',
|
||||||
|
'disabled' => '',
|
||||||
|
'id_modulo' => '7',
|
||||||
|
'custom_id' => '',
|
||||||
|
'history_data' => '1',
|
||||||
|
'dynamic_interval' => '0',
|
||||||
|
'dynamic_max' => '0',
|
||||||
|
'dynamic_min' => '0',
|
||||||
|
'dynamic_two_tailed' => '0',
|
||||||
|
'parent_module_id' => '0',
|
||||||
|
'min_warning' => '0',
|
||||||
|
'max_warning' => '0',
|
||||||
|
'str_warning' => '',
|
||||||
|
'min_critical' => '0',
|
||||||
|
'max_critical' => '0',
|
||||||
|
'str_critical' => '',
|
||||||
|
'custom_string_1' => '',
|
||||||
|
'custom_string_2' => '',
|
||||||
|
'custom_string_3' => '',
|
||||||
|
'custom_integer_1' => '0',
|
||||||
|
'custom_integer_2' => '0',
|
||||||
|
'min_ff_event' => '0',
|
||||||
|
'min_ff_event_normal' => '0',
|
||||||
|
'min_ff_event_warning' => '0',
|
||||||
|
'min_ff_event_critical' => '0',
|
||||||
|
'ff_type' => '0',
|
||||||
|
'each_ff' => '0',
|
||||||
|
'ff_timeout' => '0',
|
||||||
|
'unit' => '',
|
||||||
|
'macros' => '',
|
||||||
|
'quiet' => '0',
|
||||||
|
'cps' => '0',
|
||||||
|
'critical_instructions' => '',
|
||||||
|
'warning_instructions' => '',
|
||||||
|
'unknown_instructions' => '',
|
||||||
|
'critical_inverse' => '0',
|
||||||
|
'warning_inverse' => '0',
|
||||||
|
'percentage_critical' => '0',
|
||||||
|
'percentage_warning' => '0',
|
||||||
|
'cron_interval' => '* * * * *',
|
||||||
|
'id_category' => '0',
|
||||||
|
'disabled_types_event' => '{\"going_unknown\":0}',
|
||||||
|
'module_macros' => 'W10=',
|
||||||
|
'warning_time' => '0',
|
||||||
|
];
|
||||||
|
return modules_create_agent_module($id_agent, $module_name.'_status', $array_values);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create module basic network and return module id.
|
||||||
|
*
|
||||||
|
* @param mixed $id_agent Id agent.
|
||||||
|
* @param mixed $id_group Id group.
|
||||||
|
* @param mixed $ip_target Ip target.
|
||||||
|
*
|
||||||
|
* @return interger Module id.
|
||||||
|
*/
|
||||||
|
function create_module_basic_network($id_agent, $id_group, $ip_target)
|
||||||
|
{
|
||||||
|
include_once 'include/functions_modules.php';
|
||||||
|
|
||||||
|
$array_values = [
|
||||||
|
'id_tipo_modulo' => '6',
|
||||||
|
'descripcion' => 'Basic network check (ping)',
|
||||||
|
'max' => '0',
|
||||||
|
'min' => '0',
|
||||||
|
'snmp_oid' => '',
|
||||||
|
'snmp_community' => 'public',
|
||||||
|
'id_module_group' => $id_group,
|
||||||
|
'module_interval' => '300',
|
||||||
|
'module_ff_interval' => '0',
|
||||||
|
'ip_target' => $ip_target,
|
||||||
|
'tcp_port' => '0',
|
||||||
|
'tcp_rcv' => '',
|
||||||
|
'tcp_send' => '',
|
||||||
|
'id_export' => '0',
|
||||||
|
'plugin_user' => '',
|
||||||
|
'plugin_pass' => '0',
|
||||||
|
'plugin_parameter' => '',
|
||||||
|
'id_plugin' => '0',
|
||||||
|
'post_process' => '0',
|
||||||
|
'prediction_module' => '0',
|
||||||
|
'max_timeout' => '0',
|
||||||
|
'max_retries' => '0',
|
||||||
|
'disabled' => '',
|
||||||
|
'id_modulo' => '2',
|
||||||
|
'custom_id' => '',
|
||||||
|
'history_data' => '1',
|
||||||
|
'dynamic_interval' => '0',
|
||||||
|
'dynamic_max' => '0',
|
||||||
|
'dynamic_min' => '0',
|
||||||
|
'dynamic_two_tailed' => '0',
|
||||||
|
'parent_module_id' => '0',
|
||||||
|
'min_warning' => '0',
|
||||||
|
'max_warning' => '0',
|
||||||
|
'str_warning' => '',
|
||||||
|
'min_critical' => '0',
|
||||||
|
'max_critical' => '0',
|
||||||
|
'str_critical' => '',
|
||||||
|
'custom_string_1' => '',
|
||||||
|
'custom_string_2' => '',
|
||||||
|
'custom_string_3' => '',
|
||||||
|
'custom_integer_1' => '0',
|
||||||
|
'custom_integer_2' => '0',
|
||||||
|
'min_ff_event' => '0',
|
||||||
|
'min_ff_event_normal' => '0',
|
||||||
|
'min_ff_event_warning' => '0',
|
||||||
|
'min_ff_event_critical' => '0',
|
||||||
|
'ff_type' => '0',
|
||||||
|
'each_ff' => '0',
|
||||||
|
'ff_timeout' => '0',
|
||||||
|
'unit' => '',
|
||||||
|
'macros' => '',
|
||||||
|
'quiet' => '0',
|
||||||
|
'cps' => '0',
|
||||||
|
'critical_instructions' => '',
|
||||||
|
'warning_instructions' => '',
|
||||||
|
'unknown_instructions' => '',
|
||||||
|
'critical_inverse' => '0',
|
||||||
|
'warning_inverse' => '0',
|
||||||
|
'percentage_critical' => '0',
|
||||||
|
'percentage_warning' => '0',
|
||||||
|
'cron_interval' => '* * * * *',
|
||||||
|
'id_category' => '0',
|
||||||
|
'disabled_types_event' => '{\"going_unknown\":0}',
|
||||||
|
'module_macros' => 'W10=',
|
||||||
|
'warning_time' => '0',
|
||||||
|
];
|
||||||
|
return modules_create_agent_module($id_agent, 'Basic_Network_Check', $array_values);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create module latency network and return module id.
|
||||||
|
*
|
||||||
|
* @param mixed $id_agent Id agent.
|
||||||
|
* @param mixed $id_group Id group.
|
||||||
|
* @param mixed $ip_target Ip target.
|
||||||
|
*
|
||||||
|
* @return interger Module id.
|
||||||
|
*/
|
||||||
|
function create_module_latency_network($id_agent, $id_group, $ip_target)
|
||||||
|
{
|
||||||
|
include_once 'include/functions_modules.php';
|
||||||
|
|
||||||
|
$array_values = [
|
||||||
|
'id_tipo_modulo' => '7',
|
||||||
|
'descripcion' => 'Basic network connectivity check to measure network latency in miliseconds',
|
||||||
|
'max' => '0',
|
||||||
|
'min' => '0',
|
||||||
|
'snmp_oid' => '',
|
||||||
|
'snmp_community' => 'public',
|
||||||
|
'id_module_group' => $id_group,
|
||||||
|
'module_interval' => '300',
|
||||||
|
'module_ff_interval' => '0',
|
||||||
|
'ip_target' => $ip_target,
|
||||||
|
'tcp_port' => '0',
|
||||||
|
'tcp_rcv' => '',
|
||||||
|
'tcp_send' => '',
|
||||||
|
'id_export' => '0',
|
||||||
|
'plugin_user' => '',
|
||||||
|
'plugin_pass' => '0',
|
||||||
|
'plugin_parameter' => '',
|
||||||
|
'id_plugin' => '0',
|
||||||
|
'post_process' => '0',
|
||||||
|
'prediction_module' => '0',
|
||||||
|
'max_timeout' => '0',
|
||||||
|
'max_retries' => '0',
|
||||||
|
'disabled' => '',
|
||||||
|
'id_modulo' => '2',
|
||||||
|
'custom_id' => '',
|
||||||
|
'history_data' => '1',
|
||||||
|
'dynamic_interval' => '0',
|
||||||
|
'dynamic_max' => '0',
|
||||||
|
'dynamic_min' => '0',
|
||||||
|
'dynamic_two_tailed' => '1',
|
||||||
|
'parent_module_id' => '0',
|
||||||
|
'min_warning' => '0',
|
||||||
|
'max_warning' => '0',
|
||||||
|
'str_warning' => '',
|
||||||
|
'min_critical' => '0',
|
||||||
|
'max_critical' => '0',
|
||||||
|
'str_critical' => '',
|
||||||
|
'custom_string_1' => '',
|
||||||
|
'custom_string_2' => '',
|
||||||
|
'custom_string_3' => '',
|
||||||
|
'custom_integer_1' => '0',
|
||||||
|
'custom_integer_2' => '0',
|
||||||
|
'min_ff_event' => '0',
|
||||||
|
'min_ff_event_normal' => '0',
|
||||||
|
'min_ff_event_warning' => '0',
|
||||||
|
'min_ff_event_critical' => '0',
|
||||||
|
'ff_type' => '0',
|
||||||
|
'each_ff' => '0',
|
||||||
|
'ff_timeout' => '0',
|
||||||
|
'unit' => '',
|
||||||
|
'macros' => '',
|
||||||
|
'quiet' => '0',
|
||||||
|
'cps' => '0',
|
||||||
|
'critical_instructions' => '',
|
||||||
|
'warning_instructions' => '',
|
||||||
|
'unknown_instructions' => '',
|
||||||
|
'critical_inverse' => '0',
|
||||||
|
'warning_inverse' => '0',
|
||||||
|
'percentage_critical' => '0',
|
||||||
|
'percentage_warning' => '0',
|
||||||
|
'cron_interval' => '* * * * *',
|
||||||
|
'id_category' => '0',
|
||||||
|
'disabled_types_event' => '{\"going_unknown\":0}',
|
||||||
|
'module_macros' => 'W10=',
|
||||||
|
'warning_time' => '0',
|
||||||
|
];
|
||||||
|
return modules_create_agent_module($id_agent, 'Basic_Network_Latency', $array_values);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create module packet lost and return module id.
|
||||||
|
*
|
||||||
|
* @param mixed $id_agent Id agent.
|
||||||
|
* @param mixed $id_group Id group.
|
||||||
|
* @param mixed $ip_target Ip target.
|
||||||
|
*
|
||||||
|
* @return interger Module id.
|
||||||
|
*/
|
||||||
|
function create_module_packet_lost($id_agent, $id_group, $ip_target)
|
||||||
|
{
|
||||||
|
include_once 'include/functions_modules.php';
|
||||||
|
|
||||||
|
$array_values = [
|
||||||
|
'id_tipo_modulo' => '1',
|
||||||
|
'descripcion' => 'Basic network connectivity check to measure packet loss in %',
|
||||||
|
'max' => '0',
|
||||||
|
'min' => '0',
|
||||||
|
'snmp_oid' => '',
|
||||||
|
'snmp_community' => 'public',
|
||||||
|
'id_module_group' => $id_group,
|
||||||
|
'module_interval' => '300',
|
||||||
|
'module_ff_interval' => '0',
|
||||||
|
'ip_target' => '',
|
||||||
|
'tcp_port' => '0',
|
||||||
|
'tcp_rcv' => '',
|
||||||
|
'tcp_send' => '',
|
||||||
|
'id_export' => '0',
|
||||||
|
'plugin_user' => '',
|
||||||
|
'plugin_pass' => '0',
|
||||||
|
'plugin_parameter' => '',
|
||||||
|
'id_plugin' => '9',
|
||||||
|
'post_process' => '0',
|
||||||
|
'prediction_module' => '0',
|
||||||
|
'max_timeout' => '0',
|
||||||
|
'max_retries' => '0',
|
||||||
|
'disabled' => '',
|
||||||
|
'id_modulo' => '4',
|
||||||
|
'custom_id' => '',
|
||||||
|
'history_data' => '1',
|
||||||
|
'dynamic_interval' => '0',
|
||||||
|
'dynamic_max' => '0',
|
||||||
|
'dynamic_min' => '0',
|
||||||
|
'dynamic_two_tailed' => '1',
|
||||||
|
'parent_module_id' => '0',
|
||||||
|
'min_warning' => '0',
|
||||||
|
'max_warning' => '0',
|
||||||
|
'str_warning' => '',
|
||||||
|
'min_critical' => '0',
|
||||||
|
'max_critical' => '0',
|
||||||
|
'str_critical' => '',
|
||||||
|
'custom_string_1' => '',
|
||||||
|
'custom_string_2' => '',
|
||||||
|
'custom_string_3' => '',
|
||||||
|
'custom_integer_1' => '0',
|
||||||
|
'custom_integer_2' => '0',
|
||||||
|
'min_ff_event' => '0',
|
||||||
|
'min_ff_event_normal' => '0',
|
||||||
|
'min_ff_event_warning' => '0',
|
||||||
|
'min_ff_event_critical' => '0',
|
||||||
|
'ff_type' => '0',
|
||||||
|
'each_ff' => '0',
|
||||||
|
'ff_timeout' => '0',
|
||||||
|
'unit' => '',
|
||||||
|
'macros' => '{"1":{"macro":"_field1_","desc":"Test time","help":"","value":"8","hide":""},"2":{"macro":"_field2_","desc":"Target IP","help":"","value":"'.$ip_target.'","hide":""}}',
|
||||||
|
'quiet' => '0',
|
||||||
|
'cps' => '0',
|
||||||
|
'critical_instructions' => '',
|
||||||
|
'warning_instructions' => '',
|
||||||
|
'unknown_instructions' => '',
|
||||||
|
'critical_inverse' => '0',
|
||||||
|
'warning_inverse' => '0',
|
||||||
|
'percentage_critical' => '0',
|
||||||
|
'percentage_warning' => '0',
|
||||||
|
'cron_interval' => '* * * * *',
|
||||||
|
'id_category' => '0',
|
||||||
|
'disabled_types_event' => '{\"going_unknown\":0}',
|
||||||
|
'module_macros' => 'W10=',
|
||||||
|
'warning_time' => '0',
|
||||||
|
];
|
||||||
|
return modules_create_agent_module($id_agent, 'Basic_Network_Packetloss', $array_values);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create module packet lost and return module id.
|
||||||
|
*
|
||||||
|
* @param string $ip_target Ip and red mask.
|
||||||
|
*
|
||||||
|
* @return interger Module id.
|
||||||
|
*/
|
||||||
|
function create_net_scan($ip_target)
|
||||||
|
{
|
||||||
|
global $config;
|
||||||
|
include_once $config['homedir'].'/godmode/wizards/HostDevices.class.php';
|
||||||
|
$HostDevices = new HostDevices(1);
|
||||||
|
$id_recon_server = db_get_row_filter('tserver', ['server_type' => SERVER_TYPE_DISCOVERY], 'id_server')['id_server'];
|
||||||
|
|
||||||
|
$_POST = [
|
||||||
|
'page' => '1',
|
||||||
|
'interval_manual_defined' => '1',
|
||||||
|
'interval_select' => '-1',
|
||||||
|
'interval_text' => '0',
|
||||||
|
'interval' => '0',
|
||||||
|
'interval_units' => '1',
|
||||||
|
'taskname' => __('Basic network'),
|
||||||
|
'id_recon_server' => $id_recon_server,
|
||||||
|
'network' => $ip_target,
|
||||||
|
'id_group' => '8',
|
||||||
|
'comment' => __('Created on welcome'),
|
||||||
|
];
|
||||||
|
$task_created = $HostDevices->parseNetScan();
|
||||||
|
if ($task_created === true) {
|
||||||
|
$HostDevicesFinal = new HostDevices(2);
|
||||||
|
$_POST = [
|
||||||
|
'task' => $HostDevices->task['id_rt'],
|
||||||
|
'page' => '2',
|
||||||
|
'recon_ports' => '',
|
||||||
|
'auto_monitor' => 'on',
|
||||||
|
'id_network_profile' => ['0' => '2'],
|
||||||
|
'review_results' => 'on',
|
||||||
|
'review_limited' => '0',
|
||||||
|
'snmp_enabled' => 'on',
|
||||||
|
'snmp_version' => '1',
|
||||||
|
'snmp_skip_non_enabled_ifs' => 'on',
|
||||||
|
'community' => '',
|
||||||
|
'snmp_context' => '',
|
||||||
|
'snmp_auth_user' => '',
|
||||||
|
'snmp_security_level' => 'authNoPriv',
|
||||||
|
'snmp_auth_method' => 'MD5',
|
||||||
|
'snmp_auth_pass' => '',
|
||||||
|
'snmp_privacy_method' => 'AES',
|
||||||
|
'snmp_privacy_pass' => '',
|
||||||
|
'os_detect' => 'on',
|
||||||
|
'resolve_names' => 'on',
|
||||||
|
'parent_detection' => 'on',
|
||||||
|
'parent_recursion' => 'on',
|
||||||
|
'vlan_enabled' => 'on',
|
||||||
|
];
|
||||||
|
|
||||||
|
$task_final_created = $HostDevicesFinal->parseNetScan();
|
||||||
|
if ($task_final_created === true) {
|
||||||
|
$net_scan_id = $HostDevices->task['id_rt'];
|
||||||
|
unset($HostDevices, $HostDevicesFinal);
|
||||||
|
return $net_scan_id;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create new template unknown.
|
||||||
|
*
|
||||||
|
* @return boolean 1 correct create 0 bad create.
|
||||||
|
*/
|
||||||
|
function create_template_alert_unknown()
|
||||||
|
{
|
||||||
|
$name = io_safe_input(__('Unknown condition'));
|
||||||
|
$type = 'critical';
|
||||||
|
$values = [
|
||||||
|
'description' => __('This is a generic alert template to fire on UNKNOWN condition'),
|
||||||
|
'max_value' => 0,
|
||||||
|
'min_value' => 0,
|
||||||
|
'id_group' => 0,
|
||||||
|
'priority' => 4,
|
||||||
|
'wizard_level' => 'nowizard',
|
||||||
|
'time_threshold' => '300',
|
||||||
|
'min_alerts_reset_counter' => 1,
|
||||||
|
'schedule' => '{"monday":[{"start":"00:00:00","end":"00:00:00"}],"tuesday":[{"start":"00:00:00","end":"00:00:00"}],"wednesday":[{"start":"00:00:00","end":"00:00:00"}],"thursday":[{"start":"00:00:00","end":"00:00:00"}],"friday":[{"start":"00:00:00","end":"00:00:00"}],"saturday":[{"start":"00:00:00","end":"00:00:00"}],"sunday":[{"start":"00:00:00","end":"00:00:00"}]}',
|
||||||
|
'recovery_notify' => true,
|
||||||
|
'field2' => '[PANDORA] Alert for UNKNOWN status on _agent_ / _module_',
|
||||||
|
'field2_recovery' => '[PANDORA] Alert RECOVERED for UNKNOWN status on _agent_ / _module_',
|
||||||
|
'field3' => '<div style="background-color: #eaf0f6; font-family: Arial, Helvetica, sans-serif; padding: 30px; margin: 0;"><table style="max-width: 560px; background-color: white; border-radius: 10px; padding: 10px 20px 40px;" cellspacing="0" cellpadding="0" align="center"><thead><tr><td style="padding: 0px 0px 5px;"><a href="https://pandorafms.com/en/" target="_blank" rel="noopener"><img src="https://pandorafms.com/wp-content/uploads/2022/03/System-email-Pandora-FMS.png" width="206px"></a></td><td style="padding: 0px 0px 5px;"><p style="text-align: right; color: #223549; font-weight: bold; line-height: 36px; padding: 0px; font-size: 12px;">Automatic alert system</p></td></tr><tr><td style="padding: 0px 0px 5px;" colspan="2"><hr style="border: 1px solid #f5f5f5; width: 100%; margin: 0px;"></td></tr></thead><tbody><tr><td colspan="2"><img style="display: block; margin-left: auto; margin-right: auto; width: 105px; margin-top: 20px; padding: 0px;" src="https://pandorafms.com/wp-content/uploads/2022/03/Warning-news.png" width="105px"></td></tr><tr><td colspan="2"><p style="font-size: 24px; text-align: center; color: #223549; padding: 0px 10%; line-height: 34px; margin: 20px 0px;">We have bad news for you, something is on <span style="text-transform: uppercase; font-weight: 800;">UNKNOWN</span> status!</p><div><!-- [if mso]><v:rect xmlns:v="urn:schemas-microsoft-com:vml" xmlns:w="urn:schemas-microsoft-com:office:word" href="#" style="height:33px;v-text-anchor:middle;width:100px;" stroke="f" fillcolor="#D84A38"><w:anchorlock/><center><![endif]--><a style="background-color: #223549; border: none; color: white; padding: 15px 30px; text-align: center; text-decoration: none; display: block; font-size: 16px; margin-left: auto; margin-right: auto; border-radius: 100px; max-width: 50%; margin-top: 0px; font-weight: bold;" href="_homeurl_">Go to Pandora FMS Console</a><!-- [if mso]></center></v:rect><![endif]--></div></td></tr><tr><td colspan="2"><div style="background-color: #f6f6f6; border-radius: 10px; padding: 10px 20px; margin-top: 40px;"><p style="font-size: 18px; line-height: 30px; color: #223549;">Monitoring details</p><p style="font-size: 15px; color: #333333; font-weight: 800; line-height: 15px;">Data: <span style="font-weight: 400!important;">_data_ <em>(warning)</em></span></p><p style="font-size: 15px; color: #333333; font-weight: 800; line-height: 15px;">Agent: <span style="font-weight: 400!important;">_agent_ <em>_address_</em></span></p><p style="font-size: 15px; color: #333333; font-weight: 800; line-height: 15px;">Module: <span style="font-weight: 400!important;">_module_ <em>_moduledescription_</em></span></p><p style="font-size: 15px; color: #333333; font-weight: 800; line-height: 15px;">Timestamp: <span style="font-weight: 400!important;">_timestamp_</span></p></div></td></tr><tr><td style="padding: 20px 0px;" colspan="2"><p style="font-size: 18px; line-height: 30px; color: #223549;">This is a graph of latest 24hr data for this module</p><p style="font-weight: 400!important;">_modulegraph_24h_</p></td></tr></tbody></table><div style="text-align: center; margin-top: 10px;"><p style="font-size: 12px; text-decoration: none; font-weight: 400; color: #777;"><a style="font-size: 12px; text-decoration: none; font-weight: 400; color: #777;" href="https://pandorafms.com/en/contact/">Contact Us</a> | <a style="font-size: 12px; text-decoration: none; font-weight: 400; color: #777;" href="https://pandorafms.com/community/forums/forum/english/">Support</a> | <a style="font-size: 12px; text-decoration: none; font-weight: 400; color: #777;" href="https://pandorafms.com/manual/en/start">Docs</a></p></div></div>',
|
||||||
|
'field3_recovery' => '<div style="background-color:#EAF0F6; font-family: Arial, Helvetica, sans-serif; padding:30px; margin:0;"><table style="max-width:560px; background-color:white; border-radius:10px; padding:10px 20px 40px;" cellspacing="0" cellpadding="0" align="center"><thead><tr><td style="padding:0px 0px 5px;"><a href="https://pandorafms.com/en/" target="_blank"><img src="https://pandorafms.com/wp-content/uploads/2022/03/System-email-Pandora-FMS.png" width="206px"></a></td><td style="padding:0px 0px 5px;"><p style="text-align:right; color:#223549; font-weight:700; line-height:36px; padding:0px; font-size:12px;">Automatic alert system</p></td></tr><tr><td colspan="2" style="padding:0px 0px 5px;"><hr style="border: 1px solid #f5f5f5; width:100%; margin:0px;"></td></tr></thead><tbody><tr><td colspan="2"><img src="https://pandorafms.com/wp-content/uploads/2022/03/System-email-Good-news.png" style="display: block; margin-left: auto; margin-right: auto; width:105px; margin-top:20px; padding:0px;" width="105px"></td></tr><tr><td colspan="2"><p style="font-size:24px; text-align:center; color:#223549; padding:0px 10%; line-height:34px; margin:20px 0px;">We have good news for you, alert has been <span style="text-transform:uppercase; font-weight:800;">recovered</span></p><div><!--[if mso]><v:rect xmlns:v="urn:schemas-microsoft-com:vml" xmlns:w="urn:schemas-microsoft-com:office:word" href="#" style="height:33px;v-text-anchor:middle;width:100px;" stroke="f" fillcolor="#D84A38"><w:anchorlock/><center><![endif]--><a style="background-color: #223549; border: none; color: white; padding: 15px 30px; text-align: center; text-decoration: none; display: block; font-size: 16px; margin-left: auto; margin-right: auto; border-radius:100px; max-width:50%; margin-top:0px; font-weight:700;" href="_homeurl_">Go to Pandora FMS Console</a><!--[if mso]></center></v:rect><![endif]--></div></td></tr><tr><td colspan="2"><div style="background-color:#F6F6F6; border-radius:10px; padding:10px 20px; margin-top:40px;"><p style="font-size:18px; line-height:30px; color:#223549;">Monitoring details</p><p style="font-size:15px; color:#333333; font-weight:800; line-height:15px;">Data: <span style="font-weight:400!important;">_data_ <em>(normal)</em></span></p><p style="font-size:15px; color:#333333; font-weight:800; line-height:15px;">Agent: <span style="font-weight:400!important;">_agent_ <em>_address_</em></span></p><p style="font-size:15px; color:#333333; font-weight:800; line-height:15px;">Module: <span style="font-weight:400!important;">_module_ <em>_moduledescription_</em></span></p><p style="font-size:15px; color:#333333; font-weight:800; line-height:15px;">Timestamp: <span style="font-weight:400!important;">_timestamp_</span></p></div></td></tr><tr><td style="padding:20px 0px;" colspan="2"><p style="font-size:18px; line-height:30px; color:#223549;">This is a graph of latest 24hr data for this module</p><p style="font-weight:400!important;">_modulegraph_24h_</p></td></tr></tbody></table><div style="text-align:center; margin-top:10px;"><p style="font-size:12px; text-decoration: none; font-weight:400; color:#777;"><a href="https://pandorafms.com/en/contact/" style="font-size:12px; text-decoration: none; font-weight:400; color:#777;">Contact Us</a> | <a href="https://pandorafms.com/community/forums/forum/english/" style="font-size:12px; text-decoration: none; font-weight:400; color:#777;">Support</a> | <a href="https://pandorafms.com/manual/en/start" style="font-size:12px; text-decoration: none; font-weight:400; color:#777;">Docs</a></p></div></div>',
|
||||||
|
];
|
||||||
|
|
||||||
|
$result = alerts_create_alert_template($name, $type, $values);
|
||||||
|
return $result;
|
||||||
|
}
|
@ -86,3 +86,29 @@
|
|||||||
#welcome_form li.extra {
|
#welcome_form li.extra {
|
||||||
padding-bottom: 2.5em;
|
padding-bottom: 2.5em;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#li-div_diagnosis,
|
||||||
|
#li-div_task_todo,
|
||||||
|
#li-div_wizard_agent {
|
||||||
|
border-left: unset !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
#div_diagnosis > label,
|
||||||
|
#div_task_todo > label {
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
button.buttonButton.onlyIcon.fail,
|
||||||
|
button.submitButton.onlyIcon.fail {
|
||||||
|
mask: url(../../images/fail@svg.svg) no-repeat center / contain;
|
||||||
|
-webkit-mask: url(../../images/fail@svg.svg) no-repeat center / contain;
|
||||||
|
}
|
||||||
|
|
||||||
|
.select2-container .select2-container--default .select2-container--open {
|
||||||
|
z-index: 2000;
|
||||||
|
}
|
||||||
|
|
||||||
|
#div_wizard_agent > .select2 {
|
||||||
|
width: 75% !important;
|
||||||
|
max-width: 75% !important;
|
||||||
|
}
|
||||||
|
@ -11914,10 +11914,6 @@ span.help_icon_15px > img {
|
|||||||
height: 15px !important;
|
height: 15px !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.select2-dropdown {
|
|
||||||
z-index: 1116 !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
.icon_connection_check {
|
.icon_connection_check {
|
||||||
width: 65px !important;
|
width: 65px !important;
|
||||||
height: 65px !important;
|
height: 65px !important;
|
||||||
|
@ -71,7 +71,7 @@
|
|||||||
position: absolute;
|
position: absolute;
|
||||||
left: -100000px;
|
left: -100000px;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
z-index: 1115;
|
z-index: 1118;
|
||||||
}
|
}
|
||||||
.select2-results {
|
.select2-results {
|
||||||
display: block;
|
display: block;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user