diff --git a/configure.ac b/configure.ac
index df54c7cdfa7..db7ba17fb6b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -41,7 +41,7 @@ dnl *****************************************************************
 
 AC_PROG_CC([cc c99 gcc clang])
 AM_PROG_CC_C_O
-
+AC_PROG_EGREP
 dnl *****************************************************************
 dnl *                                                               *
 dnl *                   Checks for header files                     *
diff --git a/src/libs/zbxdbcache/dbconfig.c b/src/libs/zbxdbcache/dbconfig.c
index 4bfdb8a6c65..ed8932bbbf0 100644
--- a/src/libs/zbxdbcache/dbconfig.c
+++ b/src/libs/zbxdbcache/dbconfig.c
@@ -12104,6 +12104,129 @@ int	DCget_item_queue(zbx_vector_ptr_t *queue, int from, int to)
 	return nitems;
 }
 
+
+static void	get_trigger_statistics(zbx_hashset_t *triggers)
+{
+	zbx_hashset_iter_t	iter;
+	ZBX_DC_TRIGGER		*dc_trigger;
+
+	zbx_hashset_iter_reset(triggers, &iter);
+	/* loop over triggers to gather enabled and disabled trigger statistics */
+	while (NULL != (dc_trigger = (ZBX_DC_TRIGGER *)zbx_hashset_iter_next(&iter)))
+	{
+		if (ZBX_FLAG_DISCOVERY_PROTOTYPE == dc_trigger->flags || NULL == dc_trigger->itemids)
+			continue;
+
+		switch (dc_trigger->status)
+		{
+			case TRIGGER_STATUS_ENABLED:
+				if (TRIGGER_FUNCTIONAL_TRUE == dc_trigger->functional)
+				{
+					switch (dc_trigger->value)
+					{
+						case TRIGGER_VALUE_OK:
+							config->status->triggers_enabled_ok++;
+							break;
+						case TRIGGER_VALUE_PROBLEM:
+							config->status->triggers_enabled_problem++;
+							break;
+						default:
+							THIS_SHOULD_NEVER_HAPPEN;
+					}
+
+					break;
+				}
+				ZBX_FALLTHROUGH;
+			case TRIGGER_STATUS_DISABLED:
+				config->status->triggers_disabled++;
+				break;
+			default:
+				THIS_SHOULD_NEVER_HAPPEN;
+		}
+	}
+}
+
+static void	get_host_statistics(ZBX_DC_HOST *dc_host, int reset)
+{
+	int			i;
+	const ZBX_DC_ITEM	*dc_item;
+
+	/* loop over items to gather per-host and per-proxy statistics */
+	for (i = 0; i < dc_host->items.values_num; i++)
+	{
+		ZBX_DC_PROXY	*dc_proxy = NULL;
+		ZBX_DC_HOST	*dc_proxy_host = NULL;
+
+		dc_item = dc_host->items.values[i];
+
+		if (ZBX_FLAG_DISCOVERY_NORMAL != dc_item->flags && ZBX_FLAG_DISCOVERY_CREATED != dc_item->flags)
+			continue;
+
+		if (0 != dc_host->proxy_hostid)
+		{
+			if (SUCCEED == reset)
+				dc_proxy = (ZBX_DC_PROXY *)zbx_hashset_search(&config->proxies, &dc_host->proxy_hostid);
+
+			dc_proxy_host = (ZBX_DC_HOST *)zbx_hashset_search(&config->hosts, &dc_host->proxy_hostid);
+		}
+
+		switch (dc_item->status)
+		{
+			case ITEM_STATUS_ACTIVE:
+				if (HOST_STATUS_MONITORED == dc_host->status)
+				{
+					if (SUCCEED == reset)
+					{
+						int	delay;
+						char	*delay_s;
+
+						delay_s = dc_expand_user_macros_dyn(dc_item->delay, &dc_item->hostid, 1,
+								ZBX_MACRO_ENV_NONSECURE);
+
+						if (SUCCEED == zbx_interval_preproc(delay_s, &delay, NULL, NULL) &&
+								0 != delay)
+						{
+							config->status->required_performance += 1.0 / delay;
+
+							if (NULL != dc_proxy)
+								dc_proxy->required_performance += 1.0 / delay;
+						}
+
+						zbx_free(delay_s);
+					}
+
+					switch (dc_item->state)
+					{
+						case ITEM_STATE_NORMAL:
+							config->status->items_active_normal++;
+							dc_host->items_active_normal++;
+							if (NULL != dc_proxy_host)
+								dc_proxy_host->items_active_normal++;
+							break;
+						case ITEM_STATE_NOTSUPPORTED:
+							config->status->items_active_notsupported++;
+							dc_host->items_active_notsupported++;
+							if (NULL != dc_proxy_host)
+								dc_proxy_host->items_active_notsupported++;
+							break;
+						default:
+							THIS_SHOULD_NEVER_HAPPEN;
+					}
+
+					break;
+				}
+				ZBX_FALLTHROUGH;
+			case ITEM_STATUS_DISABLED:
+				config->status->items_disabled++;
+				if (NULL != dc_proxy_host)
+					dc_proxy_host->items_disabled++;
+				break;
+			default:
+				THIS_SHOULD_NEVER_HAPPEN;
+		}
+	}
+}
+
 /******************************************************************************
  *                                                                            *
  * Function: dc_status_update                                                 *
@@ -12138,15 +12261,12 @@ static void	dc_status_update(void)
 
 	zbx_hashset_iter_t	iter;
 	ZBX_DC_PROXY		*dc_proxy;
-	ZBX_DC_HOST		*dc_host, *dc_proxy_host;
-	const ZBX_DC_ITEM	*dc_item;
-	const ZBX_DC_TRIGGER	*dc_trigger;
+	ZBX_DC_HOST		*dc_host;
 	int			reset;
 
 	if (0 != config->status->last_update && config->status->last_update + ZBX_STATUS_LIFETIME > time(NULL))
 		return;
-
-
+	double start = zbx_time();
 	if (config->status->sync_ts != config->sync_ts)
 		reset = SUCCEED;
 	else
@@ -12228,123 +12348,12 @@ static void	dc_status_update(void)
 				}
 				break;
 		}
-	}
-
-	/* loop over items to gather per-host and per-proxy statistics */
-
-	zbx_hashset_iter_reset(&config->items, &iter);
-
-	while (NULL != (dc_item = (ZBX_DC_ITEM *)zbx_hashset_iter_next(&iter)))
-	{
-		dc_proxy = NULL;
-		dc_proxy_host = NULL;
-
-		if (ZBX_FLAG_DISCOVERY_NORMAL != dc_item->flags && ZBX_FLAG_DISCOVERY_CREATED != dc_item->flags)
-			continue;
-
-		if (NULL == (dc_host = (ZBX_DC_HOST *)zbx_hashset_search(&config->hosts, &dc_item->hostid)))
-			continue;
-
-		if (0 != dc_host->proxy_hostid)
-		{
-			if (SUCCEED == reset)
-				dc_proxy = (ZBX_DC_PROXY *)zbx_hashset_search(&config->proxies, &dc_host->proxy_hostid);
-
-			dc_proxy_host = (ZBX_DC_HOST *)zbx_hashset_search(&config->hosts, &dc_host->proxy_hostid);
-		}
-
-		switch (dc_item->status)
-		{
-			case ITEM_STATUS_ACTIVE:
-				if (HOST_STATUS_MONITORED == dc_host->status)
-				{
-					if (SUCCEED == reset)
-					{
-						int	delay;
-						char	*delay_s;
-
-						delay_s = dc_expand_user_macros_dyn(dc_item->delay, &dc_item->hostid, 1,
-								ZBX_MACRO_ENV_NONSECURE);
-
-						if (SUCCEED == zbx_interval_preproc(delay_s, &delay, NULL, NULL) &&
-								0 != delay)
-						{
-							config->status->required_performance += 1.0 / delay;
-
-							if (NULL != dc_proxy)
-								dc_proxy->required_performance += 1.0 / delay;
-						}
-
-						zbx_free(delay_s);
-					}
-
-					switch (dc_item->state)
-					{
-						case ITEM_STATE_NORMAL:
-							config->status->items_active_normal++;
-							dc_host->items_active_normal++;
-							if (NULL != dc_proxy_host)
-								dc_proxy_host->items_active_normal++;
-							break;
-						case ITEM_STATE_NOTSUPPORTED:
-							config->status->items_active_notsupported++;
-							dc_host->items_active_notsupported++;
-							if (NULL != dc_proxy_host)
-								dc_proxy_host->items_active_notsupported++;
-							break;
-						default:
-							THIS_SHOULD_NEVER_HAPPEN;
-					}
 
-					break;
-				}
-				ZBX_FALLTHROUGH;
-			case ITEM_STATUS_DISABLED:
-				config->status->items_disabled++;
-				if (NULL != dc_proxy_host)
-					dc_proxy_host->items_disabled++;
-				break;
-			default:
-				THIS_SHOULD_NEVER_HAPPEN;
-		}
+		get_host_statistics(dc_host, reset);
 	}
 
