189 lines
5.8 KiB
PHP
189 lines
5.8 KiB
PHP
|
<?php
|
||
|
/**
|
||
|
* Group tactic view.
|
||
|
*
|
||
|
* @category Group Tactic View
|
||
|
* @package Pandora FMS
|
||
|
* @subpackage Opensource
|
||
|
* @version 1.0.0
|
||
|
* @license See below
|
||
|
*
|
||
|
* ______ ___ _______ _______ ________
|
||
|
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
|
||
|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
|
||
|
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
|
||
|
*
|
||
|
* ============================================================================
|
||
|
* Copyright (c) 2005-2021 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.
|
||
|
* ============================================================================
|
||
|
*/
|
||
|
|
||
|
// Test id group.
|
||
|
$id_group = 9;
|
||
|
|
||
|
global $config;
|
||
|
|
||
|
check_login();
|
||
|
|
||
|
if (! check_acl($config['id_user'], 0, 'PM')) {
|
||
|
db_pandora_audit(
|
||
|
AUDIT_LOG_ACL_VIOLATION,
|
||
|
'Trying to access Group Management'
|
||
|
);
|
||
|
include 'general/noaccess.php';
|
||
|
return;
|
||
|
}
|
||
|
|
||
|
if (is_metaconsole() === false) {
|
||
|
// Header.
|
||
|
ui_print_standard_header(
|
||
|
__('View tactic'),
|
||
|
'images/group.png',
|
||
|
false,
|
||
|
'',
|
||
|
false,
|
||
|
[],
|
||
|
[
|
||
|
[
|
||
|
'link' => '',
|
||
|
'label' => __('Monitoring'),
|
||
|
],
|
||
|
[
|
||
|
'link' => '',
|
||
|
'label' => __('Tactic group'),
|
||
|
],
|
||
|
]
|
||
|
);
|
||
|
}
|
||
|
|
||
|
ui_require_css_file('tactical_groups');
|
||
|
ui_require_javascript_file('tactical_groups');
|
||
|
$groups = groups_get_children($id_group);
|
||
|
$id_groups = [];
|
||
|
if (count($groups) > 0) {
|
||
|
foreach ($groups as $key => $value) {
|
||
|
$id_groups[] = $value['id_grupo'];
|
||
|
}
|
||
|
} else {
|
||
|
$id_groups[] = $id_group;
|
||
|
}
|
||
|
|
||
|
|
||
|
echo '<div id="tactic_view">';
|
||
|
echo '<table style="width: 100%;">';
|
||
|
echo '<tr>';
|
||
|
echo '<td class="tactical_group_left_column">';
|
||
|
$table_col1 = new stdClass();
|
||
|
$table_col1->class = 'no-class';
|
||
|
$table_col1->data = [];
|
||
|
$table_col1->rowclass[] = '';
|
||
|
$table_col1->headstyle[0] = 'text-align:center;';
|
||
|
$table_col1->width = '100%';
|
||
|
$table_col1->data[0][0] = groups_get_heat_map_agents($id_groups, 320, 100);
|
||
|
$table_col1->data[1][0] = tactical_groups_get_agents_and_monitoring($id_groups);
|
||
|
|
||
|
$distribution_by_so = '<table cellpadding=0 cellspacing=0 class="databox pies mrgn_top_15px" width=100%><tr><td style="width:50%;">';
|
||
|
$distribution_by_so .= '<fieldset class="padding-0 databox tactical_set" id="distribution_by_so_graph">';
|
||
|
$distribution_by_so .= '<legend>'.__('Distribution by so').'</legend>';
|
||
|
$distribution_by_so .= html_print_image('images/spinner.gif', true, ['id' => 'spinner_distribution_by_so_graph']);
|
||
|
$distribution_by_so .= '</fieldset>';
|
||
|
$distribution_by_so .= '</td></tr></table>';
|
||
|
|
||
|
|
||
|
$table_col1->data[2][0] = $distribution_by_so;
|
||
|
|
||
|
|
||
|
ui_toggle(
|
||
|
html_print_table($table_col1, true),
|
||
|
__('Monitoring'),
|
||
|
'',
|
||
|
'',
|
||
|
false,
|
||
|
false
|
||
|
);
|
||
|
|
||
|
echo '</td>';
|
||
|
echo '<td class="tactical_group_left_column">';
|
||
|
$table_col2 = new stdClass();
|
||
|
$table_col2->class = 'no-class';
|
||
|
$table_col2->data = [];
|
||
|
$table_col2->rowclass[] = '';
|
||
|
$table_col2->headstyle[0] = 'text-align:center;';
|
||
|
$table_col2->width = '100%';
|
||
|
$table_col2->data[0][0] = tactical_groups_get_stats_alerts($id_groups);
|
||
|
$table_col2->data[1][0] = groups_get_stats_modules_status($id_groups);
|
||
|
|
||
|
$events_by_agents_group = '<table cellpadding=0 cellspacing=0 class="databox pies mrgn_top_15px" width=100%><tr><td style="width:50%;">';
|
||
|
$events_by_agents_group .= '<fieldset class="padding-0 databox tactical_set" id="events_by_agents_group_graph">';
|
||
|
$events_by_agents_group .= '<legend>'.__('Events by agent').'</legend>';
|
||
|
$events_by_agents_group .= html_print_image('images/spinner.gif', true, ['id' => 'spinner_events_by_agents_group_graph']);
|
||
|
$events_by_agents_group .= '</fieldset>';
|
||
|
$events_by_agents_group .= '</td></tr></table>';
|
||
|
|
||
|
|
||
|
$table_col2->data[2][0] = $events_by_agents_group;
|
||
|
ui_toggle(
|
||
|
html_print_table($table_col2, true),
|
||
|
__('Alerts'),
|
||
|
'',
|
||
|
'',
|
||
|
false,
|
||
|
false
|
||
|
);
|
||
|
echo '</td>';
|
||
|
echo '<td class="tactical_group_right_column">';
|
||
|
$table_col3 = new stdClass();
|
||
|
$table_col3->class = 'no-class';
|
||
|
$table_col3->data = [];
|
||
|
$table_col3->rowclass[] = '';
|
||
|
$table_col3->headstyle[0] = 'text-align:center;';
|
||
|
$table_col3->width = '100%';
|
||
|
$table_col3->data[0][0] = 'En desarrollo';
|
||
|
|
||
|
|
||
|
ui_toggle(
|
||
|
html_print_table($table_col3, true),
|
||
|
__('Agents'),
|
||
|
'',
|
||
|
'',
|
||
|
false,
|
||
|
false
|
||
|
);
|
||
|
echo '</td>';
|
||
|
echo '</tr>';
|
||
|
echo '</table>';
|
||
|
|
||
|
|
||
|
?>
|
||
|
<script type="text/javascript">
|
||
|
$(document).ready(function () {
|
||
|
var parameters = {};
|
||
|
parameters["page"] = "include/ajax/group";
|
||
|
parameters["method"] = 'distributionBySoGraph';
|
||
|
parameters["id_group"] = <?php echo $id_group; ?>;
|
||
|
|
||
|
$.ajax({type: "GET",url: "<?php echo ui_get_full_url('ajax.php', false, false, false); ?>",data: parameters,
|
||
|
success: function(data) {
|
||
|
$("#spinner_distribution_by_so_graph").hide();
|
||
|
$("#distribution_by_so_graph").append(data);
|
||
|
}
|
||
|
});
|
||
|
|
||
|
parameters["method"] = 'groupEventsByAgent';
|
||
|
$.ajax({type: "GET",url: "<?php echo ui_get_full_url('ajax.php', false, false, false); ?>",data: parameters,
|
||
|
success: function(data) {
|
||
|
$("#spinner_events_by_agents_group_graph").hide();
|
||
|
$("#events_by_agents_group_graph").append(data);
|
||
|
}
|
||
|
});
|
||
|
|
||
|
});
|
||
|
</script>
|