Merge branch 'develop' of https://192.168.50.5:8081/artica/pandorafms into develop

This commit is contained in:
enriquecd 2017-01-19 16:29:00 +01:00
commit 75177057e7
41 changed files with 2808 additions and 1090 deletions

View File

@ -1,5 +1,5 @@
package: pandorafms-agent-unix
Version: 7.0dev-170118
Version: 7.0dev-170119
Architecture: all
Priority: optional
Section: admin

View File

@ -14,7 +14,7 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
pandora_version="7.0dev-170118"
pandora_version="7.0dev-170119"
echo "Test if you has the tools for to make the packages."
whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null

View File

@ -41,7 +41,7 @@ my $Sem = undef;
my $ThreadSem = undef;
use constant AGENT_VERSION => '7.0dev';
use constant AGENT_BUILD => '170118';
use constant AGENT_BUILD => '170119';
# Agent log default file size maximum and instances
use constant DEFAULT_MAX_LOG_SIZE => 600000;

View File

@ -3,7 +3,7 @@
#
%define name pandorafms_agent_unix
%define version 7.0dev
%define release 170118
%define release 170119
Summary: Pandora FMS Linux agent, PERL version
Name: %{name}

View File

@ -3,7 +3,7 @@
#
%define name pandorafms_agent_unix
%define version 7.0dev
%define release 170118
%define release 170119
Summary: Pandora FMS Linux agent, PERL version
Name: %{name}

View File

@ -10,7 +10,7 @@
# **********************************************************************
PI_VERSION="7.0dev"
PI_BUILD="170118"
PI_BUILD="170119"
OS_NAME=`uname -s`
FORCE=0

View File

@ -186,7 +186,7 @@ UpgradeApplicationID
{}
Version
{170118}
{170119}
ViewReadme
{Yes}

View File

@ -30,7 +30,7 @@ using namespace Pandora;
using namespace Pandora_Strutils;
#define PATH_SIZE _MAX_PATH+1
#define PANDORA_VERSION ("7.0dev(Build 170118)")
#define PANDORA_VERSION ("7.0dev(Build 170119)")
string pandora_path;
string pandora_dir;

View File

@ -11,7 +11,7 @@ BEGIN
VALUE "LegalCopyright", "Artica ST"
VALUE "OriginalFilename", "PandoraAgent.exe"
VALUE "ProductName", "Pandora FMS Windows Agent"
VALUE "ProductVersion", "(7.0dev(Build 170118))"
VALUE "ProductVersion", "(7.0dev(Build 170119))"
VALUE "FileVersion", "1.0.0.0"
END
END

View File

@ -1,5 +1,5 @@
package: pandorafms-console
Version: 7.0dev-170118
Version: 7.0dev-170119
Architecture: all
Priority: optional
Section: admin

View File

@ -14,7 +14,7 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
pandora_version="7.0dev-170118"
pandora_version="7.0dev-170119"
package_pear=0
package_pandora=1

View File

