diff -uNrp zabbix-1.8.16/include/common.h zabbix-1.8.16.new/include/common.h
--- zabbix-1.8.16/include/common.h	2013-04-13 21:05:59.633913901 +0900
+++ zabbix-1.8.16.new/include/common.h	2013-04-13 20:37:10.854304162 +0900
@@ -181,7 +181,8 @@ typedef enum
 {
 	EVENT_SOURCE_TRIGGERS = 0,
 	EVENT_SOURCE_DISCOVERY,
-	EVENT_SOURCE_AUTO_REGISTRATION
+	EVENT_SOURCE_AUTO_REGISTRATION,
+	EVENT_SOURCE_AFTER_MAINTENANCE
 } zbx_event_source_t;
 
 /* Event objects */
@@ -409,7 +410,8 @@ typedef enum
 	ESCALATION_STATUS_SLEEP,
 	ESCALATION_STATUS_COMPLETED, /* only in server code, never in DB */
 	ESCALATION_STATUS_SUPERSEDED_ACTIVE,
-	ESCALATION_STATUS_SUPERSEDED_RECOVERY
+	ESCALATION_STATUS_SUPERSEDED_RECOVERY,
+	ESCALATION_STATUS_AFTER_MAINTENANCE
 } zbx_escalation_status_t;
 
 /* Alert types */
diff -uNrp zabbix-1.8.16/include/db.h zabbix-1.8.16.new/include/db.h
--- zabbix-1.8.16/include/db.h	2013-04-13 21:05:59.694913144 +0900
+++ zabbix-1.8.16.new/include/db.h	2013-04-13 20:35:05.696845659 +0900
@@ -305,6 +305,7 @@ typedef struct
 	int		value;
 	int		acknowledged;
 	int		skip_actions;
+	int		after_maintenance;
 }
 DB_EVENT;
 
@@ -543,7 +544,7 @@ zbx_uint64_t	DBget_maxid_num(const char 
 
 int	DBupdate_item_status_to_notsupported(DB_ITEM *item, int clock, const char *error);
 int	DBadd_service_alarm(zbx_uint64_t serviceid, int status, int clock);
-int	DBstart_escalation(zbx_uint64_t actionid, zbx_uint64_t triggerid, zbx_uint64_t eventid);
+int	DBstart_escalation(zbx_uint64_t actionid, zbx_uint64_t triggerid, zbx_uint64_t eventid, int after_maintenance);
 int	DBstop_escalation(zbx_uint64_t actionid, zbx_uint64_t triggerid, zbx_uint64_t eventid);
 int	DBremove_escalation(zbx_uint64_t escalationid);
 void	DBupdate_triggers_status_after_restart();
diff -uNrp zabbix-1.8.16/src/libs/zbxdbhigh/db.c zabbix-1.8.16.new/src/libs/zbxdbhigh/db.c
--- zabbix-1.8.16/src/libs/zbxdbhigh/db.c	2013-04-13 21:05:59.783912039 +0900
+++ zabbix-1.8.16.new/src/libs/zbxdbhigh/db.c	2013-04-13 20:51:43.909524686 +0900
@@ -1017,7 +1017,7 @@ int	DBget_proxy_lastaccess(const char *h
 	return ret;
 }
 
-int	DBstart_escalation(zbx_uint64_t actionid, zbx_uint64_t triggerid, zbx_uint64_t eventid)
+int	DBstart_escalation(zbx_uint64_t actionid, zbx_uint64_t triggerid, zbx_uint64_t eventid, int after_maintenance)
 {
 	zbx_uint64_t	escalationid;
 
@@ -1026,13 +1026,14 @@ int	DBstart_escalation(zbx_uint64_t acti
 			" where actionid=" ZBX_FS_UI64
 				" and triggerid=" ZBX_FS_UI64
 				" and status not in (%d,%d,%d)"
-				" and (esc_step<>0 or status<>%d)",
+				" and (esc_step<>0 or status not in (%d,%d))",
 			actionid,
 			triggerid,
 			ESCALATION_STATUS_RECOVERY,
 			ESCALATION_STATUS_SUPERSEDED_ACTIVE,
 			ESCALATION_STATUS_SUPERSEDED_RECOVERY,
-			ESCALATION_STATUS_ACTIVE);
+			ESCALATION_STATUS_ACTIVE,
+			ESCALATION_STATUS_AFTER_MAINTENANCE);
 
 	/* ...except we should execute an escalation at least once before it is removed */
 	DBexecute("update escalations"
@@ -1040,11 +1041,12 @@ int	DBstart_escalation(zbx_uint64_t acti
 			" where actionid=" ZBX_FS_UI64
 				" and triggerid=" ZBX_FS_UI64
 				" and esc_step=0"
-				" and status=%d",
+				" and status in (%d,%d)",
 			ESCALATION_STATUS_SUPERSEDED_ACTIVE,
 			actionid,
 			triggerid,
-			ESCALATION_STATUS_ACTIVE);
+			ESCALATION_STATUS_ACTIVE,
+			ESCALATION_STATUS_AFTER_MAINTENANCE);
 
 	escalationid = DBget_maxid("escalations");
 
@@ -1054,7 +1056,7 @@ int	DBstart_escalation(zbx_uint64_t acti
 			actionid,
 			triggerid,
 			eventid,
-			ESCALATION_STATUS_ACTIVE);
+			0 == after_maintenance ? ESCALATION_STATUS_ACTIVE : ESCALATION_STATUS_AFTER_MAINTENANCE);
 
 	return SUCCEED;
 }
