diff options
| author | alex <alex@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2006-11-24 20:52:20 +0000 |
|---|---|---|
| committer | alex <alex@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2006-11-24 20:52:20 +0000 |
| commit | a3f08e843a2c7647a45c7d9599bf6418e31bcd71 (patch) | |
| tree | 8f50a4b080dd49a64001fc095d5c33c6bf63774e | |
| parent | 8d9173ae38da6a3a69cb9f0f5c3dfca335ff9ca8 (diff) | |
Minor changes.
git-svn-id: svn://svn.zabbix.com/trunk@3518 97f52cf1-0a1b-0410-bd0e-c28be96e8082
| -rw-r--r-- | create/data/data.sql | 2 | ||||
| -rw-r--r-- | src/zabbix_server/actions.c | 6 | ||||
| -rw-r--r-- | src/zabbix_server/alerter/alerter.c | 16 |
3 files changed, 13 insertions, 11 deletions
diff --git a/create/data/data.sql b/create/data/data.sql index 2bfcfdcf..974c4399 100644 --- a/create/data/data.sql +++ b/create/data/data.sql @@ -35,7 +35,7 @@ INSERT INTO media_type VALUES (1,0,'Email','localhost','localhost','zabbix@local INSERT INTO users VALUES (1,'Admin','Zabbix','Administrator','d41d8cd98f00b204e9800998ecf8427e','',900,'en_gb',30,3); INSERT INTO users VALUES (2,'guest','Default','User','d41d8cd98f00b204e9800998ecf8427e','',900,'en_gb',30,1); -INSERT INTO users VALUES (3,'osmiy','Eugene','Grigorjev','3e5bcb058fa707f77b898c85cc13b6a0','',1800,'ru_ru',60,3); +-- INSERT INTO users VALUES (3,'osmiy','Eugene','Grigorjev','3e5bcb058fa707f77b898c85cc13b6a0','',1800,'ru_ru',60,3); -- -- Dumping data for table `usrgrp` diff --git a/src/zabbix_server/actions.c b/src/zabbix_server/actions.c index 16061519..7eb8c963 100644 --- a/src/zabbix_server/actions.c +++ b/src/zabbix_server/actions.c @@ -444,6 +444,7 @@ static int check_action_condition(DB_EVENT *event, DB_CONDITION *condition) else if(condition->conditiontype == CONDITION_TYPE_TRIGGER) { ZBX_STR2UINT64(condition_value, condition->value); + zabbix_log( LOG_LEVEL_DEBUG, "CONDITION_TYPE_TRIGGER [" ZBX_FS_UI64 ":%s]", condition_value, condition->value); if(condition->operator == CONDITION_OPERATOR_EQUAL) { // if(trigger->triggerid == atoi(condition->value)) @@ -536,6 +537,7 @@ static int check_action_condition(DB_EVENT *event, DB_CONDITION *condition) } else if(condition->conditiontype == CONDITION_TYPE_TRIGGER_VALUE) { + zabbix_log( LOG_LEVEL_DEBUG, "CONDITION_TYPE_TRIGGER_VALUE [%s:%s]", event->value, condition->value); if(condition->operator == CONDITION_OPERATOR_EQUAL) { // if(new_trigger_value == atoi(condition->value)) @@ -597,7 +599,7 @@ static int check_action_conditions(DB_EVENT *event, zbx_uint64_t actionid) zabbix_log( LOG_LEVEL_DEBUG, "In check_action_conditions [actionid:%d]", actionid); - result = DBselect("select conditionid,actionid,conditiontype,operator,value from conditions where actionid=%d order by conditiontype", actionid); + result = DBselect("select conditionid,actionid,conditiontype,operator,value from conditions where actionid=" ZBX_FS_UI64 " order by conditiontype", actionid); while((row=DBfetch(result))) { @@ -689,7 +691,7 @@ void apply_actions(DB_EVENT *event) // if(check_action_conditions(trigger, trigger_value, action.actionid) == SUCCEED) if(check_action_conditions(event, action.actionid) == SUCCEED) { - zabbix_log( LOG_LEVEL_DEBUG, "Conditions match our trigger. Do apply actions."); + zabbix_log( LOG_LEVEL_WARNING, "Conditions match our trigger. Do apply actions."); ZBX_STR2UINT64(action.userid, row[1]); // action.userid=atoi(row[1]); diff --git a/src/zabbix_server/alerter/alerter.c b/src/zabbix_server/alerter/alerter.c index 1cf2a884..75c4622a 100644 --- a/src/zabbix_server/alerter/alerter.c +++ b/src/zabbix_server/alerter/alerter.c @@ -201,7 +201,7 @@ int main_alerter_loop() while((row=DBfetch(result))) { - alert.alertid=atoi(row[0]); + ZBX_STR2UINT64(alert.alertid,row[0]); alert.mediatypeid=atoi(row[1]); alert.sendto=row[2]; alert.subject=row[3]; @@ -209,7 +209,7 @@ int main_alerter_loop() alert.status=atoi(row[5]); alert.retries=atoi(row[6]); - mediatype.mediatypeid=atoi(row[7]); + ZBX_STR2UINT64(mediatype.mediatypeid,row[7]); mediatype.type=atoi(row[8]); mediatype.description=row[9]; mediatype.smtp_server=row[10]; @@ -234,16 +234,16 @@ int main_alerter_loop() if(res==SUCCEED) { - zabbix_log( LOG_LEVEL_DEBUG, "Alert ID [%d] was sent successfully", alert.alertid); - DBexecute("update alerts set repeats=repeats+1, nextcheck=%d where alertid=%d", now+alert.delay, alert.alertid); - DBexecute("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_DEBUG, "Alert ID [" ZBX_FS_UI64 "] was sent successfully", alert.alertid); + DBexecute("update alerts set repeats=repeats+1, nextcheck=%d where alertid=" ZBX_FS_UI64, now+alert.delay, alert.alertid); + DBexecute("update alerts set status=%d where alertid=" ZBX_FS_UI64 " and repeats>=maxrepeats and status=%d and retries<3", ALERT_STATUS_SENT, alert.alertid, ALERT_STATUS_NOT_SENT); } else { - zabbix_log( LOG_LEVEL_DEBUG, "Error sending alert ID [%d]", alert.alertid); - zabbix_syslog("Error sending alert ID [%d]", alert.alertid); + zabbix_log( LOG_LEVEL_DEBUG, "Error sending alert ID [" ZBX_FS_UI64 "]", alert.alertid); + zabbix_syslog("Error sending alert ID [" ZBX_FS_UI64 "]", alert.alertid); DBescape_string(error,error_esc,MAX_STRING_LEN); - DBexecute("update alerts set retries=retries+1,error='%s' where alertid=%d", error_esc, alert.alertid); + DBexecute("update alerts set retries=retries+1,error='%s' where alertid=" ZBX_FS_UI64, error_esc, alert.alertid); } } |
