Merge branch 'ent-2076-ue-mejoras-en-gestion-de-politicas-desde-metaconsola' into 'develop'
Resolve "[UE] Mejoras en gestion de politicas desde Metaconsola" See merge request artica/pandorafms!1604
This commit is contained in:
commit
99773177dd
|
@ -14,4 +14,8 @@ ALTER TABLE `tservice` ADD COLUMN `evaluate_sla` int(1) NOT NULL DEFAULT '0';
|
|||
|
||||
ALTER TABLE `tpolicy_modules` ADD COLUMN `cps` int NOT NULL DEFAULT '0';
|
||||
|
||||
DROP INDEX id_policy ON `tpolicy_agents`;
|
||||
ALTER TABLE `tpolicy_agents` ADD COLUMN `id_node` int(10) NOT NULL DEFAULT '0';
|
||||
ALTER TABLE `tpolicy_agents` ADD UNIQUE(`id_policy`, `id_agent`, `id_node`);
|
||||
|
||||
COMMIT;
|
|
@ -757,7 +757,7 @@ $table->data[2][1] = '<b>'.__('Auth user').'</b>';
|
|||
$table->data[2][2] = html_print_input_text ('snmp3_auth_user', $snmp3_auth_user, '', 15, 60, true);
|
||||
$table->data[2][3] = '<b>'.__('Auth password').'</b>';
|
||||
$table->data[2][4] = html_print_input_password ('snmp3_auth_pass', $snmp3_auth_pass, '', 15, 60, true);
|
||||
$table->data[2][4] .= html_print_input_hidden('active_snmp_v3', 0, true);
|
||||
$table->data[2][4] .= html_print_input_hidden_extended('active_snmp_v3', 0, 'active_snmp_v3_awse', true);
|
||||
|
||||
$table->data[5][0] = '<b>'.__('Privacy method').'</b>';
|
||||
$table->data[5][1] = html_print_select(array('DES' => __('DES'), 'AES' => __('AES')), 'snmp3_privacy_method', $snmp3_privacy_method, '', '', '', true);
|
||||
|
|
|
@ -474,7 +474,7 @@ $table->data[2][1] = '<b>'.__('Auth user').'</b>';
|
|||
$table->data[2][2] = html_print_input_text ('snmp3_auth_user', $snmp3_auth_user, '', 15, 60, true);
|
||||
$table->data[2][3] = '<b>'.__('Auth password').'</b>';
|
||||
$table->data[2][4] = html_print_input_password ('snmp3_auth_pass', $snmp3_auth_pass, '', 15, 60, true);
|
||||
$table->data[2][4] .= html_print_input_hidden('active_snmp_v3', 0, true);
|
||||
$table->data[2][4] .= html_print_input_hidden_extended('active_snmp_v3', 0, 'active_snmp_v3_awsie', true);
|
||||
|
||||
$table->data[5][0] = '<b>'.__('Privacy method').'</b>';
|
||||
$table->data[5][1] = html_print_select(array('DES' => __('DES'), 'AES' => __('AES')), 'snmp3_privacy_method', $snmp3_privacy_method, '', '', '', true);
|
||||
|
|
|
@ -23,9 +23,9 @@ else {
|
|||
|
||||
enterprise_include ('godmode/agentes/module_manager.php');
|
||||
$isFunctionPolicies = enterprise_include_once ('include/functions_policies.php');
|
||||
require_once ('include/functions_modules.php');
|
||||
require_once ('include/functions_agents.php');
|
||||
require_once ('include/functions_servers.php');
|
||||
require_once ($config['homedir'] . '/include/functions_modules.php');
|
||||
require_once ($config['homedir'] . '/include/functions_agents.php');
|
||||
require_once ($config['homedir'] . '/include/functions_servers.php');
|
||||
|
||||
$search_string = io_safe_output(urldecode(trim(get_parameter ("search_string", ""))));
|
||||
|
||||
|
@ -35,7 +35,6 @@ if (!isset($policy_page))
|
|||
$policy_page = false;
|
||||
|
||||
// Search string filter form
|
||||
//echo '<form id="create_module_type" method="post" action="index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=module&id_agente='.$id_agente.'">';
|
||||
if (($policy_page) || (isset($agent)))
|
||||
echo '<form id="" method="post" action="">';
|
||||
else
|
||||
|
@ -67,11 +66,13 @@ $prediction_available = db_get_sql ("SELECT count(*)
|
|||
WHERE server_type = 5"); //POSTGRESQL AND ORACLE COMPATIBLE
|
||||
|
||||
// Development mode to use all servers
|
||||
if ($develop_bypass) {
|
||||
if ($develop_bypass || is_metaconsole()) {
|
||||
$network_available = 1;
|
||||
$wmi_available = 1;
|
||||
$plugin_available = 1;
|
||||
$prediction_available = 1;
|
||||
// FIXME when prediction predictions server modules can be configured
|
||||
// on metaconsole
|
||||
$prediction_available = is_metaconsole() ? 0 : 1;
|
||||
}
|
||||
|
||||
$modules = array ();
|
||||
|
@ -108,7 +109,7 @@ $checked = get_parameter("checked");
|
|||
|
||||
if (($policy_page) || (isset($agent))) {
|
||||
if ($policy_page) {
|
||||
$show_creation = true;
|
||||
$show_creation = !is_central_policies_on_node();
|
||||
}
|
||||
else {
|
||||
if (!isset($all_groups)) {
|
||||
|
|
|
@ -14,10 +14,11 @@
|
|||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
include_once("include/functions_modules.php");
|
||||
include_once("include/functions_categories.php");
|
||||
include_once($config['homedir'] . "/include/functions_modules.php");
|
||||
include_once($config['homedir'] . "/include/functions_categories.php");
|
||||
include_once($config['homedir'] . "/include/graphs/functions_d3.php");
|
||||
|
||||
echo "<script type='text/javascript' src='include/javascript/d3.3.5.14.js'></script>" . "\n";
|
||||
include_javascript_d3();
|
||||
|
||||
function prepend_table_simple ($row, $id = false) {
|
||||
global $table_simple;
|
||||
|
@ -133,19 +134,30 @@ $table_simple->id = 'simple';
|
|||
$table_simple->width = '100%';
|
||||
$table_simple->class = 'databox';
|
||||
$table_simple->data = array ();
|
||||
$table_simple->colspan = array ();
|
||||
$table_simple->style = array ();
|
||||
$table_simple->style[0] = 'font-weight: bold; width: 15%;';
|
||||
$table_simple->style[1] = 'width: 35%';
|
||||
$table_simple->style[0] = 'font-weight: bold; width: 25%;';
|
||||
$table_simple->style[1] = 'width: 25%';
|
||||
$table_simple->style[2] = 'font-weight: bold; width: 25%;';
|
||||
$table_simple->style[3] = 'width: 25%';
|
||||
$table_simple->cellclass = array();
|
||||
|
||||
$table_simple->colspan = array ();
|
||||
|
||||
|
||||
|
||||
#$table_simple->colspan[4][1] = 3;
|
||||
$table_simple->colspan[5][1] = 3;
|
||||
$table_simple->colspan[6][1] = 3;
|
||||
|
||||
$table_simple->rowspan = array ();
|
||||
if(strstr($page, "policy_modules")){
|
||||
$table_simple->rowspan[3][2] = 3;
|
||||
$table_simple->colspan[3][2] = 2;
|
||||
}
|
||||
else{
|
||||
$table_simple->rowspan[4][2] = 3;
|
||||
$table_simple->colspan[4][2] = 2;
|
||||
$table_simple->colspan[5][1] = 3;
|
||||
}
|
||||
|
||||
$table_simple->data[0][0] = __('Name');
|
||||
$table_simple->data[0][1] = html_print_input_text_extended ('name',
|
||||
io_safe_input(html_entity_decode($name)), 'text-name', '', 45, 100, $disabledBecauseInPolicy, '', $largeClassDisabledBecauseInPolicy, true);
|
||||
|
@ -154,7 +166,7 @@ $table_simple->data[0][1] = html_print_input_text_extended ('name',
|
|||
|
||||
if (!empty($id_agent_module) && isset($id_agente)) {
|
||||
$table_simple->data[0][1] .= ' <b>' . __('ID') . '</b> ' . $id_agent_module . ' ';
|
||||
|
||||
|
||||
$table_simple->data[0][1] .= ' <a href="index.php?sec=gagente&tab=module&sec2=godmode/agentes/configurar_agente&id_agente='.$id_agente.'&delete_module='.$id_agent_module.'"
|
||||
onClick="if (!confirm(\' '.__('Are you sure?').'\')) return false;">';
|
||||
$table_simple->data[0][1] .= html_print_image ('images/cross.png', true,
|
||||
|
@ -182,7 +194,6 @@ if (!$in_policy) {
|
|||
'parent_module_id', $parent_module_id, '', __('Not assigned'), '0', true, false, true);
|
||||
}
|
||||
|
||||
|
||||
$table_simple->data[2][0] = __('Type').' ' . ui_print_help_icon ('module_type', true);
|
||||
$table_simple->data[2][0] .= html_print_input_hidden ('id_module_type_hidden', $id_module_type, true);
|
||||
|
||||
|
@ -205,14 +216,14 @@ if (!$edit) {
|
|||
WHERE id_tipo = %s
|
||||
ORDER BY descripcion',
|
||||
$id_module_type);
|
||||
|
||||
|
||||
$type_names = db_get_all_rows_sql($sql);
|
||||
|
||||
|
||||
$type_names_hash = array();
|
||||
foreach ($type_names as $tn) {
|
||||
$type_names_hash[$tn['id_tipo']] = $tn['nombre'];
|
||||
}
|
||||
|
||||
|
||||
$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);
|
||||
}
|
||||
|
@ -223,35 +234,35 @@ else {
|
|||
else {
|
||||
$idModuleType = '';
|
||||
}
|
||||
|
||||
|
||||
$sql = sprintf ('SELECT id_tipo, descripcion
|
||||
FROM ttipo_modulo
|
||||
WHERE categoria IN (%s)
|
||||
ORDER BY descripcion',
|
||||
implode (',', $categories));
|
||||
|
||||
|
||||
$table_simple->data[2][1] = html_print_select_from_sql ($sql, 'id_module_type',
|
||||
$idModuleType, '', '', '', true, false, false, $disabledBecauseInPolicy, false, false, 100);
|
||||
|
||||
|
||||
// Store the relation between id and name of the types on a hidden field
|
||||
$sql = sprintf ('SELECT id_tipo, nombre
|
||||
FROM ttipo_modulo
|
||||
WHERE categoria IN (%s)
|
||||
ORDER BY descripcion',
|
||||
implode (',', $categories));
|
||||
|
||||
|
||||
$type_names = db_get_all_rows_sql($sql);
|
||||
|
||||
|
||||
$type_names_hash = array();
|
||||
foreach ($type_names as $tn) {
|
||||
$type_names_hash[$tn['id_tipo']] = $tn['nombre'];
|
||||
}
|
||||
|
||||
|
||||
$table_simple->data[2][1] .= html_print_input_hidden('type_names',base64_encode(io_json_mb_encode($type_names_hash)),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') .' ' . ui_print_help_icon ('dynamic_threshold', true);
|
||||
$table_simple->data[3][1] = html_print_extended_select_for_time ('dynamic_interval', $dynamic_interval, '', 'None', '0', 10, true, 'width:150px',false, $classdisabledBecauseInPolicy, $disabledBecauseInPolicy);
|
||||
|
@ -280,21 +291,21 @@ if (!modules_is_string_type($id_module_type) || $edit) {
|
|||
$table_simple->data[4][1] .= html_print_input_text ('min_warning', $min_warning, '', 10, 255, true,
|
||||
$disabledBecauseInPolicy, false, '', $classdisabledBecauseInPolicy);
|
||||
$table_simple->data[4][1] .= '<br /><em>'.__('Max.').'</em>';
|
||||
$table_simple->data[4][1] .= html_print_input_text ('max_warning', $max_warning, '', 10, 255, true,
|
||||
$table_simple->data[4][1] .= html_print_input_text ('max_warning', $max_warning, '', 10, 255, true,
|
||||
$disabledBecauseInPolicy, false, '', $classdisabledBecauseInPolicy).'</span>';
|
||||
}
|
||||
if (modules_is_string_type($id_module_type) || $edit) {
|
||||
$table_simple->data[4][1] .= '<span id="string_warning"><em>'.__('Str.').'</em>';
|
||||
$table_simple->data[4][1] .= html_print_input_text ('str_warning', str_replace("\"","",$str_warning),
|
||||
$table_simple->data[4][1] .= html_print_input_text ('str_warning', str_replace("\"","",$str_warning),
|
||||
'', 10, 255, true, $disabledBecauseInPolicy, false, '', $classdisabledBecauseInPolicy).'</span>';
|
||||
}
|
||||
$table_simple->data[4][1] .= '<br /><em>'.__('Inverse interval').'</em>';
|
||||
$table_simple->data[4][1] .= html_print_checkbox ("warning_inverse", 1, $warning_inverse, true, $disabledBecauseInPolicy);
|
||||
|
||||
if (!modules_is_string_type($id_module_type) || $edit) {
|
||||
$table_simple->data[4][2] = '<svg id="svg_dinamic" width="800" height="300"> </svg>';
|
||||
$table_simple->colspan[4][2] = 2;
|
||||
$table_simple->rowspan[4][2] = 3;
|
||||
$table_simple->data[4][2] = '<svg id="svg_dinamic" width="500" height="300"> </svg>';
|
||||
}
|
||||
|
||||
$table_simple->data[5][0] = __('Critical status').' ' . ui_print_help_icon ('critical_status', true);
|
||||
if (!modules_is_string_type($id_module_type) || $edit) {
|
||||
$table_simple->data[5][1] .= '<span id="minmax_critical"><em>'.__('Min. ').'</em>';
|
||||
|
@ -306,30 +317,29 @@ if (!modules_is_string_type($id_module_type) || $edit) {
|
|||
}
|
||||
if (modules_is_string_type($id_module_type) || $edit) {
|
||||
$table_simple->data[5][1] .= '<span id="string_critical"><em>'.__('Str.').'</em>';
|
||||
$table_simple->data[5][1] .= html_print_input_text ('str_critical', str_replace("\"","",$str_critical),
|
||||
$table_simple->data[5][1] .= html_print_input_text ('str_critical', str_replace("\"","",$str_critical),
|
||||
'', 10, 255, true, $disabledBecauseInPolicy, false, '', $classdisabledBecauseInPolicy).'</span>';
|
||||
}
|
||||
|
||||
$table_simple->data[5][1] .= '<br /><em>'.__('Inverse interval').'</em>';
|
||||
$table_simple->data[5][1] .= html_print_checkbox ("critical_inverse", 1, $critical_inverse, true, $disabledBecauseInPolicy);
|
||||
|
||||
/* FF stands for Flip-flop */
|
||||
//FF stands for Flip-flop
|
||||
$table_simple->data[6][0] = __('FF threshold').' ' . ui_print_help_icon ('ff_threshold', true);
|
||||
$table_simple->colspan[5][1] = 3;
|
||||
|
||||
$table_simple->data[6][1] = html_print_radio_button ('each_ff', 0, '', $each_ff, true, $disabledBecauseInPolicy) . ' ' . __('All state changing') . ' : ';
|
||||
$table_simple->data[6][1] .= html_print_input_text ('ff_event', $ff_event, '', 5, 15, true,
|
||||
$disabledBecauseInPolicy, false, '', $classdisabledBecauseInPolicy) . '<br />';
|
||||
$disabledBecauseInPolicy, false, '', $classdisabledBecauseInPolicy) . '<br />';
|
||||
$table_simple->data[6][1] .= html_print_radio_button ('each_ff', 1, '', $each_ff, true, $disabledBecauseInPolicy) . ' ' . __('Each state changing') . ' : ';
|
||||
$table_simple->data[6][1] .= __('To normal');
|
||||
$table_simple->data[6][1] .= html_print_input_text ('ff_event_normal', $ff_event_normal, '', 5, 15, true,
|
||||
$disabledBecauseInPolicy, false, '', $classdisabledBecauseInPolicy) . ' ';
|
||||
$disabledBecauseInPolicy, false, '', $classdisabledBecauseInPolicy) . ' ';
|
||||
$table_simple->data[6][1] .= __('To warning');
|
||||
$table_simple->data[6][1] .= html_print_input_text ('ff_event_warning', $ff_event_warning, '', 5, 15, true,
|
||||
$disabledBecauseInPolicy, false, '', $classdisabledBecauseInPolicy) . ' ';
|
||||
$disabledBecauseInPolicy, false, '', $classdisabledBecauseInPolicy) . ' ';
|
||||
$table_simple->data[6][1] .= __('To critical');
|
||||
$table_simple->data[6][1] .= html_print_input_text ('ff_event_critical', $ff_event_critical, '', 5, 15, true,
|
||||
$disabledBecauseInPolicy, false, '', $classdisabledBecauseInPolicy);
|
||||
$disabledBecauseInPolicy, false, '', $classdisabledBecauseInPolicy);
|
||||
$table_simple->data[7][0] = __('Historical data');
|
||||
if($disabledBecauseInPolicy) {
|
||||
// If is disabled, we send a hidden in his place and print a false checkbox because HTML dont send disabled fields and could be disabled by error
|
||||
|
@ -340,7 +350,7 @@ else {
|
|||
$table_simple->data[7][1] = html_print_checkbox ("history_data", 1, $history_data, true, $disabledBecauseInPolicy);
|
||||
}
|
||||
|
||||
/* Advanced form part */
|
||||
//Advanced form part
|
||||
$table_advanced = new stdClass();
|
||||
$table_advanced->id = 'advanced';
|
||||
$table_advanced->width = '100%';
|
||||
|
@ -359,8 +369,8 @@ $table_advanced->data[0][1] = html_print_textarea ('description', 2, 65,
|
|||
|
||||
$table_advanced->data[1][0] = __('Custom ID');
|
||||
$table_advanced->colspan[1][1] = 2;
|
||||
$table_advanced->data[1][1] = html_print_input_text ('custom_id', $custom_id, '', 20, 65, true,
|
||||
$disabledBecauseInPolicy, false, '', $classdisabledBecauseInPolicy);
|
||||
$table_advanced->data[1][1] = html_print_input_text ('custom_id', $custom_id, '', 20, 65, true,
|
||||
$disabledBecauseInPolicy, false, '', $classdisabledBecauseInPolicy);
|
||||
|
||||
$table_advanced->data[1][3] = __('Unit');
|
||||
// $table_advanced->data[1][4] = html_print_input_text ('unit', $unit, '', 20, 65, true,
|
||||
|
|
|
@ -16,15 +16,18 @@
|
|||
global $config;
|
||||
|
||||
require_once($config['homedir'] . "/include/functions_snmp_browser.php");
|
||||
?>
|
||||
<script type="text/javascript" src="include/javascript/pandora_snmp_browser.js"></script>
|
||||
<?php
|
||||
$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);
|
||||
//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);
|
||||
|
@ -215,11 +218,11 @@ else if ($id_agent_module === false) {
|
|||
$data = array();
|
||||
$data[0] = __('Auth user');
|
||||
$data[1] = html_print_input_text ('snmp3_auth_user', $snmp3_auth_user, '', 15, 60, true, $disabledBecauseInPolicy,
|
||||
false, '', $classdisabledBecauseInPolicy);
|
||||
false, '', $classdisabledBecauseInPolicy);
|
||||
$data[2] = __('Auth password') . ui_print_help_tip(__("The pass length must be eight character minimum."), true);
|
||||
$data[3] = html_print_input_password ('snmp3_auth_pass', $snmp3_auth_pass, '', 15, 60, true, $disabledBecauseInPolicy,
|
||||
false, $largeclassdisabledBecauseInPolicy);
|
||||
$data[3] .= html_print_input_hidden('active_snmp_v3', 0, true);
|
||||
false, $largeclassdisabledBecauseInPolicy);
|
||||
$data[3] .= html_print_input_hidden_extended('active_snmp_v3', 0, 'active_snmp_v3_mmen', true);
|
||||
if ($snmp_version != 3) $table_simple->rowstyle['field_snmpv3_row1'] = 'display: none;';
|
||||
push_table_simple($data, 'field_snmpv3_row1');
|
||||
|
||||
|
|
|
@ -66,6 +66,7 @@ if (is_ajax ()) {
|
|||
}
|
||||
|
||||
if ($get_group_agents) {
|
||||
ob_clean();
|
||||
$id_group = (int) get_parameter ('id_group');
|
||||
$disabled = (int) get_parameter ('disabled', 0);
|
||||
$search = (string) get_parameter ('search', '');
|
||||
|
@ -82,6 +83,9 @@ if (is_ajax ()) {
|
|||
$status_agents = (int)get_parameter('status_agents', AGENT_STATUS_ALL);
|
||||
// Juanma (22/05/2014) Fix: If setted remove void agents from result (by default and for compatibility show void agents)
|
||||
$show_void_agents = (int)get_parameter('show_void_agents', 1);
|
||||
$serialized = (bool)get_parameter('serialized', false);
|
||||
$serialized_separator = (string)get_parameter('serialized_separator', "|");
|
||||
$force_serialized = (bool)get_parameter('force_serialized', false);
|
||||
|
||||
if (! check_acl ($config['id_user'], $id_group, "AR")) {
|
||||
db_pandora_audit("ACL Violation",
|
||||
|
@ -121,18 +125,26 @@ if (is_ajax ()) {
|
|||
$filter[$_sql_post] = '1';
|
||||
|
||||
}
|
||||
|
||||
|
||||
$id_groups_get_agents = $id_group;
|
||||
if ( $id_group == 0 && $privilege != '') {
|
||||
$groups = users_get_groups ($config["id_user"], $privilege, false);
|
||||
// if group ID doesn't matter and $privilege is specified (like 'AW'),
|
||||
// retruns all agents that current user has $privilege privilege for.
|
||||
$agents = agents_get_group_agents(array_keys($groups), $filter, "none", false, $recursion, false, '|', $add_alert_bulk_op);
|
||||
$id_groups_get_agents = array_keys($groups);
|
||||
}
|
||||
else {
|
||||
$agents = agents_get_group_agents($id_group, $filter, "none",
|
||||
true, $recursion, false, '|', $add_alert_bulk_op);
|
||||
}
|
||||
|
||||
$agents = agents_get_group_agents(
|
||||
$id_groups_get_agents,
|
||||
$filter,
|
||||
"none",
|
||||
false,
|
||||
$recursion,
|
||||
$serialized,
|
||||
$serialized_separator,
|
||||
$add_alert_bulk_op,
|
||||
$force_serialized
|
||||
);
|
||||
|
||||
$agents_disabled = array();
|
||||
// Add keys prefix
|
||||
if ($keys_prefix !== "") {
|
||||
|
@ -140,7 +152,34 @@ if (is_ajax ()) {
|
|||
$agents[$keys_prefix . $k] = $v;
|
||||
unset($agents[$k]);
|
||||
if ($all_agents) {
|
||||
$agent_disabled = db_get_value_filter('disabled', 'tagente', array('id_agente' => $k));
|
||||
// Unserialize to get the status
|
||||
if ($serialized && is_metaconsole()) {
|
||||
$agent_info = explode($serialized_separator, $k);
|
||||
$agent_disabled = db_get_value_filter(
|
||||
'disabled',
|
||||
'tmetaconsole_agent',
|
||||
array(
|
||||
'id_tagente' => $agent_info[1],
|
||||
'id_tmetaconsole_setup' => $agent_info[0]
|
||||
)
|
||||
);
|
||||
} elseif ($serialized && !is_metaconsole() && $force_serialized) {
|
||||
$agent_info = explode($serialized_separator, $k);
|
||||
$agent_disabled = db_get_value_filter(
|
||||
'disabled',
|
||||
'tagente',
|
||||
array('id_agente' => $agent_info[1])
|
||||
);
|
||||
} elseif (!$serialized && is_metaconsole()) {
|
||||
// Cannot retrieve the disabled status. Mark all as not disabled
|
||||
$agent_disabled = 0;
|
||||
} else {
|
||||
$agent_disabled = db_get_value_filter(
|
||||
'disabled',
|
||||
'tagente',
|
||||
array('id_agente' => $k)
|
||||
);
|
||||
}
|
||||
$agents_disabled[$keys_prefix . $k] = $agent_disabled;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
// GNU General Public License for more details.
|
||||
|
||||
global $config;
|
||||
include_once($config['homedir'] . '/include/graphs/functions_d3.php');
|
||||
|
||||
if (! check_acl ($config['id_user'], 0, "PM")) {
|
||||
db_pandora_audit("ACL Violation",
|
||||
|
@ -22,7 +23,7 @@ if (! check_acl ($config['id_user'], 0, "PM")) {
|
|||
return;
|
||||
}
|
||||
|
||||
echo "<script type='text/javascript' src='include/javascript/d3.3.5.14.js'></script>" . "\n";
|
||||
include_javascript_d3();
|
||||
|
||||
function push_table_row ($row, $id = false) {
|
||||
global $table;
|
||||
|
@ -128,7 +129,7 @@ $table->data[4][1] .= html_print_input_text ('str_warning', $str_warning,
|
|||
$table->data[4][1] .= '<br /><em>'.__('Inverse interval').'</em>';
|
||||
$table->data[4][1] .= html_print_checkbox ("warning_inverse", 1, $warning_inverse, true);
|
||||
|
||||
$table->data[4][2] = '<svg id="svg_dinamic" width="800" height="300"> </svg>';
|
||||
$table->data[4][2] = '<svg id="svg_dinamic" width="500" height="300"> </svg>';
|
||||
$table->colspan[4][2] = 2;
|
||||
$table->rowspan[4][2] = 3;
|
||||
|
||||
|
|
|
@ -58,7 +58,7 @@ $data[0] = __('Auth user');
|
|||
$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('active_snmp_v3', 0, 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 = array();
|
||||
|
|
|
@ -1360,11 +1360,29 @@ function safe_sql_string($string) {
|
|||
|
||||
function is_metaconsole() {
|
||||
global $config;
|
||||
|
||||
if ($config['metaconsole'])
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
return (bool) $config['metaconsole'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Check if there is centralized management in metaconsole environment.
|
||||
* Usefull to display some policy features on metaconsole.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
function is_central_policies() {
|
||||
global $config;
|
||||
return is_metaconsole() && $config["centralized_management"];
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Check if there is centralized management in node environment. Usefull
|
||||
* to reduce the policy functionallity on nodes.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
function is_central_policies_on_node() {
|
||||
global $config;
|
||||
return (!is_metaconsole()) && $config["centralized_management"];
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -796,11 +796,22 @@ function agents_common_modules ($id_agent, $filter = false, $indexed = true, $ge
|
|||
* @param boolean $childGroups The flag to get agents in the child group of group parent passed. By default false.
|
||||
* @param boolean $serialized Only in metaconsole. Return the key as <server id><SEPARATOR><agent id>. By default false.
|
||||
* @param string $separator Only in metaconsole. Separator for the serialized data. By default |.
|
||||
* @param bool $add_alert_bulk_op //TODO documentation
|
||||
* @param bool $force_serialized. If the agent has not id_server (typically in node) put 0 as <server_id>.
|
||||
*
|
||||
* @return array An array with all agents in the group or an empty array
|
||||
*/
|
||||
function agents_get_group_agents ($id_group = 0, $search = false,
|
||||
$case = "lower", $noACL = false, $childGroups = false, $serialized = false, $separator = '|', $add_alert_bulk_op = false) {
|
||||
function agents_get_group_agents (
|
||||
$id_group = 0,
|
||||
$search = false,
|
||||
$case = "lower",
|
||||
$noACL = false,
|
||||
$childGroups = false,
|
||||
$serialized = false,
|
||||
$separator = '|',
|
||||
$add_alert_bulk_op = false,
|
||||
$force_serialized = false
|
||||
) {
|
||||
|
||||
global $config;
|
||||
|
||||
|
@ -977,11 +988,12 @@ function agents_get_group_agents ($id_group = 0, $search = false,
|
|||
|
||||
if ($serialized && isset($row["id_server"])) {
|
||||
$key = $row["id_server"] . $separator . $row["id_agente"];
|
||||
}
|
||||
else {
|
||||
} elseif ($force_serialized) {
|
||||
$key = "0" . $separator . $row["id_agente"];
|
||||
} else {
|
||||
$key = $row["id_agente"];
|
||||
}
|
||||
|
||||
|
||||
switch ($case) {
|
||||
case "lower":
|
||||
$value = mb_strtolower ($row["alias"], "UTF-8");
|
||||
|
@ -2010,7 +2022,8 @@ function agents_get_agentmodule_group ($id_module) {
|
|||
* @return int The group id
|
||||
*/
|
||||
function agents_get_agent_group ($id_agent) {
|
||||
return (int) db_get_value ('id_grupo', 'tagente', 'id_agente', (int) $id_agent);
|
||||
$table = is_metaconsole() ? "tmetaconsole_agent" : "tagente";
|
||||
return (int) db_get_value ('id_grupo', $table, 'id_agente', (int) $id_agent);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -5455,7 +5455,7 @@ function api_set_add_agent_policy($id, $thrash1, $other, $thrash2) {
|
|||
}
|
||||
|
||||
if ($id_agent_policy === false) {
|
||||
$success = enterprise_hook('policies_create_agent', array($other['data'][0], $id, true));
|
||||
$success = enterprise_hook('policies_create_agent', array($other['data'][0], $id));
|
||||
}
|
||||
else {
|
||||
returnError('error_add_agent_policy', __('Error adding agent to policy. The agent is already in the policy.'));
|
||||
|
|
|
@ -36,7 +36,7 @@ function snmp_browser_print_tree ($tree, $id = 0, $depth = 0, $last = 0, $last_a
|
|||
|
||||
// Get the base URL for images
|
||||
if ($url === false) {
|
||||
$url = ui_get_full_url('operation/tree');
|
||||
$url = ui_get_full_url('operation/tree', false, false, false);
|
||||
}
|
||||
|
||||
// Leaf
|
||||
|
@ -604,8 +604,8 @@ function snmp_browser_print_container ($return = false, $width = '100%', $height
|
|||
$table3->data[2][2] = html_print_input_text ('snmp3_browser_auth_user', '', '', 15, 60, true);
|
||||
$table3->data[2][3] = '<b>'.__('Auth password').'</b>';
|
||||
$table3->data[2][4] = html_print_input_password ('snmp3_browser_auth_pass', '', '', 15, 60, true);
|
||||
$table3->data[2][4] .= html_print_input_hidden('active_snmp_v3', 0, true);
|
||||
|
||||
$table3->data[2][4] .= html_print_input_hidden_extended('active_snmp_v3', 0, 'active_snmp_v3_fsb', true);
|
||||
|
||||
$table3->data[5][0] = '<b>'.__('Privacy method').'</b>';
|
||||
$table3->data[5][1] = html_print_select(array('DES' => __('DES'), 'AES' => __('AES')), 'snmp3_browser_privacy_method', '', '', '', '', true);
|
||||
$table3->data[5][2] = '<b>'.__('Privacy pass').'</b>';
|
||||
|
|
|
@ -2504,11 +2504,23 @@ function ui_print_page_header ($title, $icon = "", $return = false,
|
|||
";
|
||||
}
|
||||
|
||||
if ($help != "")
|
||||
$buffer .= "<div class='head_help' style='float: right; margin-top: -2px !important;'>" .
|
||||
ui_print_help_icon ($help, true, '', 'images/help_w.png') . "</div>";
|
||||
$buffer .= '</span></li></ul></div>';
|
||||
|
||||
if(!is_metaconsole()){
|
||||
if ($help != ""){
|
||||
$buffer .= "<div class='head_help' style='float: right; margin-top: -2px !important;'>" .
|
||||
ui_print_help_icon ($help, true, '', 'images/help_w.png') . "</div>";
|
||||
}
|
||||
}
|
||||
|
||||
$buffer .= '</span>';
|
||||
|
||||
if(is_metaconsole()){
|
||||
if ($help != ""){
|
||||
$buffer .= "<div class='head_help'>" . ui_print_help_icon ($help, true) . "</div>";
|
||||
}
|
||||
}
|
||||
|
||||
$buffer .= '</li></ul></div>';
|
||||
|
||||
if (is_array($options)) {
|
||||
$buffer .= '<div id="menu_tab"><ul class="mn">';
|
||||
foreach ($options as $key => $option) {
|
||||
|
|
|
@ -1264,13 +1264,14 @@ function pagination_show_more(params, message){
|
|||
datatype: "html"
|
||||
});
|
||||
}
|
||||
|
||||
/*
|
||||
*function use d3.js for paint graph
|
||||
*/
|
||||
function paint_graph_status(min_w, max_w, min_c, max_c, inverse_w, inverse_c, error_w, error_c,
|
||||
legend_normal, legend_warning, legend_critical,
|
||||
message_error_warning, message_error_critical) {
|
||||
|
||||
|
||||
//Check if they are numbers
|
||||
if(isNaN(min_w)){ min_w = 0; };
|
||||
if(isNaN(max_w)){ max_w = 0; };
|
||||
|
@ -1284,31 +1285,31 @@ function paint_graph_status(min_w, max_w, min_c, max_c, inverse_w, inverse_c, er
|
|||
min_c = parseFloat(min_c);
|
||||
max_w = parseFloat(max_w);
|
||||
max_c = parseFloat(max_c);
|
||||
|
||||
|
||||
//inicialize var
|
||||
var range_min = 0;
|
||||
var range_max = 0;
|
||||
var range_max_min = 0;
|
||||
var range_max_min = 0;
|
||||
|
||||
|
||||
//Find the lowest possible value
|
||||
if(min_w < 0 || min_c < 0){
|
||||
if(min_w < min_c){
|
||||
range_min = min_w - 100;
|
||||
} else {
|
||||
range_min = min_c - 100;
|
||||
range_min = min_c - 100;
|
||||
}
|
||||
} else if (min_w > 0 || min_c > 0) {
|
||||
if(min_w > min_c){
|
||||
range_max_min = min_w;
|
||||
} else {
|
||||
range_max_min = min_c;
|
||||
range_max_min = min_c;
|
||||
}
|
||||
} else {
|
||||
if(min_w < min_c){
|
||||
range_min = min_w - 100;
|
||||
} else {
|
||||
range_min = min_c - 100;
|
||||
range_min = min_c - 100;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1318,7 +1319,7 @@ function paint_graph_status(min_w, max_w, min_c, max_c, inverse_w, inverse_c, er
|
|||
} else {
|
||||
range_max = max_c + 100 + range_max_min;
|
||||
}
|
||||
|
||||
|
||||
//Controls whether the maximum = 0 is infinite
|
||||
if((max_w == 0 || max_w == 0.00) && min_w != 0){
|
||||
max_w = range_max;
|
||||
|
@ -1326,10 +1327,10 @@ function paint_graph_status(min_w, max_w, min_c, max_c, inverse_w, inverse_c, er
|
|||
if((max_c == 0 || max_c == 0.00) && min_c != 0){
|
||||
max_c = range_max;
|
||||
}
|
||||
|
||||
|
||||
//Scale according to the position
|
||||
position = 200 / (range_max-range_min);
|
||||
|
||||
|
||||
//axes
|
||||
var yScale = d3.scale.linear()
|
||||
.domain([range_min, range_max])
|
||||
|
@ -1344,13 +1345,13 @@ function paint_graph_status(min_w, max_w, min_c, max_c, inverse_w, inverse_c, er
|
|||
//delete elements
|
||||
svg.selectAll("g").remove();
|
||||
|
||||
width_x = 201;
|
||||
width_x = 101;
|
||||
height_x = 50;
|
||||
|
||||
svg.append("g")
|
||||
.attr("transform", "translate(200, 150)")
|
||||
.attr("transform", "translate(100, 150)")
|
||||
.call(yAxis);
|
||||
|
||||
|
||||
//legend Normal text
|
||||
svg.append("g")
|
||||
.attr("width", 300)
|
||||
|
@ -1371,14 +1372,14 @@ function paint_graph_status(min_w, max_w, min_c, max_c, inverse_w, inverse_c, er
|
|||
svg.append("g")
|
||||
.append("rect")
|
||||
.attr("id", "legend_normal")
|
||||
.attr("x", width_x + 80)
|
||||
.attr("y", height_x - 30)
|
||||
.attr("width", 10)
|
||||
.attr("height", 10)
|
||||
.style("fill", "#82B92E");
|
||||
.attr("x", width_x + 80)
|
||||
.attr("y", height_x - 30)
|
||||
.attr("width", 10)
|
||||
.attr("height", 10)
|
||||
.style("fill", "#82B92E");
|
||||
|
||||
//legend Warning text
|
||||
svg.append("g")
|
||||
//legend Warning text
|
||||
svg.append("g")
|
||||
.append("text")
|
||||
.attr("x", width_x + 100)
|
||||
.attr("y", height_x - 20)
|
||||
|
@ -1393,14 +1394,14 @@ function paint_graph_status(min_w, max_w, min_c, max_c, inverse_w, inverse_c, er
|
|||
svg.append("g")
|
||||
.append("rect")
|
||||
.attr("id", "legend_warning")
|
||||
.attr("x", width_x + 185)
|
||||
.attr("y", height_x - 30)
|
||||
.attr("width", 10)
|
||||
.attr("height", 10)
|
||||
.style("fill", "#ffd731");
|
||||
.attr("x", width_x + 185)
|
||||
.attr("y", height_x - 30)
|
||||
.attr("width", 10)
|
||||
.attr("height", 10)
|
||||
.style("fill", "#ffd731");
|
||||
|
||||
//legend Critical text
|
||||
svg.append("g")
|
||||
//legend Critical text
|
||||
svg.append("g")
|
||||
.append("text")
|
||||
.attr("x", width_x + 205)
|
||||
.attr("y", height_x - 20)
|
||||
|
@ -1415,11 +1416,11 @@ function paint_graph_status(min_w, max_w, min_c, max_c, inverse_w, inverse_c, er
|
|||
svg.append("g")
|
||||
.append("rect")
|
||||
.attr("id", "legend_critical")
|
||||
.attr("x", width_x + 285)
|
||||
.attr("y", height_x - 30)
|
||||
.attr("width", 10)
|
||||
.attr("height", 10)
|
||||
.style("fill", "#fc4444");
|
||||
.attr("x", width_x + 285)
|
||||
.attr("y", height_x - 30)
|
||||
.attr("width", 10)
|
||||
.attr("height", 10)
|
||||
.style("fill", "#fc4444");
|
||||
|
||||
//styles for number and axes
|
||||
svg.selectAll("g .domain")
|
||||
|
@ -1435,89 +1436,87 @@ function paint_graph_status(min_w, max_w, min_c, max_c, inverse_w, inverse_c, er
|
|||
svg.append("g")
|
||||
.append("rect")
|
||||
.attr("id", "status_rect")
|
||||
.attr("x", width_x)
|
||||
.attr("y", height_x)
|
||||
.attr("width", 300)
|
||||
.attr("height", 200)
|
||||
.style("fill", "#82B92E");
|
||||
|
||||
//controls the inverse warning
|
||||
if(inverse_w == 0){
|
||||
svg.append("g")
|
||||
.attr("x", width_x)
|
||||
.attr("y", height_x)
|
||||
.attr("width", 300)
|
||||
.attr("height", 200)
|
||||
.style("fill", "#82B92E");
|
||||
|
||||
//controls the inverse warning
|
||||
if(inverse_w == 0){
|
||||
svg.append("g")
|
||||
.append("rect").transition()
|
||||
.duration(600)
|
||||
.attr("id", "warning_rect")
|
||||
.attr("x", width_x)
|
||||
.attr("x", width_x)
|
||||
.attr("y", (height_x +(range_max - min_w) * position) - ((max_w - min_w) * position))
|
||||
.attr("width", 300)
|
||||
.attr("width", 300)
|
||||
.attr("height", ((max_w - min_w) * position))
|
||||
.style("fill", "#ffd731");
|
||||
}
|
||||
else {
|
||||
svg.append("g")
|
||||
.append("rect").transition()
|
||||
.duration(600)
|
||||
.style("fill", "#ffd731");
|
||||
}
|
||||
else {
|
||||
svg.append("g")
|
||||
.append("rect").transition()
|
||||
.duration(600)
|
||||
.attr("id", "warning_rect")
|
||||
.attr("x", width_x)
|
||||
.attr("x", width_x)
|
||||
.attr("y", height_x + 200 - ((min_w -range_min) * position))
|
||||
.attr("width", 300)
|
||||
.attr("width", 300)
|
||||
.attr("height", (min_w -range_min) * position)
|
||||
.style("fill", "#ffd731");
|
||||
|
||||
svg.append("g")
|
||||
.append("rect").transition()
|
||||
.duration(600)
|
||||
.style("fill", "#ffd731");
|
||||
|
||||
svg.append("g")
|
||||
.append("rect").transition()
|
||||
.duration(600)
|
||||
.attr("id", "warning_inverse_rect")
|
||||
.attr("x", width_x)
|
||||
.attr("y", height_x)
|
||||
.attr("width", 300)
|
||||
.attr("x", width_x)
|
||||
.attr("y", height_x)
|
||||
.attr("width", 300)
|
||||
.attr("height", ((range_max - min_w) * position) - ((max_w - min_w) * position))
|
||||
.style("fill", "#ffd731");
|
||||
|
||||
}
|
||||
//controls the inverse critical
|
||||
if(inverse_c == 0){
|
||||
svg.append("g")
|
||||
.style("fill", "#ffd731");
|
||||
}
|
||||
//controls the inverse critical
|
||||
if(inverse_c == 0){
|
||||
svg.append("g")
|
||||
.append("rect").transition()
|
||||
.duration(600)
|
||||
.attr("id", "critical_rect")
|
||||
.attr("x", width_x)
|
||||
.attr("x", width_x)
|
||||
.attr("y", (height_x + (range_max - min_c) * position) - ((max_c - min_c) * position))
|
||||
.attr("width", 300)
|
||||
.attr("width", 300)
|
||||
.attr("height", ((max_c - min_c) * position))
|
||||
.style("fill", "#fc4444");
|
||||
}
|
||||
else {
|
||||
svg.append("g")
|
||||
.append("rect").transition()
|
||||
.style("fill", "#fc4444");
|
||||
}
|
||||
else {
|
||||
svg.append("g")
|
||||
.append("rect").transition()
|
||||
.duration(600)
|
||||
.attr("id", "critical_rect")
|
||||
.attr("x", width_x)
|
||||
.attr("x", width_x)
|
||||
.attr("y", height_x + 200 - ((min_c -range_min) * position))
|
||||
.attr("width", 300)
|
||||
.attr("width", 300)
|
||||
.attr("height", (min_c -range_min) * position)
|
||||
.style("fill", "#fc4444");
|
||||
svg.append("g")
|
||||
.append("rect").transition()
|
||||
.style("fill", "#fc4444");
|
||||
svg.append("g")
|
||||
.append("rect").transition()
|
||||
.duration(600)
|
||||
.attr("id", "critical_inverse_rect")
|
||||
.attr("x", width_x)
|
||||
.attr("y", height_x)
|
||||
.attr("width", 300)
|
||||
.attr("x", width_x)
|
||||
.attr("y", height_x)
|
||||
.attr("width", 300)
|
||||
.attr("height", ((range_max - min_c) * position) - ((max_c - min_c) * position))
|
||||
.style("fill", "#fc4444");
|
||||
}
|
||||
|
||||
.style("fill", "#fc4444");
|
||||
}
|
||||
}
|
||||
else {
|
||||
d3.select("#svg_dinamic rect").remove();
|
||||
//create svg
|
||||
var svg = d3.select("#svg_dinamic");
|
||||
svg.selectAll("g").remove();
|
||||
|
||||
width_x = 201;
|
||||
|
||||
width_x = 10;
|
||||
height_x = 50;
|
||||
|
||||
|
||||
//message error warning
|
||||
if (error_w == 1) {
|
||||
$("#text-max_warning").addClass("input_error");
|
||||
|
@ -1546,9 +1545,8 @@ function paint_graph_status(min_w, max_w, min_c, max_c, inverse_w, inverse_c, er
|
|||
.style("font-size", 14)
|
||||
.style("fill", "red")
|
||||
.html(message_error_critical)
|
||||
.style("text-anchor", "first");
|
||||
.style("text-anchor", "first");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -203,10 +203,8 @@ $zoom_default = file($config['homedir'] . '/images/zoom_default.svg');
|
|||
</div>
|
||||
<?php
|
||||
|
||||
echo '<script '.
|
||||
' type="text/javascript" ' .
|
||||
' src="' . $config['homeurl'] . 'include/javascript/d3.3.5.14.js" ' .
|
||||
' charset="utf-8"></script>';
|
||||
include_javascript_d3();
|
||||
|
||||
echo '<div id="dinamic_networkmap" style="overflow: hidden;"></div>';
|
||||
?>
|
||||
<style type="text/css">
|
||||
|
|
|
@ -2206,8 +2206,9 @@ CREATE TABLE IF NOT EXISTS `tpolicy_agents` (
|
|||
`policy_applied` tinyint(1) unsigned default '0',
|
||||
`pending_delete` tinyint(1) unsigned default '0',
|
||||
`last_apply_utimestamp` int(10) unsigned NOT NULL default 0,
|
||||
`id_node` int(10) NOT NULL default 0,
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE (`id_policy`, `id_agent`)
|
||||
UNIQUE (`id_policy`, `id_agent`, `id_node`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
-- -----------------------------------------------------
|
||||
|
|
Loading…
Reference in New Issue