@@ -1089,7 +1091,7 @@ int	DBstop_escalation(zbx_uint64_t actio
 		esc_step = atoi(row[1]);
 		old_status = atoi(row[2]);
 
-		if ((0 == esc_step && ESCALATION_STATUS_ACTIVE == old_status) ||
+		if ((0 == esc_step && (ESCALATION_STATUS_ACTIVE == old_status || ESCALATION_STATUS_AFTER_MAINTENANCE == old_status)) ||
 				ESCALATION_STATUS_SUPERSEDED_ACTIVE == old_status)
 		{
 			new_status = ESCALATION_STATUS_SUPERSEDED_RECOVERY;
diff -uNrp zabbix-1.8.16/src/zabbix_server/actions.c zabbix-1.8.16.new/src/zabbix_server/actions.c
--- zabbix-1.8.16/src/zabbix_server/actions.c	2013-01-16 23:10:09.000000000 +0900
+++ zabbix-1.8.16.new/src/zabbix_server/actions.c	2013-04-13 20:32:36.264692984 +0900
@@ -1195,7 +1195,7 @@ void	process_actions(DB_EVENT *event)
 		{
 			zabbix_log(LOG_LEVEL_DEBUG, "conditions match our event, execute operations");
 
-			DBstart_escalation(actionid, event->source == EVENT_SOURCE_TRIGGERS ? event->objectid : 0, event->eventid);
+			DBstart_escalation(actionid, event->source == EVENT_SOURCE_TRIGGERS ? event->objectid : 0, event->eventid, event->after_maintenance);
 
 			if (event->source == EVENT_SOURCE_DISCOVERY || event->source == EVENT_SOURCE_AUTO_REGISTRATION)
 				execute_operations(event, actionid);
diff -uNrp zabbix-1.8.16/src/zabbix_server/escalator/escalator.c zabbix-1.8.16.new/src/zabbix_server/escalator/escalator.c
--- zabbix-1.8.16/src/zabbix_server/escalator/escalator.c	2013-01-16 23:10:09.000000000 +0900
+++ zabbix-1.8.16.new/src/zabbix_server/escalator/escalator.c	2013-04-13 20:50:43.130277115 +0900
@@ -614,7 +614,9 @@ static void	execute_operations(DB_ESCALA
 
 	if (0 == action->esc_period)
 	{
-		escalation->status = (action->recovery_msg == 1) ? ESCALATION_STATUS_SLEEP : ESCALATION_STATUS_COMPLETED;
+		escalation->status =
+			(ESCALATION_STATUS_AFTER_MAINTENANCE != escalation->status && action->recovery_msg == 1) ?
+				ESCALATION_STATUS_SLEEP : ESCALATION_STATUS_COMPLETED;
 	}
        	else
 	{
@@ -636,7 +638,9 @@ static void	execute_operations(DB_ESCALA
 			escalation->nextcheck = time(NULL) + esc_period;
 		}
 		else
-			escalation->status = (action->recovery_msg == 1) ? ESCALATION_STATUS_SLEEP : ESCALATION_STATUS_COMPLETED;
+			escalation->status =
+				(ESCALATION_STATUS_AFTER_MAINTENANCE != escalation->status && action->recovery_msg == 1) ?
+					ESCALATION_STATUS_SLEEP : ESCALATION_STATUS_COMPLETED;
 	}
 
 	zabbix_log(LOG_LEVEL_DEBUG, "End of execute_operations()");
@@ -822,6 +826,7 @@ static void	execute_escalation(DB_ESCALA
 	switch (escalation->status)
 	{
 		case ESCALATION_STATUS_ACTIVE:
+		case ESCALATION_STATUS_AFTER_MAINTENANCE:
 			result = DBselect("select actionid,eventsource,esc_period,def_shortdata,def_longdata,recovery_msg,status,name"
 					" from actions where actionid=" ZBX_FS_UI64,
 					escalation->actionid);
@@ -859,6 +864,7 @@ static void	execute_escalation(DB_ESCALA
 		switch (escalation->status)
 		{
 			case ESCALATION_STATUS_ACTIVE:
+			case ESCALATION_STATUS_AFTER_MAINTENANCE:
 				if (SUCCEED == get_event_info(escalation->eventid, &event))
 				{
 					substitute_simple_macros(&event, NULL, NULL, NULL, NULL,
@@ -914,11 +920,12 @@ static void	process_escalations(int now)
 	zabbix_log(LOG_LEVEL_DEBUG, "In process_escalations()");
 
 	result = DBselect("select escalationid,actionid,triggerid,eventid,r_eventid,esc_step,status"
-			" from escalations where status in (%d,%d,%d,%d) and nextcheck<=%d" DB_NODE,
+			" from escalations where status in (%d,%d,%d,%d,%d) and nextcheck<=%d" DB_NODE,
 			ESCALATION_STATUS_ACTIVE,
 			ESCALATION_STATUS_SUPERSEDED_ACTIVE,
 			ESCALATION_STATUS_SUPERSEDED_RECOVERY,
 			ESCALATION_STATUS_RECOVERY,
+			ESCALATION_STATUS_AFTER_MAINTENANCE,
 			now,
 			DBnode_local("escalationid"));
 
@@ -965,12 +972,13 @@ static void	process_escalations(int now)
 			else
 				DBexecute("update escalations set status=%d,esc_step=%d,nextcheck=%d"
 						" where escalationid=" ZBX_FS_UI64
-							" and status=%d",
+							" and status in (%d,%d)",
 						escalation.status,
 						escalation.esc_step,
 						escalation.nextcheck,
 						escalation.escalationid,
-						ESCALATION_STATUS_ACTIVE);
+						ESCALATION_STATUS_ACTIVE,
+						ESCALATION_STATUS_AFTER_MAINTENANCE);
 		}
 
 		DBcommit();
diff -uNrp zabbix-1.8.16/src/zabbix_server/events.c zabbix-1.8.16.new/src/zabbix_server/events.c
--- zabbix-1.8.16/src/zabbix_server/events.c	2013-04-13 21:06:30.037536357 +0900
+++ zabbix-1.8.16.new/src/zabbix_server/events.c	2013-04-13 20:30:34.675212643 +0900
@@ -283,12 +283,13 @@ int	process_event(zbx_uint64_t eventid, 
 	/* preparing event for processing */
 	memset(&event, 0, sizeof(DB_EVENT));
 	event.eventid = eventid;
-	event.source = source;
+	event.source = EVENT_SOURCE_AFTER_MAINTENANCE != source ? source : EVENT_SOURCE_TRIGGERS;
 	event.object = object;
 	event.objectid = objectid;
 	event.clock = clock;
 	event.value = value;
 	event.acknowledged = acknowledged;
+	event.after_maintenance = EVENT_SOURCE_AFTER_MAINTENANCE == source ? 1 : 0;
 
 	if (SUCCEED != add_trigger_info(&event))
 		goto fail;
diff -uNrp zabbix-1.8.16/src/zabbix_server/timer/timer.c zabbix-1.8.16.new/src/zabbix_server/timer/timer.c
--- zabbix-1.8.16/src/zabbix_server/timer/timer.c	2013-04-13 21:05:59.698913093 +0900
+++ zabbix-1.8.16.new/src/zabbix_server/timer/timer.c	2013-04-13 20:24:49.180529085 +0900
@@ -528,7 +528,7 @@ static void	generate_events(zbx_uint64_t
 
 		for (i = 0; i < tr_num; i++)
 		{
-			process_event(eventid++, EVENT_SOURCE_TRIGGERS, EVENT_OBJECT_TRIGGER, tr[i].triggerid,
+			process_event(eventid++, EVENT_SOURCE_AFTER_MAINTENANCE, EVENT_OBJECT_TRIGGER, tr[i].triggerid,
 					maintenance_to, tr[i].new_value, 0, 1, ITEM_VALUE_TYPE_FLOAT, 0);
 		}
 	}
