Skip to content

Commit 5899507

Browse files
authored
Fix issue #128 (#129)
* Fix issue #128 Fix issue #128 * Fix issue #128 Fix issue #128
1 parent 393dfa7 commit 5899507

2 files changed

Lines changed: 28 additions & 26 deletions

File tree

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,7 @@ that.
158158
--- develop ---
159159

160160
* issue#122: Apply Cacti#3191 for XSS exposure (CVE-2020-7106)
161+
* issue#128:The syslog alert email is not sent if the Reporting Method is set to threshold.
161162

162163
--- 2.9 ---
163164

syslog_process.php

Lines changed: 27 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -451,6 +451,33 @@
451451
$alertm .= "-----------------------------------------------\n\n";
452452

453453
if ($alert['method'] == 1) {
454+
//The syslog_sendemail should be called prior to syslog_log_alert, otherwise, the $found always larger than 0
455+
if ($alertm != '') {
456+
$resend = true;
457+
if ($alert['repeat_alert'] > 0) {
458+
$found = syslog_db_fetch_cell('SELECT count(*)
459+
FROM syslog_logs
460+
WHERE alert_id=' . $alert['id'] . "
461+
AND logtime>'$date'");
462+
463+
if ($found) $resend = false;
464+
}
465+
466+
if ($resend) {
467+
syslog_sendemail(trim($alert['email']), $from, __esc('Event Alert - %s', $alert['name'], 'syslog'), ($html ? $htmlm:$alertm), $smsalert);
468+
469+
if ($alert['open_ticket'] == 'on' && strlen(read_config_option('syslog_ticket_command'))) {
470+
if (is_executable(read_config_option('syslog_ticket_command'))) {
471+
exec(read_config_option('syslog_ticket_command') .
472+
" --alert-name='" . clean_up_name($alert['name']) . "'" .
473+
" --severity='" . $alert['severity'] . "'" .
474+
" --hostlist='" . implode(',',$hostlist) . "'" .
475+
" --message='" . $alert['message'] . "'");
476+
}
477+
}
478+
}
479+
}
480+
454481
$sequence = syslog_log_alert($alert['id'], $alert['name'], $alert['severity'], $at[0], sizeof($at), $htmlm, $hostlist);
455482
$smsalert = __('Sev:', 'syslog') . $severities[$alert['severity']] . __(', Count:', 'syslog') . sizeof($at) . __(', URL:', 'syslog') . read_config_option('base_url', true) . '/plugins/syslog/syslog.php?tab=current&id=' . $sequence;
456483
}
@@ -459,32 +486,6 @@
459486
}
460487
}
461488
}
462-
463-
if ($alertm != '' && $alert['method'] == 1) {
464-
$resend = true;
465-
if ($alert['repeat_alert'] > 0) {
466-
$found = syslog_db_fetch_cell('SELECT count(*)
467-
FROM syslog_logs
468-
WHERE alert_id=' . $alert['id'] . "
469-
AND logtime>'$date'");
470-
471-
if ($found) $resend = false;
472-
}
473-
474-
if ($resend) {
475-
syslog_sendemail(trim($alert['email']), $from, __esc('Event Alert - %s', $alert['name'], 'syslog'), ($html ? $htmlm:$alertm), $smsalert);
476-
477-
if ($alert['open_ticket'] == 'on' && strlen(read_config_option('syslog_ticket_command'))) {
478-
if (is_executable(read_config_option('syslog_ticket_command'))) {
479-
exec(read_config_option('syslog_ticket_command') .
480-
" --alert-name='" . clean_up_name($alert['name']) . "'" .
481-
" --severity='" . $alert['severity'] . "'" .
482-
" --hostlist='" . implode(',',$hostlist) . "'" .
483-
" --message='" . $alert['message'] . "'");
484-
}
485-
}
486-
}
487-
}
488489
}
489490
}
490491

0 commit comments

Comments
 (0)