diff options
author | hugetoad <hugetoad@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2005-10-11 16:57:32 +0000 |
---|---|---|
committer | hugetoad <hugetoad@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2005-10-11 16:57:32 +0000 |
commit | ac20f3bd016e7d596b47a7dc98ec07821e9e26f5 (patch) | |
tree | a458ddc7073dc5884ea3c57ef07b86e699f1204f | |
parent | 0c229c4ffffb0f8d8092f6c3a848f365abfd2bdc (diff) | |
download | zabbix-ac20f3bd016e7d596b47a7dc98ec07821e9e26f5.tar.gz zabbix-ac20f3bd016e7d596b47a7dc98ec07821e9e26f5.tar.xz zabbix-ac20f3bd016e7d596b47a7dc98ec07821e9e26f5.zip |
Minor changes.
git-svn-id: svn://svn.zabbix.com/trunk@2173 97f52cf1-0a1b-0410-bd0e-c28be96e8082
-rw-r--r-- | frontends/php/actions.php | 13 | ||||
-rw-r--r-- | src/libs/zbxdbhigh/db.c | 2 | ||||
-rw-r--r-- | src/zabbix_server/alerter/alerter.c | 6 |
3 files changed, 13 insertions, 8 deletions
diff --git a/frontends/php/actions.php b/frontends/php/actions.php index e812f8ed..86a998df 100644 --- a/frontends/php/actions.php +++ b/frontends/php/actions.php @@ -40,7 +40,12 @@ { if($_GET["register"]=="add") { - if($_GET["repeat"]==0) $_GET["maxrepeats"]=0; + if($_GET["repeat"]==0) + { + $_GET["maxrepeats"]=0; + $_GET["repeatdelay"]=600; + } + $actionid=add_action( $_GET["triggerid"], $_GET["userid"], $_GET["good"], $_GET["delay"], $_GET["subject"], $_GET["message"],$_GET["scope"],$_GET["severity"],$_GET["recipient"],$_GET["usrgrpid"],$_GET["maxrepeats"],$_GET["repeatdelay"]); add_action_to_linked_hosts($actionid); show_messages($actionid,S_ACTION_ADDED,S_CANNOT_ADD_ACTION); @@ -60,7 +65,11 @@ } if($_GET["register"]=="update") { - if($_GET["repeat"]==0) $_GET["maxrepeats"]=0; + if($_GET["repeat"]==0) + { + $_GET["maxrepeats"]=0; + $_GET["repeatdelay"]=600; + } $result=update_action( $_GET["actionid"], $_GET["triggerid"], $_GET["userid"], $_GET["good"], $_GET["delay"], $_GET["subject"], $_GET["message"],$_GET["scope"],$_GET["severity"],$_GET["recipient"],$_GET["usrgrpid"],$_GET["maxrepeats"],$_GET["repeatdelay"]); show_messages($result,S_ACTION_UPDATED,S_CANNOT_UPDATE_ACTION); if($result) 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); } |