Added details to agent wizard and secundary servers
This commit is contained in:
parent
a99b75da4c
commit
a80f62003c
|
@ -716,7 +716,7 @@ $servers_to_exec[0] = __('Local console');
|
|||
if (enterprise_installed()) {
|
||||
enterprise_include_once ('include/functions_satellite.php');
|
||||
|
||||
$rows = get_proxy_servers();
|
||||
$rows = get_proxy_servers(true);
|
||||
foreach ($rows as $row) {
|
||||
$servers_to_exec[$row['id_server']] = $row['name'];
|
||||
}
|
||||
|
|
|
@ -254,6 +254,30 @@ if ($create_modules) {
|
|||
$values['unit'] = "Bytes";
|
||||
}
|
||||
|
||||
if ($server_to_exec != 0) {
|
||||
$sql = sprintf("SELECT server_type FROM tserver WHERE id_server = %d", $server_to_exec);
|
||||
$row = db_get_row_sql ($sql);
|
||||
|
||||
if ($row['server_type'] = 13) {
|
||||
if (preg_match ("/Status/", $name_array[1])) {
|
||||
$module_type = 2;
|
||||
}
|
||||
elseif (preg_match ("/Present/", $name_array[1])) {
|
||||
$module_type = 2;
|
||||
}
|
||||
elseif (preg_match("/PromiscuousMode/", $name_array[1])) {
|
||||
$module_type = 2;
|
||||
}
|
||||
// Specific counters (ends in s)
|
||||
elseif (preg_match("/s$/", $name_array[1])) {
|
||||
$module_type = 4;
|
||||
}
|
||||
else {
|
||||
$module_type = 4;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$values['id_tipo_modulo'] = $module_type;
|
||||
|
||||
if (!empty($ifPhysAddress) && isset($interfaces_ip[$id])) {
|
||||
|
@ -281,6 +305,26 @@ if ($create_modules) {
|
|||
$errors[$result]++;
|
||||
}
|
||||
else {
|
||||
if ($server_to_exec != 0) {
|
||||
$sql = sprintf("SELECT server_type FROM tserver WHERE id_server = %d", $server_to_exec);
|
||||
$row = db_get_row_sql ($sql);
|
||||
|
||||
if ($row['server_type'] = 13) {
|
||||
$module_type_name = db_get_value_filter("nombre", "ttipo_modulo", array("id_tipo" => $values['id_tipo_modulo']));
|
||||
|
||||
$new_module_configuration_data = "
|
||||
module_begin
|
||||
module_name " . io_safe_input($name) . "
|
||||
module_description " . $values['descripcion'] . "
|
||||
module_type " . $module_type_name . "
|
||||
module_snmp
|
||||
module_oid " . $values['snmp_oid'] . "
|
||||
module_community " . $values['snmp_community'] . "
|
||||
module_end";
|
||||
|
||||
config_agents_add_module_in_conf($id_agent, $new_module_configuration_data);
|
||||
}
|
||||
}
|
||||
$done++;
|
||||
}
|
||||
}
|
||||
|
@ -445,6 +489,7 @@ if (!empty($interfaces_list)) {
|
|||
html_print_input_hidden('snmp3_privacy_method', $snmp3_privacy_method);
|
||||
html_print_input_hidden('snmp3_privacy_pass', $snmp3_privacy_pass);
|
||||
html_print_input_hidden('snmp3_security_level', $snmp3_security_level);
|
||||
html_print_input_hidden('server_to_exec', $server_to_exec);
|
||||
|
||||
$table->width = '100%';
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@ $ip_target = (string) get_parameter ('ip_target', $ipAgent); // Host
|
|||
$plugin_user = (string) get_parameter ('plugin_user', 'Administrator'); // Username
|
||||
$plugin_pass = io_safe_output(get_parameter('plugin_pass', '')); // Password
|
||||
$tcp_send = (string) get_parameter ('tcp_send'); // Namespace
|
||||
$server_to_exec = get_parameter('server_to_exec', true);
|
||||
$server_to_exec = get_parameter('server_to_exec', 0);
|
||||
|
||||
//See if id_agente is set (either POST or GET, otherwise -1
|
||||
$id_agent = $idAgent;
|
||||
|
@ -202,16 +202,16 @@ if ($create_modules) {
|
|||
$services_values['snmp_community'] = 'Running'; // Key string
|
||||
$services_values['tcp_port'] = 1; // Field number (Running/Stopped)
|
||||
$services_values['id_tipo_modulo'] = 2; // Generic boolean
|
||||
|
||||
$services_result = wmi_create_wizard_modules($id_agent, $services, 'services', $services_values);
|
||||
|
||||
|
||||
$services_result = wmi_create_wizard_modules($id_agent, $services, 'services', $services_values, 0, 0, $server_to_exec);
|
||||
|
||||
// Create Process modules
|
||||
$processes_values = $values;
|
||||
|
||||
$processes_values['tcp_port'] = 0; // Field number (OID)
|
||||
$processes_values['id_tipo_modulo'] = 2; // Generic boolean
|
||||
|
||||
$processes_result = wmi_create_wizard_modules($id_agent, $processes, 'processes', $processes_values);
|
||||
$processes_result = wmi_create_wizard_modules($id_agent, $processes, 'processes', $processes_values, 0, 0, $server_to_exec);
|
||||
|
||||
// Create Space on disk modules
|
||||
$disks_values = $values;
|
||||
|
@ -220,14 +220,14 @@ if ($create_modules) {
|
|||
$disks_values['id_tipo_modulo'] = 1; // Generic numeric
|
||||
$disks_values['unit'] = 'Bytes'; // Unit
|
||||
|
||||
$disks_result = wmi_create_wizard_modules($id_agent, $disks, 'disks', $disks_values);
|
||||
$disks_result = wmi_create_wizard_modules($id_agent, $disks, 'disks', $disks_values, 0, 0, $server_to_exec);
|
||||
|
||||
// Create modules from component
|
||||
$components_values = $values;
|
||||
|
||||
$components_values['id_agente'] = $id_agent;
|
||||
|
||||
$components_result = wmi_create_module_from_components($components, $components_values);
|
||||
$components_result = wmi_create_module_from_components($components, $components_values, 0, 0, $server_to_exec);
|
||||
|
||||
|
||||
// Errors/Success messages
|
||||
|
@ -339,6 +339,7 @@ if ($wmiexplore && !$fail) {
|
|||
html_print_input_hidden('plugin_user', $plugin_user); // User
|
||||
html_print_input_hidden('plugin_pass', $plugin_pass); // Password
|
||||
html_print_input_hidden('tcp_send', $tcp_send); // Namespace
|
||||
html_print_input_hidden('server_to_exec', $server_to_exec);
|
||||
|
||||
$table->width = '98%';
|
||||
|
||||
|
|
|
@ -58,7 +58,7 @@ if (isset($_GET["server"])) {
|
|||
|
||||
if (enterprise_installed()) {
|
||||
$table->data[] = array (__('Type'), $server_type);
|
||||
if ($row["server_type"] == 13) {
|
||||
if ($row["server_type"] == 13 || $row["server_type"] == 1) {
|
||||
$table->data[] = array (__('Exec Server'), html_print_checkbox ("exec_proxy", 1, $row["exec_proxy"], true));
|
||||
if ($row["exec_proxy"]) {
|
||||
$table->data[] = array (__('Check Exec Server'), '<a id="check_exec_server">' . html_print_image ("images/dot_red.disabled.png", true) . '</a>' . '<div id="check_error_message"></div>');
|
||||
|
|
|
@ -50,7 +50,7 @@ function wmi_compose_query($wmi_client, $user, $password, $host, $namespace = ''
|
|||
}
|
||||
|
||||
|
||||
function wmi_create_wizard_modules($id_agent, $names, $wizard_mode, $values, $id_police=0, $module_id=0) {
|
||||
function wmi_create_wizard_modules($id_agent, $names, $wizard_mode, $values, $id_police=0, $module_id=0, $server_to_exec = 0) {
|
||||
$results = array(ERR_GENERIC => array(), NOERR => array());
|
||||
|
||||
if (empty($names)) {
|
||||
|
@ -84,6 +84,32 @@ function wmi_create_wizard_modules($id_agent, $names, $wizard_mode, $values, $id
|
|||
$results[ERR_GENERIC][] = $name;
|
||||
}
|
||||
else {
|
||||
if ($id_police == 0) {
|
||||
if ($server_to_exec != 0) {
|
||||
$sql = sprintf("SELECT server_type FROM tserver WHERE id_server = %d", $server_to_exec);
|
||||
$row = db_get_row_sql ($sql);
|
||||
|
||||
if ($row['server_type'] = 13) {
|
||||
$new_module_configuration_data = "
|
||||
module_begin
|
||||
module_name " . $name . "
|
||||
module_description
|
||||
module_type generic_proc
|
||||
module_snmp
|
||||
module_oid " . $values['snmp_oid'] . "
|
||||
module_community " . $values['snmp_community'] . "
|
||||
ip_target " . $nc['ip_target'] ."
|
||||
tcp_send " . $nc['tcp_send'] ."
|
||||
plugin_user " . $nc['plugin_user'] ."
|
||||
plugin_pass " . $nc['plugin_pass'] ."
|
||||
tcp_port " . $nc['tcp_port'] . "
|
||||
module_end";
|
||||
|
||||
config_agents_add_module_in_conf($id_agent, $new_module_configuration_data);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$results[NOERR][] = $name;
|
||||
}
|
||||
}
|
||||
|
@ -91,7 +117,7 @@ function wmi_create_wizard_modules($id_agent, $names, $wizard_mode, $values, $id
|
|||
return $results;
|
||||
}
|
||||
|
||||
function wmi_create_module_from_components($components, $values, $id_police=0, $module_id=0) {
|
||||
function wmi_create_module_from_components($components, $values, $id_police=0, $module_id=0, $server_to_exec = 0) {
|
||||
$results = array(ERR_GENERIC => array(), NOERR => array(), ERR_EXIST => array());
|
||||
|
||||
if (empty($components)) {
|
||||
|
@ -155,6 +181,30 @@ function wmi_create_module_from_components($components, $values, $id_police=0, $
|
|||
$results[ERR_GENERIC][] = $nc["nombre"];
|
||||
}
|
||||
else {
|
||||
if ($id_police == 0) {
|
||||
if ($server_to_exec != 0) {
|
||||
$sql = sprintf("SELECT server_type FROM tserver WHERE id_server = %d", $server_to_exec);
|
||||
$row = db_get_row_sql ($sql);
|
||||
|
||||
if ($row['server_type'] = 13) {
|
||||
$new_module_configuration_data = "
|
||||
module_begin
|
||||
module_name " . $nc["nombre"] . "
|
||||
module_description " . $nc['descripcion'] . "
|
||||
module_type generic_data
|
||||
ip_target " . $nc['ip_target'] ."
|
||||
tcp_send " . $nc['tcp_send'] ."
|
||||
plugin_user " . $nc['plugin_user'] ."
|
||||
plugin_pass " . $nc['plugin_pass'] ."
|
||||
unit Bytes
|
||||
tcp_port 1
|
||||
module_end";
|
||||
|
||||
config_agents_add_module_in_conf($nc["id_agente"], $new_module_configuration_data);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(!empty($tags)) {
|
||||
// Creating tags
|
||||
$tag_ids = array();
|
||||
|
|
Loading…
Reference in New Issue