Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ that.
--- develop ---

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

--- 2.9 ---

Expand Down
53 changes: 27 additions & 26 deletions syslog_process.php
Original file line number Diff line number Diff line change
Expand Up @@ -451,6 +451,33 @@
$alertm .= "-----------------------------------------------\n\n";

if ($alert['method'] == 1) {
//The syslog_sendemail should be called prior to syslog_log_alert, otherwise, the $found always larger than 0
if ($alertm != '') {
$resend = true;
if ($alert['repeat_alert'] > 0) {
$found = syslog_db_fetch_cell('SELECT count(*)
FROM syslog_logs
WHERE alert_id=' . $alert['id'] . "
AND logtime>'$date'");

if ($found) $resend = false;
}

if ($resend) {
syslog_sendemail(trim($alert['email']), $from, __esc('Event Alert - %s', $alert['name'], 'syslog'), ($html ? $htmlm:$alertm), $smsalert);

if ($alert['open_ticket'] == 'on' && strlen(read_config_option('syslog_ticket_command'))) {
if (is_executable(read_config_option('syslog_ticket_command'))) {
exec(read_config_option('syslog_ticket_command') .
" --alert-name='" . clean_up_name($alert['name']) . "'" .
" --severity='" . $alert['severity'] . "'" .
" --hostlist='" . implode(',',$hostlist) . "'" .
" --message='" . $alert['message'] . "'");
}
}
}
}

$sequence = syslog_log_alert($alert['id'], $alert['name'], $alert['severity'], $at[0], sizeof($at), $htmlm, $hostlist);
$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;
}
Expand All @@ -459,32 +486,6 @@
}
}
}

if ($alertm != '' && $alert['method'] == 1) {
$resend = true;
if ($alert['repeat_alert'] > 0) {
$found = syslog_db_fetch_cell('SELECT count(*)
FROM syslog_logs
WHERE alert_id=' . $alert['id'] . "
AND logtime>'$date'");

if ($found) $resend = false;
}

if ($resend) {
syslog_sendemail(trim($alert['email']), $from, __esc('Event Alert - %s', $alert['name'], 'syslog'), ($html ? $htmlm:$alertm), $smsalert);

if ($alert['open_ticket'] == 'on' && strlen(read_config_option('syslog_ticket_command'))) {
if (is_executable(read_config_option('syslog_ticket_command'))) {
exec(read_config_option('syslog_ticket_command') .
" --alert-name='" . clean_up_name($alert['name']) . "'" .
" --severity='" . $alert['severity'] . "'" .
" --hostlist='" . implode(',',$hostlist) . "'" .
" --message='" . $alert['message'] . "'");
}
}
}
}
}
}

Expand Down