-	/* loop over triggers to gather enabled and disabled trigger statistics */
-
-	zbx_hashset_iter_reset(&config->triggers, &iter);
-
-	while (NULL != (dc_trigger = (ZBX_DC_TRIGGER *)zbx_hashset_iter_next(&iter)))
-	{
-		if (ZBX_FLAG_DISCOVERY_PROTOTYPE == dc_trigger->flags || NULL == dc_trigger->itemids)
-			continue;
-
-		switch (dc_trigger->status)
-		{
-			case TRIGGER_STATUS_ENABLED:
-				if (TRIGGER_FUNCTIONAL_TRUE == dc_trigger->functional)
-				{
-					switch (dc_trigger->value)
-					{
-						case TRIGGER_VALUE_OK:
-							config->status->triggers_enabled_ok++;
-							break;
-						case TRIGGER_VALUE_PROBLEM:
-							config->status->triggers_enabled_problem++;
-							break;
-						default:
-							THIS_SHOULD_NEVER_HAPPEN;
-					}
-
-					break;
-				}
-				ZBX_FALLTHROUGH;
-			case TRIGGER_STATUS_DISABLED:
-				config->status->triggers_disabled++;
-				break;
-			default:
-				THIS_SHOULD_NEVER_HAPPEN;
-		}
-	}
+	get_trigger_statistics(&config->triggers);
+	zabbix_log(LOG_LEVEL_INFORMATION, "end:" ZBX_FS_DBL, zbx_time() - start);
 
 	config->status->sync_ts = config->sync_ts;
 	config->status->last_update = time(NULL);
