diff options
author | sasha <sasha@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2008-06-26 08:53:11 +0000 |
---|---|---|
committer | sasha <sasha@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2008-06-26 08:53:11 +0000 |
commit | 35c0395807948dd662cabec7450bd6c5bcfb6b53 (patch) | |
tree | e46a721c747863bb8b01597c3d19411d4f879773 /src | |
parent | e8ee3b3e016176ac49a8361a20a41ed2a23d8e88 (diff) | |
download | zabbix-35c0395807948dd662cabec7450bd6c5bcfb6b53.tar.gz zabbix-35c0395807948dd662cabec7450bd6c5bcfb6b53.tar.xz zabbix-35c0395807948dd662cabec7450bd6c5bcfb6b53.zip |
- [DEV-173] support of escalation, server-side
link recovery message to recovery event
git-svn-id: svn://svn.zabbix.com/trunk@5797 97f52cf1-0a1b-0410-bd0e-c28be96e8082
Diffstat (limited to 'src')
-rw-r--r-- | src/libs/zbxdbhigh/db.c | 7 | ||||
-rw-r--r-- | src/zabbix_server/actions.c | 2 | ||||
-rw-r--r-- | src/zabbix_server/escalator/escalator.c | 31 |
3 files changed, 21 insertions, 19 deletions
diff --git a/src/libs/zbxdbhigh/db.c b/src/libs/zbxdbhigh/db.c index a300fad4..5976252d 100644 --- a/src/libs/zbxdbhigh/db.c +++ b/src/libs/zbxdbhigh/db.c @@ -1582,10 +1582,11 @@ int DBstart_escalation(zbx_uint64_t actionid, zbx_uint64_t triggerid, zbx_uint64 return SUCCEED; } -int DBstop_escalation(zbx_uint64_t actionid, zbx_uint64_t triggerid) +int DBstop_escalation(zbx_uint64_t actionid, zbx_uint64_t triggerid, zbx_uint64_t eventid) { - DBexecute("update escalations set status=%d,nextcheck=0 where actionid=" ZBX_FS_UI64 - " and triggerid=" ZBX_FS_UI64, + DBexecute("update escalations set r_eventid=" ZBX_FS_UI64 ",status=%d,nextcheck=0" + " where actionid=" ZBX_FS_UI64 " and triggerid=" ZBX_FS_UI64, + eventid, ESCALATION_STATUS_RECOVERY, actionid, triggerid); diff --git a/src/zabbix_server/actions.c b/src/zabbix_server/actions.c index ca88da7c..4f6250c6 100644 --- a/src/zabbix_server/actions.c +++ b/src/zabbix_server/actions.c @@ -881,7 +881,7 @@ void process_actions(DB_EVENT *event) zabbix_log( LOG_LEVEL_DEBUG, "Conditions do not match our event. Do not execute operations."); if (event->source == EVENT_SOURCE_TRIGGERS && event->object == EVENT_OBJECT_TRIGGER) - DBstop_escalation(action.actionid, event->objectid); + DBstop_escalation(action.actionid, event->objectid, event->eventid); } } DBfree_result(result); diff --git a/src/zabbix_server/escalator/escalator.c b/src/zabbix_server/escalator/escalator.c index fc9149d7..7d334210 100644 --- a/src/zabbix_server/escalator/escalator.c +++ b/src/zabbix_server/escalator/escalator.c @@ -147,7 +147,7 @@ static void add_command_alert(DB_ESCALATION *escalation, DB_EVENT *event, DB_ACT zbx_free(command_esc); } -static void add_message_alert(DB_ESCALATION *escalation, DB_EVENT *event, DB_ACTION *action, zbx_uint64_t userid, char *subject, char *message) +static void add_message_alert(DB_ESCALATION *escalation, DB_EVENT *event, DB_ACTION *action, zbx_uint64_t eventid, zbx_uint64_t userid, char *subject, char *message) { DB_RESULT result; DB_ROW row; @@ -201,7 +201,7 @@ static void add_message_alert(DB_ESCALATION *escalation, DB_EVENT *event, DB_ACT "," ZBX_FS_UI64 ",'%s','%s','%s',%d,%d,%d)", alertid, action->actionid, - event->eventid, + eventid, userid, now, mediatypeid, @@ -240,7 +240,7 @@ static void add_message_alert(DB_ESCALATION *escalation, DB_EVENT *event, DB_ACT ",'%s','%s',%d,%d,'%s',%d)", alertid, action->actionid, - event->eventid, + eventid, userid, ALERT_MAX_RETRIES, now, @@ -429,7 +429,7 @@ static void execute_operations(DB_ESCALATION *escalation, DB_EVENT *event, DB_AC p = user_msg; user_msg = user_msg->next; - add_message_alert(escalation, event, action, p->userid, p->subject, p->message); + add_message_alert(escalation, event, action, event->eventid, p->userid, p->subject, p->message); zbx_free(p->subject); zbx_free(p->message); @@ -474,7 +474,7 @@ static void process_recovery_msg(DB_ESCALATION *escalation, DB_EVENT *event, DB_ while (NULL != (row = DBfetch(result))) { userid = zbx_atoui64(row[0]); - add_message_alert(escalation, event, action, userid, action->shortdata, action->longdata); + add_message_alert(escalation, event, action, escalation->r_eventid, userid, action->shortdata, action->longdata); } DBfree_result(result); @@ -552,7 +552,7 @@ static void process_escalations(int now) zabbix_log(LOG_LEVEL_DEBUG, "In process_escalations()"); - result = DBselect("select e.escalationid,e.actionid,e.esc_step,e.status,ev.eventid" + result = DBselect("select e.escalationid,e.actionid,e.r_eventid,e.esc_step,e.status,ev.eventid" ",ev.source,ev.object,ev.objectid,ev.clock,ev.value,ev.acknowledged" " from escalations e,events ev where e.eventid=ev.eventid" " and e.status in (%d,%d) and e.nextcheck<=%d" DB_NODE, @@ -565,18 +565,19 @@ static void process_escalations(int now) memset(&escalation, 0, sizeof(escalation)); escalation.escalationid = zbx_atoui64(row[0]); escalation.actionid = zbx_atoui64(row[1]); - escalation.esc_step = atoi(row[2]); - escalation.status = atoi(row[3]); + escalation.r_eventid = zbx_atoui64(row[2]); + escalation.esc_step = atoi(row[3]); + escalation.status = atoi(row[4]); escalation.nextcheck = 0; memset(&event, 0, sizeof(event)); - event.eventid = zbx_atoui64(row[4]); - event.source = atoi(row[5]); - event.object = atoi(row[6]); - event.objectid = zbx_atoui64(row[7]); - event.clock = atoi(row[8]); - event.value = atoi(row[9]); - event.acknowledged = atoi(row[10]); + event.eventid = zbx_atoui64(row[5]); + event.source = atoi(row[6]); + event.object = atoi(row[7]); + event.objectid = zbx_atoui64(row[8]); + event.clock = atoi(row[9]); + event.value = atoi(row[10]); + event.acknowledged = atoi(row[11]); add_trigger_info(&event); |