@ -292,7 +292,8 @@ function godmode_net_tools() {
else {
if (isset($config['network_tools_config'])) {
$network_tools_config = json_decode($config['network_tools_config'], true);
$network_tools_config_output = io_safe_output($config['network_tools_config']);
$network_tools_config = json_decode($network_tools_config_output, true);
$traceroute_path = $network_tools_config['traceroute_path'];
$ping_path = $network_tools_config['ping_path'];
$nmap_path = $network_tools_config['nmap_path'];

View File

@ -102,7 +102,8 @@ function sc_get_critical_events () {
$own_groups = array_keys(users_get_groups($config['id_user'], "IR", false));
// Get events in the last 8 hours
$shortcut_events_update = events_get_group_events($own_groups, 28800, time());
$shortcut_events_update = events_get_agent (false, 28800, time(), false, false, false, false,
false, false, $own_groups, true);
if ($shortcut_events_update == false)
$shortcut_events_update = array();

View File

@ -66,10 +66,36 @@ $extra_title = __('Network server module');
$data = array ();
$data[0] = __('Target IP');
//show agent_for defect;
if($ip_target == 'auto'){
$ip_target = agents_get_address ($id_agente);
if($page == 'enterprise/godmode/policies/policy_modules'){
if($ip_target != 'auto' && $ip_target != ''){
$custom_ip_target = $ip_target;
$ip_target = 'custom';
}
elseif($ip_target == ''){
$ip_target = 'force_pri';
$custom_ip_target = '';
}
else{
$custom_ip_target = '';
}
$target_ip_values = array();
$target_ip_values['auto'] = __('Auto');
$target_ip_values['force_pri'] = __('Force primary key');
$target_ip_values['custom'] = __('Custom');
$data[1] = html_print_select ($target_ip_values, 'ip_target', $ip_target, '', '', '',
true, false, false, '', false, 'width:200px;');
$data[1] .= html_print_input_text ('custom_ip_target', $custom_ip_target, '', 15, 60, true);
}
else{
if($ip_target == 'auto'){
$ip_target = agents_get_address ($id_agente);
}
$data[1] = html_print_input_text ('ip_target', $ip_target, '', 15, 60, true);
}
$data[1] = html_print_input_text ('ip_target', $ip_target, '', 15, 60, true);
// In ICMP modules, port is not configurable
if ($id_module_type >= 6 && $id_module_type <= 7) {
@ -351,6 +377,18 @@ $(document).ready (function () {
$('#snmp3_browser_privacy_pass').keyup(function() {
$('#snmp3_privacy_pass').val($(this).val());
});
var custom_ip_target = "<?php echo $custom_ip_target?>";
if(custom_ip_target == ''){
$("#text-custom_ip_target").hide();
}
$('#ip_target').change(function() {
if($(this).val() == 'custom') {
$("#text-custom_ip_target").show();
}
else{
$("#text-custom_ip_target").hide();
}
});
});
// Show the SNMP browser window

View File

@ -95,17 +95,15 @@ $percentil = false;
$time_compare_overlapped = false;
//Added for events items
$filter_event_validated = false;
$filter_event_no_validated = false;
$filter_event_critical = false;
$filter_event_warning = false;
$filter_event_type = false;
$show_summary_group = false;
$filter_event_severity = false;
$filter_event_type = false;
$filter_event_status = false;
$event_graph_by_agent = false;
$event_graph_by_user_validator = false;
$event_graph_by_criticity = false;
$event_graph_validated_vs_unvalidated = false;
$netflow_filter = 0;
$max_values = 0;
$resolution = 0;
@ -401,33 +399,19 @@ switch ($action) {
$group = $item['id_group'];
break;
case 'event_report_agent':
$description = $item['description'];
$idAgent = $item['id_agent'];
$period = $item['period'];
//Added for events items
$filter_event_no_validated = $style['filter_event_no_validated'];
$filter_event_validated = $style['filter_event_validated'];
$filter_event_critical = $style['filter_event_critical'];
$filter_event_warning = $style['filter_event_warning'];
$filter_event_type = json_decode($style['filter_event_type'], true);
$event_graph_by_agent = $style['event_graph_by_agent'];
$event_graph_by_user_validator = $style['event_graph_by_user_validator'];
$event_graph_by_criticity = $style['event_graph_by_criticity'];
$event_graph_validated_vs_unvalidated = $style['event_graph_validated_vs_unvalidated'];
break;
case 'event_report_group':
case 'event_report_module':
$description = $item['description'];
$period = $item['period'];
$group = $item['id_group'];
$idAgent = $item['id_agent'];
$idAgentModule = $item['id_agent_module'];
//Added for events items
$filter_event_no_validated = $style['filter_event_no_validated'];
$filter_event_validated = $style['filter_event_validated'];
$filter_event_critical = $style['filter_event_critical'];
$filter_event_warning = $style['filter_event_warning'];
$filter_event_type = json_decode($style['filter_event_type'], true);
$show_summary_group = $style['show_summary_group'];
$filter_event_severity = json_decode($style['filter_event_severity'], true);
$filter_event_status = json_decode($style['filter_event_status'], true);
$filter_event_type = json_decode($style['filter_event_type'], true);
$event_graph_by_agent = $style['event_graph_by_agent'];
$event_graph_by_user_validator = $style['event_graph_by_user_validator'];
@ -436,14 +420,6 @@ switch ($action) {
$filter_search = $style['event_filter_search'];
break;
case 'event_report_module':
$description = $item['description'];
$idAgentModule = $item['id_agent_module'];
$idAgent = db_get_value_filter('id_agente',
'tagente_modulo',
array('id_agente_modulo' => $idAgentModule));
$period = $item['period'];
break;
case 'general':
$description = $item['description'];
$group_by_agent = $item['group_by_agent'];
@ -999,10 +975,12 @@ You can of course remove the warnings, that's why we include the source and do n
if ((empty($agents)) || $agents == -1) $agents = array();
$agents_select = array();
foreach ($id_agents as $id) {
foreach ($agents as $key => $a) {
if ($key == (int)$id) {
$agents_select[$key] = $key;
if (is_array($id_agents) || is_object($id_agents)){
foreach ($id_agents as $id) {
foreach ($agents as $key => $a) {
if ($key == (int)$id) {
$agents_select[$key] = $key;
}
}
}
}
@ -1338,35 +1316,52 @@ You can of course remove the warnings, that's why we include the source and do n
?>
</td>
</tr>
<tr id="row_event_filter" style="" class="datos">
<td style="font-weight:bold;"><?php echo __('Event filter'); ?></td>
<tr id="row_show_summary_group" style="" class="datos">
<td style="font-weight:bold;"><?php echo __('Show Summary group'); ?></td>
<td>
<?php
echo __('No Validated');
html_print_checkbox ('filter_event_no_validated', true, $filter_event_no_validated);
echo __('Validated');
html_print_checkbox ('filter_event_validated', true, $filter_event_validated);
echo __('Critical');
html_print_checkbox ('filter_event_critical', true, $filter_event_critical);
echo __('Warning');
html_print_checkbox ('filter_event_warning', true, $filter_event_warning);
html_print_checkbox ('show_summary_group', true, $show_summary_group);
?>
</td>
</tr>
<tr id="row_event_severity" style="" class="datos">
<td style="font-weight:bold;"><?php echo __('Severity'); ?></td>
<td>
<?php
$valuesSeverity = get_priorities ();
html_print_select ($valuesSeverity, 'filter_event_severity[]',
$filter_event_severity, '', __('All'), '-1', false, true,
false, '', false, false, false, false, false, '');
?>
</td>
</tr>
<tr id="row_event_type" style="" class="datos">
<td style="font-weight:bold;"><?php echo __('Event type'); ?></td>
<td>
<?php
$event_types_select = get_event_types();
html_print_select ($event_types_select, 'filter_event_type[]',
$filter_event_type, '', __('All'), 'all', false, true,
false, '', false, false, false, false, false, '');
$event_types_select = get_event_types();
html_print_select ($event_types_select, 'filter_event_type[]',
$filter_event_type, '', __('All'), 'all', false, true,
false, '', false, false, false, false, false, '');
?>
</td>
</tr>
<tr id="row_event_status" style="" class="datos">
<td style="font-weight:bold;"><?php echo __('Event Status'); ?></td>
<td>
<?php
$fields = events_get_all_status(true);
html_print_select ($fields, 'filter_event_status[]',
$filter_event_status, '', '', '', false, true,
false, '', false, false, false, false, false, '');
?>
</td>
</tr>
<tr id="row_event_graphs" style="" class="datos">
<td style="font-weight:bold;"><?php echo __('Event graphs'); ?></td>
<td>
@ -1428,9 +1423,7 @@ You can of course remove the warnings, that's why we include the source and do n
?>
</td>
</tr>
<tr id="row_filter_search" style="" class="datos">
<td style="font-weight:bold;"><?php echo __('Free search');?></td>
<td>
@ -1984,7 +1977,7 @@ $(document).ready (function () {
switch (data) {
case 'boolean':
case 'sparse':
$("#row_percentil").show();
//$("#row_percentil").show();
break;
default:
$("#row_percentil").hide();
@ -1994,6 +1987,47 @@ $(document).ready (function () {
});
});
$("#submit-create_item").click(function () {
var type = $('#type').val();
switch (type){
case 'alert_report_module': case 'alert_report_agent': case 'alert_report_group':
case 'event_report_agent': case 'event_report_module': case 'event_report_group':
case 'simple_graph': case 'simple_baseline_graph': case 'TTRT': case 'TTO':
case 'MTBF': case 'MTTR': case 'prediction_date': case 'projection_graph':
case 'avg_value': case 'max_value': case 'min_value': case 'monitor_report':
case 'database_serialized': case 'sumatory': case 'historical_data':
case 'agent_configuration':
if ($("#hidden-id_agent").val() == 0) {
alert( <?php echo "'" . __('Please select Agent'). "'"; ?> );
return false;
}
break;
default:
break;
}
});
$("#submit-edit_item").click(function () {
var type = $('#type').val();
switch (type){
case 'alert_report_module': case 'alert_report_agent': case 'alert_report_group':
case 'event_report_agent': case 'event_report_module': case 'event_report_group':
case 'simple_graph': case 'simple_baseline_graph': case 'TTRT': case 'TTO':
case 'MTBF': case 'MTTR': case 'prediction_date': case 'projection_graph':
case 'avg_value': case 'max_value': case 'min_value': case 'monitor_report':
case 'database_serialized': case 'sumatory': case 'historical_data':
case 'agent_configuration':
if ($("#hidden-id_agent").val() == 0) {
alert( <?php echo "'" . __('Please select Agent'). "'"; ?> );
return false;
}
break;
default:
break;
}
});
});
@ -2479,7 +2513,6 @@ function chooseType() {
$("#row_date").hide();
$("#row_agent_multi").hide();
$("#row_module_multi").hide();
$("#row_event_filter").hide();
$("#row_event_graphs").hide();
$("#row_event_graph_by_agent").hide();
$("#row_event_graph_by_user").hide();
@ -2494,7 +2527,10 @@ function chooseType() {
$("#agents_row").hide();
$("#select_agent_modules").hide();
$("#modules_row").hide();
$("#row_show_summary_group").hide();
$("#row_event_severity").hide();
$("#row_event_type").hide();
$("#row_event_status").hide();
// SLA list default state
$("#sla_list").hide();
@ -2510,24 +2546,6 @@ function chooseType() {
$('#agent_autocomplete_events').show();
switch (type) {
case 'event_report_group':
$("#row_description").show();
$("#row_period").show();
$("#row_servers").show();
$("#row_group").show();
$("#row_show_in_two_columns").show();
$("#row_event_filter").show();
$("#row_event_graphs").show();
$("#row_event_graph_by_agent").show();
$("#row_event_graph_by_user").show();
$("#row_event_graph_by_criticity").show();
$("#row_event_graph_by_validated").show();
$("#row_event_type").show();
$("#row_filter_search").show();
break;
case 'simple_graph':
$("#row_time_compare_overlapped").show();
$("#row_only_avg").show();
@ -2782,21 +2800,44 @@ function chooseType() {
$("#row_show_in_two_columns").show();
break;
case 'event_report_agent':
case 'event_report_group':
$("#row_description").show();
$("#row_agent").show();
$("#row_period").show();
$("#row_show_in_two_columns").show();
$("#row_event_filter").show();
$("#row_event_graphs").show();
$("#row_servers").show();
$("#row_group").show();
$("#row_event_severity").show();
$("#row_event_status").show();
$("#row_show_summary_group").show();
$("#row_event_graph_by_agent").show();
$("#row_event_graph_by_user").show();
$("#row_event_graph_by_criticity").show();
$("#row_event_graph_by_validated").show();
$("#row_event_type").show();
$("#row_filter_search").show();
break;
case 'event_report_agent':
$("#row_description").show();
$("#row_agent").show();
$("#row_period").show();
$("#row_event_severity").show();
$("#row_event_status").show();
$("#row_show_summary_group").show();
$("#row_event_graphs").show();
$("#row_event_type").show();
$("#row_event_graph_by_user").show();
$("#row_event_graph_by_criticity").show();
$("#row_event_graph_by_validated").show();
$('#agent_autocomplete').hide();
$('#agent_autocomplete_events').show();
$("#row_filter_search").show();
break;
case 'event_report_module':
@ -2804,15 +2845,19 @@ function chooseType() {
$("#row_agent").show();
$("#row_module").show();
$("#row_period").show();
$("#row_show_in_two_columns").show();
$("#row_event_graph_by_agent").show();
$("#row_event_severity").show();
$("#row_event_status").show();
$("#row_show_summary_group").show();
$("#row_event_graphs").show();
$("#row_event_type").show();
$("#row_event_graph_by_user").show();
$("#row_event_graph_by_criticity").show();
$("#row_event_graph_by_validated").show();
$('#agent_autocomplete').hide();
$('#agent_autocomplete_events').show();
$("#row_filter_search").show();
break;
case 'general':

View File

@ -1065,15 +1065,14 @@ switch ($action) {
$resultOperationDB = false;
break;
}
$filter_event_validated = get_parameter('filter_event_validated', 0);
$filter_event_no_validated = get_parameter('filter_event_no_validated', 0);
$filter_event_critical = get_parameter('filter_event_critical', 0);
$filter_event_warning = get_parameter('filter_event_warning', 0);
$filter_event_type = get_parameter('filter_event_type', '');
$event_graph_by_agent = get_parameter('event_graph_by_agent', 0);
$event_graph_by_user_validator = get_parameter('event_graph_by_user_validator', 0);
$event_graph_by_criticity = get_parameter('event_graph_by_criticity', 0);
$show_summary_group = get_parameter('show_summary_group', 0);
$filter_event_severity = get_parameter('filter_event_severity', 0);
$filter_event_type = get_parameter('filter_event_type', '');
$filter_event_status = get_parameter('filter_event_status', 0);
$event_graph_by_agent = get_parameter('event_graph_by_agent', 0);
$event_graph_by_user_validator = get_parameter('event_graph_by_user_validator', 0);
$event_graph_by_criticity = get_parameter('event_graph_by_criticity', 0);
$event_graph_validated_vs_unvalidated = get_parameter('event_graph_validated_vs_unvalidated', 0);
$event_filter_search = get_parameter('filter_search', '');
@ -1135,12 +1134,13 @@ switch ($action) {
switch ($values['type']) {
case 'event_report_agent':
case 'event_report_group':
case 'event_report_module':
//Added for events items
$style['filter_event_no_validated'] = $filter_event_no_validated;
$style['filter_event_validated'] = $filter_event_validated;
$style['filter_event_critical'] = $filter_event_critical;
$style['filter_event_warning'] = $filter_event_warning;
$style['filter_event_type'] = json_encode($filter_event_type);
$style['show_summary_group'] = $show_summary_group;
$style['filter_event_severity'] = json_encode($filter_event_severity);
$style['filter_event_type'] = json_encode($filter_event_type);
$style['filter_event_status'] = json_encode($filter_event_status);
$style['event_graph_by_agent'] = $event_graph_by_agent;
$style['event_graph_by_user_validator'] = $event_graph_by_user_validator;
$style['event_graph_by_criticity'] = $event_graph_by_criticity;
@ -1148,10 +1148,8 @@ switch ($action) {
switch ($values['type']) {
case 'event_report_group':
$style['event_filter_search'] =
$event_filter_search;
break;
case 'event_report_agent':
$style['event_filter_search'] = $event_filter_search;
if ($label != '')
$style['label'] = $label;
else
@ -1170,7 +1168,6 @@ switch ($action) {
$style['label'] = '';
break;
case 'agent_configuration':
case 'event_report_module':
case 'alert_report_agent':
case 'alert_report_module':
case 'historical_data':
@ -1450,37 +1447,35 @@ switch ($action) {
switch ($values['type']) {
case 'event_report_agent':
case 'event_report_group':
$filter_event_no_validated = get_parameter('filter_event_no_validated', 0);
$filter_event_validated = get_parameter('filter_event_validated', 0);
$filter_event_critical = get_parameter('filter_event_critical', 0);
$filter_event_warning = get_parameter('filter_event_warning', 0);
case 'event_report_module':
$show_summary_group = get_parameter('show_summary_group', 0);
$filter_event_severity = get_parameter('filter_event_severity', '');
$filter_event_type = get_parameter('filter_event_type', '');
$filter_event_status = get_parameter('filter_event_status', '');
$event_graph_by_agent = get_parameter('event_graph_by_agent', 0);
$event_graph_by_user_validator = get_parameter('event_graph_by_user_validator', 0);
$event_graph_by_criticity = get_parameter('event_graph_by_criticity', 0);
$event_graph_by_agent = get_parameter('event_graph_by_agent', 0);
$event_graph_by_user_validator = get_parameter('event_graph_by_user_validator', 0);
$event_graph_by_criticity = get_parameter('event_graph_by_criticity', 0);
$event_graph_validated_vs_unvalidated = get_parameter('event_graph_validated_vs_unvalidated', 0);
$filter_event_type = get_parameter('filter_event_type', '');
$event_filter_search = get_parameter('filter_search', '');
//Added for events items
$style['filter_event_no_validated'] = $filter_event_no_validated;
$style['filter_event_validated'] = $filter_event_validated;
$style['filter_event_critical'] = $filter_event_critical;
$style['filter_event_warning'] = $filter_event_warning;
$style['filter_event_type'] = json_encode($filter_event_type);
$style['event_graph_by_agent'] = $event_graph_by_agent;
$style['event_graph_by_user_validator'] = $event_graph_by_user_validator;
$style['event_graph_by_criticity'] = $event_graph_by_criticity;
$style['show_summary_group'] = $show_summary_group;
$style['filter_event_severity'] = json_encode($filter_event_severity);
$style['filter_event_type'] = json_encode($filter_event_type);
$style['filter_event_status'] = json_encode($filter_event_status);
$style['event_graph_by_agent'] = $event_graph_by_agent;
$style['event_graph_by_user_validator'] = $event_graph_by_user_validator;
$style['event_graph_by_criticity'] = $event_graph_by_criticity;
$style['event_graph_validated_vs_unvalidated'] = $event_graph_validated_vs_unvalidated;
switch ($values['type']) {
case 'event_report_group':
$style['event_filter_search'] =
$event_filter_search;
break;
case 'event_report_agent':
$style['event_filter_search'] = $event_filter_search;
if ($label != '')
$style['label'] = $label;
else
@ -1500,7 +1495,6 @@ switch ($action) {
$style['label'] = '';
break;
case 'agent_configuration':
case 'event_report_module':
case 'alert_report_agent':
case 'alert_report_module':
case 'historical_data':

View File

@ -1265,7 +1265,7 @@ function hiddenFields(item) {
$("#percentile_item_row_4." + item).css('display', '');
$("#period_row").css('display', 'none');
$("#period_row." + item).css('display', '');
$("#period_row." + item).css('display', 'none');
$("#size_row").css('display', 'none');
$("#size_row." + item).css('display', '');
@ -1335,7 +1335,7 @@ function cleanFields(item) {
$("input[name=top]").val(0);
$("input[name=agent]").val('');
$("select[name=module]").val('');
$("input[name=process_value]").val('');
$("select[name=process_value]").val(0);
$("select[name=background_image]").val('');
$("input[name=width_percentile]").val('');
$("input[name=max_percentile]").val('');

View File

@ -75,7 +75,7 @@ if (!defined('METACONSOLE')) {
echo '<div id="frame_view" style="width: 100%; height: 500px; overflow: scroll; margin: 0 auto;">';
}
else {
echo '<div id="frame_view" style="width: 919px; height: 500px; overflow: scroll; margin: 0 auto;">';
echo '<div id="frame_view" style="overflow: auto; margin: 0px auto; padding: 5px; ">';
}
echo '<div id="background" class="" style="top:50px;
margin: 0px auto;border: 1px lightgray solid; width: ' . $widthBackground . 'px; height: ' . $heightBackground . 'px;">';

View File

@ -1435,7 +1435,7 @@ class Tree {
$module['type'] = 'module';
$module['id'] = (int) $module['id'];
$module['name'] = $module['name'];
$module['name'] = io_safe_output($module['name']);
$module['id_module_type'] = (int) $module['id_tipo_modulo'];
$module['server_type'] = (int) $module['id_modulo'];
$module['status'] = $module['estado'];

View File

@ -22,7 +22,7 @@
/**
* Pandora build version and version
*/
$build_version = 'PC170118';
$build_version = 'PC170119';
$pandora_version = 'v7.0dev';
// Do not overwrite default timezone set if defined.

View File

@ -109,6 +109,20 @@ function events_get_event ($id, $fields = false) {
return $event;
}
function events_get_events_no_grouped($sql_post, $offset = 0,
$pagination = 1, $meta = false, $history = false, $total = false,
$history_db = false, $order = "ASC") {
global $config;
$table = events_get_events_table($meta, $history);
$sql = "SELECT * FROM $table te WHERE 1=1 " . $sql_post;
$events = db_get_all_rows_sql ($sql, $history_db);
return $events;
}
function events_get_events_grouped($sql_post, $offset = 0,
$pagination = 1, $meta = false, $history = false, $total = false,
@ -124,7 +138,7 @@ function events_get_events_grouped($sql_post, $offset = 0,
else {
$groupby_extra = '';
}
switch ($config["dbtype"]) {
case "mysql":
db_process_sql ('SET group_concat_max_len = 9999999');
@ -136,19 +150,19 @@ function events_get_events_grouped($sql_post, $offset = 0,
}
else {
$sql = "SELECT *, MAX(id_evento) AS id_evento,
GROUP_CONCAT(DISTINCT user_comment SEPARATOR '<br>') AS user_comment,
GROUP_CONCAT(DISTINCT id_evento SEPARATOR ',') AS similar_ids,
COUNT(*) AS event_rep, MAX(utimestamp) AS timestamp_rep,
MIN(utimestamp) AS timestamp_rep_min,
(SELECT owner_user FROM $table WHERE id_evento = MAX(te.id_evento)) owner_user,
(SELECT id_usuario FROM $table WHERE id_evento = MAX(te.id_evento)) id_usuario,
(SELECT id_agente FROM $table WHERE id_evento = MAX(te.id_evento)) id_agente,
(SELECT criticity FROM $table WHERE id_evento = MAX(te.id_evento)) AS criticity,
(SELECT ack_utimestamp FROM $table WHERE id_evento = MAX(te.id_evento)) AS ack_utimestamp
FROM $table te
WHERE 1=1 " . $sql_post . "
GROUP BY estado, evento, id_agentmodule" . $groupby_extra . "
ORDER BY timestamp_rep " . $order . " LIMIT " . $offset . "," . $pagination;
GROUP_CONCAT(DISTINCT user_comment SEPARATOR '<br>') AS user_comment,
GROUP_CONCAT(DISTINCT id_evento SEPARATOR ',') AS similar_ids,
COUNT(*) AS event_rep, MAX(utimestamp) AS timestamp_rep,
MIN(utimestamp) AS timestamp_rep_min,
(SELECT owner_user FROM $table WHERE id_evento = MAX(te.id_evento)) owner_user,
(SELECT id_usuario FROM $table WHERE id_evento = MAX(te.id_evento)) id_usuario,
(SELECT id_agente FROM $table WHERE id_evento = MAX(te.id_evento)) id_agente,
(SELECT criticity FROM $table WHERE id_evento = MAX(te.id_evento)) AS criticity,
(SELECT ack_utimestamp FROM $table WHERE id_evento = MAX(te.id_evento)) AS ack_utimestamp
FROM $table te
WHERE 1=1 " . $sql_post . "
GROUP BY estado, evento, id_agentmodule" . $groupby_extra . "
ORDER BY timestamp_rep " . $order . " LIMIT " . $offset . "," . $pagination;
}
break;
case "postgresql":
@ -210,7 +224,6 @@ function events_get_events_grouped($sql_post, $offset = 0,
}
break;
}
//Extract the events by filter (or not) from db
$events = db_get_all_rows_sql ($sql, $history_db);
@ -1173,89 +1186,6 @@ function events_print_type_description ($type, $return = false) {
echo $output;
}
/**
* Get all the events happened in a group during a period of time.
*
* The returned events will be in the time interval ($date - $period, $date]
*
* @param mixed $id_group Group id to get events for.
* @param int $period Period of time in seconds to get events.
* @param int $date Beginning date to get events.
*
* @return array An array with all the events happened.
*/
function events_get_group_events ($id_group, $period, $date,
$filter_event_validated = false, $filter_event_critical = false,
$filter_event_warning = false, $filter_event_no_validated = false,
$filter_event_search = false, $meta = false, $history = false,
$filter_event_type = false) {
global $config;
$id_group = groups_safe_acl ($config["id_user"], $id_group, "ER");
if (empty ($id_group)) {
//An empty array means the user doesn't have access
return false;
}
$datelimit = $date - $period;
$sql_where = ' AND 1 = 1 ';
$criticities = array();
if ($filter_event_critical) {
$criticities[] = 4;
}
if ($filter_event_warning) {
$criticities[] = 3;
}
if (!empty($criticities)) {
$sql_where .= ' AND criticity IN (' . implode(', ', $criticities) . ')';
}
if ($filter_event_validated) {
$sql_where .= ' AND estado = 1 ';
}
if ($filter_event_no_validated) {
$sql_where .= ' AND estado = 0 ';
}
if (!empty($filter_event_search)) {
$sql_where .= ' AND (evento LIKE "%'. io_safe_input($filter_event_search) . '%"'.
' OR id_evento LIKE "%' . io_safe_input($filter_event_search) . '%")';
}
if (!empty($filter_event_type) && $filter_event_type[0] != 'all') {
$sql_where .= ' AND (';
$type = array();
foreach ($filter_event_type as $event_type) {
if ($event_type != "") {
// If normal, warning, could be several (going_up_warning, going_down_warning... too complex
// for the user so for him is presented only "warning, critical and normal"
if ($event_type == "warning" || $event_type == "critical" || $event_type == "normal") {
$type[] = " event_type LIKE '%$event_type%' ";
}
else if ($event_type == "not_normal") {
$type[] = " (event_type LIKE '%warning%' OR event_type LIKE '%critical%' OR event_type LIKE '%unknown%') ";
}
else if ($event_type != "all") {
$type[] = " event_type = '" . $event_type."'";
}
}
}
$sql_where .= implode(' OR ', $type) . ')';
}
$sql_where .= sprintf('
AND id_grupo IN (%s)
AND utimestamp > %d
AND utimestamp <= %d ',
implode (",", $id_group), $datelimit, $date);
return events_get_events_grouped($sql_where, 0, 1000, $meta,
false, false, $history);
}
/**
* Get all the events happened in a group during a period of time.
*
@ -1328,46 +1258,72 @@ function events_get_group_events_steps ($begin, &$result, $id_group, $period, $d
*
* @return array An array with all the events happened.
*/
function events_get_agent ($id_agent, $period, $date = 0,
$filter_event_validated = false, $filter_event_critical = false,
$filter_event_warning = false, $filter_event_no_validated = false,
$history = false, $filter_event_type = false) {
function events_get_agent ($id_agent, $period, $date = 0,
$history = false, $show_summary_group = false, $filter_event_severity = false,
$filter_event_type = false, $filter_event_status = false, $filter_event_filter_search=false,
$id_group = false, $events_group = false, $id_agent_module = false, $events_module = false) {
global $config;
if (!is_numeric ($date)) {
$date = strtotime ($date);
}
if (empty ($date)) {
$date = get_system_time ();
}
if($events_group){
$id_group = groups_safe_acl ($config["id_user"], $id_group, "ER");
$datelimit = $date - $period;
$sql_where = '';
$criticities = array();
if ($filter_event_critical) {
$criticities[] = 4;
}
if ($filter_event_warning) {
$criticities[] = 3;
}
if (!empty($criticities)) {
$sql_where .= ' AND criticity IN (' . implode(', ', $criticities) . ')';
}
if ( $filter_event_validated && $filter_event_no_validated ) {
$sql_where .= " AND (estado = 1 OR estado = 0)";
}
else {
if ($filter_event_validated) {
$sql_where .= ' AND estado = 1 ';
} else {
if ($filter_event_no_validated) {
$sql_where .= ' AND estado = 0 ';
}
if (empty ($id_group)) {
//An empty array means the user doesn't have access
return false;
}
}
$datelimit = $date - $period;
$sql_where = '';
$severity_all = 0;
if (!empty($filter_event_severity)) {
foreach ($filter_event_severity as $key => $value) {
switch ($value) {
case -1:
$severity_all = 1;
break;
case 34:
$filter_event_severity[$key] = '3, 4';
break;
case 20:
$filter_event_severity[$key] = '0, 1, 3, 4, 5, 6';
break;
case 21:
$filter_event_severity[$key] = '4, 2';
break;
default:
break;
}
}
if(!$severity_all){
$sql_where .= ' AND criticity IN (' . implode(', ', $filter_event_severity) . ')';
}
}
$status_all = 0;
if(!empty($filter_event_status)){
foreach ($filter_event_status as $key => $value) {
switch ($value) {
case -1:
$status_all = 1;
break;
default:
break;
}
}
if(!$status_all){
$sql_where .= ' AND estado IN (' . implode(', ', $filter_event_status) . ')';
}
}
if (!empty($filter_event_type) && $filter_event_type[0] != 'all') {
$sql_where .= ' AND (';
$type = array();
@ -1386,52 +1342,35 @@ function events_get_agent ($id_agent, $period, $date = 0,
}
}
}
$sql_where .= implode(' OR ', $type) . ')';
}
$sql_where .= sprintf(' AND id_agente = %d AND utimestamp > %d
AND utimestamp <= %d ', $id_agent, $datelimit, $date);
return events_get_events_grouped($sql_where, 0, 1000,
is_metaconsole(), false, false, $history);
}
/**
* Get all the events happened in an Agent during a period of time.
*
* The returned events will be in the time interval ($date - $period, $date]
*
* @param int $id_agent_module Module id to get events.
* @param int $period Period of time in seconds to get events.
* @param int $date Beginning date to get events.
*
* @return array An array with all the events happened.
*/
function events_get_module ($id_agent_module, $period, $date = 0, $history = false) {
global $config;
if (!is_numeric ($date)) {
$date = strtotime ($date);
}
if (empty ($date)) {
$date = get_system_time ();
if (!empty($filter_event_filter_search)) {
$sql_where .= ' AND (evento LIKE "%'. io_safe_input($filter_event_filter_search) . '%"'.
' OR id_evento LIKE "%' . io_safe_input($filter_event_filter_search) . '%")';
}
$datelimit = $date - $period;
$sql_where = sprintf(' AND id_agentmodule = %d AND utimestamp > %d
if($events_group){
$sql_where .= sprintf(' AND id_grupo IN (%s) AND utimestamp > %d
AND utimestamp <= %d ', implode (",", $id_group), $datelimit, $date);
}
elseif($events_module){
$sql_where .= sprintf(' AND id_agentmodule = %d AND utimestamp > %d
AND utimestamp <= %d ', $id_agent_module, $datelimit, $date);
return events_get_events_grouped($sql_where, 0, 1000, false,
false, false, $history);
$sql = sprintf ('SELECT evento, event_type, criticity, count(*) as count_rep, max(timestamp) AS time2
FROM tevento
WHERE id_agentmodule = %d AND utimestamp > %d AND utimestamp <= %d
GROUP BY id_agentmodule, evento ORDER BY time2 DESC', $id_agent_module, $datelimit, $date);
return db_get_all_rows_sql ($sql);
}
else{
$sql_where .= sprintf(' AND id_agente = %d AND utimestamp > %d
AND utimestamp <= %d ', $id_agent, $datelimit, $date);
}
if($show_summary_group){
return events_get_events_grouped($sql_where, 0, 1000,
is_metaconsole(), false, false, $history);
}
else{
return events_get_events_no_grouped($sql_where, 0, 1000,
is_metaconsole(), false, false, $history);
}
}
/**
@ -1549,13 +1488,22 @@ function events_get_severity_types ($severity_id) {
*
* @return array Status description array.
*/
function events_get_all_status () {
function events_get_all_status ($report = false) {
$fields = array ();
$fields[-1] = __('All event');
$fields[0] = __('Only new');
$fields[1] = __('Only validated');
$fields[2] = __('Only in process');
$fields[3] = __('Only not validated');
if(!$report){
$fields[-1] = __('All event');
$fields[0] = __('Only new');
$fields[1] = __('Only validated');
$fields[2] = __('Only in process');
$fields[3] = __('Only not validated');
}
else{
$fields[-1] = __('All event');
$fields[0] = __('New');
$fields[1] = __('Validated');
$fields[2] = __('In process');
$fields[3] = __('Not Validated');
}
return $fields;
}
@ -2643,12 +2591,20 @@ function events_clean_tags ($tags) {
* @return array An array with all the events happened.
*/
function events_get_count_events_by_agent ($id_group, $period, $date,
$filter_event_validated = false, $filter_event_critical = false,
$filter_event_warning = false, $filter_event_no_validated = false,
$filter_event_search = false) {
$filter_event_severity = false, $filter_event_type = false,
$filter_event_status = false, $filter_event_filter_search = false) {
global $config;
//date
if (!is_numeric ($date)) {
$date = strtotime ($date);
}
if (empty ($date)) {
$date = get_system_time ();
}
//group
$id_group = groups_safe_acl ($config["id_user"], $id_group, "AR");
if (empty ($id_group)) {
@ -2658,30 +2614,74 @@ function events_get_count_events_by_agent ($id_group, $period, $date,
$datelimit = $date - $period;
$sql_where = ' AND 1 = 1 ';
$criticities = array();
if ($filter_event_critical) {
$criticities[] = 4;
$sql_where = '';
$severity_all = 0;
if (!empty($filter_event_severity)) {
foreach ($filter_event_severity as $key => $value) {
switch ($value) {
case -1:
$severity_all = 1;
break;
case 34:
$filter_event_severity[$key] = '3, 4';
break;
case 20:
$filter_event_severity[$key] = '0, 1, 3, 4, 5, 6';
break;
case 21:
$filter_event_severity[$key] = '4, 2';
break;
default:
break;
}
}
if(!$severity_all){
$sql_where .= ' AND criticity IN (' . implode(', ', $filter_event_severity) . ')';
}
}
if ($filter_event_warning) {
$criticities[] = 3;
}
if (!empty($criticities)) {
$sql_where .= ' AND criticity IN (' . implode(', ', $criticities) . ')';
$status_all = 0;
if(!empty($filter_event_status)){
foreach ($filter_event_status as $key => $value) {
switch ($value) {
case -1:
$status_all = 1;
break;
default:
break;
}
}
if(!$status_all){
$sql_where .= ' AND estado IN (' . implode(', ', $filter_event_status) . ')';
}
}
if ($filter_event_validated) {
$sql_where .= ' AND estado = 1 ';
if (!empty($filter_event_type) && $filter_event_type[0] != 'all') {
$sql_where .= ' AND (';
$type = array();
foreach ($filter_event_type as $event_type) {
if ($event_type != "") {
// If normal, warning, could be several (going_up_warning, going_down_warning... too complex
// for the user so for him is presented only "warning, critical and normal"
if ($event_type == "warning" || $event_type == "critical" || $event_type == "normal") {
$type[] = " event_type LIKE '%$event_type%' ";
}
else if ($event_type == "not_normal") {
$type[] = " (event_type LIKE '%warning%' OR event_type LIKE '%critical%' OR event_type LIKE '%unknown%') ";
}
else if ($event_type != "all") {
$type[] = " event_type = '" . $event_type."'";
}
}
}
$sql_where .= implode(' OR ', $type) . ')';
}
if ($filter_event_no_validated) {
$sql_where .= ' AND estado = 0 ';
if (!empty($filter_event_filter_search)) {
$sql_where .= ' AND (evento LIKE "%'. io_safe_input($filter_event_filter_search) . '%"'.
' OR id_evento LIKE "%' . io_safe_input($filter_event_filter_search) . '%")';
}
if (!empty($filter_event_search)) {
$sql_where .= ' AND (evento LIKE "%%'. io_safe_input($filter_event_search) . '%%"'.
' OR id_evento LIKE "%%' . io_safe_input($filter_event_search) . '%%")';
}
$sql = sprintf ('SELECT id_agente,
(SELECT t2.nombre
FROM tagente t2
@ -2689,9 +2689,9 @@ function events_get_count_events_by_agent ($id_group, $period, $date,
COUNT(*) AS count
FROM tevento t3
WHERE utimestamp > %d AND utimestamp <= %d
AND id_grupo IN (%s) ' . $sql_where . '
AND id_grupo IN (%s) %s
GROUP BY id_agente',
$datelimit, $date, implode (",", $id_group));
$datelimit, $date, implode (",", $id_group), $sql_where);
$rows = db_get_all_rows_sql ($sql);
@ -2722,12 +2722,10 @@ function events_get_count_events_by_agent ($id_group, $period, $date,
* @return array An array with all the events happened.
*/
function events_get_count_events_validated_by_user ($filter, $period, $date,
$filter_event_validated = false, $filter_event_critical = false,
$filter_event_warning = false, $filter_event_no_validated = false,
$filter_event_search = false) {
$filter_event_severity = false, $filter_event_type = false,
$filter_event_status = false, $filter_event_filter_search = false) {
global $config;
//group
$sql_filter = ' AND 1=1 ';
if (isset($filter['id_group'])) {
$id_group = groups_safe_acl ($config["id_user"], $filter['id_group'], "AR");
@ -2740,35 +2738,93 @@ function events_get_count_events_validated_by_user ($filter, $period, $date,
$sql_filter .=
sprintf(' AND id_grupo IN (%s) ', implode (",", $id_group));
}
if (!empty($filter['id_agent'])) {
$sql_filter .=
sprintf(' AND id_agente = %d ', $filter['id_agent']);
}
if(!empty($filter['id_agentmodule'])){
$sql_filter .=
sprintf(' AND id_agentmodule = %d ', $filter['id_agentmodule']);
}
//date
if (!is_numeric ($date)) {
$date = strtotime ($date);
}
if (empty ($date)) {
$date = get_system_time ();
}
$datelimit = $date - $period;
$sql_where = ' AND 1 = 1 ';
$criticities = array();
if ($filter_event_critical) {
$criticities[] = 4;
$sql_where = '';
$severity_all = 0;
if (!empty($filter_event_severity)) {
foreach ($filter_event_severity as $key => $value) {
switch ($value) {
case -1:
$severity_all = 1;
break;
case 34:
$filter_event_severity[$key] = '3, 4';
break;
case 20:
$filter_event_severity[$key] = '0, 1, 3, 4, 5, 6';
break;
case 21:
$filter_event_severity[$key] = '4, 2';
break;
default:
break;
}
}
if(!$severity_all){
$sql_where .= ' AND criticity IN (' . implode(', ', $filter_event_severity) . ')';
}
}
if ($filter_event_warning) {
$criticities[] = 3;
}
if (!empty($criticities)) {
$sql_where .= ' AND criticity IN (' . implode(', ', $criticities) . ')';
$status_all = 0;
if(!empty($filter_event_status)){
foreach ($filter_event_status as $key => $value) {
switch ($value) {
case -1:
$status_all = 1;
break;
default:
break;
}
}
if(!$status_all){
$sql_where .= ' AND estado IN (' . implode(', ', $filter_event_status) . ')';
}
}
if ($filter_event_validated) {
$sql_where .= ' AND estado = 1 ';
if (!empty($filter_event_type) && $filter_event_type[0] != 'all') {
$sql_where .= ' AND (';
$type = array();
foreach ($filter_event_type as $event_type) {
if ($event_type != "") {
// If normal, warning, could be several (going_up_warning, going_down_warning... too complex
// for the user so for him is presented only "warning, critical and normal"
if ($event_type == "warning" || $event_type == "critical" || $event_type == "normal") {
$type[] = " event_type LIKE '%$event_type%' ";
}
else if ($event_type == "not_normal") {
$type[] = " (event_type LIKE '%warning%' OR event_type LIKE '%critical%' OR event_type LIKE '%unknown%') ";
}
else if ($event_type != "all") {
$type[] = " event_type = '" . $event_type."'";
}
}
}
$sql_where .= implode(' OR ', $type) . ')';
}
if ($filter_event_no_validated) {
$sql_where .= ' AND estado = 0 ';
}
if (!empty($filter_event_search)) {
$sql_where .= ' AND (evento LIKE "%%'. io_safe_input($filter_event_search) . '%%"'.
' OR id_evento LIKE "%%' . io_safe_input($filter_event_search) . '%%")';
if (!empty($filter_event_filter_search)) {
$sql_where .= ' AND (evento LIKE "%'. io_safe_input($filter_event_filter_search) . '%"'.
' OR id_evento LIKE "%' . io_safe_input($filter_event_filter_search) . '%")';
}
$sql = sprintf ('SELECT id_usuario,
@ -2778,10 +2834,9 @@ function events_get_count_events_validated_by_user ($filter, $period, $date,
COUNT(*) AS count
FROM tevento t3
WHERE utimestamp > %d AND utimestamp <= %d
%s ' . $sql_where . '
%s %s
GROUP BY id_usuario',
$datelimit, $date, $sql_filter);
$datelimit, $date, $sql_filter, $sql_where);
$rows = db_get_all_rows_sql ($sql);
if ($rows == false)
@ -2795,7 +2850,6 @@ function events_get_count_events_validated_by_user ($filter, $period, $date,
}
$return[$user_name] = $row['count'];
}
return $return;
}
@ -2811,9 +2865,8 @@ function events_get_count_events_validated_by_user ($filter, $period, $date,
* @return array An array with all the events happened.
*/
function events_get_count_events_by_criticity ($filter, $period, $date,
$filter_event_validated = false, $filter_event_critical = false,
$filter_event_warning = false, $filter_event_no_validated = false,
$filter_event_search = false) {
$filter_event_severity = false, $filter_event_type = false,
$filter_event_status = false, $filter_event_filter_search = false) {
global $config;
@ -2829,44 +2882,101 @@ function events_get_count_events_by_criticity ($filter, $period, $date,
$sql_filter .=
sprintf(' AND id_grupo IN (%s) ', implode (",", $id_group));
}
if (!empty($filter['id_agent'])) {
$sql_filter .=
sprintf(' AND id_agente = %d ', $filter['id_agent']);
}
if(!empty($filter['id_agentmodule'])){
$sql_filter .=
sprintf(' AND id_agentmodule = %d ', $filter['id_agentmodule']);
}
if (!is_numeric ($date)) {
$date = strtotime ($date);
}
if (empty ($date)) {
$date = get_system_time ();
}
$datelimit = $date - $period;
$sql_where = ' AND 1 = 1 ';
$criticities = array();
if ($filter_event_critical) {
$criticities[] = 4;
$sql_where = '';
$severity_all = 0;
if (!empty($filter_event_severity)) {
foreach ($filter_event_severity as $key => $value) {
switch ($value) {
case -1:
$severity_all = 1;
break;
case 34:
$filter_event_severity[$key] = '3, 4';
break;
case 20:
$filter_event_severity[$key] = '0, 1, 3, 4, 5, 6';
break;
case 21:
$filter_event_severity[$key] = '4, 2';
break;
default:
break;
}
}
if(!$severity_all){
$sql_where .= ' AND criticity IN (' . implode(', ', $filter_event_severity) . ')';
}
}
if ($filter_event_warning) {
$criticities[] = 3;
}
if (!empty($criticities)) {
$sql_where .= ' AND criticity IN (' . implode(', ', $criticities) . ')';
$status_all = 0;
if(!empty($filter_event_status)){
foreach ($filter_event_status as $key => $value) {
switch ($value) {
case -1:
$status_all = 1;
break;
default:
break;
}
}
if(!$status_all){
$sql_where .= ' AND estado IN (' . implode(', ', $filter_event_status) . ')';
}
}
if ($filter_event_validated) {
$sql_where .= ' AND estado = 1 ';
if (!empty($filter_event_type) && $filter_event_type[0] != 'all') {
$sql_where .= ' AND (';
$type = array();
foreach ($filter_event_type as $event_type) {
if ($event_type != "") {
// If normal, warning, could be several (going_up_warning, going_down_warning... too complex
// for the user so for him is presented only "warning, critical and normal"
if ($event_type == "warning" || $event_type == "critical" || $event_type == "normal") {
$type[] = " event_type LIKE '%$event_type%' ";
}
else if ($event_type == "not_normal") {
$type[] = " (event_type LIKE '%warning%' OR event_type LIKE '%critical%' OR event_type LIKE '%unknown%') ";
}
else if ($event_type != "all") {
$type[] = " event_type = '" . $event_type."'";
}
}
}
$sql_where .= implode(' OR ', $type) . ')';
}
if ($filter_event_no_validated) {
$sql_where .= ' AND estado = 0 ';
if (!empty($filter_event_filter_search)) {
$sql_where .= ' AND (evento LIKE "%'. io_safe_input($filter_event_filter_search) . '%"'.
' OR id_evento LIKE "%' . io_safe_input($filter_event_filter_search) . '%")';
}
if (!empty($filter_event_search)) {
$sql_where .= ' AND (evento LIKE "%%'. io_safe_input($filter_event_search) . '%%"'.
' OR id_evento LIKE "%%' . io_safe_input($filter_event_search) . '%%")';
}
$sql = sprintf ('SELECT criticity,
COUNT(*) AS count
FROM tevento
WHERE utimestamp > %d AND utimestamp <= %d
%s ' . $sql_where . '
%s %s
GROUP BY criticity',
$datelimit, $date, $sql_filter);
$datelimit, $date, $sql_filter, $sql_where);
$rows = db_get_all_rows_sql ($sql);
@ -2893,12 +3003,12 @@ function events_get_count_events_by_criticity ($filter, $period, $date,
* @return array An array with all the events happened.
*/
function events_get_count_events_validated ($filter, $period = null, $date = null,
$filter_event_validated = false, $filter_event_critical = false,
$filter_event_warning = false, $filter_event_no_validated = false,
$filter_event_search = false) {
$filter_event_severity = false, $filter_event_type = false,
$filter_event_status = false, $filter_event_filter_search = false) {
global $config;
//group
$sql_filter = " 1=1 ";
if (isset($filter['id_group'])) {
$id_group = groups_safe_acl ($config["id_user"], $filter['id_group'], "AR");
@ -2911,11 +3021,25 @@ function events_get_count_events_validated ($filter, $period = null, $date = nul
$sql_filter .=
sprintf(" AND id_grupo IN (%s) ", implode (",", $id_group));
}
//agent
if (!empty($filter['id_agent'])) {
$sql_filter .=
sprintf(" AND id_agente = %d ", $filter['id_agent']);
}
//module
if(!empty($filter['id_agentmodule'])){
$sql_filter .=
sprintf(' AND id_agentmodule = %d ', $filter['id_agentmodule']);
}
//date
if (!is_numeric ($date)) {
$date = strtotime ($date);
}
if (empty ($date)) {
$date = get_system_time ();
}
$date_filter = '';
if (!empty($date) && !empty($period)) {
$datelimit = $date - $period;
@ -2934,31 +3058,75 @@ function events_get_count_events_validated ($filter, $period = null, $date = nul
$date_filter .= sprintf (" AND utimestamp <= %d ", $date);
}
$sql_where = " AND 1=1 ";
$criticities = array();
if ($filter_event_critical) {
$criticities[] = 4;
}
if ($filter_event_warning) {
$criticities[] = 3;
}
if (!empty($criticities)) {
$sql_where .= " AND criticity IN (" . implode(",", $criticities) . ")";
}
if ($filter_event_validated) {
$sql_where .= " AND estado = 1 ";
}
if ($filter_event_no_validated) {
$sql_where .= " AND estado = 0 ";
}
if (!empty($filter_event_search)) {
$sql_where .= " AND (evento LIKE '%%" . io_safe_input($filter_event_search) . "%%'" .
" OR id_evento LIKE '%%" . io_safe_input($filter_event_search) . "%%')";
$sql_where = '';
$severity_all = 0;
if (!empty($filter_event_severity)) {
foreach ($filter_event_severity as $key => $value) {
switch ($value) {
case -1:
$severity_all = 1;
break;
case 34:
$filter_event_severity[$key] = '3, 4';
break;
case 20:
$filter_event_severity[$key] = '0, 1, 3, 4, 5, 6';
break;
case 21:
$filter_event_severity[$key] = '4, 2';
break;
default:
break;
}
}
if(!$severity_all){
$sql_where .= ' AND criticity IN (' . implode(', ', $filter_event_severity) . ')';
}
}
$sql = sprintf ("SELECT estado, COUNT(*) AS count FROM tevento WHERE %s " . $sql_where . " GROUP BY estado", $sql_filter);
$status_all = 0;
if(!empty($filter_event_status)){
foreach ($filter_event_status as $key => $value) {
switch ($value) {
case -1:
$status_all = 1;
break;
default:
break;
}
}
if(!$status_all){
$sql_where .= ' AND estado IN (' . implode(', ', $filter_event_status) . ')';
}
}
if (!empty($filter_event_type) && $filter_event_type[0] != 'all') {
$sql_where .= ' AND (';
$type = array();
foreach ($filter_event_type as $event_type) {
if ($event_type != "") {
// If normal, warning, could be several (going_up_warning, going_down_warning... too complex
// for the user so for him is presented only "warning, critical and normal"
if ($event_type == "warning" || $event_type == "critical" || $event_type == "normal") {
$type[] = " event_type LIKE '%$event_type%' ";
}
else if ($event_type == "not_normal") {
$type[] = " (event_type LIKE '%warning%' OR event_type LIKE '%critical%' OR event_type LIKE '%unknown%') ";
}
else if ($event_type != "all") {
$type[] = " event_type = '" . $event_type."'";
}
}
}
$sql_where .= implode(' OR ', $type) . ')';
}
if (!empty($filter_event_filter_search)) {
$sql_where .= ' AND (evento LIKE "%'. io_safe_input($filter_event_filter_search) . '%"'.
' OR id_evento LIKE "%' . io_safe_input($filter_event_filter_search) . '%")';
}
$sql = sprintf ("SELECT estado, COUNT(*) AS count FROM tevento WHERE %s %s GROUP BY estado", $sql_filter, $sql_where);
$rows = db_get_all_rows_sql ($sql);

View File

@ -2997,7 +2997,7 @@ function graph_events_validated($width = 300, $height = 200, $url = "", $meta =
global $config;
global $graphic_type;
$data_graph = reporting_get_count_events_validated(
$data_graph = events_get_count_events_validated(
array('id_group' => array_keys(users_get_groups())));
$colors = array();

View File

@ -405,15 +405,6 @@ function reporting_make_reporting_data($report = null, $id_report,
$report,
$content);
break;
case 'agent_detailed_event':
case 'event_report_agent':
$report['contents'][] = reporting_event_report_agent(
$report,
$content,
$type,
$force_width_chart,
$force_height_chart);
break;
case 'group_report':
$report['contents'][] = reporting_group_report(
$report,
@ -444,10 +435,23 @@ function reporting_make_reporting_data($report = null, $id_report,
$content,
$type);
break;
case 'agent_detailed_event':
case 'event_report_agent':
$report['contents'][] = reporting_event_report_agent(
$report,
$content,
$type,
$force_width_chart,
$force_height_chart);
break;
case 'event_report_module':
$report['contents'][] = reporting_event_report_module(
$report,
$content);
$content,
$type,
$force_width_chart,
$force_height_chart,
$pdf);
break;
case 'event_report_group':
$report['contents'][] = reporting_event_report_group(
@ -1287,26 +1291,25 @@ function reporting_event_report_group($report, $content,
$return["date"] = reporting_get_date_text($report, $content);
$event_filter = $content['style'];
$filter_event_no_validated = $event_filter['filter_event_no_validated'];
$filter_event_validated = $event_filter['filter_event_validated'];
$filter_event_critical = $event_filter['filter_event_critical'];
$filter_event_warning = $event_filter['filter_event_warning'];
$return['show_summary_group'] = $event_filter['show_summary_group'];
//filter
$show_summary_group = $event_filter['show_summary_group'];
$filter_event_severity = json_decode($event_filter['filter_event_severity'],true);
$filter_event_type = json_decode($event_filter['filter_event_type'],true);
$filter_event_status = json_decode($event_filter['filter_event_status'],true);
$filter_event_filter_search = $event_filter['event_filter_search'];
$filter_event_type = json_decode($event_filter['filter_event_type'],true);
$event_graph_by_agent = $event_filter['event_graph_by_agent'];
$event_graph_by_user_validator = $event_filter['event_graph_by_user_validator'];
$event_graph_by_criticity = $event_filter['event_graph_by_criticity'];
//graphs
$event_graph_by_agent = $event_filter['event_graph_by_agent'];
$event_graph_by_user_validator = $event_filter['event_graph_by_user_validator'];
$event_graph_by_criticity = $event_filter['event_graph_by_criticity'];
$event_graph_validated_vs_unvalidated = $event_filter['event_graph_validated_vs_unvalidated'];
$data = reporting_get_group_detailed_event(
$content['id_group'], $content['period'], $report["datetime"],
true, true, $filter_event_validated, $filter_event_critical,
$filter_event_warning, $filter_event_no_validated,
$filter_event_filter_search, 'hash', $history, $filter_event_type);
$data = events_get_agent (false, $content['period'], $report["datetime"],
$history, $show_summary_group, $filter_event_severity,
$filter_event_type, $filter_event_status, $filter_event_filter_search,
$content['id_group'], true);
if (empty($data)) {
$return['failed'] = __('No events');
}
@ -1314,8 +1317,6 @@ function reporting_event_report_group($report, $content,
$return['data'] = array_reverse($data);
}
reporting_set_conf_charts($width, $height, $only_image, $type,
$content, $ttl);
@ -1327,22 +1328,16 @@ function reporting_event_report_group($report, $content,
$height = $force_height_chart;
}
$return['chart']['by_agent'] = null;
$return['chart']['by_user_validator'] = null;
$return['chart']['by_criticity'] = null;
$return['chart']['validated_vs_unvalidated'] = null;
if ($event_graph_by_agent) {
$data_graph = reporting_get_count_events_by_agent(
$content['id_group'], $content['period'],
$report["datetime"],
$filter_event_validated,
$filter_event_critical,
$filter_event_warning,
$filter_event_no_validated,
$filter_event_filter_search);
$data_graph = events_get_count_events_by_agent(
$content['id_group'], $content['period'], $report["datetime"],
$filter_event_severity, $filter_event_type,
$filter_event_status, $filter_event_filter_search);
$return['chart']['by_agent']= pie3d_graph(
false,
@ -1358,15 +1353,10 @@ function reporting_event_report_group($report, $content,
}
if ($event_graph_by_user_validator) {
$data_graph =
reporting_get_count_events_validated_by_user(
array('id_group' => $content['id_group']), $content['period'],
$report["datetime"],
$filter_event_validated,
$filter_event_critical,
$filter_event_warning,
$filter_event_no_validated,
$filter_event_filter_search);
$data_graph = events_get_count_events_validated_by_user(
array('id_group' => $content['id_group']), $content['period'],
$report["datetime"],$filter_event_severity, $filter_event_type,
$filter_event_status, $filter_event_filter_search);
$return['chart']['by_user_validator'] = pie3d_graph(
false,
@ -1382,14 +1372,10 @@ function reporting_event_report_group($report, $content,
}
if ($event_graph_by_criticity) {
$data_graph = reporting_get_count_events_by_criticity(
$data_graph = events_get_count_events_by_criticity(
array('id_group' => $content['id_group']), $content['period'],
$report["datetime"],
$filter_event_validated,
$filter_event_critical,
$filter_event_warning,
$filter_event_no_validated,
$filter_event_filter_search);
$report["datetime"],$filter_event_severity, $filter_event_type,
$filter_event_status, $filter_event_filter_search);
$colors = get_criticity_pie_colors($data_graph);
@ -1409,15 +1395,10 @@ function reporting_event_report_group($report, $content,
}
if ($event_graph_validated_vs_unvalidated) {
$data_graph =
reporting_get_count_events_validated(
array('id_group' => $content['id_group']), $content['period'],
$report["datetime"],
$filter_event_validated,
$filter_event_critical,
$filter_event_warning,
$filter_event_no_validated,
$filter_event_filter_search);
$data_graph = events_get_count_events_validated(
array('id_group' => $content['id_group']), $content['period'],
$report["datetime"],$filter_event_severity, $filter_event_type,
$filter_event_status, $filter_event_filter_search);
$return['chart']['validated_vs_unvalidated'] = pie3d_graph(
false,
@ -1436,14 +1417,30 @@ function reporting_event_report_group($report, $content,
metaconsole_restore_db();
}
$return['total_events'] = count($return['data']);
//total_events
if(isset($return['data'])){
$return['total_events'] = count($return['data']);
}
else{
$return['total_events'] = 0;
}
return reporting_check_structure_content($return);
}
function reporting_event_report_module($report, $content) {
global $config;
function reporting_event_report_module($report, $content,
$type = 'dinamic', $force_width_chart = null,
$force_height_chart = null, $pdf=0) {
global $config;
if($pdf){
$ttl = 2;
}
else{
$ttl = 1;
}
$return['type'] = 'event_report_module';
if (empty($content['name'])) {
@ -1467,23 +1464,39 @@ function reporting_event_report_module($report, $content) {
$return["date"] = reporting_get_date_text($report, $content);
$return['label'] = (isset($content['style']['label'])) ? $content['style']['label'] : '';
$data = reporting_get_module_detailed_event(
$content['id_agent_module'], $content['period'],
$report["datetime"], true, false, true);
$event_filter = $content['style'];
$return['show_summary_group'] = $event_filter['show_summary_group'];
//filter
$show_summary_group = $event_filter['show_summary_group'];
$filter_event_severity = json_decode($event_filter['filter_event_severity'],true);
$filter_event_type = json_decode($event_filter['filter_event_type'],true);
$filter_event_status = json_decode($event_filter['filter_event_status'],true);
$filter_event_filter_search = $event_filter['event_filter_search'];
//graphs
$event_graph_by_user_validator = $event_filter['event_graph_by_user_validator'];
$event_graph_by_criticity = $event_filter['event_graph_by_criticity'];
$event_graph_validated_vs_unvalidated = $event_filter['event_graph_validated_vs_unvalidated'];
//data events
$data = reporting_get_module_detailed_event (
$content['id_agent_module'], $content['period'], $report["datetime"],
$show_summary_group, $filter_event_severity, $filter_event_type,
$filter_event_status, $filter_event_filter_search, $force_width_chart,
$event_graph_by_user_validator, $event_graph_by_criticity,
$event_graph_validated_vs_unvalidated, $ttl);
if (empty($data)) {
$return['failed'] = __('No events');
}
else {
$return['data'] = array_reverse($data);
}
}
if ($config['metaconsole']) {
metaconsole_restore_db();
}
$return['total_events'] = count($return['data']);
return reporting_check_structure_content($return);
}
@ -2176,38 +2189,39 @@ function reporting_event_report_agent($report, $content,
if ($config['history_event_enabled'])
$history = true;
$return['title'] = $content['name'];
$return['subtitle'] = agents_get_name($content['id_agent']);
$return["description"] = $content["description"];
$return["date"] = reporting_get_date_text($report, $content);
$return['label'] = (isset($content['style']['label'])) ? $content['style']['label'] : '';
$return['title'] = $content['name'];
$return['subtitle'] = agents_get_name($content['id_agent']);
$return["description"] = $content["description"];
$return["date"] = reporting_get_date_text($report, $content);
$return['label'] = (isset($content['style']['label'])) ? $content['style']['label'] : '';
$return['show_summary_group'] = $content['style']['show_summary_group'];
$style = $content['style'];
$filter_event_no_validated = $style['filter_event_no_validated'];
$filter_event_validated = $style['filter_event_validated'];
$filter_event_critical = $style['filter_event_critical'];
$filter_event_warning = $style['filter_event_warning'];
$filter_event_type = json_decode($style['filter_event_type'], true);
$event_graph_by_user_validator = $style['event_graph_by_user_validator'];
$event_graph_by_criticity = $style['event_graph_by_criticity'];
//filter
$show_summary_group = $style['show_summary_group'];
$filter_event_severity = json_decode($style['filter_event_severity'], true);
$filter_event_type = json_decode($style['filter_event_type'], true);
$filter_event_status = json_decode($style['filter_event_status'], true);
$filter_event_filter_search = $style['event_filter_search'];
//graph
$event_graph_by_user_validator = $style['event_graph_by_user_validator'];
$event_graph_by_criticity = $style['event_graph_by_criticity'];
$event_graph_validated_vs_unvalidated = $style['event_graph_validated_vs_unvalidated'];
$return['data'] = reporting_get_agents_detailed_event(
$content['id_agent'],
$content['period'],
$report["datetime"],
true,
$filter_event_validated,
$filter_event_critical,
$filter_event_warning,
$filter_event_no_validated,
true,
$history,
$filter_event_type);
$show_summary_group,
$filter_event_severity,
$filter_event_type,
$filter_event_status,
$filter_event_filter_search);
reporting_set_conf_charts($width, $height, $only_image, $type,
$content, $ttl);
@ -2220,26 +2234,19 @@ function reporting_event_report_agent($report, $content,
$height = $force_height_chart;
}
$return["chart"]["by_user_validator"] = null;
$return["chart"]["by_criticity"] = null;
$return["chart"]["validated_vs_unvalidated"] = null;
if ($event_graph_by_user_validator) {
$data_chart =
reporting_get_count_events_validated_by_user(
array('id_agent' => $content['id_agent']),
$content['period'],
$report["datetime"],
$filter_event_validated,
$filter_event_critical,
$filter_event_warning,
$filter_event_no_validated);
$data_graph = events_get_count_events_validated_by_user(
array('id_agent' => $content['id_agent']), $content['period'],
$report["datetime"],$filter_event_severity, $filter_event_type,
$filter_event_status, $filter_event_filter_search);
$return["chart"]["by_user_validator"] = pie3d_graph(
false,
$data_chart,
$data_graph,
500,
150,
__("other"),
@ -2251,13 +2258,10 @@ function reporting_event_report_agent($report, $content,
}
if ($event_graph_by_criticity) {
$data_graph = reporting_get_count_events_by_criticity(
$data_graph = events_get_count_events_by_criticity(
array('id_agent' => $content['id_agent']), $content['period'],
$report["datetime"],
$filter_event_validated,
$filter_event_critical,
$filter_event_warning,
$filter_event_no_validated);
$report["datetime"],$filter_event_severity, $filter_event_type,
$filter_event_status, $filter_event_filter_search);
$colors = get_criticity_pie_colors($data_graph);
@ -2277,13 +2281,10 @@ function reporting_event_report_agent($report, $content,
}
if ($event_graph_validated_vs_unvalidated) {
$data_graph = reporting_get_count_events_validated(
$data_graph = events_get_count_events_validated(
array('id_agent' => $content['id_agent']), $content['period'],
$report["datetime"],
$filter_event_validated,
$filter_event_critical,
$filter_event_warning,
$filter_event_no_validated);
$report["datetime"],$filter_event_severity, $filter_event_type,
$filter_event_status, $filter_event_filter_search);
$return["chart"]["validated_vs_unvalidated"] = pie3d_graph(
false,
@ -2302,8 +2303,14 @@ function reporting_event_report_agent($report, $content,
metaconsole_restore_db();
}
$return['total_events'] = count($return['data']);
//total_events
if(isset($return['data'])){
$return['total_events'] = count($return['data']);
}
else{
$return['total_events'] = 0;
}
return reporting_check_structure_content($return);
}
@ -6036,13 +6043,6 @@ function reporting_set_conf_charts(&$width, &$height, &$only_image, $type,
}
}
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
@ -6051,221 +6051,6 @@ function reporting_set_conf_charts(&$width, &$height, &$only_image, $type,
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
/**
* Gets a detailed reporting of groups's events.
*
* @param unknown_type $id_group Id of the group.
* @param unknown_type $period Time period of the report.
* @param unknown_type $date Date of the report.
* @param unknown_type $return Whether to return or not.
* @param unknown_type $html Whether to return HTML code or not.
*
* @return string Report of groups's events
*/
function reporting_get_count_events_validated ($filter, $period = 0,
$date = 0,
$filter_event_validated = false, $filter_event_critical = false,
$filter_event_warning = false, $filter_event_no_validated = false,
$filter_event_search = false) {
if (!is_numeric ($date)) {
$date = strtotime ($date);
}
if (empty ($date)) {
$date = get_system_time ();
}
return events_get_count_events_validated($filter, $period, $date,
$filter_event_validated, $filter_event_critical,
$filter_event_warning, $filter_event_no_validated,
$filter_event_search);
}
/**
* Gets a detailed reporting of groups's events.
*
* @param unknown_type $id_group Id of the group.
* @param unknown_type $period Time period of the report.
* @param unknown_type $date Date of the report.
* @param unknown_type $return Whether to return or not.
* @param unknown_type $html Whether to return HTML code or not.
*
* @return string Report of groups's events
*/
function reporting_get_count_events_by_criticity ($filter, $period = 0,
$date = 0,
$filter_event_validated = false, $filter_event_critical = false,
$filter_event_warning = false, $filter_event_no_validated = false,
$filter_event_search = false) {
if (!is_numeric ($date)) {
$date = strtotime ($date);
}
if (empty ($date)) {
$date = get_system_time ();
}
return events_get_count_events_by_criticity($filter, $period, $date,
$filter_event_validated, $filter_event_critical,
$filter_event_warning, $filter_event_no_validated,
$filter_event_search);
}
/**
* Gets a detailed reporting of groups's events.
*
* @param unknown_type $filter.
* @param unknown_type $period Time period of the report.
* @param unknown_type $date Date of the report.
* @param unknown_type $return Whether to return or not.
* @param unknown_type $html Whether to return HTML code or not.
*
* @return string Report of groups's events
*/
function reporting_get_count_events_validated_by_user ($filter, $period = 0,
$date = 0,
$filter_event_validated = false, $filter_event_critical = false,
$filter_event_warning = false, $filter_event_no_validated = false,
$filter_event_search = false) {
if (!is_numeric ($date)) {
$date = strtotime ($date);
}
if (empty ($date)) {
$date = get_system_time ();
}
return events_get_count_events_validated_by_user($filter, $period, $date,
$filter_event_validated, $filter_event_critical,
$filter_event_warning, $filter_event_no_validated, $filter_event_search);
}
/**
* Gets a detailed reporting of groups's events.
*
* @param unknown_type $id_group Id of the group.
* @param unknown_type $period Time period of the report.
* @param unknown_type $date Date of the report.
* @param unknown_type $return Whether to return or not.
* @param unknown_type $html Whether to return HTML code or not.
*
* @return string Report of groups's events
*/
function reporting_get_group_detailed_event ($id_group, $period = 0,
$date = 0, $return = false, $html = true,
$filter_event_validated = false, $filter_event_critical = false,
$filter_event_warning = false, $filter_event_no_validated = false,
$filter_event_filter_search = null, $return_type = false,
$history = false, $filter_event_type = false) {
global $config;
if (!is_numeric ($date)) {
$date = strtotime ($date);
}
if (empty ($date)) {
$date = get_system_time ();
}
$table = new stdClass();
$table->width = '99%';
$table->align = array();
$table->align[0] = 'center';
$table->align[2] = 'center';
$table->data = array ();
$table->head = array ();
$table->head[0] = __('Status');
$table->head[1] = __('Name');
$table->head[2] = __('Type');
$table->head[3] = __('Agent');
$table->head[4] = __('Severity');
$table->head[5] = __('Val. by');
$table->head[6] = __('Timestamp');
$events = events_get_group_events($id_group, $period, $date,
$filter_event_validated, $filter_event_critical,
$filter_event_warning, $filter_event_no_validated,
$filter_event_filter_search, false, $history, $filter_event_type);
if ($return_type === 'hash') {
return $events;
}
if ($events) {
$note = '';
if (count($events) >= 1000) {
$note .= '* ' . __('Maximum of events shown') . ' (1000)<br>';
}
foreach ($events as $k => $event) {
//First pass along the class of this row
$table->cellclass[$k][1] = $table->cellclass[$k][3] =
$table->cellclass[$k][4] = $table->cellclass[$k][5] =
$table->cellclass[$k][6] =
get_priority_class ($event["criticity"]);
$data = array ();
// Colored box
switch ($event['estado']) {
case 0:
$img_st = "images/star.png";
$title_st = __('New event');
break;
case 1:
$img_st = "images/tick.png";
$title_st = __('Event validated');
break;
case 2:
$img_st = "images/hourglass.png";
$title_st = __('Event in process');
break;
}
$data[] = html_print_image ($img_st, true,
array ("class" => "image_status",
"width" => 16,
"title" => $title_st,
"id" => 'status_img_' . $event["id_evento"]));
$data[] = ui_print_truncate_text(
io_safe_output($event['evento']),
140, false, true);
//$data[1] = $event['event_type'];
$data[] = events_print_type_img ($event["event_type"], true);
if (!empty($event['id_agente']))
$data[] = agents_get_name($event['id_agente']);
else
$data[] = __('Pandora System');
$data[] = get_priority_name ($event['criticity']);
if (empty($event['id_usuario']) && $event['estado'] == EVENT_VALIDATE) {
$data[] = '<i>' . __('System') . '</i>';
}
else {
$user_name = db_get_value ('fullname', 'tusuario', 'id_user', $event['id_usuario']);
$data[] = io_safe_output($user_name);
}
$data[] = '<font style="font-size: 6pt;">' .
date($config['date_format'], $event['timestamp_rep']) .
'</font>';
array_push ($table->data, $data);
}
if ($html) {
return html_print_table ($table, $return) . $note;
}
else {
return $table;
}
}
else {
return false;
}
}
/**
* Get a detailed report of summarized events per agent
*
@ -6281,7 +6066,11 @@ function reporting_get_group_detailed_event ($id_group, $period = 0,
* @return mixed A table object (XHTML) or object table is false the html.
*/
function reporting_get_module_detailed_event ($id_modules, $period = 0,
$date = 0, $return = false, $html = true, $only_data = false) {
$date = 0, $show_summary_group = false, $filter_event_severity = false,
$filter_event_type = false, $filter_event_status = false,
$filter_event_filter_search = false, $force_width_chart = false,
$event_graph_by_user_validator = false, $event_graph_by_criticity = false,
$event_graph_validated_vs_unvalidated = false, $ttl = 1) {
global $config;
@ -6301,72 +6090,93 @@ function reporting_get_module_detailed_event ($id_modules, $period = 0,
$events = array ();
foreach ($id_modules as $id_module) {
$event = events_get_module ($id_module, (int) $period, (int) $date, $history);
$event['data'] = events_get_agent (false, (int) $period, (int) $date,
$history, $show_summary_group, $filter_event_severity,
$filter_event_type, $filter_event_status, $filter_event_filter_search,
false, false, $id_module, true);
//total_events
if(isset($event['data'])){
$event['total_events'] = count($event['data']);
}
else{
$event['total_events'] = 0;
}
//graphs
if (!empty($force_width_chart)) {
$width = $force_width_chart;
}
if (!empty($force_height_chart)) {
$height = $force_height_chart;
}
if ($event_graph_by_user_validator) {
$data_graph = events_get_count_events_validated_by_user(
array('id_agentmodule' => $id_module), $period, $date, $filter_event_severity,
$filter_event_type, $filter_event_status, $filter_event_filter_search);
$event['chart']['by_user_validator'] = pie3d_graph(
false,
$data_graph,
500,
150,
__("other"),
ui_get_full_url(false, false, false, false),
ui_get_full_url(false, false, false, false) . "/images/logo_vertical_water.png",
$config['fontpath'],
$config['font_size'],
$ttl);
}
if ($event_graph_by_criticity) {
$data_graph = events_get_count_events_by_criticity(
array('id_agentmodule' => $id_module), $period, $date, $filter_event_severity,
$filter_event_type, $filter_event_status, $filter_event_filter_search);
$colors = get_criticity_pie_colors($data_graph);
$event['chart']['by_criticity'] = pie3d_graph(
false,
$data_graph,
500,
150,
__("other"),
ui_get_full_url(false, false, false, false),
ui_get_full_url(false, false, false, false) . "/images/logo_vertical_water.png",
$config['fontpath'],
$config['font_size'],
$ttl,
false,
$colors);
}
if ($event_graph_validated_vs_unvalidated) {
$data_graph = events_get_count_events_validated(
array('id_agentmodule' => $id_module), $period, $date, $filter_event_severity,
$filter_event_type, $filter_event_status, $filter_event_filter_search);
$event['chart']['validated_vs_unvalidated'] = pie3d_graph(
false,
$data_graph,
500,
150,
__("other"),
ui_get_full_url(false, false, false, false),
ui_get_full_url(false, false, false, false) . "/images/logo_vertical_water.png",
$config['fontpath'],
$config['font_size'],
$ttl);
}
if (!empty ($event)) {
array_push ($events, $event);
}
}
if ($only_data) {
return $event;
}
if ($events) {
$note = '';
if (count($events) >= 1000) {
$note .= '* ' . __('Maximum of events shown') . ' (1000)<br>';
}
foreach ($events as $eventRow) {
foreach ($eventRow as $k => $event) {
//$k = count($table->data);
$table->cellclass[$k][1] = $table->cellclass[$k][2] =
$table->cellclass[$k][3] = $table->cellclass[$k][4] =
$table->cellclass[$k][5] = get_priority_class ($event["criticity"]);
$data = array ();
// Colored box
switch ($event['estado']) {
case 0:
$img_st = "images/star.png";
$title_st = __('New event');
break;
case 1:
$img_st = "images/tick.png";
$title_st = __('Event validated');
break;
case 2:
$img_st = "images/hourglass.png";
$title_st = __('Event in process');
break;
}
$data[0] = html_print_image ($img_st, true,
array ("class" => "image_status",
"width" => 16,
"title" => $title_st,
"id" => 'status_img_' . $event["id_evento"]));
$data[1] = io_safe_output($event['evento']);
$data[2] = $event['event_type'];
$data[3] = get_priority_name ($event['criticity']);
$data[4] = $event['event_rep'];
$data[5] = date($config['date_format'], $event['timestamp_rep']);
array_push ($table->data, $data);
}
}
if ($html) {
return html_print_table ($table, $return) . $note;
}
else {
return $table;
}
}
else {
return false;
}
}
return $events;
}
/**
* Get a detailed report of summarized events per agent
@ -6382,10 +6192,10 @@ function reporting_get_module_detailed_event ($id_modules, $period = 0,
* @return A table object (XHTML)
*/
function reporting_get_agents_detailed_event ($id_agents, $period = 0,
$date = 0, $return = false, $filter_event_validated = false,
$filter_event_critical = false, $filter_event_warning = false,
$filter_event_no_validated = false, $only_data = false,
$history = false, $filter_event_type = false) {
$date = 0, $return = false, $only_data = false, $history = false,
$show_summary_group = false, $filter_event_severity = false,
$filter_event_type = false, $filter_event_status = false,
$filter_event_filter_search = false) {
global $config;
@ -6407,12 +6217,10 @@ function reporting_get_agents_detailed_event ($id_agents, $period = 0,
$events = array ();
foreach ($id_agents as $id_agent) {
$event = events_get_agent ($id_agent,
(int)$period,
(int)$date,
$filter_event_validated, $filter_event_critical,
$filter_event_warning, $filter_event_no_validated,
$history, $filter_event_type);
$event = events_get_agent ($id_agent, (int)$period, (int)$date,
$history, $show_summary_group, $filter_event_severity,
$filter_event_type, $filter_event_status,
$filter_event_filter_search, false, false);
if (empty($event)) {
$event = array();
@ -6421,17 +6229,28 @@ function reporting_get_agents_detailed_event ($id_agents, $period = 0,
if ($only_data) {
$nevents = count($event);
for($i=$nevents-1; $i >= 0; $i--) {
$e = $event[$i];
//foreach ($event as $e) {
$return_data[] = array(
'status' => $e['estado'],
'count' => $e['event_rep'],
'name' => $e['evento'],
'type' => $e["event_type"],
'criticity' => $e["criticity"],
'validated_by' => $e['id_usuario'],
'timestamp' => $e['timestamp_rep']
);
$e = $event[$i];
if($show_summary_group){
$return_data[] = array(
'status' => $e['estado'],
'count' => $e['event_rep'],
'name' => $e['evento'],
'type' => $e["event_type"],
'criticity' => $e["criticity"],
'validated_by' => $e['id_usuario'],
'timestamp' => $e['timestamp_rep']
);
}
else{
$return_data[] = array(
'status' => $e['estado'],
'name' => $e['evento'],
'type' => $e["event_type"],
'criticity' => $e["criticity"],
'validated_by' => $e['id_usuario'],
'timestamp' => $e['timestamp']
);
}
}
}
else {
@ -8625,36 +8444,6 @@ function reporting_get_planned_downtimes_intervals ($id_agent_module, $start_dat
return $downtime_dates;
}
/**
* Gets a detailed reporting of groups's events.
*
* @param unknown_type $id_group Id of the group.
* @param unknown_type $period Time period of the report.
* @param unknown_type $date Date of the report.
* @param unknown_type $return Whether to return or not.
* @param unknown_type $html Whether to return HTML code or not.
*
* @return string Report of groups's events
*/
function reporting_get_count_events_by_agent ($id_group, $period = 0,
$date = 0,
$filter_event_validated = false, $filter_event_critical = false,
$filter_event_warning = false, $filter_event_no_validated = false,
$filter_event_filter_search = null) {
if (!is_numeric ($date)) {
$date = strtotime ($date);
}
if (empty ($date)) {
$date = get_system_time ();
}
return events_get_count_events_by_agent($id_group, $period, $date,
$filter_event_validated, $filter_event_critical,
$filter_event_warning, $filter_event_no_validated,
$filter_event_filter_search);
}
/**
* Get the maximum value of an agent module in a period of time.
*

View File

@ -130,17 +130,13 @@ function reporting_html_print_report($report, $mini = false) {
$table->data['description_row']['description'] = $item['description'];
if($item['type']=='event_report_agent' || $item['type']=='event_report_module' || $item['type']=='event_report_group'){
if($item['type']=='event_report_agent' || $item['type']=='event_report_group'){
if($item['description'] != '' && $item['description'] != null){
$table->data['description_row']['description'] .= " - ";
}
$table->data['description_row']['description'] .= "Total events: ".$item["total_events"];
}
$table->colspan['description_row']['description'] = 3;
@ -250,10 +246,6 @@ function reporting_html_print_report($report, $mini = false) {
case 'database_serialized':
reporting_html_database_serialized($table, $item);
break;
case 'agent_detailed_event':
case 'event_report_agent':
reporting_html_event_report_agent($table, $item);
break;
case 'group_report':
reporting_html_group_report($table, $item);
break;
@ -269,6 +261,10 @@ function reporting_html_print_report($report, $mini = false) {
case 'inventory_changes':
reporting_html_inventory_changes($table, $item);
break;
case 'agent_detailed_event':
case 'event_report_agent':
reporting_html_event_report_agent($table, $item);
break;
case 'event_report_module':
reporting_html_event_report_module($table, $item);
break;
@ -750,9 +746,8 @@ function reporting_html_top_n($table, $item) {
}
}
function reporting_html_event_report_group($table, $item) {
function reporting_html_event_report_group($table, $item, $pdf = 0) {
global $config;
if (!empty($item['failed'])) {
$table->colspan['events']['cell'] = 3;
$table->data['events']['cell'] = $item['failed'];
@ -763,26 +758,49 @@ function reporting_html_event_report_group($table, $item) {
$table1->align = array();
$table1->align[0] = 'center';
$table1->align[2] = 'center';
if($item['show_summary_group']){
$table1->align[3] = 'center';
}
else{
$table1->align[2] = 'center';
}
$table1->data = array ();
$table1->head = array ();
$table1->head[0] = __('Status');
$table1->head[1] = __('Name');
$table1->head[2] = __('Type');
$table1->head[3] = __('Agent');
$table1->head[4] = __('Severity');
$table1->head[5] = __('Val. by');
$table1->head[6] = __('Timestamp');
if($item['show_summary_group']){
$table1->head[0] = __('Status');
$table1->head[1] = __('Count');
$table1->head[2] = __('Name');
$table1->head[3] = __('Type');
$table1->head[4] = __('Agent');
$table1->head[5] = __('Severity');
$table1->head[6] = __('Val. by');
$table1->head[7] = __('Timestamp');
}
else{
$table1->head[0] = __('Status');
$table1->head[1] = __('Name');
$table1->head[2] = __('Type');
$table1->head[3] = __('Agent');
$table1->head[4] = __('Severity');
$table1->head[5] = __('Val. by');
$table1->head[6] = __('Timestamp');
}
foreach ($item['data'] as $k => $event) {
//First pass along the class of this row
$table1->cellclass[$k][1] = $table1->cellclass[$k][3] =
$table1->cellclass[$k][4] = $table1->cellclass[$k][5] =
$table1->cellclass[$k][6] =
get_priority_class ($event["criticity"]);
if($item['show_summary_group']){
$table1->cellclass[$k][1] = $table1->cellclass[$k][2] =
$table1->cellclass[$k][4] = $table1->cellclass[$k][5] =
$table1->cellclass[$k][6] = $table1->cellclass[$k][7] =
get_priority_class ($event["criticity"]);
}
else{
$table1->cellclass[$k][1] = $table1->cellclass[$k][3] =
$table1->cellclass[$k][4] = $table1->cellclass[$k][5] =
$table1->cellclass[$k][6] =
get_priority_class ($event["criticity"]);
}
$data = array ();
// Colored box
@ -805,6 +823,10 @@ function reporting_html_event_report_group($table, $item) {
"width" => 16,
"title" => $title_st,
"id" => 'status_img_' . $event["id_evento"]));
if($item['show_summary_group']){
$data[] = $event['event_rep'];
}
$data[] = ui_print_truncate_text(
io_safe_output($event['evento']),
@ -825,17 +847,27 @@ function reporting_html_event_report_group($table, $item) {
$user_name = db_get_value ('fullname', 'tusuario', 'id_user', $event['id_usuario']);
$data[] = io_safe_output($user_name);
}
$data[] = '<font style="font-size: 6pt;">' .
date($config['date_format'], $event['timestamp_rep']) .
'</font>';
if($item['show_summary_group']){
$data[] = '<font style="font-size: 6pt;">' . date($config['date_format'], $event['timestamp_rep']) . '</font>';
}
else{
$data[] = '<font style="font-size: 6pt;">' . date($config['date_format'], strtotime($event['timestamp'])) . '</font>';
}
array_push ($table1->data, $data);
}
$table->colspan['events']['cell'] = 3;
$table->data['events']['cell'] = html_print_table($table1, true);
if($pdf){
$table1->class = 'table-beauty';
$pdf_export = html_print_table($table1, true);
$pdf_export .= '<br>';
}
else{
$table->colspan['events']['cell'] = 3;
$table->data['events']['cell'] = html_print_table($table1, true);
}
if (!empty($item['chart']['by_agent'])) {
$table1 = new stdClass();
$table1->width = '99%';
@ -843,9 +875,16 @@ function reporting_html_event_report_group($table, $item) {
$table1->head[0] = __('Events by agent');
$table1->data[0][0] = $item['chart']['by_agent'];
$table->colspan['chart_by_agent']['cell'] = 3;
$table->cellstyle['chart_by_agent']['cell'] = 'text-align: center;';
$table->data['chart_by_agent']['cell'] = html_print_table($table1, true);
if($pdf){
$table1->class = 'table-beauty';
$pdf_export .= html_print_table($table1, true);
$pdf_export .= '<br>';
}
else{
$table->colspan['chart_by_agent']['cell'] = 3;
$table->cellstyle['chart_by_agent']['cell'] = 'text-align: center;';
$table->data['chart_by_agent']['cell'] = html_print_table($table1, true);
}
}
if (!empty($item['chart']['by_user_validator'])) {
@ -855,9 +894,16 @@ function reporting_html_event_report_group($table, $item) {
$table1->head[0] = __('Events by user validator');
$table1->data[0][0] = $item['chart']['by_user_validator'];
$table->colspan['chart_by_user_validator']['cell'] = 3;
$table->cellstyle['chart_by_user_validator']['cell'] = 'text-align: center;';
$table->data['chart_by_user_validator']['cell'] = html_print_table($table1, true);
if($pdf){
$table1->class = 'table-beauty';
$pdf_export .= html_print_table($table1, true);
$pdf_export .= '<br>';
}
else{
$table->colspan['chart_by_user_validator']['cell'] = 3;
$table->cellstyle['chart_by_user_validator']['cell'] = 'text-align: center;';
$table->data['chart_by_user_validator']['cell'] = html_print_table($table1, true);
}
}
if (!empty($item['chart']['by_criticity'])) {
@ -867,9 +913,16 @@ function reporting_html_event_report_group($table, $item) {
$table1->head[0] = __('Events by Severity');
$table1->data[0][0] = $item['chart']['by_criticity'];
$table->colspan['chart_by_criticity']['cell'] = 3;
$table->cellstyle['chart_by_criticity']['cell'] = 'text-align: center;';
$table->data['chart_by_criticity']['cell'] = html_print_table($table1, true);
if($pdf){
$table1->class = 'table-beauty';
$pdf_export .= html_print_table($table1, true);
$pdf_export .= '<br>';
}
else{
$table->colspan['chart_by_criticity']['cell'] = 3;
$table->cellstyle['chart_by_criticity']['cell'] = 'text-align: center;';
$table->data['chart_by_criticity']['cell'] = html_print_table($table1, true);
}
}
if (!empty($item['chart']['validated_vs_unvalidated'])) {
@ -879,77 +932,196 @@ function reporting_html_event_report_group($table, $item) {
$table1->head[0] = __('Events validated vs unvalidated');
$table1->data[0][0] = $item['chart']['validated_vs_unvalidated'];
$table->colspan['chart_validated_vs_unvalidated']['cell'] = 3;
$table->cellstyle['chart_validated_vs_unvalidated']['cell'] = 'text-align: center;';
$table->data['chart_validated_vs_unvalidated']['cell'] = html_print_table($table1, true);
if($pdf){
$table1->class = 'table-beauty';
$pdf_export .= html_print_table($table1, true);
$pdf_export .= '<br>';
}
else{
$table->colspan['chart_validated_vs_unvalidated']['cell'] = 3;
$table->cellstyle['chart_validated_vs_unvalidated']['cell'] = 'text-align: center;';
$table->data['chart_validated_vs_unvalidated']['cell'] = html_print_table($table1, true);
}
}
if($pdf){
return $pdf_export;
}
}
}
function reporting_html_event_report_module($table, $item) {
function reporting_html_event_report_module($table, $item, $pdf = 0) {
global $config;
$show_summary_group = $item['show_summary_group'];
if (!empty($item['failed'])) {
$table->colspan['events']['cell'] = 3;
$table->data['events']['cell'] = $item['failed'];
}
else {
$table1 = new stdClass();
$table1->width = '99%';
$table1->data = array ();
$table1->head = array ();
$table1->head[0] = __('Status');
$table1->head[1] = __('Event name');
$table1->head[2] = __('Event type');
$table1->head[3] = __('Severity');
$table1->head[4] = __('Count');
$table1->head[5] = __('Timestamp');
$table1->style[0] = 'text-align: center;';
$table1->style[4] = 'text-align: center;';
foreach ($item['data'] as $i => $event) {
$data = array();
$table1->cellclass[$i][1] =
$table1->cellclass[$i][2] =
$table1->cellclass[$i][3] =
$table1->cellclass[$i][4] =
$table1->cellclass[$i][5] = get_priority_class($event["criticity"]);
// Colored box
switch ($event['estado']) {
case 0:
$img_st = "images/star.png";
$title_st = __('New event');
break;
case 1:
$img_st = "images/tick.png";
$title_st = __('Event validated');
break;
case 2:
$img_st = "images/hourglass.png";
$title_st = __('Event in process');
break;
foreach ($item['data'] as $item) {
$table1 = new stdClass();
$table1->width = '99%';
$table1->data = array ();
$table1->head = array ();
if($show_summary_group){
$table1->head[0] = __('Status');
$table1->head[1] = __('Event name');
$table1->head[2] = __('Event type');
$table1->head[3] = __('Severity');
$table1->head[4] = __('Count');
$table1->head[5] = __('Timestamp');
$table1->style[0] = 'text-align: center;';
}
else{
$table1->head[0] = __('Status');
$table1->head[1] = __('Event name');
$table1->head[2] = __('Event type');
$table1->head[3] = __('Severity');
$table1->head[4] = __('Timestamp');
$table1->style[0] = 'text-align: center;';
}
$table->data['tatal_events']['cell'] = "Total events: ".$item["total_events"];
if (is_array($item['data']) || is_object($item['data'])){
$item_data = array_reverse($item['data']);
}
$data[0] = html_print_image ($img_st, true,
array ("class" => "image_status",
"width" => 16,
"title" => $title_st,
"id" => 'status_img_' . $event["id_evento"]));
$data[1] = io_safe_output($event['evento']);
$data[2] = $event['event_type'];
$data[3] = get_priority_name ($event['criticity']);
$data[4] = $event['event_rep'];
$data[5] = date($config['date_format'], $event['timestamp_rep']);
if (is_array($item_data) || is_object($item_data)){
foreach ($item_data as $i => $event) {
$data = array();
if($show_summary_group){
$table1->cellclass[$i][1] = $table1->cellclass[$i][2] =
$table1->cellclass[$i][3] = $table1->cellclass[$i][4] =
$table1->cellclass[$i][5] = get_priority_class($event["criticity"]);
}
else{
$table1->cellclass[$i][1] = $table1->cellclass[$i][2] =
$table1->cellclass[$i][3] =
$table1->cellclass[$i][4] = get_priority_class($event["criticity"]);
}
// Colored box
switch ($event['estado']) {
case 0:
$img_st = "images/star.png";
$title_st = __('New event');
break;
case 1:
$img_st = "images/tick.png";
$title_st = __('Event validated');
break;
case 2:
$img_st = "images/hourglass.png";
$title_st = __('Event in process');
break;
}
$data[0] = html_print_image ($img_st, true,
array ("class" => "image_status",
"width" => 16,
"title" => $title_st,
"id" => 'status_img_' . $event["id_evento"]));
$data[1] = io_safe_output($event['evento']);
$data[2] = $event['event_type'];
$data[3] = get_priority_name ($event['criticity']);
if($show_summary_group){
$data[4] = $event['event_rep'];
$data[5] = date($config['date_format'], $event['timestamp_rep']);
}
else{
$data[4] = date($config['date_format'], strtotime($event['timestamp']));
}
$table1->data[] = $data;
}
}
if($pdf){
$table1->class = 'table-beauty';
$pdf_export = html_print_table($table1, true);
$pdf_export .= '<br>';
}
else{
$table->colspan['events']['cell'] = 3;
$table->data['events']['cell'] = html_print_table($table1, true);
}
$table1->data[] = $data;
if (!empty($item['chart']['by_agent'])) {
$table1 = new stdClass();
$table1->width = '99%';
$table1->head = array ();
$table1->head[0] = __('Events by agent');
$table1->data[0][0] = $item['chart']['by_agent'];
if($pdf){
$table1->class = 'table-beauty';
$pdf_export .= html_print_table($table1, true);
$pdf_export .= '<br>';
}
else{
$table->colspan['chart_by_agent']['cell'] = 3;
$table->cellstyle['chart_by_agent']['cell'] = 'text-align: center;';
$table->data['chart_by_agent']['cell'] = html_print_table($table1, true);
}
}
if (!empty($item['chart']['by_user_validator'])) {
$table1 = new stdClass();
$table1->width = '99%';
$table1->head = array ();
$table1->head[0] = __('Events by user validator');
$table1->data[0][0] = $item['chart']['by_user_validator'];
if($pdf){
$table1->class = 'table-beauty';
$pdf_export .= html_print_table($table1, true);
$pdf_export .= '<br>';
}
else{
$table->colspan['chart_by_user_validator']['cell'] = 3;
$table->cellstyle['chart_by_user_validator']['cell'] = 'text-align: center;';
$table->data['chart_by_user_validator']['cell'] = html_print_table($table1, true);
}
}
if (!empty($item['chart']['by_criticity'])) {
$table1 = new stdClass();
$table1->width = '99%';
$table1->head = array ();
$table1->head[0] = __('Events by Severity');
$table1->data[0][0] = $item['chart']['by_criticity'];
if($pdf){
$table1->class = 'table-beauty';
$pdf_export .= html_print_table($table1, true);
$pdf_export .= '<br>';
}
else{
$table->colspan['chart_by_criticity']['cell'] = 3;
$table->cellstyle['chart_by_criticity']['cell'] = 'text-align: center;';
$table->data['chart_by_criticity']['cell'] = html_print_table($table1, true);
}
}
if (!empty($item['chart']['validated_vs_unvalidated'])) {
$table1 = new stdClass();
$table1->width = '99%';
$table1->head = array ();
$table1->head[0] = __('Events validated vs unvalidated');
$table1->data[0][0] = $item['chart']['validated_vs_unvalidated'];
if($pdf){
$table1->class = 'table-beauty';
$pdf_export .= html_print_table($table1, true);
$pdf_export .= '<br>';
}
else{
$table->colspan['chart_validated_vs_unvalidated']['cell'] = 3;
$table->cellstyle['chart_validated_vs_unvalidated']['cell'] = 'text-align: center;';
$table->data['chart_validated_vs_unvalidated']['cell'] = html_print_table($table1, true);
}
}
if($pdf){
return $pdf_export;
}
}
$table->colspan['events']['cell'] = 3;
$table->data['events']['cell'] = html_print_table($table1, true);
}
}
@ -1366,12 +1538,10 @@ function reporting_html_group_report($table, $item) {
</table>";
}
function reporting_html_event_report_agent($table, $item) {
function reporting_html_event_report_agent($table, $item, $pdf = 0) {
global $config;
$table1 = new stdClass();
$table1->width = '99%';
$table1->align = array();
$table1->align[0] = 'center';
$table1->align[1] = 'center';
@ -1381,7 +1551,9 @@ function reporting_html_event_report_agent($table, $item) {
$table1->head = array ();
$table1->head[0] = __('Status');
$table1->head[1] = __('Count');
if($item['show_summary_group']){
$table1->head[1] = __('Count');
}
$table1->head[2] = __('Name');
$table1->head[3] = __('Type');
$table1->head[4] = __('Severity');
@ -1389,13 +1561,21 @@ function reporting_html_event_report_agent($table, $item) {
$table1->head[6] = __('Timestamp');
foreach ($item['data'] as $i => $event) {
$table1->cellclass[$i][1] =
$table1->cellclass[$i][2] =
$table1->cellclass[$i][4] =
$table1->cellclass[$i][5] =
$table1->cellclass[$i][6] =
get_priority_class ($event["criticity"]);
if($item['show_summary_group']){
$table1->cellclass[$i][1] =
$table1->cellclass[$i][2] =
$table1->cellclass[$i][4] =
$table1->cellclass[$i][5] =
$table1->cellclass[$i][6] =
get_priority_class ($event["criticity"]);
}
else{
$table1->cellclass[$i][1] =
$table1->cellclass[$i][3] =
$table1->cellclass[$i][4] =
$table1->cellclass[$i][5] =
get_priority_class ($event["criticity"]);
}
$data = array ();
// Colored box
switch ($event['status']) {
@ -1417,8 +1597,10 @@ function reporting_html_event_report_agent($table, $item) {
"width" => 16,
"title" => $title_st));
$data[] = $event['count'];
if($item['show_summary_group']){
$data[] = $event['count'];
}
$data[] = ui_print_truncate_text(
io_safe_output($event['name']),
140, false, true);
@ -1433,14 +1615,25 @@ function reporting_html_event_report_agent($table, $item) {
$user_name = db_get_value ('fullname', 'tusuario', 'id_user', $event['validated_by']);
$data[] = io_safe_output($user_name);
}
$data[] = '<font style="font-size: 6pt;">' .
date($config['date_format'], $event['timestamp']) . '</font>';
if($item['show_summary_group']){
$data[] = '<font style="font-size: 6pt;">' . date($config['date_format'], $event['timestamp']) . '</font>';
}
else{
$data[] = '<font style="font-size: 6pt;">' . date($config['date_format'], strtotime($event['timestamp'])) . '</font>';
}
array_push ($table1->data, $data);
}
$table->colspan['event_list']['cell'] = 3;
$table->cellstyle['event_list']['cell'] = 'text-align: center;';
$table->data['event_list']['cell'] = html_print_table($table1, true);
if($pdf){
$table1->class = 'table-beauty';
$pdf_export = html_print_table($table1, true);
$pdf_export .= '<br>';
}
else{
$table->colspan['event_list']['cell'] = 3;
$table->cellstyle['event_list']['cell'] = 'text-align: center;';
$table->data['event_list']['cell'] = html_print_table($table1, true);
}
if (!empty($item['chart']['by_user_validator'])) {
$table1 = new stdClass();
@ -1449,9 +1642,16 @@ function reporting_html_event_report_agent($table, $item) {
$table1->head[0] = __('Events validated by user');
$table1->data[0][0] = $item['chart']['by_user_validator'];
$table->colspan['chart_by_user_validator']['cell'] = 3;
$table->cellstyle['chart_by_user_validator']['cell'] = 'text-align: center;';
$table->data['chart_by_user_validator']['cell'] = html_print_table($table1, true);
if($pdf){
$table1->class = 'table-beauty';
$pdf_export .= html_print_table($table1, true);
$pdf_export .= '<br>';
}
else{
$table->colspan['chart_by_user_validator']['cell'] = 3;
$table->cellstyle['chart_by_user_validator']['cell'] = 'text-align: center;';
$table->data['chart_by_user_validator']['cell'] = html_print_table($table1, true);
}
}
if (!empty($item['chart']['by_criticity'])) {
@ -1461,9 +1661,16 @@ function reporting_html_event_report_agent($table, $item) {
$table1->head[0] = __('Events by severity');
$table1->data[0][0] = $item['chart']['by_criticity'];
$table->colspan['chart_by_criticity']['cell'] = 3;
$table->cellstyle['chart_by_criticity']['cell'] = 'text-align: center;';
$table->data['chart_by_criticity']['cell'] = html_print_table($table1, true);
if($pdf){
$table1->class = 'table-beauty';
$pdf_export .= html_print_table($table1, true);
$pdf_export .= '<br>';
}
else{
$table->colspan['chart_by_criticity']['cell'] = 3;
$table->cellstyle['chart_by_criticity']['cell'] = 'text-align: center;';
$table->data['chart_by_criticity']['cell'] = html_print_table($table1, true);
}
}
if (!empty($item['chart']['validated_vs_unvalidated'])) {
@ -1473,9 +1680,20 @@ function reporting_html_event_report_agent($table, $item) {
$table1->head[0] = __('Amount events validated');
$table1->data[0][0] = $item['chart']['validated_vs_unvalidated'];
$table->colspan['chart_validated_vs_unvalidated']['cell'] = 3;
$table->cellstyle['chart_validated_vs_unvalidated']['cell'] = 'text-align: center;';
$table->data['chart_validated_vs_unvalidated']['cell'] = html_print_table($table1, true);
if($pdf){
$table1->class = 'table-beauty';
$pdf_export .= html_print_table($table1, true);
$pdf_export .= '<br>';
}
else{
$table->colspan['chart_validated_vs_unvalidated']['cell'] = 3;
$table->cellstyle['chart_validated_vs_unvalidated']['cell'] = 'text-align: center;';
$table->data['chart_validated_vs_unvalidated']['cell'] = html_print_table($table1, true);
}
}
if($pdf){
return $pdf_export;
}
}

View File

@ -71,9 +71,9 @@ function treeview_printModuleTable($id_module, $server_data = false, $no_head =
//Module name
if ($module["disabled"])
$cellName = "<em>" . ui_print_truncate_text ($module["nombre"], GENERIC_SIZE_TEXT, true, true, true, '[&hellip;]',"text-transform: uppercase;") . ui_print_help_tip(__('Disabled'), true) . "<em>";
$cellName = "<em>" . ui_print_truncate_text (io_safe_output($module["nombre"]), GENERIC_SIZE_TEXT, true, true, true, '[&hellip;]',"text-transform: uppercase;") . ui_print_help_tip(__('Disabled'), true) . "<em>";
else
$cellName = ui_print_truncate_text ($module["nombre"], GENERIC_SIZE_TEXT, true, true, true, '[&hellip;]',"text-transform: uppercase;");
$cellName = ui_print_truncate_text (io_safe_output($module["nombre"]), GENERIC_SIZE_TEXT, true, true, true, '[&hellip;]',"text-transform: uppercase;");
$row = array();
$row['title'] = __('Name');

View File

@ -2454,7 +2454,7 @@ function visual_map_print_visual_map ($id_layout, $show_links = true,
}
if (defined('METACONSOLE')) {
echo "<div style='width: 920px; overflow:auto; margin: 0 auto;'>";
echo "<div style='width: 100%; overflow:auto; margin: 0 auto; padding:5px;'>";
}
echo '<div style="';

File diff suppressed because one or more lines are too long

View File

@ -2353,85 +2353,60 @@ span#plugin_description {
#tinymce {
text-align: left;
}
.visual_font_size_4pt, .visual_font_size_4pt > em, .visual_font_size_4pt > strong, .visual_font_size_4pt > strong > span, .visual_font_size_4pt > span, .visual_font_size_4pt > strong > em, .visual_font_size_4pt > em > strong, .visual_font_size_4pt em span, .visual_font_size_4pt span em {
.visual_font_size_4pt, .visual_font_size_4pt > em, .visual_font_size_4pt > strong, .visual_font_size_4pt > strong > span .visual_font_size_4pt > span {
font-size: 4pt !important;
line-height: 4pt;
}
.visual_font_size_6pt, .visual_font_size_6pt > em, .visual_font_size_6pt > strong, .visual_font_size_6pt > strong > span, .visual_font_size_6pt > span, .visual_font_size_6pt > strong > em, .visual_font_size_6pt > em > strong, .visual_font_size_6pt em span, .visual_font_size_6pt span em {
.visual_font_size_6pt, .visual_font_size_6pt > em, .visual_font_size_6pt > strong, .visual_font_size_6pt > strong > span, .visual_font_size_6pt > span {
font-size: 6pt !important;
line-height: 6pt;
}
.visual_font_size_8pt, .visual_font_size_8pt > em, .visual_font_size_8pt > strong, .visual_font_size_8pt > strong > span , .visual_font_size_8pt > span, .visual_font_size_8pt > strong > em, .visual_font_size_8pt > em > strong, .visual_font_size_8pt em span, .visual_font_size_8pt span em {
.visual_font_size_8pt, .visual_font_size_8pt > em, .visual_font_size_8pt > strong, .visual_font_size_8pt > strong > span , .visual_font_size_8pt > span {
font-size: 8pt !important;
line-height: 8pt;
}
.visual_font_size_10pt, .visual_font_size_10pt > em , .visual_font_size_10pt > strong, .visual_font_size_10pt > strong > em, .visual_font_size_10pt > em > strong, .visual_font_size_10pt em span, .visual_font_size_10pt span em {
font-size: 10pt !important;
line-height: 10pt;
}
.visual_font_size_12pt, .visual_font_size_12pt > em , .visual_font_size_12pt > strong, .visual_font_size_12pt > strong > em, .visual_font_size_12pt > em > strong, .visual_font_size_12pt em span, .visual_font_size_12pt span em {
font-size: 12pt !important;
line-height: 12pt;
}
.visual_font_size_14pt, .visual_font_size_14pt > em , .visual_font_size_14pt > strong, .visual_font_size_14pt > strong > span, .visual_font_size_14pt > span, .visual_font_size_14pt > strong > em, .visual_font_size_14pt > em > strong, .visual_font_size_14pt em span, .visual_font_size_14pt span em {
.visual_font_size_14pt, .visual_font_size_14pt > em , .visual_font_size_14pt > strong, .visual_font_size_14pt > strong > span, .visual_font_size_14pt > span {
font-size: 14pt !important;
line-height: 14pt;
}
.visual_font_size_24pt, .visual_font_size_24pt > em, .visual_font_size_24pt > strong, .visual_font_size_24pt > strong > span , .visual_font_size_24pt > span, .visual_font_size_24pt > strong > em, .visual_font_size_24pt > em > strong, .visual_font_size_24pt em span, .visual_font_size_24pt span em {
.visual_font_size_24pt, .visual_font_size_24pt > em, .visual_font_size_24pt > strong, .visual_font_size_24pt > strong > span , .visual_font_size_24pt > span {
font-size: 24pt !important;
line-height: 24pt;
}
.visual_font_size_36pt, .visual_font_size_36pt > em, .visual_font_size_36pt > strong, .visual_font_size_36pt > strong > span, .visual_font_size_36pt > span, .visual_font_size_36pt > strong > em, .visual_font_size_36pt > em > strong, .visual_font_size_36pt em span, .visual_font_size_36pt span em {
.visual_font_size_36pt, .visual_font_size_36pt > em, .visual_font_size_36pt > strong, .visual_font_size_36pt > strong > span, .visual_font_size_36pt > span {
font-size: 36pt !important;
line-height: 36pt;
}
.visual_font_size_72pt, .visual_font_size_72pt > em, .visual_font_size_72pt > strong, .visual_font_size_72pt > strong > span, .visual_font_size_72pt > span, .visual_font_size_72pt > strong > em, .visual_font_size_72pt > em > strong, .visual_font_size_72pt em span, .visual_font_size_72pt span em {
.visual_font_size_72pt, .visual_font_size_72pt > em, .visual_font_size_72pt > strong, .visual_font_size_72pt > strong > span, .visual_font_size_72pt > span {
font-size: 72pt !important;
line-height: 72pt;
}
.visual_font_size_96pt, .visual_font_size_96pt > em, .visual_font_size_96pt > strong, .visual_font_size_96pt > strong > span, .visual_font_size_96pt > span, .visual_font_size_96pt > strong > em, .visual_font_size_96pt > em > strong, .visual_font_size_96pt em span, .visual_font_size_96pt span em {
.visual_font_size_96pt, .visual_font_size_96pt > em, .visual_font_size_96pt > strong, .visual_font_size_96pt > strong > span, .visual_font_size_96pt > span {
font-size: 96pt !important;
line-height: 96pt;
}
.visual_font_size_128pt, .visual_font_size_128pt > em, .visual_font_size_128pt > strong, .visual_font_size_128pt > strong > span, .visual_font_size_128pt > span, .visual_font_size_128pt > strong > em, .visual_font_size_128pt > em > strong, .visual_font_size_128pt em span, .visual_font_size_128pt span em {
.visual_font_size_128pt, .visual_font_size_128pt > em, .visual_font_size_128pt > strong, .visual_font_size_128pt > strong > span, .visual_font_size_128pt > span {
font-size: 128pt !important;
line-height: 128pt;
}
.visual_font_size_154pt, .visual_font_size_154pt > em, .visual_font_size_154pt > strong, .visual_font_size_154pt > strong > span, .visual_font_size_154pt > span, .visual_font_size_154pt > strong > em, .visual_font_size_154pt > em > strong, .visual_font_size_154pt em span, .visual_font_size_154pt span em {
.visual_font_size_154pt, .visual_font_size_154pt > em, .visual_font_size_154pt > strong, .visual_font_size_154pt > strong > span, .visual_font_size_154pt > span {
font-size: 154pt !important;
line-height: 154pt;
}
.visual_font_size_196pt, .visual_font_size_196pt > em, .visual_font_size_196pt > strong, .visual_font_size_196pt > strong > span, .visual_font_size_196pt > span, .visual_font_size_196pt > strong > em, .visual_font_size_196pt > em > strong, .visual_font_size_196pt em span, .visual_font_size_196pt span em {
.visual_font_size_196pt, .visual_font_size_196pt > em, .visual_font_size_196pt > strong, .visual_font_size_196pt > strong > span, .visual_font_size_196pt > span {
font-size: 196pt !important;
line-height: 196pt;
}
.resize_visual_font_size_8pt, .resize_visual_font_size_8pt > em, .resize_visual_font_size_8pt > strong, .resize_visual_font_size_8pt > strong > span, .resize_visual_font_size_8pt > span, .resize_visual_font_size_8pt > strong > em, .resize_visual_font_size_8pt > em > strong, .visual_font_size_8pt em span, .visual_font_size_8pt span em {
.resize_visual_font_size_8pt, .resize_visual_font_size_8pt > em, .resize_visual_font_size_8pt > strong, .resize_visual_font_size_8pt > strong > span, .resize_visual_font_size_8pt > span {
font-size: 4pt !important;
line-height: 4pt;
}
.resize_visual_font_size_14pt, .resize_visual_font_size_14pt > em , .resize_visual_font_size_14pt > strong, .resize_visual_font_size_14pt > strong > span, .resize_visual_font_size_14pt > span, .resize_visual_font_size_14pt > strong > em, .resize_visual_font_size_14pt > em > strong, .visual_font_size_14pt em span, .visual_font_size_14pt span em {
.resize_visual_font_size_14pt, .resize_visual_font_size_14pt > em , .resize_visual_font_size_14pt > strong, .resize_visual_font_size_14pt > strong > span, .resize_visual_font_size_14pt > span {
font-size: 7pt !important;
line-height: 7pt;
}
.resize_visual_font_size_24pt, .resize_visual_font_size_24pt > em, .resize_visual_font_size_24pt > strong, .resize_visual_font_size_24pt > strong > span, .resize_visual_font_size_24pt > span, .resize_visual_font_size_24pt > strong > em, .resize_visual_font_size_24pt > em > strong, .visual_font_size_14pt em span, .visual_font_size_14pt span em {
.resize_visual_font_size_24pt, .resize_visual_font_size_24pt > em, .resize_visual_font_size_24pt > strong, .resize_visual_font_size_24pt > strong > span, .resize_visual_font_size_24pt > span {
font-size: 12pt !important;
line-height: 12pt;
}
.resize_visual_font_size_36pt, .resize_visual_font_size_36pt > em, .resize_visual_font_size_36pt > strong, .resize_visual_font_size_36pt > strong > span, .resize_visual_font_size_36pt > span, .resize_visual_font_size_36pt > strong > em, .resize_visual_font_size_36pt > em > strong, .visual_font_size_36pt em span, .visual_font_size_36pt span em {
.resize_visual_font_size_36pt, .resize_visual_font_size_36pt > em, .resize_visual_font_size_36pt > strong, .resize_visual_font_size_36pt > strong > span, .resize_visual_font_size_36pt > span {
font-size: 18pt !important;
line-height: 18pt;
}
.resize_visual_font_size_72pt, .resize_visual_font_size_72pt > em, .resize_visual_font_size_72pt > strong, .resize_visual_font_size_72pt > strong > span, .resize_visual_font_size_72pt > span, .resize_visual_font_size_72pt > strong > em, .resize_visual_font_size_72pt > em > strong, .visual_font_size_72pt em span, .visual_font_size_72pt span em {
.resize_visual_font_size_72pt, .resize_visual_font_size_72pt > em, .resize_visual_font_size_72pt > strong, .resize_visual_font_size_72pt > strong > span, .resize_visual_font_size_72pt > span {
font-size: 36pt !important;
line-height: 36pt;
}
/*SIDEBAR*/
@ -3502,30 +3477,6 @@ div.simple_value > a > span.text p
src: url('../fonts/unicode.ttf') format('truetype');
}
@font-face
{
font-family: 'roboto';
src: url('../../fonts/roboto.woff2') format('woff2');
}
@font-face
{
font-family: 'opensans';
src: url('../../fonts/opensans.woff2') format('woff2');
}
@font-face
{
font-family: 'lato';
src: url('../../fonts/lato.woff2') format('woff2');
}
@font-face
{
font-family: 'leaguegothic';
src: url('../../fonts/leaguegothic.woff') format('woff');
}
.unicode{
font-family: unicodeFont;
}
@ -3673,4 +3624,10 @@ color:#82b92e;font-family:Nunito;font-size:10pt;position:relative;top:6px;
#tinymce{
padding-top:20px;
}
#filter_event_status,
#filter_event_severity,
#filter_event_type {
width:50%;
}

View File

@ -723,7 +723,7 @@ else {
$main_sec = get_parameter('extension_in_menu');
else
if ($sec == 'gextensions')
+ $main_sec = get_parameter('extension_in_menu');
$main_sec = get_parameter('extension_in_menu');
else
$main_sec = $sec;
$sec = $sec2;

View File

@ -71,7 +71,7 @@
<div style='height: 10px'>
<?php
$version = '7.0dev';
$build = '170118';
$build = '170119';
$banner = "v$version Build $build";
error_reporting(0);

View File

@ -3,7 +3,7 @@
#
%define name pandorafms_console
%define version 7.0dev
%define release 170118
%define release 170119
# User and Group under which Apache is running
%define httpd_name httpd

View File

@ -3,7 +3,7 @@
#
%define name pandorafms_console
%define version 7.0dev
%define release 170118
%define release 170119
%define httpd_name httpd
# User and Group under which Apache is running
%define httpd_name apache2

View File

@ -66,7 +66,7 @@ INSERT INTO tconfig (token, value) VALUES ('graph_res','5');
INSERT INTO tconfig (token, value) VALUES ('step_compact','1');
INSERT INTO tconfig (token, value) VALUES ('db_scheme_first_version','6.0orc');
INSERT INTO tconfig (token, value) VALUES('db_scheme_version','7.0dev');
INSERT INTO tconfig (token, value) VALUES('db_scheme_build','PD170118');
INSERT INTO tconfig (token, value) VALUES('db_scheme_build','PD170119');
INSERT INTO tconfig (token, value) VALUES ('show_unknown','0');
INSERT INTO tconfig (token, value) VALUES ('show_lastalerts','1');
INSERT INTO tconfig (token, value) VALUES ('style','pandora');

View File

@ -1,5 +1,5 @@
package: pandorafms-server
Version: 7.0dev-170118
Version: 7.0dev-170119
Architecture: all
Priority: optional
Section: admin

View File

@ -14,7 +14,7 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
pandora_version="7.0dev-170118"
pandora_version="7.0dev-170119"
package_cpan=0
package_pandora=1

View File

@ -43,7 +43,7 @@ our @EXPORT = qw(
# version: Defines actual version of Pandora Server for this module only
my $pandora_version = "7.0dev";
my $pandora_build = "170118";
my $pandora_build = "170119";
our $VERSION = $pandora_version." ".$pandora_build;
# Setup hash

View File

@ -3,7 +3,7 @@
#
%define name pandorafms_server
%define version 7.0dev
%define release 170118
%define release 170119
Summary: Pandora FMS Server
Name: %{name}

View File

@ -3,7 +3,7 @@
#
%define name pandorafms_server
%define version 7.0dev
%define release 170118
%define release 170119
Summary: Pandora FMS Server
Name: %{name}

View File

@ -9,7 +9,7 @@
# **********************************************************************
PI_VERSION="7.0dev"
PI_BUILD="170118"
PI_BUILD="170119"
MODE=$1
if [ $# -gt 1 ]; then

View File

@ -33,7 +33,7 @@ use PandoraFMS::Tools;
use PandoraFMS::DB;
# version: define current version
my $version = "7.0dev PS170118";
my $version = "7.0dev PS170119";
# Pandora server configuration
my %conf;

View File

@ -35,7 +35,7 @@ use Encode::Locale;
Encode::Locale::decode_argv;
# version: define current version
my $version = "7.0dev PS170118";
my $version = "7.0dev PS170119";
# save program name for logging
my $progname = basename($0);