diff --git a/pandora_console/include/ajax/events.php b/pandora_console/include/ajax/events.php
index 9476b41718..706a875eec 100644
--- a/pandora_console/include/ajax/events.php
+++ b/pandora_console/include/ajax/events.php
@@ -1865,11 +1865,12 @@ if ($get_table_response_command) {
}
if ($get_events_fired) {
+ global $config;
$id = get_parameter('id_row');
$idGroup = get_parameter('id_group');
$agents = get_parameter('agents', null);
- $query = ' AND id_evento > '.$id;
+ $query = ' AND id_evento >= '.$id;
$type = [];
$alert = get_parameter('alert_fired');
@@ -1889,7 +1890,10 @@ if ($get_events_fired) {
if ($critical == 'true') {
$resultCritical = alerts_get_event_status_group(
$idGroup,
- 'going_up_critical',
+ [
+ 'going_up_critical',
+ 'going_down_critical',
+ ],
$query,
$agents
);
@@ -1899,7 +1903,10 @@ if ($get_events_fired) {
if ($warning == 'true') {
$resultWarning = alerts_get_event_status_group(
$idGroup,
- 'going_up_warning',
+ [
+ 'going_up_warning',
+ 'going_down_warning',
+ ],
$query,
$agents
);
diff --git a/pandora_console/include/functions_alerts.php b/pandora_console/include/functions_alerts.php
index 9e27001d15..68e0a16923 100644
--- a/pandora_console/include/functions_alerts.php
+++ b/pandora_console/include/functions_alerts.php
@@ -173,13 +173,22 @@ function alerts_get_event_status_group($idGroup, $type='alert_fired', $query='AN
$idAgents = array_values($agents);
}
- $result = db_get_all_rows_sql(
+ $sql = sprintf(
'SELECT id_evento
- FROM tevento
- WHERE estado = 0 AND id_agente IN (0,'.implode(',', $idAgents).') '.$typeWhere.$query.'
- ORDER BY id_evento DESC LIMIT 1'
+ FROM tevento
+ WHERE estado = 0
+ AND id_agente IN (0, %s)
+ %s
+ %s
+ ORDER BY id_evento DESC
+ LIMIT 1',
+ implode(',', $idAgents),
+ $typeWhere,
+ $query
);
+ $result = db_get_all_rows_sql($sql);
+
if ($result === false) {
return false;
}
diff --git a/pandora_console/include/functions_api.php b/pandora_console/include/functions_api.php
index aebef6c06b..ca0a633d6a 100644
--- a/pandora_console/include/functions_api.php
+++ b/pandora_console/include/functions_api.php
@@ -12423,6 +12423,7 @@ function api_set_create_tag($id, $trash1, $other, $returnType)
// http://127.0.0.1/pandora_console/include/api.php?op=set&op2=create_event&id=name_event&other=2|system|3|admin|2|1|10|0|comments||Pandora||critical_inst|warning_inst|unknown_inst|other||&other_mode=url_encode_separator_|&apipass=1234&user=admin&pass=pandora
+// http://127.0.0.1/pandora_console/include/api.php?op=set&op2=create_event&id=name_event&other=textodelevento|10|2|0|admin|going_down_critical|4|&other_mode=url_encode_separator_|&apipass=1234&user=admin&pass=pandora
function api_set_create_event($id, $trash1, $other, $returnType)
{
global $config;
diff --git a/pandora_console/operation/events/sound_events.php b/pandora_console/operation/events/sound_events.php
index 5a7fc45f0f..3881f468ae 100644
--- a/pandora_console/operation/events/sound_events.php
+++ b/pandora_console/operation/events/sound_events.php
@@ -1,18 +1,31 @@
'.__('Sound Events').'';
margin: 0;
padding: 0;
}
-
+
img {
border: 0;
}
@@ -72,7 +88,12 @@ $conn_title = __('Connection with server has been lost');
$conn_text = __('Connection to the server has been lost. Please check your internet connection or contact with administrator.');
ui_require_javascript_file('connection_check');
set_js_value('absolute_homeurl', ui_get_full_url(false, false, false, false));
-ui_print_message_dialog($conn_title, $conn_text, 'connection', '/images/error_1.png');
+ui_print_message_dialog(
+ $conn_title,
+ $conn_text,
+ 'connection',
+ '/images/error_1.png'
+);
$table = new StdClass;
$table->width = '100%';
@@ -83,16 +104,91 @@ $table->rowclass[1] = 'bold_top';
$table->rowclass[2] = 'bold_top';
$table->data[0][0] = __('Group');
-$table->data[0][1] = html_print_select_groups(false, $access, true, 'group', '', 'changeGroup();', '', 0, true, false, true, '', false, 'max-width:200px;').'
'.'
';
+$table->data[0][1] = html_print_select_groups(
+ false,
+ $access,
+ true,
+ 'group',
+ '',
+ 'changeGroup();',
+ '',
+ 0,
+ true,
+ false,
+ true,
+ '',
+ false,
+ 'max-width:200px;'
+).'
';
$table->data[0][2] = __('Type');
-$table->data[0][3] = html_print_checkbox('alert_fired', 'alert_fired', true, true, false, 'changeType();').__('Alert fired').'
'.html_print_checkbox('critical', 'critical', true, true, false, 'changeType();').__('Monitor critical').'
'.html_print_checkbox('unknown', 'unknown', true, true, false, 'changeType();').__('Monitor unknown').'
'.html_print_checkbox('warning', 'warning', true, true, false, 'changeType();').__('Monitor warning').'
';
+$table->data[0][3] = html_print_checkbox(
+ 'alert_fired',
+ 'alert_fired',
+ true,
+ true,
+ false,
+ 'changeType();'
+);
+$table->data[0][3] .= __('Alert fired').'
';
+$table->data[0][3] .= html_print_checkbox(
+ 'critical',
+ 'critical',
+ true,
+ true,
+ false,
+ 'changeType();'
+);
+$table->data[0][3] .= __('Monitor critical').'
';
+$table->data[0][3] .= html_print_checkbox(
+ 'unknown',
+ 'unknown',
+ true,
+ true,
+ false,
+ 'changeType();'
+);
+$table->data[0][3] .= __('Monitor unknown').'
';
+$table->data[0][3] .= html_print_checkbox(
+ 'warning',
+ 'warning',
+ true,
+ true,
+ false,
+ 'changeType();'
+);
+$table->data[0][3] .= __('Monitor warning').'
';
$table->data[1][0] = __('Agent');
-$table->data[1][1] = html_print_select($agents, 'id_agents[]', true, false, '', '', true, true, '', '', '', 'max-width:200px; height:100px', '', false, '', '', true);
+$table->data[1][1] = html_print_select(
+ $agents,
+ 'id_agents[]',
+ true,
+ false,
+ '',
+ '',
+ true,
+ true,
+ '',
+ '',
+ '',
+ 'max-width:200px; height:100px',
+ '',
+ false,
+ '',
+ '',
+ true
+);
$table->data[1][2] = __('Event');
-$table->data[1][3] = html_print_textarea('events_fired', 200, 20, '', 'readonly="readonly" style="max-height:100px; resize:none;"', true);
+$table->data[1][3] = html_print_textarea(
+ 'events_fired',
+ 200,
+ 20,
+ '',
+ 'readonly="readonly" style="max-height:100px; resize:none;"',
+ true
+);
html_print_table($table);
@@ -100,13 +196,41 @@ $table = new StdClass;
$table->width = '100%';
$table->class = 'w16px sound_div_background text_center';
-$table->data[0][0] = ''.html_print_image('images/play.button.png', true, ['id' => 'button']).'';
+$table->data[0][0] = '';
+$table->data[0][0] .= html_print_image(
+ 'images/play.button.png',
+ true,
+ ['id' => 'button']
+);
+$table->data[0][0] .= '';
-$table->data[0][1] .= ''.html_print_image('images/ok.button.png', true, ['style' => 'margin-left: 15px;']).'';
+$table->data[0][1] = '';
+$table->data[0][1] .= html_print_image(
+ 'images/ok.button.png',
+ true,
+ ['style' => 'margin-left: 15px;']
+);
+$table->data[0][1] .= '';
-$table->data[0][2] .= ''.html_print_image('images/icono_test.png', true, ['id' => 'button_try', 'style' => 'margin-left: 15px;']).'';
+$table->data[0][2] = '';
+$table->data[0][2] .= html_print_image(
+ 'images/icono_test.png',
+ true,
+ [
+ 'id' => 'button_try',
+ 'style' => 'margin-left: 15px;',
+ ]
+);
+$table->data[0][2] .= '';
-$table->data[0][3] .= html_print_image('images/tick_sound_events.png', true, ['id' => 'button_status', 'style' => 'margin-left: 15px;']);
+$table->data[0][3] = html_print_image(
+ 'images/tick_sound_events.png',
+ true,
+ [
+ 'id' => 'button_status',
+ 'style' => 'margin-left: 15px;',
+ ]
+);
html_print_table($table);
?>
@@ -149,10 +273,12 @@ function changeGroup() {
},
function (data) {
$("#id_agents").empty();
-
jQuery.each (data, function (id, value) {
if (value != "") {
- $("#id_agents").append('');
+ $("#id_agents")
+ .append(
+ ''
+ );
}
});
},
@@ -187,14 +313,14 @@ function toggleButton() {
if (button_play_status == 'pause') {
$("#button").attr('src', '../../images/play.button.png');
stopSound();
-
+
button_play_status = 'play';
}
else {
$("#button").attr('src', '../../images/pause.button.png');
forgetPreviousEvents();
startSound();
-
+
button_play_status = 'pause';
}
}
@@ -207,9 +333,7 @@ function ok() {
function stopSound() {
$('audio').remove();
-
$('body').css('background', '#494949');
-
running = false;
}
@@ -263,13 +387,21 @@ function check_event() {
var actual_text = $('#textarea_events_fired').val();
if (actual_text == "") {
$('#textarea_events_fired').val(data['message'] + "\n");
+ } else {
+ $('#textarea_events_fired')
+ .val(actual_text + "\n" + data['message'] + "\n");
}
- else {
- $('#textarea_events_fired').val(actual_text + "\n" + data['message'] + "\n");
- }
- $('#button_status').attr('src','../../images/sound_events_console_alert.gif');
+ $('#button_status')
+ .attr(
+ 'src','../../images/sound_events_console_alert.gif'
+ );
$('audio').remove();
- $('body').append("