Merge branch 'ent-4774-welcome-to-pandorafms' into 'develop'
first changed to welcome window See merge request artica/pandorafms!2822
This commit is contained in:
commit
27bdf04735
|
@ -2,4 +2,12 @@ START TRANSACTION;
|
|||
|
||||
ALTER TABLE `tlayout_template_data` ADD COLUMN `cache_expiration` INTEGER UNSIGNED NOT NULL DEFAULT 0;
|
||||
|
||||
INSERT INTO `ttipo_modulo` VALUES
|
||||
(34,'remote_cmd', 10, 'Remote execution, numeric data', 'mod_remote_cmd.png'),
|
||||
(35,'remote_cmd_proc', 10, 'Remote execution, boolean data', 'mod_remote_cmd_proc.png'),
|
||||
(36,'remote_cmd_string', 10, 'Remote execution, alphanumeric data', 'mod_remote_cmd_string.png'),
|
||||
(37,'remote_cmd_inc', 10, 'Remote execution, incremental data', 'mod_remote_cmd_inc.png');
|
||||
|
||||
INSERT INTO `tconfig`(`token`, `value`) VALUES ('welcome_state', -1);
|
||||
|
||||
COMMIT;
|
||||
|
|
|
@ -1654,7 +1654,12 @@ INSERT INTO tmodule VALUES (8, 'Wux module');
|
|||
-- Table `ttipo_modulo`
|
||||
-- ---------------------------------------------------------------------
|
||||
|
||||
INSERT INTO ttipo_modulo VALUES (25,'web_analysis', 8, 'Web analysis data', 'module-wux.png');
|
||||
INSERT INTO `ttipo_modulo` VALUES
|
||||
(25,'web_analysis', 8, 'Web analysis data', 'module-wux.png'),
|
||||
(34,'remote_cmd', 10, 'Remote execution, numeric data', 'mod_remote_cmd.png'),
|
||||
(35,'remote_cmd_proc', 10, 'Remote execution, boolean data', 'mod_remote_cmd_proc.png'),
|
||||
(36,'remote_cmd_string', 10, 'Remote execution, alphanumeric data', 'mod_remote_cmd_string.png'),
|
||||
(37,'remote_cmd_inc', 10, 'Remote execution, incremental data', 'mod_remote_cmd_inc.png');
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
-- Table `tdashboard`
|
||||
|
@ -2294,3 +2299,4 @@ CREATE TABLE `tdeployment_hosts` (
|
|||
FOREIGN KEY (`target_agent_version_id`) REFERENCES `tagent_repository`(`id`)
|
||||
ON UPDATE CASCADE ON DELETE SET NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
global $config;
|
||||
|
||||
require_once $config['homedir'].'/include/functions_update_manager.php';
|
||||
require_once $config['homedir'].'/include/class/WelcomeWindow.class.php';
|
||||
|
||||
|
||||
if (is_ajax()) {
|
||||
|
@ -122,6 +123,8 @@ if (is_ajax()) {
|
|||
exit();
|
||||
}
|
||||
|
||||
|
||||
|
||||
ui_require_css_file('register');
|
||||
|
||||
$initial = isset($config['initial_wizard']) !== true
|
||||
|
@ -170,6 +173,16 @@ if (!$config['disabled_newsletter']) {
|
|||
}
|
||||
}
|
||||
|
||||
$welcome = !$registration && !$show_newsletter && !$initial;
|
||||
try {
|
||||
$welcome_window = new WelcomeWindow($welcome);
|
||||
if ($welcome_window !== null) {
|
||||
$welcome_window->run();
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
$welcome = false;
|
||||
}
|
||||
|
||||
$newsletter = null;
|
||||
|
||||
?>
|
||||
|
|
|
@ -13,7 +13,8 @@ switch ($_GET['module']) {
|
|||
$sql = sprintf(
|
||||
'SELECT id_tipo, descripcion
|
||||
FROM ttipo_modulo
|
||||
WHERE categoria between 3 and 5 '
|
||||
WHERE categoria between 3 and 5
|
||||
OR categoria = 10 '
|
||||
);
|
||||
break;
|
||||
|
||||
|
|
|
@ -275,7 +275,7 @@ if ($new_agent) {
|
|||
|
||||
$table_alias = '<div class="label_select"><p class="input_label">'.__('Alias').': '.ui_print_help_tip(__('Characters /,\,|,%,#,&,$ will be ignored'), true).'</p>';
|
||||
$table_alias .= '<div class='.$label_select_parent.'>';
|
||||
$table_alias .= '<div class='.$label_select_child_left.'>'.html_print_input_text('alias', $alias, '', 50, 100, true).'</div>';
|
||||
$table_alias .= '<div class='.$label_select_child_left.'>'.html_print_input_text('alias', $alias, '', 50, 100, true, false, true).'</div>';
|
||||
if ($new_agent) {
|
||||
$table_alias .= '<div class="label_select_child_right">'.html_print_checkbox_switch('alias_as_name', 1, $config['alias_as_name'], true).__('Use alias as name').'</div>';
|
||||
}
|
||||
|
|
|
@ -1330,7 +1330,7 @@ if ($update_module || $create_module) {
|
|||
// Change double quotes by single.
|
||||
$snmp_oid = preg_replace('/"/', ''', $snmp_oid);
|
||||
|
||||
if (empty($snmp_oid)) {
|
||||
if (empty($snmp_oid) === true) {
|
||||
// The user did not set any OID manually but did a SNMP walk.
|
||||
$snmp_oid = (string) get_parameter('select_snmp_oid');
|
||||
}
|
||||
|
@ -1339,18 +1339,30 @@ if ($update_module || $create_module) {
|
|||
// New support for snmp v3.
|
||||
$tcp_send = (string) get_parameter('snmp_version');
|
||||
$plugin_user = (string) get_parameter('snmp3_auth_user');
|
||||
$plugin_pass = io_input_password((string) get_parameter('snmp3_auth_pass'));
|
||||
$plugin_pass = io_input_password(
|
||||
(string) get_parameter('snmp3_auth_pass')
|
||||
);
|
||||
$plugin_parameter = (string) get_parameter('snmp3_auth_method');
|
||||
|
||||
$custom_string_1 = (string) get_parameter('snmp3_privacy_method');
|
||||
$custom_string_2 = io_input_password((string) get_parameter('snmp3_privacy_pass'));
|
||||
$custom_string_2 = io_input_password(
|
||||
(string) get_parameter('snmp3_privacy_pass')
|
||||
);
|
||||
$custom_string_3 = (string) get_parameter('snmp3_security_level');
|
||||
} else if ($id_module_type >= 34 && $id_module_type <= 37) {
|
||||
$tcp_send = (string) get_parameter('command_text');
|
||||
$custom_string_1 = (string) get_parameter(
|
||||
'command_credential_identifier'
|
||||
);
|
||||
$custom_string_2 = (string) get_parameter('command_os');
|
||||
} else {
|
||||
$plugin_user = (string) get_parameter('plugin_user');
|
||||
if (get_parameter('id_module_component_type') == 7) {
|
||||
$plugin_pass = (int) get_parameter('plugin_pass');
|
||||
} else {
|
||||
$plugin_pass = io_input_password((string) get_parameter('plugin_pass'));
|
||||
$plugin_pass = io_input_password(
|
||||
(string) get_parameter('plugin_pass')
|
||||
);
|
||||
}
|
||||
|
||||
$plugin_parameter = (string) get_parameter('plugin_parameter');
|
||||
|
@ -2266,6 +2278,10 @@ if ($updateGIS) {
|
|||
// -----------------------------------
|
||||
// Load page depending on tab selected
|
||||
// -----------------------------------
|
||||
if ($_SESSION['create_module'] && $config['welcome_state'] == 1) {
|
||||
$edit_module = true;
|
||||
}
|
||||
|
||||
switch ($tab) {
|
||||
case 'main':
|
||||
include 'agent_manager.php';
|
||||
|
|
|
@ -1,16 +1,32 @@
|
|||
<?php
|
||||
/**
|
||||
* Extension to manage a list of gateways and the node address where they should
|
||||
* point to.
|
||||
*
|
||||
* @category Modules
|
||||
* @package Pandora FMS
|
||||
* @subpackage Community
|
||||
* @version 1.0.0
|
||||
* @license See below
|
||||
*
|
||||
* ______ ___ _______ _______ ________
|
||||
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
|
||||
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
|
||||
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
|
||||
*
|
||||
* ============================================================================
|
||||
* Copyright (c) 2005-2019 Artica Soluciones Tecnologicas
|
||||
* Please see http://pandorafms.org for full contribution list
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation for version 2.
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
* ============================================================================
|
||||
*/
|
||||
|
||||
// Pandora FMS - http://pandorafms.com
|
||||
// ==================================================
|
||||
// Copyright (c) 2005-2010 Artica Soluciones Tecnologicas
|
||||
// Please see http://pandorafms.org for full contribution list
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation for version 2.
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
require_once 'include/functions_network_components.php';
|
||||
enterprise_include_once('include/functions_local_components.php');
|
||||
|
||||
|
@ -19,18 +35,65 @@ if (is_ajax()) {
|
|||
$snmp_walk = (bool) get_parameter('snmp_walk');
|
||||
$get_module_component = (bool) get_parameter('get_module_component');
|
||||
$get_module_components = (bool) get_parameter('get_module_components');
|
||||
$get_module_local_components = (bool) get_parameter('get_module_local_components');
|
||||
$get_module_local_component = (bool) get_parameter('get_module_local_component');
|
||||
$get_module_local_components = (bool) get_parameter(
|
||||
'get_module_local_components'
|
||||
);
|
||||
$get_module_local_component = (bool) get_parameter(
|
||||
'get_module_local_component'
|
||||
);
|
||||
|
||||
if ($get_module_component) {
|
||||
$id_component = (int) get_parameter('id_module_component');
|
||||
|
||||
$component = db_get_row('tnetwork_component', 'id_nc', $id_component);
|
||||
|
||||
$component['throw_unknown_events'] = network_components_is_disable_type_event($id_component, EVENTS_GOING_UNKNOWN);
|
||||
$component['throw_unknown_events'] = network_components_is_disable_type_event(
|
||||
$id_component,
|
||||
EVENTS_GOING_UNKNOWN
|
||||
);
|
||||
|
||||
// Decrypt passwords in the component.
|
||||
$component['plugin_pass'] = io_output_password($component['plugin_pass']);
|
||||
$component['plugin_pass'] = io_output_password(
|
||||
$component['plugin_pass']
|
||||
);
|
||||
|
||||
if ($component['type'] >= 15
|
||||
&& $component['type'] <= 18
|
||||
) {
|
||||
// New support for snmp v3.
|
||||
$component['snmp_version'] = $component['tcp_send'];
|
||||
$component['snmp3_auth_user'] = io_safe_output(
|
||||
$component['plugin_user']
|
||||
);
|
||||
// Must use io_output_password.
|
||||
$component['snmp3_auth_pass'] = io_safe_output(
|
||||
$component['plugin_pass']
|
||||
);
|
||||
$component['snmp3_auth_method'] = io_safe_output(
|
||||
$component['plugin_parameter']
|
||||
);
|
||||
$component['snmp3_privacy_method'] = io_safe_output(
|
||||
$component['custom_string_1']
|
||||
);
|
||||
$component['snmp3_privacy_pass'] = io_safe_output(
|
||||
$component['custom_string_2']
|
||||
);
|
||||
$component['snmp3_security_level'] = io_safe_output(
|
||||
$component['custom_string_3']
|
||||
);
|
||||
} else if ($component['type'] >= 34
|
||||
&& $component['type'] <= 37
|
||||
) {
|
||||
$component['command_text'] = io_safe_output(
|
||||
$component['tcp_send']
|
||||
);
|
||||
$component['command_credential_identifier'] = io_safe_output(
|
||||
$component['custom_string_1']
|
||||
);
|
||||
$component['command_os'] = io_safe_output(
|
||||
$component['custom_string_2']
|
||||
);
|
||||
}
|
||||
|
||||
$component['str_warning'] = io_safe_output($component['str_warning']);
|
||||
$component['str_critical'] = io_safe_output($component['str_critical']);
|
||||
|
@ -83,33 +146,29 @@ if (is_ajax()) {
|
|||
|
||||
$component = db_get_row('tlocal_component', 'id', $id_component);
|
||||
foreach ($component as $index => $element) {
|
||||
$component[$index] = html_entity_decode($element, ENT_QUOTES, 'UTF-8');
|
||||
$component[$index] = html_entity_decode(
|
||||
$element,
|
||||
ENT_QUOTES,
|
||||
'UTF-8'
|
||||
);
|
||||
}
|
||||
|
||||
$typeName = local_components_parse_module_extract_value('module_type', $component['data']);
|
||||
$typeName = local_components_parse_module_extract_value(
|
||||
'module_type',
|
||||
$component['data']
|
||||
);
|
||||
|
||||
switch ($config['dbtype']) {
|
||||
case 'mysql':
|
||||
$component['type'] = db_get_value_sql(
|
||||
'
|
||||
SELECT id_tipo
|
||||
FROM ttipo_modulo
|
||||
WHERE nombre LIKE "'.$typeName.'"'
|
||||
);
|
||||
break;
|
||||
|
||||
case 'postgresql':
|
||||
case 'oracle':
|
||||
$component['type'] = db_get_value_sql(
|
||||
'
|
||||
SELECT id_tipo
|
||||
FROM ttipo_modulo
|
||||
WHERE nombre LIKE \''.$typeName.'\''
|
||||
$component['throw_unknown_events'] = !local_components_is_disable_type_event(
|
||||
$id_component,
|
||||
EVENTS_GOING_UNKNOWN
|
||||
);
|
||||
break;
|
||||
}
|
||||
|
||||
$component['throw_unknown_events'] = !local_components_is_disable_type_event($id_component, EVENTS_GOING_UNKNOWN);
|
||||
|
||||
echo io_json_mb_encode($component);
|
||||
return;
|
||||
|
@ -136,7 +195,9 @@ if (is_ajax()) {
|
|||
$snmp3_auth_method = get_parameter('snmp3_auth_method');
|
||||
$snmp3_auth_pass = io_safe_output(get_parameter('snmp3_auth_pass'));
|
||||
$snmp3_privacy_method = get_parameter('snmp3_privacy_method');
|
||||
$snmp3_privacy_pass = io_safe_output(get_parameter('snmp3_privacy_pass'));
|
||||
$snmp3_privacy_pass = io_safe_output(
|
||||
get_parameter('snmp3_privacy_pass')
|
||||
);
|
||||
$snmp_port = get_parameter('snmp_port');
|
||||
|
||||
$snmpwalk = get_snmpwalk(
|
||||
|
@ -177,7 +238,7 @@ require_once 'include/functions_exportserver.php';
|
|||
require_once $config['homedir'].'/include/functions_modules.php';
|
||||
require_once $config['homedir'].'/include/functions_agents.php';
|
||||
|
||||
// Reading a module
|
||||
// Reading a module.
|
||||
if ($id_agent_module) {
|
||||
$module = modules_get_agentmodule($id_agent_module);
|
||||
$moduletype = $module['id_modulo'];
|
||||
|
@ -202,19 +263,25 @@ if ($id_agent_module) {
|
|||
$snmp_community = $module['snmp_community'];
|
||||
$snmp_oid = $module['snmp_oid'];
|
||||
|
||||
// New support for snmp v3
|
||||
// New support for snmp v3.
|
||||
$snmp_version = $module['tcp_send'];
|
||||
$snmp3_auth_user = $module['plugin_user'];
|
||||
$snmp3_auth_pass = io_output_password($module['plugin_pass']);
|
||||
|
||||
// Auth method could be MD5 or SHA
|
||||
// Auth method could be MD5 or SHA.
|
||||
$snmp3_auth_method = $module['plugin_parameter'];
|
||||
|
||||
// Privacy method could be DES or AES
|
||||
// Privacy method could be DES or AES.
|
||||
$snmp3_privacy_method = $module['custom_string_1'];
|
||||
$snmp3_privacy_pass = io_output_password($module['custom_string_2']);
|
||||
|
||||
// Security level Could be noAuthNoPriv | authNoPriv | authPriv
|
||||
// For Remote cmd fields are reused:
|
||||
// tcp_send, custom_string_1, custom_string_2.
|
||||
$command_text = $module['tcp_send'];
|
||||
$command_credential_identifier = $module['custom_string_1'];
|
||||
$command_os = $module['custom_string_2'];
|
||||
|
||||
// Security level Could be noAuthNoPriv | authNoPriv | authPriv.
|
||||
$snmp3_security_level = $module['custom_string_3'];
|
||||
|
||||
$ip_target = $module['ip_target'];
|
||||
|
@ -265,39 +332,39 @@ if ($id_agent_module) {
|
|||
$id_category = $module['id_category'];
|
||||
|
||||
$cron_interval = explode(' ', $module['cron_interval']);
|
||||
if (isset($cron_interval[4])) {
|
||||
if (isset($cron_interval[4]) === true) {
|
||||
$minute_from = $cron_interval[0];
|
||||
$minute = explode('-', $minute_from);
|
||||
$minute_from = $minute[0];
|
||||
if (isset($minute[1])) {
|
||||
if (isset($minute[1]) === true) {
|
||||
$minute_to = $minute[1];
|
||||
}
|
||||
|
||||
$hour_from = $cron_interval[1];
|
||||
$h = explode('-', $hour_from);
|
||||
$hour_from = $h[0];
|
||||
if (isset($h[1])) {
|
||||
if (isset($h[1]) === true) {
|
||||
$hour_to = $h[1];
|
||||
}
|
||||
|
||||
$mday_from = $cron_interval[2];
|
||||
$md = explode('-', $mday_from);
|
||||
$mday_from = $md[0];
|
||||
if (isset($md[1])) {
|
||||
if (isset($md[1]) === true) {
|
||||
$mday_to = $md[1];
|
||||
}
|
||||
|
||||
$month_from = $cron_interval[3];
|
||||
$m = explode('-', $month_from);
|
||||
$month_from = $m[0];
|
||||
if (isset($m[1])) {
|
||||
if (isset($m[1]) === true) {
|
||||
$month_to = $m[1];
|
||||
}
|
||||
|
||||
$wday_from = $cron_interval[4];
|
||||
$wd = explode('-', $wday_from);
|
||||
$wday_from = $wd[0];
|
||||
if (isset($wd[1])) {
|
||||
if (isset($wd[1]) === true) {
|
||||
$wday_to = $wd[1];
|
||||
}
|
||||
} else {
|
||||
|
@ -315,14 +382,20 @@ if ($id_agent_module) {
|
|||
}
|
||||
|
||||
$module_macros = null;
|
||||
if (isset($module['module_macros'])) {
|
||||
$module_macros = json_decode(base64_decode($module['module_macros']), true);
|
||||
if (isset($module['module_macros']) === true) {
|
||||
$module_macros = json_decode(
|
||||
base64_decode($module['module_macros']),
|
||||
true
|
||||
);
|
||||
}
|
||||
} else {
|
||||
if (!isset($moduletype)) {
|
||||
if (isset($moduletype) === false) {
|
||||
$moduletype = (string) get_parameter('moduletype');
|
||||
if ($_SESSION['create_module'] && $config['welcome_state'] == 1) {
|
||||
$moduletype = 'networkserver';
|
||||
}
|
||||
|
||||
// Clean up specific network modules fields
|
||||
// Clean up specific network modules fields.
|
||||
$name = '';
|
||||
$description = '';
|
||||
$id_module_group = 1;
|
||||
|
@ -374,7 +447,7 @@ if ($id_agent_module) {
|
|||
$str_critical = '';
|
||||
$ff_event = 0;
|
||||
|
||||
// New support for snmp v3
|
||||
// New support for snmp v3.
|
||||
$snmp_version = 1;
|
||||
$snmp3_auth_user = '';
|
||||
$snmp3_auth_pass = '';
|
||||
|
@ -383,6 +456,11 @@ if ($id_agent_module) {
|
|||
$snmp3_privacy_pass = '';
|
||||
$snmp3_security_level = '';
|
||||
|
||||
// For Remote CMD.
|
||||
$command_text = '';
|
||||
$command_credential_identifier = '';
|
||||
$command_os = '';
|
||||
|
||||
$critical_instructions = '';
|
||||
$warning_instructions = '';
|
||||
$unknown_instructions = '';
|
||||
|
@ -418,7 +496,9 @@ if ($id_agent_module) {
|
|||
}
|
||||
}
|
||||
|
||||
$is_function_policies = enterprise_include_once('include/functions_policies.php');
|
||||
$is_function_policies = enterprise_include_once(
|
||||
'include/functions_policies.php'
|
||||
);
|
||||
|
||||
if ($is_function_policies !== ENTERPRISE_NOT_HOOK) {
|
||||
$relink_policy = get_parameter('relink_policy', 0);
|
||||
|
@ -428,19 +508,32 @@ if ($is_function_policies !== ENTERPRISE_NOT_HOOK) {
|
|||
$policy_info = policies_info_module_policy($id_agent_module);
|
||||
$policy_id = $policy_info['id_policy'];
|
||||
|
||||
if ($relink_policy && policies_get_policy_queue_status($policy_id) == STATUS_IN_QUEUE_APPLYING) {
|
||||
ui_print_error_message(__('This policy is applying and cannot be modified'));
|
||||
if ($relink_policy
|
||||
&& policies_get_policy_queue_status($policy_id) == STATUS_IN_QUEUE_APPLYING
|
||||
) {
|
||||
ui_print_error_message(
|
||||
__('This policy is applying and cannot be modified')
|
||||
);
|
||||
} else {
|
||||
$result = policies_relink_module($id_agent_module);
|
||||
ui_print_result_message($result, __('Module will be linked in the next application'));
|
||||
ui_print_result_message(
|
||||
$result,
|
||||
__('Module will be linked in the next application')
|
||||
);
|
||||
|
||||
db_pandora_audit('Agent management', 'Re-link module '.$id_agent_module);
|
||||
db_pandora_audit(
|
||||
'Agent management',
|
||||
'Re-link module '.$id_agent_module
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if ($unlink_policy) {
|
||||
$result = policies_unlink_module($id_agent_module);
|
||||
ui_print_result_message($result, __('Module will be unlinked in the next application'));
|
||||
ui_print_result_message(
|
||||
$result,
|
||||
__('Module will be unlinked in the next application')
|
||||
);
|
||||
|
||||
db_pandora_audit('Agent management', 'Unlink module '.$id_agent_module);
|
||||
}
|
||||
|
@ -452,7 +545,7 @@ $remote_conf = false;
|
|||
|
||||
if ($__code_from !== 'policies') {
|
||||
// Only check in the module editor.
|
||||
// Check ACL tags
|
||||
// Check ACL tags.
|
||||
$tag_acl = true;
|
||||
|
||||
// If edit a existing module.
|
||||
|
@ -479,12 +572,12 @@ switch ($moduletype) {
|
|||
$remote_conf = false;
|
||||
if (enterprise_installed()) {
|
||||
enterprise_include_once('include/functions_config_agents.php');
|
||||
$remote_conf = enterprise_hook('config_agents_has_remote_configuration', [$id_agente]);
|
||||
$remote_conf = enterprise_hook(
|
||||
'config_agents_has_remote_configuration',
|
||||
[$id_agente]
|
||||
);
|
||||
}
|
||||
|
||||
/*
|
||||
Categories is an array containing the allowed module types
|
||||
(generic_data, generic_string, etc) from ttipo_modulo (field categoria) */
|
||||
$categories = [
|
||||
0,
|
||||
1,
|
||||
|
@ -503,12 +596,16 @@ switch ($moduletype) {
|
|||
'config_agents_get_module_from_conf',
|
||||
[
|
||||
$id_agente,
|
||||
io_safe_output(modules_get_agentmodule_name($id_agent_module)),
|
||||
io_safe_output(
|
||||
modules_get_agentmodule_name($id_agent_module)
|
||||
),
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
enterprise_include('godmode/agentes/module_manager_editor_data.php');
|
||||
enterprise_include(
|
||||
'godmode/agentes/module_manager_editor_data.php'
|
||||
);
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -520,6 +617,10 @@ switch ($moduletype) {
|
|||
4,
|
||||
5,
|
||||
];
|
||||
if (enterprise_installed()) {
|
||||
$categories[] = 10;
|
||||
}
|
||||
|
||||
include 'module_manager_editor_common.php';
|
||||
include 'module_manager_editor_network.php';
|
||||
break;
|
||||
|
@ -562,9 +663,12 @@ switch ($moduletype) {
|
|||
include 'module_manager_editor_wmi.php';
|
||||
break;
|
||||
|
||||
// WARNING: type 7 is reserved on enterprise
|
||||
// WARNING: type 7 is reserved on enterprise.
|
||||
default:
|
||||
if (enterprise_include('godmode/agentes/module_manager_editor.php') === ENTERPRISE_NOT_HOOK) {
|
||||
if (enterprise_include(
|
||||
'godmode/agentes/module_manager_editor.php'
|
||||
) === ENTERPRISE_NOT_HOOK
|
||||
) {
|
||||
ui_print_error_message(sprintf(__('Invalid module type')));
|
||||
return;
|
||||
}
|
||||
|
@ -580,7 +684,7 @@ if ($config['enterprise_installed'] && $id_agent_module) {
|
|||
|
||||
echo '<h3 id="message" class="error invisible"></h3>';
|
||||
|
||||
// TODO: Change to the ui_print_error system
|
||||
// TODO: Change to the ui_print_error system.
|
||||
echo '<form method="post" id="module_form">';
|
||||
|
||||
ui_toggle(
|
||||
|
@ -602,12 +706,18 @@ ui_toggle(
|
|||
|
||||
if ($moduletype != 13) {
|
||||
ui_toggle(
|
||||
html_print_table($table_new_relations, true).html_print_table($table_relations, true),
|
||||
html_print_table(
|
||||
$table_new_relations,
|
||||
true
|
||||
).html_print_table(
|
||||
$table_relations,
|
||||
true
|
||||
),
|
||||
__('Module relations')
|
||||
);
|
||||
}
|
||||
|
||||
// Submit
|
||||
// Submit.
|
||||
echo '<div class="action-buttons" style="width: '.$table_simple->width.'">';
|
||||
if ($id_agent_module) {
|
||||
html_print_submit_button(
|
||||
|
@ -659,22 +769,64 @@ ui_require_javascript_file('pandora_modules');
|
|||
<script language="javascript">
|
||||
/* <![CDATA[ */
|
||||
var no_name_lang =`
|
||||
<?php echo ui_print_info_message(['no_close' => true, 'message' => __('No module name provided') ]); ?>
|
||||
<?php
|
||||
echo ui_print_info_message(
|
||||
[
|
||||
'no_close' => true,
|
||||
'message' => __('No module name provided'),
|
||||
]
|
||||
);
|
||||
?>
|
||||
`;
|
||||
var no_target_lang =`
|
||||
<?php echo ui_print_info_message(['no_close' => true, 'message' => __('No target IP provided') ]); ?>
|
||||
<?php
|
||||
echo ui_print_info_message(
|
||||
[
|
||||
'no_close' => true,
|
||||
'message' => __('No target IP provided'),
|
||||
]
|
||||
);
|
||||
?>
|
||||
`;
|
||||
var no_oid_lang =`
|
||||
<?php echo ui_print_info_message(['no_close' => true, 'message' => __('No SNMP OID provided') ]); ?>
|
||||
<?php
|
||||
echo ui_print_info_message(
|
||||
[
|
||||
'no_close' => true,
|
||||
'message' => __('No SNMP OID provided'),
|
||||
]
|
||||
);
|
||||
?>
|
||||
`;
|
||||
var no_prediction_module_lang =`
|
||||
<?php echo ui_print_info_message(['no_close' => true, 'message' => __('No module to predict') ]); ?>
|
||||
<?php
|
||||
echo ui_print_info_message(
|
||||
[
|
||||
'no_close' => true,
|
||||
'message' => __('No module to predict'),
|
||||
]
|
||||
);
|
||||
?>
|
||||
`;
|
||||
var no_plugin_lang =`
|
||||
<?php echo ui_print_info_message(['no_close' => true, 'message' => __('No plug-in provided') ]); ?>
|
||||
<?php
|
||||
echo ui_print_info_message(
|
||||
[
|
||||
'no_close' => true,
|
||||
'message' => __('No plug-in provided'),
|
||||
]
|
||||
);
|
||||
?>
|
||||
`;
|
||||
var no_execute_test_from =`
|
||||
<?php echo ui_print_info_message(['no_close' => true, 'message' => __('No server provided') ]); ?>
|
||||
<?php
|
||||
echo ui_print_info_message(
|
||||
[
|
||||
'no_close' => true,
|
||||
'message' => __('No server provided'),
|
||||
]
|
||||
);
|
||||
?>
|
||||
`;
|
||||
|
||||
$(document).ready (function () {
|
||||
|
@ -683,11 +835,15 @@ $(document).ready (function () {
|
|||
$("#module_form").submit(function() {
|
||||
if (typeof(check_remote_conf) != 'undefined') {
|
||||
if (check_remote_conf) {
|
||||
//Check the name
|
||||
//Check the name.
|
||||
name = $("#text-name").val();
|
||||
remote_config = $("#textarea_configuration_data").val();
|
||||
|
||||
regexp_name = new RegExp('module_name\\s*' + name.replace(/([^0-9A-Za-z_])/g, "\\$1") +"\n");
|
||||
regexp_name = new RegExp(
|
||||
'module_name\\s*' + name.replace(/([^0-9A-Za-z_])/g,
|
||||
"\\$1"
|
||||
) +"\n"
|
||||
);
|
||||
|
||||
regexp_plugin = new RegExp('^module_plugin\\s*');
|
||||
|
||||
|
@ -720,7 +876,6 @@ $(document).ready (function () {
|
|||
$("#simple-configuration_data").show();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
checkKeepaliveModule();
|
||||
|
@ -742,7 +897,11 @@ function handleFileSelect() {
|
|||
err_msg_3 = "<?php echo __('This browser doesn`t seem to support the files property of file inputs.'); ?>";
|
||||
err_msg_4 = "<?php echo __('Please select a file before clicking Load'); ?>";
|
||||
|
||||
if (!window.File || !window.FileReader || !window.FileList || !window.Blob) {
|
||||
if (!window.File ||
|
||||
!window.FileReader ||
|
||||
!window.FileList ||
|
||||
!window.Blob
|
||||
) {
|
||||
$('#mssg_error_div').append(err_msg_1);
|
||||
return;
|
||||
}
|
||||
|
@ -767,7 +926,9 @@ function handleFileSelect() {
|
|||
}
|
||||
|
||||
function receivedText() {
|
||||
document.getElementById('textarea_custom_string_1').appendChild(document.createTextNode(fr.result));
|
||||
document
|
||||
.getElementById('textarea_custom_string_1')
|
||||
.appendChild(document.createTextNode(fr.result));
|
||||
}
|
||||
/* ]]> */
|
||||
</script>
|
||||
|
|
|
@ -132,7 +132,7 @@ function add_component_selection($id_network_component_type)
|
|||
require_once 'include/functions_network_components.php';
|
||||
enterprise_include_once('include/functions_policies.php');
|
||||
|
||||
// If code comes from policies disable export select
|
||||
// If code comes from policies disable export select.
|
||||
global $__code_from;
|
||||
|
||||
$disabledBecauseInPolicy = false;
|
||||
|
@ -209,8 +209,7 @@ $table_simple->data[0][1] = html_print_input_text_extended(
|
|||
$largeClassDisabledBecauseInPolicy,
|
||||
true
|
||||
);
|
||||
// $table_simple->data[0][1] = html_print_input_text ('name',
|
||||
// io_safe_output($name), '', 45, 100, true, $disabledBecauseInPolicy);
|
||||
|
||||
if (!empty($id_agent_module) && isset($id_agente)) {
|
||||
$table_simple->data[0][1] .= ' <b>'.__('ID').'</b> '.$id_agent_module.' ';
|
||||
|
||||
|
@ -237,7 +236,13 @@ if ($policy_link != 0) {
|
|||
}
|
||||
|
||||
$table_simple->data[0][2] = __('Disabled');
|
||||
$table_simple->data[0][2] .= html_print_checkbox('disabled', 1, $disabled, true, $disabled_enable);
|
||||
$table_simple->data[0][2] .= html_print_checkbox(
|
||||
'disabled',
|
||||
1,
|
||||
$disabled,
|
||||
true,
|
||||
$disabled_enable
|
||||
);
|
||||
$table_simple->data[0][3] = __('Module group');
|
||||
$table_simple->data[0][3] .= html_print_select_from_sql(
|
||||
'SELECT id_mg, name FROM tmodule_group ORDER BY name',
|
||||
|
@ -260,12 +265,18 @@ if ((isset($id_agent_module) && $id_agent_module) || $id_policy_module != 0) {
|
|||
|
||||
$in_policy = strstr($page, 'policy_modules');
|
||||
if (!$in_policy) {
|
||||
// Cannot select the current module to be itself parent
|
||||
$module_parent_filter = $id_agent_module ? ['tagente_modulo.id_agente_modulo' => "<>$id_agent_module"] : '';
|
||||
// Cannot select the current module to be itself parent.
|
||||
$module_parent_filter = ($id_agent_module) ? ['tagente_modulo.id_agente_modulo' => "<>$id_agent_module"] : '';
|
||||
$table_simple->data[1][0] = __('Module parent');
|
||||
$modules_can_be_parent = agents_get_modules($id_agente, false, $module_parent_filter);
|
||||
// If the user cannot have access to parent module, only print the name
|
||||
if ($parent_module_id != 0 && !in_array($parent_module_id, array_keys($modules_can_be_parent))) {
|
||||
$modules_can_be_parent = agents_get_modules(
|
||||
$id_agente,
|
||||
false,
|
||||
$module_parent_filter
|
||||
);
|
||||
// If the user cannot have access to parent module, only print the name.
|
||||
if ($parent_module_id != 0
|
||||
&& !in_array($parent_module_id, array_keys($modules_can_be_parent))
|
||||
) {
|
||||
$table_simple->data[1][1] = db_get_value(
|
||||
'nombre',
|
||||
'tagente_modulo',
|
||||
|
@ -305,7 +316,11 @@ if (!$edit) {
|
|||
}
|
||||
|
||||
$table_simple->data[2][1] = '<em>'.modules_get_moduletype_description($id_module_type).' ('.$type_names_hash[$id_module_type].')</em>';
|
||||
$table_simple->data[2][1] .= html_print_input_hidden('type_names', base64_encode(io_json_mb_encode($type_names_hash)), true);
|
||||
$table_simple->data[2][1] .= html_print_input_hidden(
|
||||
'type_names',
|
||||
base64_encode(io_json_mb_encode($type_names_hash)),
|
||||
true
|
||||
);
|
||||
} else {
|
||||
if (isset($id_module_type)) {
|
||||
$idModuleType = $id_module_type;
|
||||
|
@ -313,12 +328,13 @@ if (!$edit) {
|
|||
$idModuleType = '';
|
||||
}
|
||||
|
||||
// Removed web analysis and log4x from select
|
||||
// Removed web analysis and log4x from select.
|
||||
$sql = sprintf(
|
||||
'SELECT id_tipo, descripcion, nombre
|
||||
'SELECT id_tipo, descripcion, nombre, categoria
|
||||
FROM ttipo_modulo
|
||||
WHERE categoria IN (%s) AND id_tipo NOT IN (24, 25)
|
||||
ORDER BY descripcion',
|
||||
WHERE categoria IN (%s)
|
||||
AND id_tipo NOT IN (24, 25)
|
||||
ORDER BY id_tipo ASC',
|
||||
implode(',', $categories)
|
||||
);
|
||||
|
||||
|
@ -326,7 +342,9 @@ if (!$edit) {
|
|||
|
||||
$type_names_hash = [];
|
||||
$type_description_hash = [];
|
||||
if (isset($type_names) && is_array($type_names)) {
|
||||
if (isset($type_names) === true
|
||||
&& is_array($type_names) === true
|
||||
) {
|
||||
foreach ($type_names as $tn) {
|
||||
$type_names_hash[$tn['id_tipo']] = $tn['nombre'];
|
||||
$type_description_hash[$tn['id_tipo']] = $tn['descripcion'];
|
||||
|
@ -342,7 +360,7 @@ if (!$edit) {
|
|||
0,
|
||||
true,
|
||||
false,
|
||||
true,
|
||||
false,
|
||||
'',
|
||||
false,
|
||||
false,
|
||||
|
@ -350,8 +368,12 @@ if (!$edit) {
|
|||
100
|
||||
);
|
||||
|
||||
// Store the relation between id and name of the types on a hidden field
|
||||
$table_simple->data[2][1] .= html_print_input_hidden('type_names', base64_encode(io_json_mb_encode($type_names_hash)), true);
|
||||
// Store the relation between id and name of the types on a hidden field.
|
||||
$table_simple->data[2][1] .= html_print_input_hidden(
|
||||
'type_names',
|
||||
base64_encode(io_json_mb_encode($type_names_hash)),
|
||||
true
|
||||
);
|
||||
}
|
||||
|
||||
if ($edit_module) {
|
||||
|
@ -380,15 +402,32 @@ if ($edit_module) {
|
|||
$help_header = 'webserver_module_tab';
|
||||
}
|
||||
|
||||
$table_simple->data[2][0] = __('Type').' '.ui_print_help_icon($help_header, true);
|
||||
$table_simple->data[2][0] = __('Type').' ';
|
||||
$table_simple->data[2][0] .= ui_print_help_icon($help_header, true);
|
||||
}
|
||||
|
||||
if ($disabledBecauseInPolicy) {
|
||||
$table_simple->data[2][3] .= html_print_input_hidden('id_module_group', $id_module_group, true);
|
||||
$table_simple->data[2][3] .= html_print_input_hidden(
|
||||
'id_module_group',
|
||||
$id_module_group,
|
||||
true
|
||||
);
|
||||
}
|
||||
|
||||
$table_simple->data[3][0] = __('Dynamic Threshold Interval');
|
||||
$table_simple->data[3][1] = html_print_extended_select_for_time('dynamic_interval', $dynamic_interval, '', 'None', '0', 10, true, 'width:150px', false, $classdisabledBecauseInPolicy, $disabledBecauseInPolicy);
|
||||
$table_simple->data[3][1] = html_print_extended_select_for_time(
|
||||
'dynamic_interval',
|
||||
$dynamic_interval,
|
||||
'',
|
||||
'None',
|
||||
'0',
|
||||
10,
|
||||
true,
|
||||
'width:150px',
|
||||
false,
|
||||
$classdisabledBecauseInPolicy,
|
||||
$disabledBecauseInPolicy
|
||||
);
|
||||
$table_simple->data[3][1] .= '<a onclick=advanced_option_dynamic()>'.html_print_image('images/cog.png', true, ['title' => __('Advanced options Dynamic Threshold')]).'</a>';
|
||||
if ($in_policy) {
|
||||
$table_simple->cellclass[2][2] = 'hide_dinamic';
|
||||
|
|
|
@ -1,30 +1,50 @@
|
|||
<?php
|
||||
/**
|
||||
* Extension to manage a list of gateways and the node address where they should
|
||||
* point to.
|
||||
*
|
||||
* @category Extensions
|
||||
* @package Pandora FMS
|
||||
* @subpackage Community
|
||||
* @version 1.0.0
|
||||
* @license See below
|
||||
*
|
||||
* ______ ___ _______ _______ ________
|
||||
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
|
||||
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
|
||||
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
|
||||
*
|
||||
* ============================================================================
|
||||
* Copyright (c) 2005-2019 Artica Soluciones Tecnologicas
|
||||
* Please see http://pandorafms.org for full contribution list
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation for version 2.
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
* ============================================================================
|
||||
*/
|
||||
|
||||
// Pandora FMS - http://pandorafms.com
|
||||
// ==================================================
|
||||
// Copyright (c) 2005-2009 Artica Soluciones Tecnologicas
|
||||
// Please see http://pandorafms.org for full contribution list
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation for version 2.
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
global $config;
|
||||
|
||||
require_once $config['homedir'].'/include/functions_snmp_browser.php';
|
||||
$snmp_browser_path = is_metaconsole() ? '../../' : '';
|
||||
$snmp_browser_path = (is_metaconsole()) ? '../../' : '';
|
||||
$snmp_browser_path .= 'include/javascript/pandora_snmp_browser.js';
|
||||
echo "<script type='text/javascript' src='$snmp_browser_path'></script>";
|
||||
// This line does not run with the dinamic loader editor in policies.
|
||||
// ui_require_javascript_file ('pandora_snmp_browser');
|
||||
// WARNING REPEAT input hidden errors in console
|
||||
// Save some variables for javascript functions
|
||||
// html_print_input_hidden ('ajax_url', ui_get_full_url("ajax.php"), false);
|
||||
// html_print_input_hidden ('search_matches_translation', __("Search matches"), false);
|
||||
// Define a custom action to save the OID selected in the SNMP browser to the form
|
||||
html_print_input_hidden('custom_action', urlencode(base64_encode(' <a href="javascript:setOID()"><img src="'.ui_get_full_url('images').'/input_filter.disabled.png" title="'.__('Use this OID').'" style="vertical-align: middle;"></img></a>')), false);
|
||||
echo "<script type='text/javascript' src='".$snmp_browser_path."'></script>";
|
||||
|
||||
// Define a custom action to save the OID selected
|
||||
// in the SNMP browser to the form.
|
||||
html_print_input_hidden(
|
||||
'custom_action',
|
||||
urlencode(
|
||||
base64_encode(
|
||||
' <a href="javascript:setOID()"><img src="'.ui_get_full_url('images').'/input_filter.disabled.png" title="'.__('Use this OID').'" style="vertical-align: middle;"></img></a>'
|
||||
)
|
||||
),
|
||||
false
|
||||
);
|
||||
|
||||
$isFunctionPolicies = enterprise_include_once('include/functions_policies.php');
|
||||
|
||||
|
@ -50,17 +70,15 @@ if (strstr($page, 'policy_modules') === false) {
|
|||
define('ID_NETWORK_COMPONENT_TYPE', 2);
|
||||
|
||||
if (empty($update_module_id)) {
|
||||
// Function in module_manager_editor_common.php
|
||||
// Function in module_manager_editor_common.php.
|
||||
add_component_selection(ID_NETWORK_COMPONENT_TYPE);
|
||||
} else {
|
||||
// TODO: Print network component if available
|
||||
}
|
||||
|
||||
$extra_title = __('Network server module');
|
||||
|
||||
$data = [];
|
||||
$data[0] = __('Target IP');
|
||||
// show agent_for defect;
|
||||
// Show agent_for defect.
|
||||
if ($page == 'enterprise/godmode/policies/policy_modules') {
|
||||
if ($ip_target != 'auto' && $ip_target != '') {
|
||||
$custom_ip_target = $ip_target;
|
||||
|
@ -100,7 +118,7 @@ if ($page == 'enterprise/godmode/policies/policy_modules') {
|
|||
$data[1] = html_print_input_text('ip_target', $ip_target, '', 15, 60, true);
|
||||
}
|
||||
|
||||
// In ICMP modules, port is not configurable
|
||||
// In ICMP modules, port is not configurable.
|
||||
if ($id_module_type >= 6 && $id_module_type <= 7) {
|
||||
$data[2] = '';
|
||||
$data[3] = '';
|
||||
|
@ -148,7 +166,15 @@ if (!$adopt) {
|
|||
$classdisabledBecauseInPolicy
|
||||
);
|
||||
} else {
|
||||
$data[1] = html_print_input_text('snmp_community', $snmp_community, '', 15, 60, true, false);
|
||||
$data[1] = html_print_input_text(
|
||||
'snmp_community',
|
||||
$snmp_community,
|
||||
'',
|
||||
15,
|
||||
60,
|
||||
true,
|
||||
false
|
||||
);
|
||||
}
|
||||
|
||||
$data[2] = _('SNMP version');
|
||||
|
@ -213,8 +239,27 @@ $data[1] .= html_print_input_text(
|
|||
$classdisabledBecauseInPolicy
|
||||
);
|
||||
$data[1] .= '<span class="invisible" id="oid">';
|
||||
$data[1] .= html_print_select([], 'select_snmp_oid', $snmp_oid, '', '', 0, true, false, false, '', $disabledBecauseInPolicy);
|
||||
$data[1] .= html_print_image('images/edit.png', true, ['class' => 'invisible clickable', 'id' => 'edit_oid']);
|
||||
$data[1] .= html_print_select(
|
||||
[],
|
||||
'select_snmp_oid',
|
||||
$snmp_oid,
|
||||
'',
|
||||
'',
|
||||
0,
|
||||
true,
|
||||
false,
|
||||
false,
|
||||
'',
|
||||
$disabledBecauseInPolicy
|
||||
);
|
||||
$data[1] .= html_print_image(
|
||||
'images/edit.png',
|
||||
true,
|
||||
[
|
||||
'class' => 'invisible clickable',
|
||||
'id' => 'edit_oid',
|
||||
]
|
||||
);
|
||||
$data[1] .= '</span>';
|
||||
$data[1] .= '</span><span class="right" style="width: 50%; text-align: right">';
|
||||
$data[1] .= html_print_button(
|
||||
|
@ -231,42 +276,50 @@ $table_simple->colspan['snmp_2'][1] = 3;
|
|||
|
||||
push_table_simple($data, 'snmp_2');
|
||||
|
||||
// Advanced stuff
|
||||
// Advanced stuff.
|
||||
$data = [];
|
||||
$data[0] = __('TCP send');
|
||||
$data[1] = html_print_textarea('tcp_send', 2, 65, $tcp_send, $disabledTextBecauseInPolicy, true, $largeclassdisabledBecauseInPolicy);
|
||||
$data[1] = html_print_textarea(
|
||||
'tcp_send',
|
||||
2,
|
||||
65,
|
||||
$tcp_send,
|
||||
$disabledTextBecauseInPolicy,
|
||||
true,
|
||||
$largeclassdisabledBecauseInPolicy
|
||||
);
|
||||
$table_simple->colspan['tcp_send'][1] = 3;
|
||||
|
||||
push_table_simple($data, 'tcp_send');
|
||||
|
||||
$data[0] = __('TCP receive');
|
||||
$data[1] = html_print_textarea('tcp_rcv', 2, 65, $tcp_rcv, $disabledTextBecauseInPolicy, true, $largeclassdisabledBecauseInPolicy);
|
||||
$data[1] = html_print_textarea(
|
||||
'tcp_rcv',
|
||||
2,
|
||||
65,
|
||||
$tcp_rcv,
|
||||
$disabledTextBecauseInPolicy,
|
||||
true,
|
||||
$largeclassdisabledBecauseInPolicy
|
||||
);
|
||||
$table_simple->colspan['tcp_receive'][1] = 3;
|
||||
|
||||
push_table_simple($data, 'tcp_receive');
|
||||
|
||||
if ($id_module_type < 8 || $id_module_type > 11) {
|
||||
// NOT TCP
|
||||
// NOT TCP.
|
||||
$table_simple->rowstyle['tcp_send'] = 'display: none;';
|
||||
$table_simple->rowstyle['tcp_receive'] = 'display: none;';
|
||||
}
|
||||
|
||||
if ($id_module_type < 15 || $id_module_type > 18) {
|
||||
// NOT SNMP
|
||||
// NOT SNMP.
|
||||
$table_simple->rowstyle['snmp_1'] = 'display: none';
|
||||
$table_simple->rowstyle['snmp_2'] = 'display: none';
|
||||
}
|
||||
|
||||
// For a policy
|
||||
if (!isset($id_agent_module)) {
|
||||
$snmp3_auth_user = '';
|
||||
$snmp3_auth_pass = '';
|
||||
$snmp_version = 1;
|
||||
$snmp3_privacy_method = '';
|
||||
$snmp3_privacy_pass = '';
|
||||
$snmp3_auth_method = '';
|
||||
$snmp3_security_level = '';
|
||||
} else if ($id_agent_module === false) {
|
||||
// For a policy.
|
||||
if (isset($id_agent_module) === false || $id_agent_module === false) {
|
||||
$snmp3_auth_user = '';
|
||||
$snmp3_auth_pass = '';
|
||||
$snmp_version = 1;
|
||||
|
@ -274,6 +327,9 @@ if (!isset($id_agent_module)) {
|
|||
$snmp3_privacy_pass = '';
|
||||
$snmp3_auth_method = '';
|
||||
$snmp3_security_level = '';
|
||||
$command_text = '';
|
||||
$command_os = 'inherited';
|
||||
$command_credential_identifier = '';
|
||||
}
|
||||
|
||||
$data = [];
|
||||
|
@ -333,7 +389,22 @@ push_table_simple($data, 'field_snmpv3_row2');
|
|||
|
||||
$data = [];
|
||||
$data[0] = __('Auth method');
|
||||
$data[1] = html_print_select(['MD5' => __('MD5'), 'SHA' => __('SHA')], 'snmp3_auth_method', $snmp3_auth_method, '', '', '', true, false, false, '', $disabledBecauseInPolicy);
|
||||
$data[1] = html_print_select(
|
||||
[
|
||||
'MD5' => __('MD5'),
|
||||
'SHA' => __('SHA'),
|
||||
],
|
||||
'snmp3_auth_method',
|
||||
$snmp3_auth_method,
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
true,
|
||||
false,
|
||||
false,
|
||||
'',
|
||||
$disabledBecauseInPolicy
|
||||
);
|
||||
$data[2] = __('Security level');
|
||||
$data[3] = html_print_select(
|
||||
[
|
||||
|
@ -358,13 +429,84 @@ if ($snmp_version != 3) {
|
|||
|
||||
push_table_simple($data, 'field_snmpv3_row3');
|
||||
|
||||
$data = [];
|
||||
$data[0] = __('Command');
|
||||
$data[1] = html_print_input_text_extended(
|
||||
'command_text',
|
||||
$command_text,
|
||||
'command_text',
|
||||
'',
|
||||
100,
|
||||
10000,
|
||||
$disabledBecauseInPolicy,
|
||||
'',
|
||||
$largeClassDisabledBecauseInPolicy,
|
||||
true
|
||||
);
|
||||
$table_simple->colspan['row-cmd-row-1'][1] = 3;
|
||||
push_table_simple($data, 'row-cmd-row-1');
|
||||
|
||||
require_once $config['homedir'].'/include/class/CredentialStore.class.php';
|
||||
$array_credential_identifier = CredentialStore::getKeys('CUSTOM');
|
||||
|
||||
$data[0] = __('Credential identifier');
|
||||
$data[1] = html_print_select(
|
||||
$array_credential_identifier,
|
||||
'command_credential_identifier',
|
||||
$command_credential_identifier,
|
||||
'',
|
||||
__('None'),
|
||||
'',
|
||||
true,
|
||||
false,
|
||||
false,
|
||||
'',
|
||||
$disabledBecauseInPolicy
|
||||
);
|
||||
|
||||
$array_os = [
|
||||
'inherited' => __('Inherited'),
|
||||
'linux' => __('Linux'),
|
||||
'windows' => __('Windows'),
|
||||
];
|
||||
|
||||
$data[2] = __('Target OS');
|
||||
$data[3] = html_print_select(
|
||||
$array_os,
|
||||
'command_os',
|
||||
$command_os,
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
true,
|
||||
false,
|
||||
false,
|
||||
'',
|
||||
$disabledBecauseInPolicy
|
||||
);
|
||||
|
||||
push_table_simple($data, 'row-cmd-row-2');
|
||||
|
||||
if ($id_module_type !== 34
|
||||
&& $id_module_type !== 35
|
||||
&& $id_module_type !== 36
|
||||
&& $id_module_type !== 37
|
||||
) {
|
||||
$table_simple->rowstyle['row-cmd-row-1'] = 'display: none;';
|
||||
$table_simple->rowstyle['row-cmd-row-2'] = 'display: none;';
|
||||
}
|
||||
|
||||
snmp_browser_print_container(false, '100%', '60%', 'none');
|
||||
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
$(document).ready (function () {
|
||||
$("#id_module_type").change(function (){
|
||||
if ((this.value == "17") || (this.value == "18") || (this.value == "16") || (this.value == "15")) {
|
||||
if ((this.value == "17") ||
|
||||
(this.value == "18") ||
|
||||
(this.value == "16") ||
|
||||
(this.value == "15")
|
||||
) {
|
||||
if ($("#snmp_version").val() == "3"){
|
||||
$("#simple-field_snmpv3_row1").attr("style", "");
|
||||
$("#simple-field_snmpv3_row2").attr("style", "");
|
||||
|
@ -379,6 +521,18 @@ $(document).ready (function () {
|
|||
$("input[name=active_snmp_v3]").val(0);
|
||||
$("input[name=snmp_community]").removeAttr('disabled');
|
||||
}
|
||||
|
||||
if((this.value == "34") ||
|
||||
(this.value == "35") ||
|
||||
(this.value == "36") ||
|
||||
(this.value == "37")
|
||||
) {
|
||||
$("#simple-row-cmd-row-1").attr("style", "");
|
||||
$("#simple-row-cmd-row-2").attr("style", "");
|
||||
} else {
|
||||
$("#simple-row-cmd-row-1").css("display", "none");
|
||||
$("#simple-row-cmd-row-2").css("display", "none");
|
||||
}
|
||||
});
|
||||
|
||||
$("#snmp_version").change(function () {
|
||||
|
@ -412,7 +566,8 @@ $(document).ready (function () {
|
|||
function () {
|
||||
$(this).css ("width", "auto");
|
||||
$(this).css ("min-width", "180px");
|
||||
});
|
||||
}
|
||||
);
|
||||
|
||||
$("#id_module_type").blur (function () {
|
||||
$(this).css ("width", "180px");
|
||||
|
@ -433,7 +588,6 @@ $(document).ready (function () {
|
|||
});
|
||||
$('#snmp_version').change(function() {
|
||||
$('#snmp_browser_version').val($(this).val());
|
||||
|
||||
// Display or collapse the SNMP browser's v3 options
|
||||
checkSNMPVersion ();
|
||||
});
|
||||
|
|
|
@ -184,9 +184,11 @@ if ($own_info['is_admin'] || check_acl($config['id_user'], 0, 'PM')) {
|
|||
}
|
||||
|
||||
ui_require_css_file('cluetip', 'include/styles/js/');
|
||||
ui_require_jquery_file('validate');
|
||||
ui_require_jquery_file('cluetip');
|
||||
ui_require_jquery_file('pandora.controls');
|
||||
ui_require_jquery_file('bgiframe');
|
||||
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
/* <![CDATA[ */
|
||||
|
@ -202,6 +204,24 @@ $(document).ready (function () {
|
|||
});
|
||||
<?php endif; ?>
|
||||
|
||||
// Rule.
|
||||
$.validator.addMethod(
|
||||
"valueNotEquals",
|
||||
function(value, element, arg) {
|
||||
return arg != value;
|
||||
},
|
||||
"Value must not equal arg."
|
||||
);
|
||||
|
||||
// configure your validation
|
||||
$("form.add_alert_form").validate({
|
||||
rules: {
|
||||
id_agent_module: { valueNotEquals: "0" }
|
||||
},
|
||||
messages: {
|
||||
id_agent_module: { valueNotEquals: "Please select an item!" }
|
||||
}
|
||||
});
|
||||
$("select#template").change (function () {
|
||||
id = this.value;
|
||||
$a = $(this).siblings ("a.template_details");
|
||||
|
|
|
@ -1,17 +1,32 @@
|
|||
<?php
|
||||
/**
|
||||
* Extension to manage a list of gateways and the node address where they should
|
||||
* point to.
|
||||
*
|
||||
* @category Extensions
|
||||
* @package Pandora FMS
|
||||
* @subpackage Community
|
||||
* @version 1.0.0
|
||||
* @license See below
|
||||
*
|
||||
* ______ ___ _______ _______ ________
|
||||
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
|
||||
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
|
||||
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
|
||||
*
|
||||
* ============================================================================
|
||||
* Copyright (c) 2005-2019 Artica Soluciones Tecnologicas
|
||||
* Please see http://pandorafms.org for full contribution list
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation for version 2.
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
* ============================================================================
|
||||
*/
|
||||
|
||||
// Pandora FMS - http://pandorafms.com
|
||||
// ==================================================
|
||||
// Copyright (c) 2005-2010 Artica Soluciones Tecnologicas
|
||||
// Please see http://pandorafms.org for full contribution list
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation for version 2.
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
// Load global vars
|
||||
global $config;
|
||||
|
||||
check_login();
|
||||
|
@ -32,7 +47,7 @@ require_once $config['homedir'].'/include/functions_categories.php';
|
|||
enterprise_include_once('meta/include/functions_components_meta.php');
|
||||
require_once $config['homedir'].'/include/functions_component_groups.php';
|
||||
|
||||
// Header
|
||||
// Header.
|
||||
if (defined('METACONSOLE')) {
|
||||
components_meta_print_header();
|
||||
$sec = 'advanced';
|
||||
|
@ -40,15 +55,6 @@ if (defined('METACONSOLE')) {
|
|||
$id_modulo = (int) get_parameter('id_component_type');
|
||||
$new_component = (bool) get_parameter('new_component');
|
||||
} else {
|
||||
/*
|
||||
Hello there! :)
|
||||
|
||||
We added some of what seems to be "buggy" messages to the openSource version recently. This is not to force open-source users to move to the enterprise version, this is just to inform people using Pandora FMS open source that it requires skilled people to maintain and keep it running smoothly without professional support. This does not imply open-source version is limited in any way. If you check the recently added code, it contains only warnings and messages, no limitations except one: we removed the option to add custom logo in header. In the Update Manager section, it warns about the 'danger’ of applying automated updates without a proper backup, remembering in the process that the Enterprise version comes with a human-tested package. Maintaining an OpenSource version with more than 500 agents is not so easy, that's why someone using a Pandora with 8000 agents should consider asking for support. It's not a joke, we know of many setups with a huge number of agents, and we hate to hear that “its becoming unstable and slow” :(
|
||||
|
||||
You can of course remove the warnings, that's why we include the source and do not use any kind of trick. And that's why we added here this comment, to let you know this does not reflect any change in our opensource mentality of does the last 14 years.
|
||||
|
||||
*/
|
||||
|
||||
$id_modulo = (int) get_parameter('id_component_type');
|
||||
$new_component = (bool) get_parameter('new_component');
|
||||
if ($id_modulo == 2 || $id_modulo == 4 || $id_modulo == 6) {
|
||||
|
@ -59,7 +65,6 @@ if (defined('METACONSOLE')) {
|
|||
$help_header = 'network_component_tab';
|
||||
}
|
||||
|
||||
|
||||
ui_print_page_header(
|
||||
__('Module management').' » '.__('Network component management'),
|
||||
'',
|
||||
|
@ -73,7 +78,6 @@ if (defined('METACONSOLE')) {
|
|||
$sec = 'gmodules';
|
||||
}
|
||||
|
||||
|
||||
$type = (int) get_parameter('type');
|
||||
$name = (string) get_parameter('name');
|
||||
$description = (string) get_parameter('description');
|
||||
|
@ -120,7 +124,7 @@ $history_data = (bool) get_parameter('history_data');
|
|||
|
||||
// Don't read as (float) because it lost it's decimals when put into MySQL
|
||||
// where are very big and PHP uses scientific notation, p.e:
|
||||
// 1.23E-10 is 0.000000000123
|
||||
// 1.23E-10 is 0.000000000123.
|
||||
$post_process = (string) get_parameter('post_process', 0.0);
|
||||
|
||||
$unit = (string) get_parameter('unit');
|
||||
|
@ -151,9 +155,16 @@ $snmp3_auth_user = (string) io_safe_output(get_parameter('snmp3_auth_user'));
|
|||
$snmp3_auth_pass = io_input_password((string) get_parameter('snmp3_auth_pass'));
|
||||
$snmp3_auth_method = (string) get_parameter('snmp3_auth_method');
|
||||
$snmp3_privacy_method = (string) get_parameter('snmp3_privacy_method');
|
||||
$snmp3_privacy_pass = io_input_password((string) get_parameter('snmp3_privacy_pass'));
|
||||
$snmp3_privacy_pass = io_input_password(
|
||||
(string) get_parameter('snmp3_privacy_pass')
|
||||
);
|
||||
$snmp3_security_level = (string) get_parameter('snmp3_security_level');
|
||||
|
||||
$command_text = (string) get_parameter('command_text');
|
||||
$command_credential_identifier = (string) get_parameter(
|
||||
'command_credential_identifier'
|
||||
);
|
||||
$command_os = (string) get_parameter('command_os');
|
||||
|
||||
$throw_unknown_events = get_parameter('throw_unknown_events', false);
|
||||
// Set the event type that can show.
|
||||
|
@ -163,11 +174,19 @@ $disabled_types_event = json_encode($disabled_types_event);
|
|||
$create_component = (bool) get_parameter('create_component');
|
||||
$update_component = (bool) get_parameter('update_component');
|
||||
$delete_component = (bool) get_parameter('delete_component');
|
||||
$duplicate_network_component = (bool) get_parameter('duplicate_network_component');
|
||||
$duplicate_network_component = (bool) get_parameter(
|
||||
'duplicate_network_component'
|
||||
);
|
||||
$delete_multiple = (bool) get_parameter('delete_multiple');
|
||||
$multiple_delete = (bool) get_parameter('multiple_delete', 0);
|
||||
$create_network_from_module = (bool) get_parameter('create_network_from_module', 0);
|
||||
$create_network_from_snmp_browser = (bool) get_parameter('create_network_from_snmp_browser', 0);
|
||||
$create_network_from_module = (bool) get_parameter(
|
||||
'create_network_from_module',
|
||||
0
|
||||
);
|
||||
$create_network_from_snmp_browser = (bool) get_parameter(
|
||||
'create_network_from_snmp_browser',
|
||||
0
|
||||
);
|
||||
|
||||
if ($duplicate_network_component) {
|
||||
$source_id = (int) get_parameter('source_id');
|
||||
|
@ -182,29 +201,20 @@ if ($duplicate_network_component) {
|
|||
__('Could not be created')
|
||||
);
|
||||
|
||||
// List unset for jump the bug in the pagination (TODO) that the make another
|
||||
// copy for each pass into pages.
|
||||
// List unset for jump the bug in the pagination
|
||||
// that the make another copy for each pass into pages.
|
||||
unset($_GET['source_id']);
|
||||
unset($_GET['duplicate_network_component']);
|
||||
|
||||
$id = 0;
|
||||
}
|
||||
|
||||
if ($create_component) {
|
||||
$custom_string_1 = '';
|
||||
$custom_string_2 = '';
|
||||
$custom_string_3 = '';
|
||||
$name_check = db_get_value(
|
||||
'name',
|
||||
'tnetwork_component',
|
||||
'name',
|
||||
$name
|
||||
);
|
||||
|
||||
// remote_snmp = 15
|
||||
// remote_snmp_proc = 18
|
||||
if ($type >= 15 && $type <= 18) {
|
||||
// New support for snmp v3
|
||||
// New support for snmp v3.
|
||||
$tcp_send = $snmp_version;
|
||||
$plugin_user = $snmp3_auth_user;
|
||||
$plugin_pass = $snmp3_auth_pass;
|
||||
|
@ -212,13 +222,19 @@ if ($create_component) {
|
|||
$custom_string_1 = $snmp3_privacy_method;
|
||||
$custom_string_2 = $snmp3_privacy_pass;
|
||||
$custom_string_3 = $snmp3_security_level;
|
||||
} else if ($type >= 34 && $type <= 37) {
|
||||
$tcp_send = $command_text;
|
||||
$custom_string_1 = $command_credential_identifier;
|
||||
$custom_string_2 = $command_os;
|
||||
}
|
||||
|
||||
if ($create_component) {
|
||||
$name_check = db_get_value(
|
||||
'name',
|
||||
'tnetwork_component',
|
||||
'name',
|
||||
$name
|
||||
);
|
||||
}
|
||||
|
||||
if ($name && !$name_check) {
|
||||
$id = network_components_create_network_component(
|
||||
|
@ -283,13 +299,16 @@ if ($create_component) {
|
|||
}
|
||||
|
||||
if ($id === false || !$id) {
|
||||
db_pandora_audit('Module management', 'Fail try to create network component');
|
||||
db_pandora_audit(
|
||||
'Module management',
|
||||
'Fail try to create network component'
|
||||
);
|
||||
ui_print_error_message(__('Could not be created'));
|
||||
include_once 'godmode/modules/manage_network_components_form.php';
|
||||
return;
|
||||
}
|
||||
|
||||
db_pandora_audit('Module management', "Create network component #$id");
|
||||
db_pandora_audit('Module management', 'Create network component #'.$id);
|
||||
ui_print_success_message(__('Created successfully'));
|
||||
$id = 0;
|
||||
}
|
||||
|
@ -297,23 +316,6 @@ if ($create_component) {
|
|||
if ($update_component) {
|
||||
$id = (int) get_parameter('id');
|
||||
|
||||
$custom_string_1 = '';
|
||||
$custom_string_2 = '';
|
||||
$custom_string_3 = '';
|
||||
|
||||
// $name_check = db_get_value ('name', 'tnetwork_component', 'name', $name);
|
||||
if ($type >= 15 && $type <= 18) {
|
||||
// New support for snmp v3
|
||||
$tcp_send = $snmp_version;
|
||||
$plugin_user = $snmp3_auth_user;
|
||||
$plugin_pass = $snmp3_auth_pass;
|
||||
$plugin_parameter = $snmp3_auth_method;
|
||||
$custom_string_1 = $snmp3_privacy_method;
|
||||
$custom_string_2 = $snmp3_privacy_pass;
|
||||
$custom_string_3 = $snmp3_security_level;
|
||||
// $name_check = db_get_value ('name', 'tnetwork_component', 'name', $name);
|
||||
}
|
||||
|
||||
if (!empty($name)) {
|
||||
$result = network_components_update_network_component(
|
||||
$id,
|
||||
|
@ -380,14 +382,14 @@ if ($update_component) {
|
|||
if ($result === false || !$result) {
|
||||
db_pandora_audit(
|
||||
'Module management',
|
||||
"Fail try to update network component #$id"
|
||||
'Fail try to update network component #'.$id
|
||||
);
|
||||
ui_print_error_message(__('Could not be updated'));
|
||||
include_once 'godmode/modules/manage_network_components_form.php';
|
||||
return;
|
||||
}
|
||||
|
||||
db_pandora_audit('Module management', "Update network component #$id");
|
||||
db_pandora_audit('Module management', 'Update network component #'.$id);
|
||||
ui_print_success_message(__('Updated successfully'));
|
||||
|
||||
$id = 0;
|
||||
|
@ -401,12 +403,12 @@ if ($delete_component) {
|
|||
if ($result) {
|
||||
db_pandora_audit(
|
||||
'Module management',
|
||||
"Delete network component #$id"
|
||||
'Delete network component #'.$id
|
||||
);
|
||||
} else {
|
||||
db_pandora_audit(
|
||||
'Module management',
|
||||
"Fail try to delete network component #$id"
|
||||
'Fail try to delete network component #'.$id
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -433,12 +435,12 @@ if ($multiple_delete) {
|
|||
if ($result) {
|
||||
db_pandora_audit(
|
||||
'Module management',
|
||||
"Multiple delete network component: $str_ids"
|
||||
'Multiple delete network component:'.$str_ids
|
||||
);
|
||||
} else {
|
||||
db_pandora_audit(
|
||||
'Module management',
|
||||
"Fail try to delete network component: $str_ids"
|
||||
'Fail try to delete network component:'.$str_ids
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -451,7 +453,10 @@ if ($multiple_delete) {
|
|||
$id = 0;
|
||||
}
|
||||
|
||||
if ($id || $new_component || $create_network_from_module || $create_network_from_snmp_browser) {
|
||||
if ($id || $new_component
|
||||
|| $create_network_from_module
|
||||
|| $create_network_from_snmp_browser
|
||||
) {
|
||||
include_once $config['homedir'].'/godmode/modules/manage_network_components_form.php';
|
||||
return;
|
||||
}
|
||||
|
@ -558,7 +563,7 @@ foreach ($component_groups as $component_group_key => $component_group_val) {
|
|||
}
|
||||
}
|
||||
|
||||
// Only show component groups with local components
|
||||
// Only show component groups with local components.
|
||||
if ($num_components == 0 && $num_components_childs == 0) {
|
||||
unset($component_groups[$component_group_key]);
|
||||
}
|
||||
|
@ -622,7 +627,11 @@ if ($search_string != '') {
|
|||
$filter[] = '(name LIKE '."'%".$search_string."%'".'OR description LIKE '."'%".$search_string."%'".'OR tcp_send LIKE '."'%".$search_string."%'".'OR tcp_rcv LIKE '."'%".$search_string."%'".')';
|
||||
}
|
||||
|
||||
$total_components = network_components_get_network_components(false, $filter, 'COUNT(*) AS total');
|
||||
$total_components = network_components_get_network_components(
|
||||
false,
|
||||
$filter,
|
||||
'COUNT(*) AS total'
|
||||
);
|
||||
$total_components = $total_components[0]['total'];
|
||||
ui_pagination($total_components, $url);
|
||||
$filter['offset'] = (int) get_parameter('offset');
|
||||
|
@ -651,7 +660,13 @@ unset($table);
|
|||
$table->width = '100%';
|
||||
$table->head = [];
|
||||
$table->class = 'info_table';
|
||||
$table->head['checkbox'] = html_print_checkbox('all_delete', 0, false, true, false);
|
||||
$table->head['checkbox'] = html_print_checkbox(
|
||||
'all_delete',
|
||||
0,
|
||||
false,
|
||||
true,
|
||||
false
|
||||
);
|
||||
$table->head[0] = __('Module name');
|
||||
$table->head[1] = __('Type');
|
||||
$table->head[3] = __('Description');
|
||||
|
@ -669,12 +684,21 @@ foreach ($components as $component) {
|
|||
$data = [];
|
||||
|
||||
if ($component['max'] == $component['min'] && $component['max'] == 0) {
|
||||
$component['max'] = $component['min'] = __('N/A');
|
||||
$component['max'] = __('N/A');
|
||||
$component['min'] = __('N/A');
|
||||
}
|
||||
|
||||
$data['checkbox'] = html_print_checkbox_extended('delete_multiple[]', $component['id_nc'], false, false, '', 'class="check_delete"', true);
|
||||
$data['checkbox'] = html_print_checkbox_extended(
|
||||
'delete_multiple[]',
|
||||
$component['id_nc'],
|
||||
false,
|
||||
false,
|
||||
'',
|
||||
'class="check_delete"',
|
||||
true
|
||||
);
|
||||
|
||||
$data[0] = '<a href="index.php?sec='.$sec.'&'.'sec2=godmode/modules/manage_network_components&'.'id='.$component['id_nc'].'&pure='.$pure.'">';
|
||||
$data[0] = '<a href="index.php?sec='.$sec.'&sec2=godmode/modules/manage_network_components&id='.$component['id_nc'].'&pure='.$pure.'">';
|
||||
$data[0] .= io_safe_output($component['name']);
|
||||
$data[0] .= '</a>';
|
||||
$data[1] = ui_print_moduletype_icon($component['type'], true);
|
||||
|
@ -702,6 +726,10 @@ foreach ($components as $component) {
|
|||
['title' => __('Plug-in module')]
|
||||
);
|
||||
break;
|
||||
|
||||
default:
|
||||
// Not possible.
|
||||
break;
|
||||
}
|
||||
|
||||
$data[3] = "<span style='font-size: 8px'>".mb_strimwidth(io_safe_output($component['description']), 0, 60, '...').'</span>';
|
||||
|
@ -719,13 +747,32 @@ if (isset($data)) {
|
|||
echo "<form method='post' action='index.php?sec=".$sec.'&sec2=godmode/modules/manage_network_components&search_id_group=0search_string=&pure='.$pure."'>";
|
||||
html_print_input_hidden('multiple_delete', 1);
|
||||
html_print_table($table);
|
||||
ui_pagination($total_components, $url, 0, 0, false, 'offset', true, 'pagination-bottom');
|
||||
ui_pagination(
|
||||
$total_components,
|
||||
$url,
|
||||
0,
|
||||
0,
|
||||
false,
|
||||
'offset',
|
||||
true,
|
||||
'pagination-bottom'
|
||||
);
|
||||
echo "<div style='float: right; margin-left: 5px;'>";
|
||||
html_print_submit_button(__('Delete'), 'delete_btn', false, 'class="sub delete"');
|
||||
html_print_submit_button(
|
||||
__('Delete'),
|
||||
'delete_btn',
|
||||
false,
|
||||
'class="sub delete"'
|
||||
);
|
||||
echo '</div>';
|
||||
echo '</form>';
|
||||
} else {
|
||||
ui_print_info_message(['no_close' => true, 'message' => __('There are no defined network components') ]);
|
||||
ui_print_info_message(
|
||||
[
|
||||
'no_close' => true,
|
||||
'message' => __('There are no defined network components'),
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
echo '<form method="post" action="'.$url.'">';
|
||||
|
@ -744,7 +791,12 @@ html_print_select(
|
|||
'',
|
||||
''
|
||||
);
|
||||
html_print_submit_button(__('Create'), 'crt', false, 'class="sub next" style="margin-left: 5px;"');
|
||||
html_print_submit_button(
|
||||
__('Create'),
|
||||
'crt',
|
||||
false,
|
||||
'class="sub next" style="margin-left: 5px;"'
|
||||
);
|
||||
echo '</div>';
|
||||
echo '</form>';
|
||||
|
||||
|
@ -752,9 +804,7 @@ enterprise_hook('close_meta_frame');
|
|||
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
|
||||
$( document ).ready(function() {
|
||||
|
||||
$('[id^=checkbox-delete_multiple]').change(function(){
|
||||
if($(this).parent().parent().hasClass('checkselected')){
|
||||
$(this).parent().parent().removeClass('checkselected');
|
||||
|
@ -766,16 +816,21 @@ enterprise_hook('close_meta_frame');
|
|||
|
||||
$('[id^=checkbox-all_delete]').change(function(){
|
||||
if ($("#checkbox-all_delete").prop("checked")) {
|
||||
$('[id^=checkbox-delete_multiple]').parent().parent().addClass('checkselected');
|
||||
$(".check_delete").prop("checked", true);
|
||||
$('[id^=checkbox-delete_multiple]')
|
||||
.parent()
|
||||
.parent()
|
||||
.addClass('checkselected');
|
||||
$(".check_delete")
|
||||
.prop("checked", true);
|
||||
}
|
||||
else{
|
||||
$('[id^=checkbox-delete_multiple]').parent().parent().removeClass('checkselected');
|
||||
$('[id^=checkbox-delete_multiple]')
|
||||
.parent()
|
||||
.parent()
|
||||
.removeClass('checkselected');
|
||||
$(".check_delete").prop("checked", false);
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
|
||||
</script>
|
||||
|
|
|
@ -1,17 +1,32 @@
|
|||
<?php
|
||||
/**
|
||||
* Extension to manage a list of gateways and the node address where they should
|
||||
* point to.
|
||||
*
|
||||
* @category Extensions
|
||||
* @package Pandora FMS
|
||||
* @subpackage Community
|
||||
* @version 1.0.0
|
||||
* @license See below
|
||||
*
|
||||
* ______ ___ _______ _______ ________
|
||||
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
|
||||
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
|
||||
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
|
||||
*
|
||||
* ============================================================================
|
||||
* Copyright (c) 2005-2019 Artica Soluciones Tecnologicas
|
||||
* Please see http://pandorafms.org for full contribution list
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation for version 2.
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
* ============================================================================
|
||||
*/
|
||||
|
||||
// Pandora FMS - http://pandorafms.com
|
||||
// ==================================================
|
||||
// Copyright (c) 2005-2010 Artica Soluciones Tecnologicas
|
||||
// Please see http://pandorafms.org for full contribution list
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation for version 2.
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
// Load global vars
|
||||
global $config;
|
||||
|
||||
check_login();
|
||||
|
@ -26,12 +41,18 @@ if (! check_acl($config['id_user'], 0, 'PM')) {
|
|||
}
|
||||
|
||||
$create_network_from_module = get_parameter('create_network_from_module');
|
||||
$create_network_from_snmp_browser = get_parameter('create_network_from_snmp_browser', 0);
|
||||
$create_network_from_snmp_browser = get_parameter(
|
||||
'create_network_from_snmp_browser',
|
||||
0
|
||||
);
|
||||
$pure = get_parameter('pure', 0);
|
||||
|
||||
if ($create_network_from_module) {
|
||||
$id_agentmodule = get_parameter('create_module_from');
|
||||
$data_module = db_get_row_filter('tagente_modulo', ['id_agente_modulo' => $id_agentmodule]);
|
||||
$data_module = db_get_row_filter(
|
||||
'tagente_modulo',
|
||||
['id_agente_modulo' => $id_agentmodule]
|
||||
);
|
||||
|
||||
$name = $data_module['nombre'];
|
||||
$description = $data_module['descripcion'];
|
||||
|
@ -139,16 +160,25 @@ if (isset($id)) {
|
|||
$each_ff = $component['each_ff'];
|
||||
|
||||
if ($type >= 15 && $type <= 18) {
|
||||
// New support for snmp v3
|
||||
// New support for snmp v3.
|
||||
$snmp_version = $component['tcp_send'];
|
||||
$snmp3_auth_user = $component['plugin_user'];
|
||||
$snmp3_auth_pass = io_output_password($component['plugin_pass']);
|
||||
$snmp3_auth_method = $component['plugin_parameter'];
|
||||
$snmp3_privacy_method = $component['custom_string_1'];
|
||||
$snmp3_privacy_pass = io_output_password($component['custom_string_2']);
|
||||
$snmp3_privacy_pass = io_output_password(
|
||||
$component['custom_string_2']
|
||||
);
|
||||
$snmp3_security_level = $component['custom_string_3'];
|
||||
} else if ($type >= 34 && $type <= 37) {
|
||||
$command_text = $component['tcp_send'];
|
||||
$command_credential_identifier = $component['custom_string_1'];
|
||||
$command_os = $component['custom_string_2'];
|
||||
}
|
||||
} else if (isset($new_component) && $new_component && !$create_network_from_snmp_browser) {
|
||||
} else if (isset($new_component)
|
||||
&& $new_component
|
||||
&& !$create_network_from_snmp_browser
|
||||
) {
|
||||
$name = '';
|
||||
$snmp_oid = '';
|
||||
$description = '';
|
||||
|
@ -204,21 +234,13 @@ if (isset($id)) {
|
|||
$snmp3_privacy_pass = '';
|
||||
$snmp3_auth_method = '';
|
||||
$snmp3_security_level = '';
|
||||
|
||||
$command_text = '';
|
||||
$command_os = 'inherited';
|
||||
$command_credential_identifier = '';
|
||||
}
|
||||
}
|
||||
|
||||
if ($create_network_from_snmp_browser) {
|
||||
}
|
||||
|
||||
/*
|
||||
* $id_component_type has these values:
|
||||
* 6 - Module WMI
|
||||
* 4 - Plugin component
|
||||
* 2 - network component
|
||||
*
|
||||
* You can see this values in file godmode/modules/manage_network_components.php
|
||||
* in the last lines (in the call function "html_print_select").
|
||||
*/
|
||||
$table = new stdClass();
|
||||
|
||||
if ($id_component_type == 6) {
|
||||
|
@ -243,6 +265,10 @@ if ($id_component_type == 6) {
|
|||
4,
|
||||
5,
|
||||
];
|
||||
if (enterprise_installed()) {
|
||||
$categories[] = 10;
|
||||
}
|
||||
|
||||
include $config['homedir'].'/godmode/modules/manage_network_components_form_common.php';
|
||||
include $config['homedir'].'/godmode/modules/manage_network_components_form_network.php';
|
||||
} else {
|
||||
|
@ -253,7 +279,7 @@ echo '<form name="component" method="post">';
|
|||
|
||||
$table->width = '100%';
|
||||
$table->class = 'databox filters';
|
||||
// $table came from manage_network_components_form_common.php
|
||||
|
||||
if (defined('METACONSOLE')) {
|
||||
if ($id) {
|
||||
$table->head[0] = __('Update Network Component');
|
||||
|
@ -295,57 +321,74 @@ ui_require_javascript_file('pandora_modules');
|
|||
function type_change () {
|
||||
// type 1-4 - Generic_xxxxxx
|
||||
if ((document.component.type.value > 0) && (document.component.type.value < 5)) {
|
||||
|
||||
$("input[name=snmp_community]").css({backgroundColor: '#ddd !important'});
|
||||
$("input[name=snmp_community]")
|
||||
.css({backgroundColor: '#ddd '});
|
||||
$("input[name=snmp_community]").attr("disabled", true);
|
||||
|
||||
$("input[name=tcp_rcv]").css({backgroundColor: '#ddd !important'});
|
||||
$("input[name=tcp_rcv]").css({backgroundColor: '#ddd '});
|
||||
$("input[name=tcp_rcv]").attr("disabled", true);
|
||||
|
||||
<?php
|
||||
if ($id_component_type != MODULE_WMI) {
|
||||
?>
|
||||
$("input[name=snmp_oid]").css({backgroundColor: '#ddd !important'});
|
||||
$("input[name=snmp_oid]")
|
||||
.css({backgroundColor: '#ddd '});
|
||||
$("input[name=snmp_oid]").attr("disabled", true);
|
||||
|
||||
$("input[name=tcp_send]").css({backgroundColor: '#ddd !important'});
|
||||
$("input[name=tcp_send]")
|
||||
.css({backgroundColor: '#ddd '});
|
||||
$("input[name=tcp_send]").attr("disabled", true);
|
||||
|
||||
$("input[name=tcp_port]").css({backgroundColor: '#ddd !important'});
|
||||
$("input[name=tcp_port]")
|
||||
.css({backgroundColor: '#ddd '});
|
||||
$("input[name=tcp_port]").attr("disabled", true);
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
$("input[name=snmp3_auth_user]").css({backgroundColor: '#ddd !important'});
|
||||
$("input[name=snmp3_auth_user]")
|
||||
.css({backgroundColor: '#ddd '});
|
||||
$("input[name=snmp3_auth_user]").attr("disabled", true);
|
||||
|
||||
$("input[name=snmp3_auth_pass]").css({backgroundColor: '#ddd !important'});
|
||||
$("input[name=snmp3_auth_pass]")
|
||||
.css({backgroundColor: '#ddd '});
|
||||
$("input[name=snmp3_auth_pass]").attr("disabled", true);
|
||||
|
||||
$("#snmp3_privacy_method").css({backgroundColor: '#ddd !important'});
|
||||
$("#snmp3_privacy_method").css({backgroundColor: '#ddd '});
|
||||
$("#snmp3_privacy_method").attr("disabled", true);
|
||||
|
||||
$("input[name=snmp3_privacy_pass]").css({backgroundColor: '#ddd !important'});
|
||||
$("input[name=snmp3_privacy_pass]")
|
||||
.css({backgroundColor: '#ddd '});
|
||||
$("input[name=snmp3_privacy_pass]").attr("disabled", true);
|
||||
|
||||
$("#snmp3_auth_method").css({backgroundColor: '#ddd !important'});
|
||||
$("#snmp3_auth_method").css({backgroundColor: '#ddd '});
|
||||
$("#snmp3_auth_method").attr("disabled", true);
|
||||
|
||||
$("#snmp3_security_level").css({backgroundColor: '#ddd !important'});
|
||||
$("#snmp3_security_level").css({backgroundColor: '#ddd '});
|
||||
$("#snmp3_security_level").attr("disabled", true);
|
||||
|
||||
$("#command_text").css({backgroundColor: '#ddd '});
|
||||
$("#command_text").attr("disabled", true);
|
||||
|
||||
$("#command_credential_identifier")
|
||||
.css({backgroundColor: '#ddd '});
|
||||
$("#command_credential_identifier").attr("disabled", true);
|
||||
|
||||
$("#command_os").css({backgroundColor: '#ddd '});
|
||||
$("#command_os").attr("disabled", true);
|
||||
}
|
||||
// type 15-18- SNMP
|
||||
if ((document.component.type.value > 14) && (document.component.type.value < 19 )) {
|
||||
document.component.snmp_oid.style.background="#fff";
|
||||
document.component.snmp_oid.style.disabled=false;
|
||||
document.component.snmp_community.style.background="#fff";
|
||||
document.component.snmp_community.disabled=false;
|
||||
document.component.snmp_oid.disabled=false;
|
||||
|
||||
document.getElementById('text-snmp_community').style.background="#fff";
|
||||
document.getElementById('text-snmp_community').disabled=false;
|
||||
document.component.snmp_oid.style.background="#fff";
|
||||
document.component.snmp_oid.disabled=false;
|
||||
document.component.tcp_send.style.background="#ddd !important";
|
||||
document.component.tcp_send.style.background="#ddd ";
|
||||
document.component.tcp_send.disabled=true;
|
||||
document.component.tcp_rcv.style.background="#ddd !important";
|
||||
document.component.tcp_rcv.style.background="#ddd ";
|
||||
document.component.tcp_rcv.disabled=true;
|
||||
document.component.tcp_port.style.background="#fff";
|
||||
document.component.tcp_port.disabled=false;
|
||||
|
@ -365,44 +408,97 @@ function type_change () {
|
|||
document.component.snmp3_security_level.style.background="#fff";
|
||||
document.component.snmp3_security_level.disabled=false;
|
||||
|
||||
document.component.command_text.style.background="#ddd";
|
||||
document.component.command_text.style.disabled=true;
|
||||
document.component.command_credential_identifier.style.background="#ddd";
|
||||
document.component.command_credential_identifier.disabled=true;
|
||||
document.component.command_os.style.background="#ddd";
|
||||
document.component.command_os.disabled=true;
|
||||
|
||||
$("#snmp_version" ).trigger("change");
|
||||
}
|
||||
|
||||
if ((document.component.type.value >= 34) && (document.component.type.value <= 37 )) {
|
||||
document.component.snmp_oid.style.background="#ddd";
|
||||
document.component.snmp_oid.disabled=true;
|
||||
document.getElementById('text-snmp_community').style.background="#ddd";
|
||||
document.getElementById('text-snmp_community').disabled=true;
|
||||
document.component.snmp_oid.style.background="#ddd";
|
||||
document.component.snmp_oid.disabled=true;
|
||||
document.component.snmp_version.style.background="#ddd";
|
||||
document.component.snmp_version.disabled=true;
|
||||
|
||||
document.component.tcp_send.style.background="#ddd";
|
||||
document.component.tcp_send.disabled=true;
|
||||
document.component.tcp_rcv.style.background="#ddd";
|
||||
document.component.tcp_rcv.disabled=true;
|
||||
document.component.tcp_port.style.background="#fff";
|
||||
document.component.tcp_port.disabled=false;
|
||||
|
||||
document.component.snmp3_auth_user.style.background="#ddd ";
|
||||
document.component.snmp3_auth_user.disabled=true;
|
||||
document.component.snmp3_auth_pass.background="#ddd ";
|
||||
document.component.snmp3_auth_pass.disabled=true;
|
||||
document.component.snmp3_privacy_method.style.background="#ddd ";
|
||||
document.component.snmp3_privacy_method.disabled=true;
|
||||
document.component.snmp3_privacy_pass.style.background="#ddd ";
|
||||
document.component.snmp3_privacy_pass.disabled=true;
|
||||
document.component.snmp3_auth_method.style.background="#ddd ";
|
||||
document.component.snmp3_auth_method.disabled=true;
|
||||
document.component.snmp3_security_level.style.background="#ddd ";
|
||||
document.component.snmp3_security_level.disabled=true;
|
||||
|
||||
document.component.command_text.style.background="#fff";
|
||||
document.component.command_text.style.disabled=false;
|
||||
document.component.command_credential_identifier.style.background="#fff";
|
||||
document.component.command_credential_identifier.disabled=false;
|
||||
document.component.command_os.style.background="#fff";
|
||||
document.component.command_os.disabled=false;
|
||||
}
|
||||
|
||||
// type 6-7 - ICMP
|
||||
if ((document.component.type.value == 6) || (document.component.type.value == 7)) {
|
||||
document.component.snmp_oid.style.background="#ddd !important";
|
||||
document.component.snmp_oid.style.background="#ddd ";
|
||||
document.component.snmp_oid.disabled=true;
|
||||
document.component.snmp_community.style.background="#ddd !important";
|
||||
document.component.snmp_community.disabled=true;
|
||||
document.component.snmp_oid.style.background="#ddd !important";
|
||||
document.getElementById('text-snmp_community').style.background="#ddd";
|
||||
document.getElementById('text-snmp_community').disabled=true;
|
||||
document.component.snmp_oid.style.background="#ddd ";
|
||||
document.component.snmp_oid.disabled=true;
|
||||
document.component.tcp_send.style.background="#ddd !important";
|
||||
document.component.tcp_send.style.background="#ddd ";
|
||||
document.component.tcp_send.disabled=true;
|
||||
document.component.tcp_rcv.style.background="#ddd !important";
|
||||
document.component.tcp_rcv.style.background="#ddd ";
|
||||
document.component.tcp_rcv.disabled=true;
|
||||
document.component.tcp_port.style.background="#ddd !important";
|
||||
document.component.tcp_port.style.background="#ddd ";
|
||||
document.component.tcp_port.disabled=true;
|
||||
|
||||
document.component.snmp_version.style.background="#ddd !important";
|
||||
document.component.snmp_version.style.background="#ddd ";
|
||||
document.component.snmp_version.disabled=true;
|
||||
document.component.snmp3_auth_user.style.background="#ddd !important";
|
||||
document.component.snmp3_auth_user.style.background="#ddd ";
|
||||
document.component.snmp3_auth_user.disabled=true;
|
||||
document.component.snmp3_auth_pass.background="#ddd !important";
|
||||
document.component.snmp3_auth_pass.background="#ddd ";
|
||||
document.component.snmp3_auth_pass.disabled=true;
|
||||
document.component.snmp3_privacy_method.style.background="#ddd !important";
|
||||
document.component.snmp3_privacy_method.style.background="#ddd ";
|
||||
document.component.snmp3_privacy_method.disabled=true;
|
||||
document.component.snmp3_privacy_pass.style.background="#ddd !important";
|
||||
document.component.snmp3_privacy_pass.style.background="#ddd ";
|
||||
document.component.snmp3_privacy_pass.disabled=true;
|
||||
document.component.snmp3_auth_method.style.background="#ddd !important";
|
||||
document.component.snmp3_auth_method.style.background="#ddd ";
|
||||
document.component.snmp3_auth_method.disabled=true;
|
||||
document.component.snmp3_security_level.style.background="#ddd !important";
|
||||
document.component.snmp3_security_level.style.background="#ddd ";
|
||||
document.component.snmp3_security_level.disabled=true;
|
||||
|
||||
document.component.command_text.style.background="#ddd";
|
||||
document.component.command_text.style.disabled=true;
|
||||
document.component.command_credential_identifier.style.background="#ddd";
|
||||
document.component.command_credential_identifier.disabled=true;
|
||||
document.component.command_os.style.background="#ddd";
|
||||
document.component.command_os.disabled=true;
|
||||
}
|
||||
// type 8-11 - TCP
|
||||
if ((document.component.type.value > 7) && (document.component.type.value < 12)) {
|
||||
document.component.snmp_oid.style.background="#ddd !important";
|
||||
document.component.snmp_oid.style.background="#ddd ";
|
||||
document.component.snmp_oid.disabled=true;
|
||||
document.component.snmp_community.style.background="#ddd !important";
|
||||
document.component.snmp_community.disabled=true;
|
||||
document.getElementById('text-snmp_community').style.background="#ddd ";
|
||||
document.getElementById('text-snmp_community').disabled=true;
|
||||
document.component.tcp_send.style.background="#fff";
|
||||
document.component.tcp_send.disabled=false;
|
||||
document.component.tcp_rcv.style.background="#fff";
|
||||
|
@ -410,27 +506,34 @@ function type_change () {
|
|||
document.component.tcp_port.style.background="#fff";
|
||||
document.component.tcp_port.disabled=false;
|
||||
|
||||
document.component.snmp_version.style.background="#ddd !important";
|
||||
document.component.snmp_version.style.background="#ddd ";
|
||||
document.component.snmp_version.disabled=true;
|
||||
document.component.snmp3_auth_user.style.background="#ddd !important";
|
||||
document.component.snmp3_auth_user.style.background="#ddd ";
|
||||
document.component.snmp3_auth_user.disabled=true;
|
||||
document.component.snmp3_auth_pass.background="#ddd !important";
|
||||
document.component.snmp3_auth_pass.background="#ddd ";
|
||||
document.component.snmp3_auth_pass.disabled=true;
|
||||
document.component.snmp3_privacy_method.style.background="#ddd !important";
|
||||
document.component.snmp3_privacy_method.style.background="#ddd ";
|
||||
document.component.snmp3_privacy_method.disabled=true;
|
||||
document.component.snmp3_privacy_pass.style.background="#ddd !important";
|
||||
document.component.snmp3_privacy_pass.style.background="#ddd ";
|
||||
document.component.snmp3_privacy_pass.disabled=true;
|
||||
document.component.snmp3_auth_method.style.background="#ddd !important";
|
||||
document.component.snmp3_auth_method.style.background="#ddd ";
|
||||
document.component.snmp3_auth_method.disabled=true;
|
||||
document.component.snmp3_security_level.style.background="#ddd !important";
|
||||
document.component.snmp3_security_level.style.background="#ddd ";
|
||||
document.component.snmp3_security_level.disabled=true;
|
||||
|
||||
document.component.command_text.style.background="#ddd";
|
||||
document.component.command_text.style.disabled=true;
|
||||
document.component.command_credential_identifier.style.background="#ddd";
|
||||
document.component.command_credential_identifier.disabled=true;
|
||||
document.component.command_os.style.background="#ddd";
|
||||
document.component.command_os.disabled=true;
|
||||
}
|
||||
// type 12 - UDP
|
||||
if (document.component.type.value == 12) {
|
||||
document.component.snmp_oid.style.background="#ddd !important";
|
||||
document.component.snmp_oid.style.background="#ddd ";
|
||||
document.component.snmp_oid.disabled=true;
|
||||
document.component.snmp_community.style.background="#ddd !important";
|
||||
document.component.snmp_community.disabled=true;
|
||||
document.getElementById('text-snmp_community').style.background="#ddd ";
|
||||
document.getElementById('text-snmp_community').disabled=true;
|
||||
document.component.tcp_send.style.background="#fff";
|
||||
document.component.tcp_send.disabled=false;
|
||||
document.component.tcp_rcv.style.background="#fff";
|
||||
|
@ -438,20 +541,27 @@ function type_change () {
|
|||
document.component.tcp_port.style.background="#fff";
|
||||
document.component.tcp_port.disabled=false;
|
||||
|
||||
document.component.snmp_version.style.background="#ddd !important";
|
||||
document.component.snmp_version.style.background="#ddd ";
|
||||
document.component.snmp_version.disabled=true;
|
||||
document.component.snmp3_auth_user.style.background="#ddd !important";
|
||||
document.component.snmp3_auth_user.style.background="#ddd ";
|
||||
document.component.snmp3_auth_user.disabled=true;
|
||||
document.component.snmp3_auth_pass.background="#ddd !important";
|
||||
document.component.snmp3_auth_pass.background="#ddd ";
|
||||
document.component.snmp3_auth_pass.disabled=true;
|
||||
document.component.snmp3_privacy_method.style.background="#ddd !important";
|
||||
document.component.snmp3_privacy_method.style.background="#ddd ";
|
||||
document.component.snmp3_privacy_method.disabled=true;
|
||||
document.component.snmp3_privacy_pass.style.background="#ddd !important";
|
||||
document.component.snmp3_privacy_pass.style.background="#ddd ";
|
||||
document.component.snmp3_privacy_pass.disabled=true;
|
||||
document.component.snmp3_auth_method.style.background="#ddd !important";
|
||||
document.component.snmp3_auth_method.style.background="#ddd ";
|
||||
document.component.snmp3_auth_method.disabled=true;
|
||||
document.component.snmp3_security_level.style.background="#ddd !important";
|
||||
document.component.snmp3_security_level.style.background="#ddd ";
|
||||
document.component.snmp3_security_level.disabled=true;
|
||||
|
||||
document.component.command_text.style.background="#ddd";
|
||||
document.component.command_text.style.disabled=true;
|
||||
document.component.command_credential_identifier.style.background="#ddd";
|
||||
document.component.command_credential_identifier.disabled=true;
|
||||
document.component.command_os.style.background="#ddd";
|
||||
document.component.command_os.disabled=true;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -544,8 +654,6 @@ $(document).ready (function () {
|
|||
$("#snmp3_security_level").attr("disabled", true);
|
||||
|
||||
$("input[name=active_snmp_v3]").val(0);
|
||||
$("input[name=snmp_community]").css({backgroundColor: '#fff'});
|
||||
$("input[name=snmp_community]").removeAttr('disabled');
|
||||
}
|
||||
|
||||
$("#snmp_version").change(function () {
|
||||
|
@ -647,8 +755,6 @@ $(document).ready (function () {
|
|||
$("#snmp3_security_level").attr("disabled", true);
|
||||
|
||||
$("input[name=active_snmp_v3]").val(0);
|
||||
$("input[name=snmp_community]").css({backgroundColor: '#fff'});
|
||||
$("input[name=snmp_community]").removeAttr('disabled');
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
@ -77,7 +77,7 @@ $sql = sprintf(
|
|||
'SELECT id_tipo, descripcion
|
||||
FROM ttipo_modulo
|
||||
WHERE categoria IN (%s)
|
||||
ORDER BY descripcion',
|
||||
ORDER BY id_tipo ASC',
|
||||
implode(',', $categories)
|
||||
);
|
||||
$table->data[1][1] = html_print_select_from_sql(
|
||||
|
|
|
@ -1,17 +1,32 @@
|
|||
<?php
|
||||
/**
|
||||
* Extension to manage a list of gateways and the node address where they should
|
||||
* point to.
|
||||
*
|
||||
* @category Extensions
|
||||
* @package Pandora FMS
|
||||
* @subpackage Community
|
||||
* @version 1.0.0
|
||||
* @license See below
|
||||
*
|
||||
* ______ ___ _______ _______ ________
|
||||
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
|
||||
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
|
||||
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
|
||||
*
|
||||
* ============================================================================
|
||||
* Copyright (c) 2005-2019 Artica Soluciones Tecnologicas
|
||||
* Please see http://pandorafms.org for full contribution list
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation for version 2.
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
* ============================================================================
|
||||
*/
|
||||
|
||||
// Pandora FMS - http://pandorafms.com
|
||||
// ==================================================
|
||||
// Copyright (c) 2005-2010 Artica Soluciones Tecnologicas
|
||||
// Please see http://pandorafms.org for full contribution list
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation for version 2.
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
// Load global vars
|
||||
global $config;
|
||||
|
||||
check_login();
|
||||
|
@ -55,32 +70,94 @@ push_table_row($data, 'snmp_port');
|
|||
|
||||
$data = [];
|
||||
$data[0] = __('SNMP Enterprise String');
|
||||
$data[1] = html_print_input_text('snmp_oid', $snmp_oid, '', 30, 400, true);
|
||||
// $table->colspan['snmp_2'][1] = 3;
|
||||
$data[1] = html_print_input_text(
|
||||
'snmp_oid',
|
||||
$snmp_oid,
|
||||
'',
|
||||
30,
|
||||
400,
|
||||
true
|
||||
);
|
||||
|
||||
$data[2] = __('SNMP community');
|
||||
$data[3] = html_print_input_text('snmp_community', $snmp_community, '', 15, 60, true);
|
||||
$data[3] = html_print_input_text(
|
||||
'snmp_community',
|
||||
$snmp_community,
|
||||
'',
|
||||
15,
|
||||
60,
|
||||
true
|
||||
);
|
||||
|
||||
push_table_row($data, 'snmp_2');
|
||||
|
||||
|
||||
$data = [];
|
||||
$data[0] = __('Auth user');
|
||||
$data[1] = html_print_input_text('snmp3_auth_user', $snmp3_auth_user, '', 15, 60, true);
|
||||
$data[1] = html_print_input_text(
|
||||
'snmp3_auth_user',
|
||||
$snmp3_auth_user,
|
||||
'',
|
||||
15,
|
||||
60,
|
||||
true
|
||||
);
|
||||
$data[2] = __('Auth password');
|
||||
$data[3] = html_print_input_password('snmp3_auth_pass', $snmp3_auth_pass, '', 15, 60, true);
|
||||
$data[3] .= html_print_input_hidden_extended('active_snmp_v3', 0, 'active_snmp_v3_mncfn', true);
|
||||
$data[3] = html_print_input_password(
|
||||
'snmp3_auth_pass',
|
||||
$snmp3_auth_pass,
|
||||
'',
|
||||
15,
|
||||
60,
|
||||
true
|
||||
);
|
||||
$data[3] .= html_print_input_hidden_extended(
|
||||
'active_snmp_v3',
|
||||
0,
|
||||
'active_snmp_v3_mncfn',
|
||||
true
|
||||
);
|
||||
push_table_row($data, 'field_snmpv3_row1');
|
||||
|
||||
$data = [];
|
||||
$data[0] = __('Privacy method');
|
||||
$data[1] = html_print_select(['DES' => __('DES'), 'AES' => __('AES')], 'snmp3_privacy_method', $snmp3_privacy_method, '', '', '', true);
|
||||
$data[1] = html_print_select(
|
||||
[
|
||||
'DES' => __('DES'),
|
||||
'AES' => __('AES'),
|
||||
],
|
||||
'snmp3_privacy_method',
|
||||
$snmp3_privacy_method,
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
true
|
||||
);
|
||||
$data[2] = __('Privacy pass');
|
||||
$data[3] = html_print_input_password('snmp3_privacy_pass', $snmp3_privacy_pass, '', 15, 60, true);
|
||||
$data[3] = html_print_input_password(
|
||||
'snmp3_privacy_pass',
|
||||
$snmp3_privacy_pass,
|
||||
'',
|
||||
15,
|
||||
60,
|
||||
true
|
||||
);
|
||||
push_table_row($data, 'field_snmpv3_row2');
|
||||
|
||||
$data = [];
|
||||
$data[0] = __('Auth method');
|
||||
$data[1] = html_print_select(['MD5' => __('MD5'), 'SHA' => __('SHA')], 'snmp3_auth_method', $snmp3_auth_method, '', '', '', true);
|
||||
$data[1] = html_print_select(
|
||||
[
|
||||
'MD5' => __('MD5'),
|
||||
'SHA' => __('SHA'),
|
||||
],
|
||||
'snmp3_auth_method',
|
||||
$snmp3_auth_method,
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
true
|
||||
);
|
||||
$data[2] = __('Security level');
|
||||
$data[3] = html_print_select(
|
||||
[
|
||||
|
@ -110,12 +187,11 @@ $data[1] = html_print_extended_select_for_post_process(
|
|||
false,
|
||||
true
|
||||
);
|
||||
$data[2] = $data[3] = '';
|
||||
$data[2] = '';
|
||||
$data[3] = '';
|
||||
push_table_row($data, 'field_process');
|
||||
|
||||
|
||||
|
||||
// Advanced stuff
|
||||
// Advanced stuff.
|
||||
$data = [];
|
||||
$data[0] = __('TCP send');
|
||||
$data[1] = html_print_textarea('tcp_send', 2, 65, $tcp_send, '', true);
|
||||
|
@ -129,6 +205,64 @@ $data[1] = html_print_textarea('tcp_rcv', 2, 65, $tcp_rcv, '', true);
|
|||
$table->colspan['tcp_receive'][1] = 3;
|
||||
|
||||
push_table_row($data, 'tcp_receive');
|
||||
|
||||
$data = [];
|
||||
$data[0] = __('Command');
|
||||
$data[1] = html_print_input_text_extended(
|
||||
'command_text',
|
||||
$command_text,
|
||||
'command_text',
|
||||
'',
|
||||
100,
|
||||
10000,
|
||||
$disabledBecauseInPolicy,
|
||||
'',
|
||||
$largeClassDisabledBecauseInPolicy,
|
||||
true
|
||||
);
|
||||
$table->colspan['row-cmd-row-1'][1] = 3;
|
||||
push_table_row($data, 'row-cmd-row-1');
|
||||
|
||||
require_once $config['homedir'].'/include/class/CredentialStore.class.php';
|
||||
$array_credential_identifier = CredentialStore::getKeys('CUSTOM');
|
||||
|
||||
$data[0] = __('Credential identifier');
|
||||
$data[1] = html_print_select(
|
||||
$array_credential_identifier,
|
||||
'command_credential_identifier',
|
||||
$command_credential_identifier,
|
||||
'',
|
||||
__('None'),
|
||||
'',
|
||||
true,
|
||||
false,
|
||||
false,
|
||||
'',
|
||||
$disabledBecauseInPolicy
|
||||
);
|
||||
|
||||
$array_os = [
|
||||
'inherited' => __('Inherited'),
|
||||
'linux' => __('Linux'),
|
||||
'windows' => __('Windows'),
|
||||
];
|
||||
|
||||
$data[2] = __('Target OS');
|
||||
$data[3] = html_print_select(
|
||||
$array_os,
|
||||
'command_os',
|
||||
$command_os,
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
true,
|
||||
false,
|
||||
false,
|
||||
'',
|
||||
$disabledBecauseInPolicy
|
||||
);
|
||||
|
||||
push_table_row($data, 'row-cmd-row-2');
|
||||
?>
|
||||
|
||||
<script type="text/javascript">
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 369 B |
Binary file not shown.
After Width: | Height: | Size: 190 KiB |
Binary file not shown.
After Width: | Height: | Size: 1.5 KiB |
Binary file not shown.
After Width: | Height: | Size: 1.4 KiB |
Binary file not shown.
After Width: | Height: | Size: 1.5 KiB |
Binary file not shown.
After Width: | Height: | Size: 1.4 KiB |
|
@ -0,0 +1,62 @@
|
|||
<?php
|
||||
/**
|
||||
* Welcome window ajax controller.
|
||||
*
|
||||
* @category WelcomeWindow
|
||||
* @package Pandora FMS
|
||||
* @subpackage New Installation Welcome Window
|
||||
* @version 1.0.0
|
||||
* @license See below
|
||||
*
|
||||
* ______ ___ _______ _______ ________
|
||||
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
|
||||
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
|
||||
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
|
||||
*
|
||||
* ============================================================================
|
||||
* Copyright (c) 2005-2019 Artica Soluciones Tecnologicas
|
||||
* Please see http://pandorafms.org for full contribution list
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation for version 2.
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
* ============================================================================
|
||||
*/
|
||||
|
||||
// Begin.
|
||||
global $config;
|
||||
|
||||
require_once $config['homedir'].'/include/class/WelcomeWindow.class.php';
|
||||
if (is_ajax() === false) {
|
||||
exit;
|
||||
}
|
||||
|
||||
$ajaxPage = 'include/ajax/welcome_window';
|
||||
|
||||
// Control call flow.
|
||||
try {
|
||||
// User access and validation is being processed on class constructor.
|
||||
$welcome_actions = new WelcomeWindow(true, $ajaxPage);
|
||||
} catch (Exception $e) {
|
||||
exit;
|
||||
}
|
||||
|
||||
// Ajax controller.
|
||||
$method = get_parameter('method', '');
|
||||
|
||||
if (method_exists($welcome_actions, $method) === true) {
|
||||
if ($welcome_actions->ajaxMethod($method) === true) {
|
||||
$welcome_actions->{$method}();
|
||||
} else {
|
||||
$welcome_actions->error('Unavailable method.');
|
||||
}
|
||||
} else {
|
||||
$welcome_actions->error('Method not found. ['.$method.']');
|
||||
}
|
||||
|
||||
|
||||
// Stop any execution.
|
||||
exit;
|
|
@ -403,6 +403,8 @@ class CredentialStore extends Wizard
|
|||
{
|
||||
global $config;
|
||||
|
||||
$filter = [];
|
||||
|
||||
if ($product !== false) {
|
||||
$filter['product'] = $product;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,900 @@
|
|||
<?php
|
||||
/**
|
||||
* Welcome to Pandora FMS feature.
|
||||
*
|
||||
* @category Class
|
||||
* @package Pandora FMS
|
||||
* @subpackage New Installation Welcome Window
|
||||
* @version 1.0.0
|
||||
* @license See below
|
||||
*
|
||||
* ______ ___ _______ _______ ________
|
||||
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
|
||||
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
|
||||
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
|
||||
*
|
||||
* ============================================================================
|
||||
* Copyright (c) 2005-2019 Artica Soluciones Tecnologicas
|
||||
* Please see http://pandorafms.org for full contribution list
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation for version 2.
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
* ============================================================================
|
||||
*/
|
||||
|
||||
// Begin.
|
||||
global $config;
|
||||
|
||||
require_once $config['homedir'].'/godmode/wizards/Wizard.main.php';
|
||||
|
||||
/**
|
||||
* Class WelcomeWindow.
|
||||
*/
|
||||
class WelcomeWindow extends Wizard
|
||||
{
|
||||
|
||||
/**
|
||||
* Allowed methods to be called using AJAX request.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $AJAXMethods = [
|
||||
'loadWelcomeWindow',
|
||||
'cancelWelcome',
|
||||
];
|
||||
|
||||
/**
|
||||
* Tasks.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
private $tasks = [
|
||||
'welcome_mail_configured',
|
||||
'welcome_id_agent',
|
||||
'welcome_module',
|
||||
'welcome_alert',
|
||||
'welcome_task',
|
||||
];
|
||||
|
||||
/**
|
||||
* Url of controller.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $ajaxController;
|
||||
|
||||
/**
|
||||
* Current step.
|
||||
*
|
||||
* @var integer
|
||||
*/
|
||||
public $step;
|
||||
|
||||
/**
|
||||
* Current agent (created example).
|
||||
*
|
||||
* @var integer
|
||||
*/
|
||||
public $agent;
|
||||
|
||||
|
||||
/**
|
||||
* Generates a JSON error.
|
||||
*
|
||||
* @param string $msg Error message.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function error($msg)
|
||||
{
|
||||
echo json_encode(
|
||||
['error' => $msg]
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Checks if target method is available to be called using AJAX.
|
||||
*
|
||||
* @param string $method Target method.
|
||||
*
|
||||
* @return boolean True allowed, false not.
|
||||
*/
|
||||
public function ajaxMethod($method)
|
||||
{
|
||||
global $config;
|
||||
|
||||
// Check access.
|
||||
check_login();
|
||||
|
||||
return in_array($method, $this->AJAXMethods);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param boolean $must_run Must run or not.
|
||||
* @param string $ajax_controller Controller.
|
||||
*
|
||||
* @return object
|
||||
* @throws Exception On error.
|
||||
*/
|
||||
public function __construct(
|
||||
bool $must_run=false,
|
||||
$ajax_controller='include/ajax/welcome_window'
|
||||
) {
|
||||
$this->ajaxController = $ajax_controller;
|
||||
|
||||
if ($this->initialize($must_run) !== true) {
|
||||
throw new Exception('Must not be shown');
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Main method.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
ui_require_css_file('new_installation_welcome_window');
|
||||
echo '<div id="welcome_modal_window" style="display: none"; >';
|
||||
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
load_modal({
|
||||
target: $('#welcome_modal_window'),
|
||||
url: '<?php echo ui_get_full_url('ajax.php', false, false, false); ?>',
|
||||
modal: {
|
||||
title: "<?php echo __('Welcome to Pandora FMS'); ?>",
|
||||
cancel: '<?php echo __('Do not show anymore'); ?>',
|
||||
ok: '<?php echo __('Close'); ?>'
|
||||
},
|
||||
onshow: {
|
||||
page: '<?php echo $this->ajaxController; ?>',
|
||||
method: 'loadWelcomeWindow',
|
||||
},
|
||||
oncancel: {
|
||||
page: '<?php echo $this->ajaxController; ?>',
|
||||
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
|
||||
echo '</div>';
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Method to cancel welcome modal window.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function cancelWelcome()
|
||||
{
|
||||
// Config update value.
|
||||
$this->setStep(WELCOME_FINISHED);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return current step.
|
||||
*
|
||||
* @return integer Step.
|
||||
*/
|
||||
public function getStep(): int
|
||||
{
|
||||
global $config;
|
||||
$this->step = $config['welcome_state'];
|
||||
|
||||
// Get step available.
|
||||
if (empty($config['welcome_mail_configured']) === true
|
||||
&& get_parameter('sec2') == 'godmode/setup/setup'
|
||||
&& get_parameter('section', '') == 'general'
|
||||
&& get_parameter('update_config', false) !== false
|
||||
) {
|
||||
$this->step = W_CONFIGURE_MAIL;
|
||||
} else if (empty($config['welcome_id_agent']) === true) {
|
||||
$this->step = W_CREATE_AGENT;
|
||||
} else if (empty($config['welcome_module']) === true) {
|
||||
$this->step = W_CREATE_MODULE;
|
||||
} else if (empty($config['welcome_alert']) === true) {
|
||||
$this->step = W_CREATE_ALERT;
|
||||
} else if (empty($config['welcome_task']) === true) {
|
||||
$this->step = W_CREATE_TASK;
|
||||
}
|
||||
|
||||
return $this->step;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets current step.
|
||||
*
|
||||
* @param integer $step Current step.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setStep(int $step)
|
||||
{
|
||||
$this->step = $step;
|
||||
config_update_value('welcome_state', $step);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Completes current step.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function completeStep()
|
||||
{
|
||||
switch ($this->step) {
|
||||
case W_CONFIGURE_MAIL:
|
||||
config_update_value('welcome_mail_configured', true);
|
||||
break;
|
||||
|
||||
case W_CREATE_AGENT:
|
||||
config_update_value('welcome_id_agent', true);
|
||||
break;
|
||||
|
||||
case W_CREATE_MODULE:
|
||||
config_update_value('welcome_module', true);
|
||||
break;
|
||||
|
||||
case W_CREATE_ALERT:
|
||||
config_update_value('welcome_alert', true);
|
||||
break;
|
||||
|
||||
case W_CREATE_TASK:
|
||||
config_update_value('welcome_task', true);
|
||||
break;
|
||||
|
||||
default:
|
||||
// Ignore.
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Check if all tasks had been completed.
|
||||
*
|
||||
* @return boolean All completed or not.
|
||||
*/
|
||||
public function checkAllTasks()
|
||||
{
|
||||
global $config;
|
||||
|
||||
foreach ($this->tasks as $t) {
|
||||
if (empty($config[$t]) === true) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Retrieve current welcome agent id.
|
||||
*
|
||||
* @return integer Agent id (created).
|
||||
*/
|
||||
public function getWelcomeAgent()
|
||||
{
|
||||
global $config;
|
||||
|
||||
return $config['welcome_id_agent'];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Saves current welcome agent (latest created).
|
||||
*
|
||||
* @param integer $id_agent Agent id.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setWelcomeAgent(int $id_agent)
|
||||
{
|
||||
config_update_value('welcome_id_agent', $id_agent);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Loads a welcome window form
|
||||
*
|
||||
* @return string HTML code for form.
|
||||
*
|
||||
* @return void Runs loadWelcomeWindow (AJAX).
|
||||
*/
|
||||
public function loadWelcomeWindow()
|
||||
{
|
||||
global $config;
|
||||
$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 = [
|
||||
'action' => '#',
|
||||
'id' => 'welcome_form',
|
||||
'onsubmit' => 'this.dialog("close");',
|
||||
'class' => 'modal',
|
||||
];
|
||||
|
||||
$logo_url = '';
|
||||
if (enterprise_installed()) {
|
||||
$logo_url = ENTERPRISE_DIR.'/';
|
||||
}
|
||||
|
||||
$logo_url .= 'images/custom_logo/'.$config['custom_logo_white_bg'];
|
||||
|
||||
$inputs = [
|
||||
[
|
||||
'class' => 'white_box',
|
||||
'block_content' => [
|
||||
[
|
||||
'class' => 'centered_full',
|
||||
'arguments' => [
|
||||
'type' => 'image',
|
||||
'src' => $logo_url,
|
||||
'value' => 1,
|
||||
'return' => true,
|
||||
],
|
||||
],
|
||||
],
|
||||
],
|
||||
[
|
||||
'wrapper' => 'div',
|
||||
'block_id' => 'div_configure_mail',
|
||||
'class' => 'hole flex-row w100p '.$li_configure_mail_class,
|
||||
'direct' => 1,
|
||||
'block_content' => [
|
||||
[
|
||||
'label' => __('Please ensure mail configuration matches your needs'),
|
||||
'arguments' => [
|
||||
'class' => 'first_lbl',
|
||||
'name' => 'lbl_create_agent',
|
||||
'id' => 'lbl_create_agent',
|
||||
],
|
||||
],
|
||||
[
|
||||
'arguments' => [
|
||||
'label' => '',
|
||||
'type' => 'button',
|
||||
'attributes' => 'class="go '.$btn_configure_mail_class.'"',
|
||||
'name' => 'btn_email_conf',
|
||||
'id' => 'btn_email_conf',
|
||||
],
|
||||
],
|
||||
],
|
||||
],
|
||||
[
|
||||
'label' => 'Learn to monitor',
|
||||
'class' => 'extra',
|
||||
'arguments' => [
|
||||
'class' => 'class="lbl_learn"',
|
||||
'name' => 'lbl_learn',
|
||||
'id' => 'lbl_learn',
|
||||
],
|
||||
],
|
||||
[
|
||||
'wrapper' => 'div',
|
||||
'block_id' => 'div_create_agent',
|
||||
'class' => 'learn_content_indented flex-row w100p '.$li_create_agent_class,
|
||||
'direct' => 1,
|
||||
'block_content' => [
|
||||
[
|
||||
'label' => __('Create an agent'),
|
||||
'arguments' => [
|
||||
'class' => 'first_lbl',
|
||||
'name' => 'lbl_create_agent',
|
||||
'id' => 'lbl_create_agent',
|
||||
],
|
||||
],
|
||||
[
|
||||
'arguments' => [
|
||||
'label' => '',
|
||||
'type' => 'button',
|
||||
'attributes' => 'class="go '.$btn_create_agent_class.'"',
|
||||
'name' => 'btn_create_agent',
|
||||
'id' => 'btn_create_agent',
|
||||
],
|
||||
],
|
||||
],
|
||||
],
|
||||
[
|
||||
'wrapper' => 'div',
|
||||
'block_id' => 'div_monitor_actions',
|
||||
'class' => 'learn_content_indented flex-row w100p '.$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="go '.$btn_create_module_class.'"',
|
||||
'name' => 'btn_create_module',
|
||||
'id' => 'btn_create_module',
|
||||
],
|
||||
],
|
||||
],
|
||||
],
|
||||
[
|
||||
'wrapper' => 'div',
|
||||
'block_id' => 'div_monitor_actions',
|
||||
'class' => 'hole learn_content_indented flex-row w100p '.$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="go '.$btn_create_alert_class.'"',
|
||||
'name' => 'btn_create_alert',
|
||||
'id' => 'btn_create_alert',
|
||||
],
|
||||
],
|
||||
],
|
||||
],
|
||||
[
|
||||
'wrapper' => 'div',
|
||||
'block_id' => 'div_discover',
|
||||
'class' => 'hole flex-row w100p '.$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="go '.$btn_create_discovery_class.'"',
|
||||
'name' => 'btn_discover_devices',
|
||||
'id' => 'btn_discover_devices',
|
||||
],
|
||||
],
|
||||
],
|
||||
],
|
||||
];
|
||||
|
||||
if (enterprise_installed()) {
|
||||
$inputs[] = [
|
||||
'wrapper' => 'div',
|
||||
'block_id' => 'div_not_working',
|
||||
'class' => 'hole flex-row w100p',
|
||||
'direct' => 1,
|
||||
'block_content' => [
|
||||
[
|
||||
'label' => __('If something is not working as expected, look for this icon and report!'),
|
||||
'arguments' => [
|
||||
'class' => 'first_lbl',
|
||||
'name' => 'lbl_not_working',
|
||||
'id' => 'lbl_not_working',
|
||||
],
|
||||
],
|
||||
[
|
||||
'label' => html_print_image(
|
||||
'images/feedback-header.png',
|
||||
true,
|
||||
[
|
||||
'onclick' => '$(\'#feedback-header\').click()',
|
||||
'style' => 'cursor: pointer;',
|
||||
]
|
||||
),
|
||||
|
||||
],
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
$output = $this->printForm(
|
||||
[
|
||||
'form' => $form,
|
||||
'inputs' => $inputs,
|
||||
],
|
||||
true
|
||||
);
|
||||
|
||||
$output .= $this->loadJS();
|
||||
echo $output;
|
||||
|
||||
// Ajax methods does not continue.
|
||||
exit();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* This function acts as a constructor. Receive the condition to check with
|
||||
* the global config (welcome_state) if continues
|
||||
*
|
||||
* @param boolean $must_run Must be run or not (check register.php).
|
||||
*
|
||||
* @return boolean True if initialized or false if must not run.
|
||||
*/
|
||||
public function initialize($must_run)
|
||||
{
|
||||
global $config;
|
||||
|
||||
if (isset($config['welcome_state']) === false) {
|
||||
$this->completeStep();
|
||||
$this->setStep(W_CONFIGURE_MAIL);
|
||||
}
|
||||
|
||||
// Check current page.
|
||||
$sec2 = get_parameter('sec2', '');
|
||||
|
||||
// Search also does not fulfill sec2.
|
||||
if (empty($sec2) === true) {
|
||||
$sec2 = get_parameter('keywords', '');
|
||||
}
|
||||
|
||||
if ($must_run === false
|
||||
|| ((int) $config['welcome_state']) === WELCOME_FINISHED
|
||||
) {
|
||||
// Do not show if finished.
|
||||
return false;
|
||||
}
|
||||
|
||||
$this->step = $this->getStep();
|
||||
$this->agent = $this->getWelcomeAgent();
|
||||
|
||||
/*
|
||||
* Configure mail. Control current flow.
|
||||
*
|
||||
* On empty sec2: show current step.
|
||||
* On setup page: do not show.
|
||||
* After mail configuration: enable agent step.
|
||||
*/
|
||||
|
||||
if ($this->step === W_CONFIGURE_MAIL) {
|
||||
if ($sec2 === 'godmode/setup/setup'
|
||||
&& get_parameter('section', '') == 'general'
|
||||
&& get_parameter('update_config', false) !== false
|
||||
) {
|
||||
// Mail configuration have been processed.
|
||||
$this->step = W_CONFIGURE_MAIL;
|
||||
$this->completeStep();
|
||||
$this->setStep(W_CREATE_AGENT);
|
||||
} else if ($sec2 === 'godmode/setup/setup'
|
||||
&& get_parameter('section', '') === 'general'
|
||||
) {
|
||||
// Mail configuration is being processed.
|
||||
return false;
|
||||
} else if (empty($sec2) === true) {
|
||||
// Show main page.
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Create agent. Control current flow.
|
||||
*
|
||||
* Welcome wizard is shown if you create your first agent.
|
||||
*
|
||||
*/
|
||||
|
||||
if (empty($config['welcome_id_agent']) === true) {
|
||||
// Create agent is pending.
|
||||
if ($sec2 === 'godmode/agentes/configurar_agente'
|
||||
&& get_parameter('create_agent', false) !== false
|
||||
) {
|
||||
// Agent have been created. Store.
|
||||
// Here complete step is not needed because is already done
|
||||
// by setWelcomeAgent.
|
||||
$this->setWelcomeAgent(
|
||||
// Non yet processed. Get next available ID.
|
||||
db_get_value_sql(
|
||||
sprintf(
|
||||
'SELECT AUTO_INCREMENT
|
||||
FROM information_schema.TABLES
|
||||
WHERE TABLE_SCHEMA = "%s"
|
||||
AND TABLE_NAME = "%s"',
|
||||
$config['dbname'],
|
||||
'tagente'
|
||||
)
|
||||
)
|
||||
);
|
||||
$this->setStep(W_CREATE_MODULE);
|
||||
return true;
|
||||
} else if ($sec2 === 'godmode/agentes/configurar_agente') {
|
||||
// Agent is being created.
|
||||
return false;
|
||||
} else if (empty($sec2) === true) {
|
||||
// If at main page, show welcome.
|
||||
return true;
|
||||
}
|
||||
} else if ($this->step === W_CREATE_AGENT) {
|
||||
$this->step = W_CREATE_MODULE;
|
||||
}
|
||||
|
||||
/*
|
||||
* Create module. Control current flow.
|
||||
*
|
||||
* On empty sec2: show current step.
|
||||
* On module creation page: do not show.
|
||||
* After module creation: enable alert step.
|
||||
*/
|
||||
|
||||
if ($this->step === W_CREATE_MODULE) {
|
||||
// Create module is pending.
|
||||
if ($sec2 === 'godmode/agentes/configurar_agente'
|
||||
&& get_parameter('tab', '') === 'module'
|
||||
&& get_parameter('create_module', false) !== false
|
||||
) {
|
||||
// Module have been created.
|
||||
$this->completeStep();
|
||||
$this->setStep(W_CREATE_ALERT);
|
||||
return true;
|
||||
} else if ($sec2 === 'godmode/agentes/configurar_agente'
|
||||
&& get_parameter('tab', '') === 'module'
|
||||
) {
|
||||
// Module is being created.
|
||||
return false;
|
||||
} else if (empty($sec2) === true) {
|
||||
// If at main page, show welcome.
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Create alert. Control current flow.
|
||||
*
|
||||
* On empty sec2: show current step.
|
||||
* On alert creation page: do not show.
|
||||
* After alert creation: enable discovery task step.
|
||||
*/
|
||||
|
||||
if ($this->step === W_CREATE_ALERT) {
|
||||
// Create alert is pending.
|
||||
if ($sec2 === 'godmode/agentes/configurar_agente'
|
||||
&& get_parameter('tab', '') === 'alert'
|
||||
&& get_parameter('create_alert', false) !== false
|
||||
) {
|
||||
// Alert have been created.
|
||||
$this->completeStep();
|
||||
$this->setStep(W_CREATE_TASK);
|
||||
return true;
|
||||
} else if ($sec2 === 'godmode/agentes/configurar_agente'
|
||||
&& get_parameter('tab', '') === 'alert'
|
||||
) {
|
||||
// Alert is being created.
|
||||
return false;
|
||||
} else if (empty($sec2) === true) {
|
||||
// If at main page, show welcome.
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Create discovery task. Control current flow.
|
||||
*
|
||||
* On empty sec2: show current step.
|
||||
* On discovery task creation page: do not show.
|
||||
* After discovery task creation: finish.
|
||||
*/
|
||||
|
||||
// Create Discovery task is pending.
|
||||
// Host&Devices finishses on page 2.
|
||||
if ($sec2 === 'godmode/servers/discovery'
|
||||
&& get_parameter('page', 0) == 2
|
||||
) {
|
||||
// Discovery task have been created.
|
||||
$this->step = W_CREATE_TASK;
|
||||
$this->completeStep();
|
||||
|
||||
// Check if all other tasks had been completed.
|
||||
if ($this->checkAllTasks() === true) {
|
||||
// Finished! do not show.
|
||||
$this->setStep(WELCOME_FINISHED);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
} else if ($sec2 == 'godmode/servers/discovery') {
|
||||
// Discovery task is being created.
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check if all other tasks had been completed.
|
||||
if ($this->checkAllTasks() === true) {
|
||||
// Finished! do not show.
|
||||
$this->setStep(WELCOME_FINISHED);
|
||||
return false;
|
||||
} else if (empty($sec2) === true) {
|
||||
// Pending tasks.
|
||||
return true;
|
||||
}
|
||||
|
||||
if ($this->step === WELCOME_FINISHED) {
|
||||
// Welcome tutorial finished.
|
||||
return false;
|
||||
}
|
||||
|
||||
// Return a reference to the new object.
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Load JS content.
|
||||
* function that enables the functions to the buttons when its action is
|
||||
* completed.
|
||||
* Assign the url of each button.
|
||||
*
|
||||
* @return string HTML code for javascript functionality.
|
||||
*/
|
||||
public function loadJS()
|
||||
{
|
||||
ob_start();
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
<?php
|
||||
if ($this->step > W_CREATE_AGENT) {
|
||||
switch ($this->step) {
|
||||
case W_CREATE_MODULE:
|
||||
?>
|
||||
document.getElementById("button-btn_create_module").setAttribute(
|
||||
'onclick',
|
||||
'checkAgentOnline()'
|
||||
);
|
||||
<?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(
|
||||
'onclick',
|
||||
'configureEmail()'
|
||||
);
|
||||
document.getElementById("button-btn_create_agent").setAttribute(
|
||||
'onclick',
|
||||
'createNewAgent()'
|
||||
);
|
||||
document.getElementById("button-btn_discover_devices").setAttribute(
|
||||
'onclick',
|
||||
'discoverDevicesNetwork()'
|
||||
);
|
||||
|
||||
function configureEmail() {
|
||||
window.location = '<?php echo ui_get_full_url('index.php?sec=general&sec2=godmode/setup/setup§ion=general#table3'); ?>';
|
||||
}
|
||||
|
||||
function createNewAgent() {
|
||||
window.location = '<?php echo ui_get_full_url('index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&new_agent=1&crt-2=Create+agent'); ?>';
|
||||
}
|
||||
|
||||
function checkAgentOnline() {
|
||||
window.location = '<?php echo ui_get_full_url('index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=module&id_agente='.$this->getWelcomeAgent().''); ?>';
|
||||
}
|
||||
|
||||
function createAlertModule() {
|
||||
window.location = '<?php echo ui_get_full_url('index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=alert&id_agente='.$this->getWelcomeAgent().''); ?>';
|
||||
}
|
||||
|
||||
function monitorRemoteCommands() {
|
||||
window.location = '<?php echo ui_get_full_url(''); ?>';
|
||||
}
|
||||
|
||||
function discoverDevicesNetwork() {
|
||||
window.location = '<?php echo ui_get_full_url('index.php?sec=gservers&sec2=godmode/servers/discovery&wiz=hd&mode=netscan'); ?>';
|
||||
}
|
||||
|
||||
function reportIsNotWorking() {
|
||||
}
|
||||
|
||||
function cierre_dialog(){
|
||||
this.dialog("close");
|
||||
}
|
||||
</script>
|
||||
<?php
|
||||
return ob_get_clean();
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -648,3 +648,12 @@ define('HA_PENDING', 2);
|
|||
define('HA_PROCESSING', 3);
|
||||
define('HA_DISABLED', 4);
|
||||
define('HA_FAILED', 5);
|
||||
|
||||
|
||||
define('WELCOME_STARTED', 1);
|
||||
define('W_CONFIGURE_MAIL', 1);
|
||||
define('W_CREATE_AGENT', 2);
|
||||
define('W_CREATE_MODULE', 3);
|
||||
define('W_CREATE_ALERT', 4);
|
||||
define('W_CREATE_TASK', 5);
|
||||
define('WELCOME_FINISHED', -1);
|
||||
|
|
|
@ -1899,6 +1899,10 @@ function config_process_config()
|
|||
config_update_value('unique_ip', 0);
|
||||
}
|
||||
|
||||
if (!isset($config['welcome_state'])) {
|
||||
config_update_value('welcome_state', WELCOME_STARTED);
|
||||
}
|
||||
|
||||
/*
|
||||
* Parse the ACL IP list for access API
|
||||
*/
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -1900,50 +1900,72 @@ function load_modal(settings) {
|
|||
buttons: []
|
||||
})
|
||||
.show();
|
||||
var required_buttons = [];
|
||||
if (settings.modal.cancel != undefined) {
|
||||
//The variable contains a function
|
||||
// that is responsible for executing the method it receives from settings
|
||||
// which confirms the closure of a modal
|
||||
var cancelModal = function() {
|
||||
settings.target.dialog("close");
|
||||
if (AJAX_RUNNING) return;
|
||||
AJAX_RUNNING = 1;
|
||||
var formdata = new FormData();
|
||||
|
||||
formdata.append("page", settings.oncancel.page);
|
||||
formdata.append("method", settings.oncancel.method);
|
||||
|
||||
$.ajax({
|
||||
method: "post",
|
||||
url: settings.url,
|
||||
processData: false,
|
||||
contentType: false,
|
||||
data: data,
|
||||
data: formdata,
|
||||
success: function(data) {
|
||||
settings.target.html(data);
|
||||
if (settings.onload != undefined) {
|
||||
settings.onload(data);
|
||||
if (typeof settings.oncancel.callback == "function") {
|
||||
settings.oncancel.callback(data);
|
||||
settings.target.dialog("close");
|
||||
}
|
||||
settings.target.dialog({
|
||||
resizable: true,
|
||||
draggable: true,
|
||||
modal: true,
|
||||
title: settings.modal.title,
|
||||
width: width,
|
||||
overlay: {
|
||||
opacity: 0.5,
|
||||
background: "black"
|
||||
AJAX_RUNNING = 0;
|
||||
},
|
||||
buttons: [
|
||||
{
|
||||
error: function(data) {
|
||||
// console.log(data);
|
||||
AJAX_RUNNING = 0;
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
required_buttons.push({
|
||||
class:
|
||||
"ui-widget ui-state-default ui-corner-all ui-button-text-only sub upd submit-cancel",
|
||||
text: settings.modal.cancel,
|
||||
click: function() {
|
||||
if (settings.oncancel != undefined) {
|
||||
if (typeof settings.oncancel.confirm == "function") {
|
||||
//receive function
|
||||
settings.oncancel.confirm(cancelModal);
|
||||
} else if (settings.oncancel != undefined) {
|
||||
cancelModal();
|
||||
}
|
||||
} else {
|
||||
$(this).dialog("close");
|
||||
if (typeof settings.cleanup == "function") {
|
||||
settings.cleanup();
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
});
|
||||
}
|
||||
|
||||
if (settings.modal.ok != undefined) {
|
||||
required_buttons.push({
|
||||
class:
|
||||
"ui-widget ui-state-default ui-corner-all ui-button-text-only sub ok submit-next",
|
||||
text: settings.modal.ok,
|
||||
click: function() {
|
||||
if (AJAX_RUNNING) return;
|
||||
AJAX_RUNNING = 1;
|
||||
|
||||
if (settings.onsubmit != undefined) {
|
||||
if (settings.onsubmit.preaction != undefined) {
|
||||
settings.onsubmit.preaction();
|
||||
}
|
||||
AJAX_RUNNING = 1;
|
||||
if (settings.onsubmit.dataType == undefined) {
|
||||
settings.onsubmit.dataType = "html";
|
||||
}
|
||||
|
@ -2030,18 +2052,96 @@ function load_modal(settings) {
|
|||
} else {
|
||||
AJAX_RUNNING = 0;
|
||||
}
|
||||
} else {
|
||||
// No onsumbit configured. Directly close.
|
||||
$(this).dialog("close");
|
||||
}
|
||||
},
|
||||
error: function(data) {
|
||||
// console.log(data);
|
||||
AJAX_RUNNING = 0;
|
||||
}
|
||||
],
|
||||
});
|
||||
}
|
||||
|
||||
$.ajax({
|
||||
method: "post",
|
||||
url: settings.url,
|
||||
processData: false,
|
||||
contentType: false,
|
||||
data: data,
|
||||
success: function(data) {
|
||||
settings.target.html(data);
|
||||
if (settings.onload != undefined) {
|
||||
settings.onload(data);
|
||||
}
|
||||
settings.target.dialog({
|
||||
resizable: true,
|
||||
draggable: true,
|
||||
modal: true,
|
||||
title: settings.modal.title,
|
||||
width: width,
|
||||
overlay: {
|
||||
opacity: 0.5,
|
||||
background: "black"
|
||||
},
|
||||
buttons: required_buttons,
|
||||
closeOnEscape: false,
|
||||
open: function() {
|
||||
$(".ui-dialog-titlebar-close").hide();
|
||||
}
|
||||
});
|
||||
},
|
||||
error: function(data) {
|
||||
// console.log(data);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//Function that shows a dialog box to confirm closures of generic manners. The modal id is random
|
||||
function confirmDialog(settings) {
|
||||
var randomStr =
|
||||
Math.random()
|
||||
.toString(36)
|
||||
.substring(2, 15) +
|
||||
Math.random()
|
||||
.toString(36)
|
||||
.substring(2, 15);
|
||||
|
||||
$("body").append(
|
||||
'<div id="confirm_' + randomStr + '">' + settings.message + "</div>"
|
||||
);
|
||||
$("#confirm_" + randomStr);
|
||||
$("#confirm_" + randomStr)
|
||||
.dialog({
|
||||
title: settings.title,
|
||||
close: false,
|
||||
width: 350,
|
||||
modal: true,
|
||||
buttons: [
|
||||
{
|
||||
text: "Cancel",
|
||||
class:
|
||||
"ui-widget ui-state-default ui-corner-all ui-button-text-only sub upd submit-cancel",
|
||||
click: function() {
|
||||
$(this).dialog("close");
|
||||
if (typeof settings.onDeny == "function") settings.onDeny();
|
||||
}
|
||||
},
|
||||
{
|
||||
text: "Ok",
|
||||
class:
|
||||
"ui-widget ui-state-default ui-corner-all ui-button-text-only sub ok submit-next",
|
||||
click: function() {
|
||||
$(this).dialog("close");
|
||||
if (typeof settings.onAccept == "function") settings.onAccept();
|
||||
}
|
||||
}
|
||||
]
|
||||
})
|
||||
.show();
|
||||
}
|
||||
|
||||
/**
|
||||
* Function to show modal with message Validation.
|
||||
*
|
||||
|
|
|
@ -541,13 +541,13 @@ function configure_modules_form() {
|
|||
}
|
||||
|
||||
if (data["type"] >= 15 && data["type"] <= 18) {
|
||||
$("#snmp_version").val(data["tcp_send"]);
|
||||
$("#text-snmp3_auth_user").val(data["plugin_user"]);
|
||||
$("#password-snmp3_auth_pass").val(data["plugin_pass"]);
|
||||
$("#snmp3_auth_method").val(data["plugin_parameter"]);
|
||||
$("#snmp3_privacy_method").val(data["custom_string_1"]);
|
||||
$("#password-snmp3_privacy_pass").val(data["custom_string_2"]);
|
||||
$("#snmp3_security_level").val(data["custom_string_3"]);
|
||||
$("#snmp_version").val(data["snmp_version"]);
|
||||
$("#text-snmp3_auth_user").val(data["snmp3_auth_user"]);
|
||||
$("#password-snmp3_auth_pass").val(data["snmp3_auth_pass"]);
|
||||
$("#snmp3_auth_method").val(data["snmp3_auth_method"]);
|
||||
$("#snmp3_privacy_method").val(data["snmp3_privacy_method"]);
|
||||
$("#password-snmp3_privacy_pass").val(data["snmp3_privacy_pass"]);
|
||||
$("#snmp3_security_level").val(data["snmp3_security_level"]);
|
||||
|
||||
if (data["tcp_send"] == "3") {
|
||||
$("#simple-field_snmpv3_row1").attr("style", "");
|
||||
|
@ -564,6 +564,14 @@ function configure_modules_form() {
|
|||
if (data["id_plugin"] != undefined) {
|
||||
$("#id_plugin").trigger("change");
|
||||
}
|
||||
|
||||
if (data["type"] >= 34 && data["type"] <= 37) {
|
||||
$("#command_text").val(data["command_text"]);
|
||||
$("#command_credential_identifier").val(
|
||||
data["command_credential_identifier"]
|
||||
);
|
||||
$("#command_os").val(data["command_os"]);
|
||||
}
|
||||
},
|
||||
"json"
|
||||
);
|
||||
|
|
|
@ -0,0 +1,92 @@
|
|||
.modal {
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.welcome_modal_window {
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
#welcome_modal_window * {
|
||||
font-size: 10pt;
|
||||
}
|
||||
|
||||
#welcome_form ul.wizard > li {
|
||||
padding: 1em;
|
||||
padding-bottom: 0.6em;
|
||||
padding-top: 0.6em;
|
||||
padding-left: 0.7em;
|
||||
}
|
||||
|
||||
#welcome_form label {
|
||||
font-family: "lato-lighter", "Open Sans", sans-serif;
|
||||
font-weight: normal;
|
||||
}
|
||||
.content_position {
|
||||
display: flex;
|
||||
margin-top: 5px;
|
||||
font-family: "lato-lighter", "Open Sans", sans-serif;
|
||||
font-weight: normal;
|
||||
}
|
||||
|
||||
.learn_content_indented {
|
||||
text-indent: 1.5em;
|
||||
font-family: "lato-lighter", "Open Sans", sans-serif;
|
||||
font-weight: normal;
|
||||
}
|
||||
|
||||
#lbl_learn {
|
||||
font-family: "lato-lighter", "Open Sans", sans-serif;
|
||||
font-weight: normal;
|
||||
}
|
||||
|
||||
.go {
|
||||
background-repeat: no-repeat;
|
||||
background-size: cover;
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
border: none;
|
||||
}
|
||||
|
||||
.pending {
|
||||
background-image: url(../../images/darrowright.png);
|
||||
background-image: url(../../images/arrow-icon.png);
|
||||
}
|
||||
|
||||
.completed {
|
||||
background-image: url(../../images/input_tick_badge.png);
|
||||
}
|
||||
|
||||
.centered_full {
|
||||
padding: 1em;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
#welcome_form li.centered_full > label {
|
||||
width: auto;
|
||||
}
|
||||
|
||||
#welcome_form ul.wizard li.white_box {
|
||||
padding: 0;
|
||||
margin-bottom: 2em;
|
||||
}
|
||||
|
||||
#welcome_form ul.wizard li.centered_full {
|
||||
padding-top: 1em;
|
||||
padding-bottom: 1em;
|
||||
}
|
||||
|
||||
#welcome_form li:not(.centered_full):not(.white_box) {
|
||||
border-left: 4px solid #79a930;
|
||||
}
|
||||
|
||||
#welcome_form li:not(.centered_full):not(.white_box).row_grey {
|
||||
border-left: 4px solid #d6d6d6;
|
||||
}
|
||||
|
||||
#welcome_form li.hole {
|
||||
margin-bottom: 0.8em;
|
||||
}
|
||||
|
||||
#welcome_form li.extra {
|
||||
padding-bottom: 2.5em;
|
||||
}
|
|
@ -10,7 +10,8 @@ button.submit-cancel {
|
|||
cursor: pointer;
|
||||
text-align: center;
|
||||
height: 30px;
|
||||
width: 90px;
|
||||
width: auto;
|
||||
min-width: 90px;
|
||||
}
|
||||
|
||||
input[type="submit"].submit-cancel:hover,
|
||||
|
@ -32,6 +33,8 @@ input[type="button"].submit-next {
|
|||
cursor: pointer;
|
||||
text-align: center;
|
||||
height: 30px;
|
||||
width: auto;
|
||||
min-width: 90px;
|
||||
}
|
||||
|
||||
input[type="submit"].submit-next:hover,
|
||||
|
|
|
@ -1718,10 +1718,9 @@ if (!empty($result)) {
|
|||
}
|
||||
}
|
||||
|
||||
// End Build List Result
|
||||
//
|
||||
// End Build List Result.
|
||||
echo "<div id='monitor_details_window'></div>";
|
||||
// strict user hidden
|
||||
// Strict user hidden.
|
||||
echo '<div id="strict_hidden" style="display:none;">';
|
||||
html_print_input_text('strict_user_hidden', $strict_user);
|
||||
echo '</div>';
|
||||
|
|
|
@ -275,6 +275,7 @@ sub pandora_load_config {
|
|||
$pa_config->{"alert_recovery"} = 0; # Introduced on 1.3.1
|
||||
$pa_config->{"snmp_checks"} = 1; # Introduced on 1.3.1
|
||||
$pa_config->{"snmp_timeout"} = 8; # Introduced on 1.3.1
|
||||
$pa_config->{"rcmd_timeout"} = 30; # Introduced on 7.0.740
|
||||
$pa_config->{"snmp_trapd"} = '/usr/sbin/snmptrapd'; # 3.0
|
||||
$pa_config->{"tcp_checks"} = 1; # Introduced on 1.3.1
|
||||
$pa_config->{"tcp_timeout"} = 20; # Introduced on 1.3.1
|
||||
|
@ -788,6 +789,9 @@ sub pandora_load_config {
|
|||
elsif ($parametro =~ m/^snmp_timeout\s+([0-9]*)/i) {
|
||||
$pa_config->{"snmp_timeout"} = clean_blank($1);
|
||||
}
|
||||
elsif ($parametro =~ m/^rcmd_timeout\s+([0-9]*)/i) {
|
||||
$pa_config->{"rcmd_timeout"} = clean_blank($1);
|
||||
}
|
||||
elsif ($parametro =~ m/^tcp_checks\s+([0-9]*)/i) {
|
||||
$pa_config->{"tcp_checks"} = clean_blank($1);
|
||||
}
|
||||
|
|
|
@ -205,6 +205,7 @@ our @EXPORT = qw(
|
|||
pandora_get_module_phone_tags
|
||||
pandora_get_module_email_tags
|
||||
pandora_get_os
|
||||
pandora_get_os_by_id
|
||||
pandora_input_password
|
||||
pandora_is_master
|
||||
pandora_mark_agent_for_alert_update
|
||||
|
@ -5812,6 +5813,66 @@ sub pandora_get_os ($$) {
|
|||
return 10;
|
||||
}
|
||||
|
||||
########################################################################
|
||||
# SUB pandora_get_os_by_id (integer)
|
||||
# Returns a chain with the name associated to target id_os.
|
||||
########################################################################
|
||||
sub pandora_get_os_by_id ($$) {
|
||||
my ($dbh, $os_id) = @_;
|
||||
|
||||
if (! defined($os_id) || !is_numeric($os_id)) {
|
||||
# Other OS
|
||||
return 'Other';
|
||||
}
|
||||
|
||||
if ($os_id eq 9) {
|
||||
return 'Windows';
|
||||
}
|
||||
if ($os_id eq 7 ) {
|
||||
return 'Cisco';
|
||||
}
|
||||
if ($os_id eq 2 ) {
|
||||
return 'Solaris';
|
||||
}
|
||||
if ($os_id eq 3 ) {
|
||||
return 'AIX';
|
||||
}
|
||||
if ($os_id eq 5) {
|
||||
return 'HP-UX';
|
||||
}
|
||||
if ($os_id eq 8 ) {
|
||||
return 'Apple';
|
||||
}
|
||||
if ($os_id eq 1 ) {
|
||||
return 'Linux';
|
||||
}
|
||||
if ($os_id eq 1) {
|
||||
return 'Enterasys';
|
||||
}
|
||||
if ($os_id eq 3) {
|
||||
return 'Octopods';
|
||||
}
|
||||
if ($os_id eq 4) {
|
||||
return 'embedded';
|
||||
}
|
||||
if ($os_id eq 5) {
|
||||
return 'android';
|
||||
}
|
||||
if ($os_id eq 4 ) {
|
||||
return 'BSD';
|
||||
}
|
||||
|
||||
# Search for a custom OS
|
||||
my $os_name = get_db_value ($dbh, 'SELECT name FROM tconfig_os WHERE id_os = ?', $os_id);
|
||||
if (defined ($os_name)) {
|
||||
return $os_name;
|
||||
}
|
||||
|
||||
# Other OS
|
||||
return 'Other';
|
||||
}
|
||||
|
||||
|
||||
########################################################################
|
||||
# Load module macros (a base 64 encoded JSON document) into the macro
|
||||
# hash.
|
||||
|
|
|
@ -102,8 +102,8 @@ sub data_producer ($) {
|
|||
WHERE server_name = ?
|
||||
AND tagente_modulo.id_agente = tagente.id_agente
|
||||
AND tagente.disabled = 0
|
||||
AND tagente_modulo.id_tipo_modulo > 5
|
||||
AND tagente_modulo.id_tipo_modulo < 19 '
|
||||
AND ((tagente_modulo.id_tipo_modulo > 5 AND tagente_modulo.id_tipo_modulo < 19 )
|
||||
OR (tagente_modulo.id_tipo_modulo > 33 AND tagente_modulo.id_tipo_modulo < 38 )) '
|
||||
. (defined ($network_filter) ? $network_filter : ' ') .
|
||||
'AND tagente_modulo.disabled = 0
|
||||
AND tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo
|
||||
|
@ -116,8 +116,8 @@ sub data_producer ($) {
|
|||
AND tagente_modulo.id_agente = tagente.id_agente
|
||||
AND tagente.disabled = 0
|
||||
AND tagente_modulo.disabled = 0
|
||||
AND tagente_modulo.id_tipo_modulo > 5
|
||||
AND tagente_modulo.id_tipo_modulo < 19 '
|
||||
AND ((tagente_modulo.id_tipo_modulo > 5 AND tagente_modulo.id_tipo_modulo < 19 )
|
||||
OR (tagente_modulo.id_tipo_modulo > 33 AND tagente_modulo.id_tipo_modulo < 38 )) '
|
||||
. (defined ($network_filter) ? $network_filter : ' ') .
|
||||
'AND tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo
|
||||
AND (tagente_modulo.flag = 1 OR ((tagente_estado.last_execution_try + tagente_estado.current_interval) < UNIX_TIMESTAMP()))
|
||||
|
@ -468,6 +468,13 @@ sub exec_network_module ($$$$) {
|
|||
my $tcp_rcv = $module->{'tcp_rcv'};
|
||||
my $timeout = $module->{'max_timeout'};
|
||||
my $retries = $module->{'max_retries'};
|
||||
my $target_os = pandora_get_os($dbh, $module->{'custom_string_2'});
|
||||
|
||||
if ($module->{'custom_string_2'} eq "inherited" ) {
|
||||
$target_os = $agent_row->{'id_os'};
|
||||
} elsif (!defined($target_os) || "$target_os" eq '0') {
|
||||
$target_os = $agent_row->{'id_os'};
|
||||
}
|
||||
|
||||
# Use the agent address by default
|
||||
if (! defined($ip_target) || $ip_target eq '' || $ip_target eq 'auto') {
|
||||
|
@ -545,6 +552,22 @@ sub exec_network_module ($$$$) {
|
|||
$module_result = 1;
|
||||
}
|
||||
}
|
||||
|
||||
# -------------------------------------------------------
|
||||
# CMD Module
|
||||
# -------------------------------------------------------
|
||||
elsif (($id_tipo_modulo == 34)
|
||||
|| ($id_tipo_modulo == 35)
|
||||
|| ($id_tipo_modulo == 36)
|
||||
|| ($id_tipo_modulo == 37)) { # CMD Module
|
||||
$module_data = enterprise_hook('remote_execution_module',[$pa_config, $dbh, $module, $target_os, $ip_target]);
|
||||
if (!defined($module_data) || "$module_data" eq "") {
|
||||
$module_result = 1;
|
||||
} else {
|
||||
# Success.
|
||||
$module_result = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# Write data section
|
||||
|
|
|
@ -657,7 +657,7 @@ sub logger ($$;$) {
|
|||
if (defined $parent_caller) {
|
||||
$parent_caller = (split '/', $parent_caller)[-1];
|
||||
$parent_caller =~ s/\.[^.]+$//;
|
||||
$parent_caller = " ** " . $parent_caller . " **: ";
|
||||
$parent_caller = " " . $parent_caller . ": ";
|
||||
} else {
|
||||
$parent_caller = " ";
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue