diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/libs/zbxdbhigh/db.c | 2 | ||||
-rw-r--r-- | src/zabbix_server/alerter/alerter.c | 6 |
2 files changed, 2 insertions, 6 deletions
diff --git a/src/libs/zbxdbhigh/db.c b/src/libs/zbxdbhigh/db.c index f0771a16..cb3629e5 100644 --- a/src/libs/zbxdbhigh/db.c +++ b/src/libs/zbxdbhigh/db.c @@ -523,7 +523,7 @@ int add_alarm(int triggerid,int status,int clock,int *alarmid) /* Cancel currently active alerts */ if(status == TRIGGER_VALUE_FALSE || status == TRIGGER_VALUE_TRUE) { - snprintf(sql,sizeof(sql)-1,"update alerts set retries=3,error='Trigger changed its status. WIll not send repeats.' where triggerid=%d and repeats>0", triggerid); + snprintf(sql,sizeof(sql)-1,"update alerts set retries=3,error='Trigger changed its status. WIll not send repeats.' where triggerid=%d and repeats>0 and status=%d", triggerid, ALERT_STATUS_NOT_SENT); DBexecute(sql); } 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); } |