Index: src/zabbix_agent/zabbix_agentd.c
===================================================================
--- src/zabbix_agent/zabbix_agentd.c	(revision 16152)
+++ src/zabbix_agent/zabbix_agentd.c	(working copy)
@@ -158,6 +158,9 @@
 
 int			threads_num = 0;
 ZBX_THREAD_HANDLE	*threads = NULL;
+static ZBX_THREAD_ACTIVECHK_ARGS	*activechk_args = NULL;
+static char	*activechk_hosts = NULL;
+static int	active_zabbix_forks = 0;
 
 static void	parse_commandline(int argc, char **argv, ZBX_TASK_EX *t)
 {
@@ -225,9 +228,9 @@
 
 int MAIN_ZABBIX_ENTRY(void)
 {
-	ZBX_THREAD_ACTIVECHK_ARGS	activechk_args;
-
 	int	i = 0;
+	int	j = 0;
+	char	*p = NULL;
 
 	zbx_sock_t	listen_sock;
 	
@@ -265,8 +268,27 @@
 		CONFIG_ZABBIX_FORKS = 0;/* Listeners won't be needed for passive checks. */
 	}
 
-	/* Allocate memory for a collector, all listeners and an active check. */
-	threads_num = 1 + CONFIG_ZABBIX_FORKS + (0 == CONFIG_DISABLE_ACTIVE ? 1 : 0);
+ 	/* count active check server */
+ 	if(NULL == CONFIG_HOSTS_ACTIVE_ALLOWED){
+ 		active_zabbix_forks = 1;
+ 		activechk_hosts = zbx_malloc(activechk_hosts, strlen(CONFIG_HOSTS_ALLOWED) + sizeof(char));
+ 		strcpy(activechk_hosts, CONFIG_HOSTS_ALLOWED);
+ 		p = strchr(activechk_hosts,',');
+ 		if(p) *p = '\0';
+ 	}
+ 	else
+ 	{
+ 		activechk_hosts = zbx_malloc(activechk_hosts, strlen(CONFIG_HOSTS_ACTIVE_ALLOWED) + sizeof(char));
+ 		strcpy(activechk_hosts, CONFIG_HOSTS_ACTIVE_ALLOWED);
+ 		p = activechk_hosts;
+ 		for(active_zabbix_forks = 0; NULL != p; active_zabbix_forks++){
+ 			p = strchr(p,',');
+ 			if(p) p++;
+ 		}
+ 	}
+ 
+  	/* Allocate memory for a collector, all listeners and an active check. */
+ 	threads_num = 1 + CONFIG_ZABBIX_FORKS + ((0 == CONFIG_DISABLE_ACTIVE) ? active_zabbix_forks : 0);
 	threads = calloc(threads_num, sizeof(ZBX_THREAD_HANDLE));
 
 	/* Start the collector thread. */
@@ -281,17 +303,28 @@
 	/* start active check */
 	if(0 == CONFIG_DISABLE_ACTIVE)
 	{
-		activechk_args.host = CONFIG_HOSTS_ALLOWED;
-		activechk_args.port = (unsigned short)CONFIG_SERVER_PORT;
+		/* Allocate memory for active check */
+		activechk_args = calloc(active_zabbix_forks, sizeof(ZBX_THREAD_ACTIVECHK_ARGS));
+		p = activechk_hosts;
 
-		threads[i] = zbx_thread_start(active_checks_thread, &activechk_args);
+		for(j = 0; j < active_zabbix_forks; i++, j++){
+			activechk_args[j].host = p;
+			activechk_args[j].port = (unsigned short)CONFIG_SERVER_PORT;
+			p = strchr(p,',');
+			if(p)
+			{
+				*p = '\0';
+				p++;
+			}
+			threads[i] = zbx_thread_start(active_checks_thread, &(activechk_args[j]));
+		}
 	}
 
 	/* Must be called after all child processes loading. */
 	init_main_process();
 
 	/* wait for all threads exiting */
-	for(i = 0; i < 1 + CONFIG_ZABBIX_FORKS +((0 == CONFIG_DISABLE_ACTIVE) ? 1 : 0); i++)
+	for(i = 0; i < 1 + CONFIG_ZABBIX_FORKS +((0 == CONFIG_DISABLE_ACTIVE) ? active_zabbix_forks : 0); i++)
 	{
 		if(threads && threads[i])
 		{
@@ -319,7 +352,7 @@
 	{
 		int	i;
 
-		for (i = 0; i < 1 + CONFIG_ZABBIX_FORKS + (0 == CONFIG_DISABLE_ACTIVE ? 1 : 0); i++)
+		for (i = 0; i < 1 + CONFIG_ZABBIX_FORKS + (0 == CONFIG_DISABLE_ACTIVE ? active_zabbix_forks : 0); i++)
 		{
 			if (threads[i])
 			{
@@ -330,6 +363,8 @@
 
 		zbx_free(threads);
 	}
+	zbx_free(activechk_args);
+	zbx_free(activechk_hosts);
 
 #ifdef USE_PID_FILE
 
Index: src/zabbix_agent/zbxconf.c
===================================================================
--- src/zabbix_agent/zbxconf.c	(revision 16152)
+++ src/zabbix_agent/zbxconf.c	(working copy)
@@ -37,6 +37,7 @@
 #endif /* WITH_PLUGINS */
 
 char	*CONFIG_HOSTS_ALLOWED		= NULL;
+char	*CONFIG_HOSTS_ACTIVE_ALLOWED	= NULL;
 char	*CONFIG_HOSTNAME		= NULL;
 
 int	CONFIG_DISABLE_ACTIVE		= 0;
@@ -63,6 +64,7 @@
 /*               PARAMETER      ,VAR    ,FUNC,  TYPE(0i,1s), MANDATORY, MIN, MAX
 */
 		{"Server",		&CONFIG_HOSTS_ALLOWED,	0,TYPE_STRING,	PARM_MAND,	0,0},
+		{"ActiveCheckServer",	&CONFIG_HOSTS_ACTIVE_ALLOWED,	0,TYPE_STRING,	PARM_OPT,	0,0},
 		{"Hostname",		&CONFIG_HOSTNAME,	0,TYPE_STRING,	PARM_OPT,	0,0},
 		{"BufferSize",		&CONFIG_BUFFER_SIZE,	0,TYPE_INT,	PARM_OPT,	2,65535},
 		{"BufferSend",		&CONFIG_BUFFER_SEND,	0,TYPE_INT,	PARM_OPT,	1,3600},
Index: src/zabbix_agent/active.c
===================================================================
--- src/zabbix_agent/active.c	(revision 16152)
+++ src/zabbix_agent/active.c	(working copy)
@@ -37,10 +37,18 @@
 #	include "daemon.h"
 #endif /* ZABBIX_DAEMON */
 
+#if defined(_WINDOWS)
+__declspec(thread) static ZBX_ACTIVE_METRIC *active_metrics = NULL;
+__declspec(thread) static ZBX_ACTIVE_BUFFER buffer;
+__declspec(thread) static ZBX_REGEXP	*regexps = NULL;
+__declspec(thread) static int		regexps_alloc = 0;
+__declspec(thread) static int		regexps_num = 0;
+#else
 static ZBX_ACTIVE_METRIC *active_metrics = NULL;
 static ZBX_ACTIVE_BUFFER buffer;
 static ZBX_REGEXP	*regexps = NULL;
 static int		regexps_alloc = 0, regexps_num = 0;
+#endif /* _WINDOWS */
 
 static void	init_active_metrics()
 {
@@ -1138,7 +1146,6 @@
 	struct	sigaction phan;
 #endif /* ZABBIX_DAEMON */
 	int	nextcheck = 0, nextrefresh = 0, nextsend = 0;
-	char	*p = NULL;
 
 #if defined(ZABBIX_DAEMON)
 	phan.sa_sigaction = child_signal_handler;
@@ -1152,9 +1159,6 @@
 
 	assert(activechk_args.host);
 
-	p = strchr(activechk_args.host,',');
-	if(p) *p = '\0';
-
 	zabbix_log( LOG_LEVEL_INFORMATION, "zabbix_agentd active check started [%s:%u]", activechk_args.host, activechk_args.port);
 
 	init_active_metrics();
Index: src/zabbix_agent/zbxconf.h
===================================================================
--- src/zabbix_agent/zbxconf.h	(revision 16152)
+++ src/zabbix_agent/zbxconf.h	(working copy)
@@ -21,6 +21,7 @@
 #define ZABBIX_ZBXCONF_H
 
 extern char	*CONFIG_HOSTS_ALLOWED;
+extern char	*CONFIG_HOSTS_ACTIVE_ALLOWED;
 extern char	*CONFIG_HOSTNAME;
 extern int	CONFIG_DISABLE_ACTIVE;
 extern int	CONFIG_DISABLE_PASSIVE;
