summaryrefslogtreecommitdiffstats
path: root/src/zabbix_server/alerter/alerter.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/zabbix_server/alerter/alerter.c')
-rw-r--r--src/zabbix_server/alerter/alerter.c6
1 files changed, 1 insertions, 5 deletions
diff --git a/src/zabbix_server/alerter/alerter.c b/src/zabbix_server/alerter/alerter.c
index bb25f8ee..d477b415 100644
--- a/src/zabbix_server/alerter/alerter.c
+++ b/src/zabbix_server/alerter/alerter.c
@@ -202,7 +202,6 @@ int main_alerter_loop()
/* snprintf(sql,sizeof(sql)-1,"select a.alertid,a.mediatypeid,a.sendto,a.subject,a.message,a.status,a.retries,mt.mediatypeid,mt.type,mt.description,mt.smtp_server,mt.smtp_helo,mt.smtp_email,mt.exec_path from alerts a,media_type mt where a.status=0 and a.retries<3 and a.mediatypeid=mt.mediatypeid order by a.clock"); */
snprintf(sql,sizeof(sql)-1,"select a.alertid,a.mediatypeid,a.sendto,a.subject,a.message,a.status,a.retries,mt.mediatypeid,mt.type,mt.description,mt.smtp_server,mt.smtp_helo,mt.smtp_email,mt.exec_path,a.delay from alerts a,media_type mt where a.status=%d and a.retries<3 and (a.repeats<a.maxrepeats or a.maxrepeats=0) and a.nextcheck<=%d and a.mediatypeid=mt.mediatypeid order by a.clock", ALERT_STATUS_NOT_SENT, now);
- zabbix_log( LOG_LEVEL_WARNING, "SQL [%s]", sql);
result = DBselect(sql);
for(i=0;i<DBnum_rows(result);i++)
@@ -239,10 +238,8 @@ int main_alerter_loop()
{
zabbix_log( LOG_LEVEL_DEBUG, "Alert ID [%d] was sent successfully", alert.alertid);
snprintf(sql,sizeof(sql)-1,"update alerts set repeats=repeats+1, nextcheck=%d where alertid=%d", now+alert.delay, alert.alertid);
- zabbix_log( LOG_LEVEL_WARNING, "SQL [%s]", sql);
DBexecute(sql);
- snprintf(sql,sizeof(sql)-1,"update alerts set status=%d where alertid=%d and repeats>maxrepeats and status=%d and retries<3", ALERT_STATUS_SENT, alert.alertid, ALERT_STATUS_NOT_SENT);
- zabbix_log( LOG_LEVEL_WARNING, "SQL [%s]", sql);
+ snprintf(sql,sizeof(sql)-1,"update alerts set status=%d where alertid=%d and repeats>=maxrepeats and status=%d and retries<3", ALERT_STATUS_SENT, alert.alertid, ALERT_STATUS_NOT_SENT);
DBexecute(sql);
}
else
@@ -251,7 +248,6 @@ int main_alerter_loop()
zabbix_syslog("Error sending alert ID [%d]", alert.alertid);
DBescape_string(error,error_esc,MAX_STRING_LEN);
snprintf(sql,sizeof(sql)-1,"update alerts set retries=retries+1,error='%s' where alertid=%d", error_esc, alert.alertid);
- zabbix_log( LOG_LEVEL_WARNING, "SQL [%s]", sql);
DBexecute(sql);
}