Index: include/module.h
===================================================================
--- include/module.h	(revision 61608)
+++ include/module.h	(working copy)
@@ -45,6 +45,77 @@
 }
 ZBX_METRIC;
 
+typedef struct
+{
+	int		clock;
+	zbx_uint64_t	itemid;
+	int		ns;
+	double		value;
+	
+}
+ZBX_FLOAT_HISTORY_OBJECT;
+
+typedef struct
+{
+	int		clock;
+	zbx_uint64_t	itemid;
+	int		ns;
+	zbx_uint64_t	value;
+	
+}
+ZBX_INTEGER_HISTORY_OBJECT;
+
+typedef struct
+{
+	int		clock;
+	zbx_uint64_t	itemid;
+	int		ns;
+	const char	*value;
+	
+}
+ZBX_STRING_HISTORY_OBJECT;
+
+typedef struct
+{
+	/* zbx_uint64_t	id; */
+	int		clock;
+	zbx_uint64_t	itemid;
+	int		ns;
+	const char	*value;
+	
+}
+ZBX_TEXT_HISTORY_OBJECT;
+
+typedef struct
+{
+	/* zbx_uint64_t	id; */
+	int		clock;
+	zbx_uint64_t	itemid;
+	int		logeventid;
+	int		ns;
+	int		severity;
+	const char	*source;
+	int		timestamp;
+	const char	*value;
+}
+ZBX_LOG_HISTORY_OBJECT;
+
+typedef void (*zbx_module_store_history_float_value_cb_t)(ZBX_FLOAT_HISTORY_OBJECT *obj);
+typedef void (*zbx_module_store_history_integer_value_cb_t)(ZBX_INTEGER_HISTORY_OBJECT *obj);
+typedef void (*zbx_module_store_history_string_value_cb_t)(ZBX_STRING_HISTORY_OBJECT *obj);
+typedef void (*zbx_module_store_history_text_value_cb_t)(ZBX_TEXT_HISTORY_OBJECT *obj);
+typedef void (*zbx_module_store_history_log_value_cb_t)(ZBX_LOG_HISTORY_OBJECT *obj);
+
+typedef struct
+{
+	zbx_module_store_history_float_value_cb_t	store_history_float_value_cb;
+	zbx_module_store_history_integer_value_cb_t	store_history_integer_value_cb;
+	zbx_module_store_history_string_value_cb_t	store_history_string_value_cb;
+	zbx_module_store_history_text_value_cb_t	store_history_text_value_cb;
+	zbx_module_store_history_log_value_cb_t		store_history_log_value_cb;
+}
+ZBX_HISTORY_HOOKS;
+
 /* agent request structure */
 typedef struct
 {
Index: include/zbxmodules.h
===================================================================
--- include/zbxmodules.h	(revision 61608)
+++ include/zbxmodules.h	(working copy)
@@ -20,7 +20,12 @@
 #ifndef ZABBIX_ZBXMODULES_H
 #define ZABBIX_ZBXMODULES_H
 
-int	load_modules(const char *path, char **file_names, int timeout, int verbose);
-void	unload_modules();
+int	zbx_load_modules(const char *path, char **file_names, int timeout, int verbose);
+void	zbx_store_history_float_value_to_modules(ZBX_FLOAT_HISTORY_OBJECT *obj);
+void	zbx_store_history_integer_value_to_modules(ZBX_INTEGER_HISTORY_OBJECT *obj);
+void	zbx_store_history_string_value_to_modules(ZBX_STRING_HISTORY_OBJECT *obj);
+void	zbx_store_history_text_value_to_modules(ZBX_TEXT_HISTORY_OBJECT *obj);
+void	zbx_store_history_log_value_to_modules(ZBX_LOG_HISTORY_OBJECT *obj);
+void	zbx_unload_modules();
 
 #endif
Index: src/libs/zbxdbcache/dbcache.c
===================================================================
--- src/libs/zbxdbcache/dbcache.c	(revision 61608)
+++ src/libs/zbxdbcache/dbcache.c	(working copy)
@@ -31,6 +31,8 @@
 #include "memalloc.h"
 #include "zbxalgo.h"
 #include "valuecache.h"
+#include "module.h"
+#include "zbxmodules.h"
 
 static zbx_mem_info_t	*hc_index_mem = NULL;
 static zbx_mem_info_t	*hc_mem = NULL;
@@ -1483,7 +1485,8 @@
 
 	for (i = 0; i < history_num; i++)
 	{
-		const ZBX_DC_HISTORY	*h = &history[i];
+		const ZBX_DC_HISTORY		*h = &history[i];
+		ZBX_FLOAT_HISTORY_OBJECT	obj;
 
 		if (0 != (ZBX_DC_FLAG_UNDEF & h->flags) || 0 != (ZBX_DC_FLAG_NOVALUE & h->flags))
 			continue;
@@ -1495,6 +1498,13 @@
 			continue;
 
 		zbx_db_insert_add_values(&db_insert, h->itemid, h->ts.sec, h->ts.ns, h->value.dbl);
+
+		obj.clock = h->ts.sec;
+		obj.itemid = h->itemid;
+		obj.ns = h->ts.ns;
+		obj.value = h->value.dbl;
+
+		zbx_store_history_float_value_to_modules(&obj);
 	}
 
 	zbx_db_insert_execute(&db_insert);
@@ -1517,7 +1527,8 @@
 
 	for (i = 0; i < history_num; i++)
 	{
-		const ZBX_DC_HISTORY	*h = &history[i];
+		const ZBX_DC_HISTORY		*h = &history[i];
+		ZBX_INTEGER_HISTORY_OBJECT	obj;
 
 		if (0 != (ZBX_DC_FLAG_UNDEF & h->flags) || 0 != (ZBX_DC_FLAG_NOVALUE & h->flags))
 			continue;
@@ -1529,6 +1540,13 @@
 			continue;
 
 		zbx_db_insert_add_values(&db_insert, h->itemid, h->ts.sec, h->ts.ns, h->value.ui64);
+
+		obj.clock = h->ts.sec;
+		obj.itemid = h->itemid;
+		obj.ns = h->ts.ns;
+		obj.value = h->value.ui64;
+		
+		zbx_store_history_integer_value_to_modules(&obj);
 	}
 
 	zbx_db_insert_execute(&db_insert);
@@ -1551,7 +1569,8 @@
 
 	for (i = 0; i < history_num; i++)
 	{
-		const ZBX_DC_HISTORY	*h = &history[i];
+		const ZBX_DC_HISTORY		*h = &history[i];
+		ZBX_STRING_HISTORY_OBJECT	obj;
 
 		if (0 != (ZBX_DC_FLAG_UNDEF & h->flags) || 0 != (ZBX_DC_FLAG_NOVALUE & h->flags))
 			continue;
@@ -1563,6 +1582,13 @@
 			continue;
 
 		zbx_db_insert_add_values(&db_insert, h->itemid, h->ts.sec, h->ts.ns, h->value_orig.str);
+
+		obj.clock = h->ts.sec;
+		obj.itemid = h->itemid;
+		obj.ns = h->ts.ns;
+		obj.value = h->value_orig.str;
+
+		zbx_store_history_string_value_to_modules(&obj);
 	}
 
 	zbx_db_insert_execute(&db_insert);
@@ -1585,7 +1611,8 @@
 
 	for (i = 0; i < history_num; i++)
 	{
-		const ZBX_DC_HISTORY	*h = &history[i];
+		const ZBX_DC_HISTORY		*h = &history[i];
+		ZBX_TEXT_HISTORY_OBJECT	obj;
 
 		if (0 != (ZBX_DC_FLAG_UNDEF & h->flags) || 0 != (ZBX_DC_FLAG_NOVALUE & h->flags))
 			continue;
@@ -1597,6 +1624,13 @@
 			continue;
 
 		zbx_db_insert_add_values(&db_insert, h->itemid, h->ts.sec, h->ts.ns, h->value_orig.str);
+
+		obj.clock = h->ts.sec;
+		obj.itemid = h->itemid;
+		obj.ns = h->ts.ns;
+		obj.value = h->value_orig.str;
+
+		zbx_store_history_text_value_to_modules(&obj);
 	}
 
 	zbx_db_insert_execute(&db_insert);
@@ -1621,6 +1655,7 @@
 	for (i = 0; i < history_num; i++)
 	{
 		const ZBX_DC_HISTORY	*h = &history[i];
+		ZBX_LOG_HISTORY_OBJECT	obj;
 
 		if (0 != (ZBX_DC_FLAG_UNDEF & h->flags) || 0 != (ZBX_DC_FLAG_NOVALUE & h->flags))
 			continue;
@@ -1634,6 +1669,17 @@
 		zbx_db_insert_add_values(&db_insert, h->itemid, h->ts.sec, h->ts.ns, h->timestamp,
 				NULL != h->value.str ? h->value.str : "", h->severity, h->value_orig.str,
 				h->logeventid);
+
+		obj.clock = h->ts.sec;
+		obj.itemid = h->itemid;
+		obj.logeventid = h->logeventid;
+		obj.ns = h->ts.ns;
+		obj.severity = h->severity;
+		obj.source = NULL != h->value.str ? h->value.str : "";
+		obj.timestamp = h->timestamp;
+		obj.value = h->value_orig.str;
+
+		zbx_store_history_log_value_to_modules(&obj);
 	}
 
 	zbx_db_insert_execute(&db_insert);
Index: src/libs/zbxmodules/modules.c
===================================================================
--- src/libs/zbxmodules/modules.c	(revision 61608)
+++ src/libs/zbxmodules/modules.c	(working copy)
@@ -29,10 +29,17 @@
 #define ZBX_MODULE_FUNC_ITEM_LIST	"zbx_module_item_list"
 #define ZBX_MODULE_FUNC_ITEM_PROCESS	"zbx_module_item_process"
 #define ZBX_MODULE_FUNC_ITEM_TIMEOUT	"zbx_module_item_timeout"
+#define ZBX_MODULE_FUNC_HISTORY_HOOKS	"zbx_module_history_hooks"
 #define ZBX_MODULE_FUNC_UNINIT		"zbx_module_uninit"
 
-static void	**modules = NULL;
+static void						**modules;
 
+static zbx_module_store_history_float_value_cb_t	*history_float_cbs;
+static zbx_module_store_history_integer_value_cb_t	*history_integer_cbs;
+static zbx_module_store_history_string_value_cb_t	*history_string_cbs;
+static zbx_module_store_history_text_value_cb_t		*history_text_cbs;
+static zbx_module_store_history_log_value_cb_t		*history_log_cbs;
+
 /******************************************************************************
  *                                                                            *
  * Function: register_module                                                  *
@@ -78,9 +85,75 @@
 	return ret;
 }
 
+static void	register_hooks(const ZBX_HISTORY_HOOKS *hooks)
+{
+	const char	*__function_name = "register_hooks";
+
+	int		i;
+
+	zabbix_log(LOG_LEVEL_DEBUG, "In %s()", __function_name);
+
+	if (NULL != hooks->store_history_float_value_cb)
+	{
+		i = 0;
+		while (NULL != history_float_cbs[i])
+			i++;
+
+		history_float_cbs = zbx_realloc(history_float_cbs, (i + 2) * sizeof(zbx_module_store_history_float_value_cb_t *));
+		history_float_cbs[i] = hooks->store_history_float_value_cb;
+		history_float_cbs[i + 1] = NULL;
+	}
+
+	if (NULL != hooks->store_history_integer_value_cb)
+	{
+		i = 0;
+		while (NULL != history_integer_cbs[i])
+			i++;
+
+		history_integer_cbs = zbx_realloc(history_integer_cbs, (i + 2) * sizeof(zbx_module_store_history_integer_value_cb_t *));
+		history_integer_cbs[i] = hooks->store_history_integer_value_cb;
+		history_integer_cbs[i + 1] = NULL;
+	}
+
+	if (NULL != hooks->store_history_string_value_cb)
+	{
+		i = 0;
+		while (NULL != history_string_cbs[i])
+			i++;
+
+		history_string_cbs = zbx_realloc(history_string_cbs, (i + 2) * sizeof(zbx_module_store_history_string_value_cb_t *));
+		history_string_cbs[i] = hooks->store_history_string_value_cb;
+		history_string_cbs[i + 1] = NULL;
+	}
+
+	if (NULL != hooks->store_history_text_value_cb)
+	{
+		i = 0;
+		while (NULL != history_text_cbs[i])
+			i++;
+
+		history_text_cbs = zbx_realloc(history_text_cbs, (i + 2) * sizeof(zbx_module_store_history_text_value_cb_t *));
+		history_text_cbs[i] = hooks->store_history_text_value_cb;
+		history_text_cbs[i + 1] = NULL;
+	}
+
+	if (NULL != hooks->store_history_log_value_cb)
+	{
+		i = 0;
+		while (NULL != history_log_cbs[i])
+			i++;
+
+		history_log_cbs = zbx_realloc(history_log_cbs, (i + 2) * sizeof(zbx_module_store_history_log_value_cb_t *));
+		history_log_cbs[i] = hooks->store_history_log_value_cb;
+		history_log_cbs[i + 1] = NULL;
+	}
+
+	zabbix_log(LOG_LEVEL_DEBUG, "End of %s()", __function_name);
+}
+
 /******************************************************************************
  *                                                                            *
- * Function: load_modules                                                     *
+ * Function: zbx_load_modules                                                 *
  *                                                                            *
  * Purpose: load loadable modules (dynamic libraries)                         *
  *          It skips a module in case of any errors                           *
@@ -94,20 +167,38 @@
  *               FAIL - loading of modules failed                             *
  *                                                                            *
  ******************************************************************************/
-int	load_modules(const char *path, char **file_names, int timeout, int verbose)
+int	zbx_load_modules(const char *path, char **file_names, int timeout, int verbose)
 {
 	const char	*__function_name = "load_modules";
 
-	char		**file_name, *buffer = NULL;
-	void		*lib;
-	char		full_name[MAX_STRING_LEN], error[MAX_STRING_LEN];
-	int		(*func_init)(), (*func_version)();
-	ZBX_METRIC	*(*func_list)();
-	void		(*func_timeout)();
-	int		i, ret = FAIL;
+	char			**file_name, *buffer = NULL;
+	void			*lib;
+	char			full_name[MAX_STRING_LEN], error[MAX_STRING_LEN];
+	int			(*func_init)();
+	int			(*func_version)();
+	ZBX_METRIC		*(*func_list)();
+	ZBX_HISTORY_HOOKS	*(*func_hooks)();
+	void			(*func_timeout)();
+	int			i, ret = FAIL;
 
 	zabbix_log(LOG_LEVEL_DEBUG, "In %s()", __function_name);
 
+	history_float_cbs = zbx_malloc(history_float_cbs, sizeof(zbx_module_store_history_float_value_cb_t *));
+	history_float_cbs[0] = NULL;
+
+	history_integer_cbs = zbx_malloc(history_integer_cbs, sizeof(zbx_module_store_history_integer_value_cb_t *));
+	history_integer_cbs[0] = NULL;
+
+	history_string_cbs = zbx_malloc(history_string_cbs, sizeof(zbx_module_store_history_string_value_cb_t *));
+	history_string_cbs[0] = NULL;
+
+	history_text_cbs = zbx_malloc(history_text_cbs, sizeof(zbx_module_store_history_text_value_cb_t *));
+	history_text_cbs[0] = NULL;
+
+	history_log_cbs = zbx_malloc(history_log_cbs, sizeof(zbx_module_store_history_log_value_cb_t *));
+	history_log_cbs[0] = NULL;
+
+
 	for (file_name = file_names; NULL != *file_name; file_name++)
 	{
 		zbx_snprintf(full_name, sizeof(full_name), "%s/%s", path, *file_name);
@@ -162,7 +253,7 @@
 		else
 			func_timeout(timeout);
 
-		func_list = (ZBX_METRIC *(*)(void))dlsym(lib, ZBX_MODULE_FUNC_ITEM_LIST);
+		func_list = (ZBX_METRIC * (*)(void))dlsym(lib, ZBX_MODULE_FUNC_ITEM_LIST);
 		if (NULL == func_list)
 		{
 			zabbix_log(LOG_LEVEL_WARNING, "cannot find \"" ZBX_MODULE_FUNC_ITEM_LIST "()\""
@@ -171,9 +262,18 @@
 			continue;
 		}
 
+		/* the function is optional, zabbix will load the module even if it is missing */
+		func_hooks = (ZBX_HISTORY_HOOKS * (*)(void))dlsym(lib, ZBX_MODULE_FUNC_HISTORY_HOOKS);
+		if (NULL == func_hooks)
+		{
+			zabbix_log(LOG_LEVEL_DEBUG, "cannot find \"" ZBX_MODULE_FUNC_HISTORY_HOOKS "()\""
+					" function in module \"%s\": %s", *file_name, dlerror());
+		}
+
 		if (SUCCEED == register_module(lib))
 		{
-			ZBX_METRIC	*metrics;
+			ZBX_METRIC		*metrics;
+			ZBX_HISTORY_HOOKS	*hooks;
 
 			metrics = func_list();
 
@@ -190,6 +290,12 @@
 				}
 			}
 
+			if (NULL != func_hooks)
+			{
+				hooks = func_hooks();
+				register_hooks(hooks);
+			}
+
 			if (1 == verbose)
 			{
 				if (NULL != buffer)
@@ -211,15 +317,85 @@
 	return ret;
 }
 
+void    zbx_store_history_float_value_to_modules(ZBX_FLOAT_HISTORY_OBJECT *obj)
+{
+	zbx_module_store_history_float_value_cb_t	cb;
+	int						i;
+
+	i = 0;
+	while (NULL != history_float_cbs[i])
+	{
+		cb = history_float_cbs[i];
+		cb(obj);
+		i++;
+	}
+}
+
+void    zbx_store_history_integer_value_to_modules(ZBX_INTEGER_HISTORY_OBJECT *obj)
+{
+	zbx_module_store_history_integer_value_cb_t	cb;
+	int						i;
+
+	i = 0;
+	while (NULL != history_integer_cbs[i])
+	{
+		cb = history_integer_cbs[i];
+		cb(obj);
+		i++;
+	}
+}
+
+void    zbx_store_history_string_value_to_modules(ZBX_STRING_HISTORY_OBJECT *obj)
+{
+	zbx_module_store_history_string_value_cb_t	cb;
+	int						i;
+
+	i = 0;
+	while (NULL != history_string_cbs[i])
+	{
+		cb = history_string_cbs[i];
+		cb(obj);
+		i++;
+	}
+}
+
+void    zbx_store_history_text_value_to_modules(ZBX_TEXT_HISTORY_OBJECT *obj)
+{
+	zbx_module_store_history_text_value_cb_t	cb;
+	int						i;
+
+	i = 0;
+	while (NULL != history_text_cbs[i])
+	{
+		cb = history_text_cbs[i];
+		cb(obj);
+		i++;
+	}
+}
+
+void    zbx_store_history_log_value_to_modules(ZBX_LOG_HISTORY_OBJECT *obj)
+{
+	zbx_module_store_history_log_value_cb_t		cb;
+	int						i;
+
+	i = 0;
+	while (NULL != history_log_cbs[i])
+	{
+		cb = history_log_cbs[i];
+		cb(obj);
+		i++;
+	}
+}
+
 /******************************************************************************
  *                                                                            *
- * Function: unload_modules                                                   *
+ * Function: zbx_unload_modules                                               *
  *                                                                            *
  * Purpose: Unload already loaded loadable modules (dynamic libraries).       *
  *          It is called on process shutdown.                                 *
  *                                                                            *
  ******************************************************************************/
-void	unload_modules()
+void	zbx_unload_modules()
 {
 	const char	*__function_name = "unload_modules";
 
@@ -228,6 +404,12 @@
 
 	zabbix_log(LOG_LEVEL_DEBUG, "In %s()", __function_name);
 
+	zbx_free(history_float_cbs);
+	zbx_free(history_integer_cbs);
+	zbx_free(history_string_cbs);
+	zbx_free(history_text_cbs);
+	zbx_free(history_log_cbs);
+
 	/* there are no registered modules */
 	if (NULL == modules)
 		goto out;
Index: src/modules/dummy/Makefile
===================================================================
--- src/modules/dummy/Makefile	(revision 61608)
+++ src/modules/dummy/Makefile	(working copy)
@@ -1,2 +1,18 @@
-dummy: dummy.c
-	gcc -fPIC -shared -o dummy.so dummy.c -I../../../include
+PROG = dummy.so
+
+CC = clang
+CFLAGS = -g -fPIC -shared
+IFLAGS = -I../../../include -I/home/sandis/hiredis
+LFLAGS = -L/home/sandis/hiredis
+LIBS = -Wl,-rpath=/home/sandis/hiredis -lhiredis
+
+SRCS = dummy.c
+
+all: $(PROG)
+
+$(PROG): $(SRCS)
+	$(CC) $(CFLAGS) ${IFLAGS} ${LFLAGS} -o $(PROG) $(SRCS) $(LIBS)
+
+clean:
+	rm -f $(PROG) *.o
+
Index: src/modules/dummy/dummy.c
===================================================================
--- src/modules/dummy/dummy.c	(revision 61608)
+++ src/modules/dummy/dummy.c	(working copy)
@@ -20,12 +20,15 @@
 #include "sysinc.h"
 #include "module.h"
 
+#include <syslog.h>
+
 /* the variable keeps timeout setting for item processing */
 static int	item_timeout = 0;
 
-int	zbx_module_dummy_ping(AGENT_REQUEST *request, AGENT_RESULT *result);
-int	zbx_module_dummy_echo(AGENT_REQUEST *request, AGENT_RESULT *result);
-int	zbx_module_dummy_random(AGENT_REQUEST *request, AGENT_RESULT *result);
+static int	zbx_module_dummy_ping(AGENT_REQUEST *request, AGENT_RESULT *result);
+static int	zbx_module_dummy_echo(AGENT_REQUEST *request, AGENT_RESULT *result);
+static int	zbx_module_dummy_random(AGENT_REQUEST *request, AGENT_RESULT *result);
+static void	zbx_module_store_history_string_value_cb(ZBX_STRING_HISTORY_OBJECT *obj);
 
 static ZBX_METRIC keys[] =
 /*      KEY                     FLAG		FUNCTION        	TEST PARAMETERS */
@@ -36,6 +39,15 @@
 	{NULL}
 };
 
+static ZBX_HISTORY_HOOKS hooks =
+{
+	NULL,
+	NULL,
+	zbx_module_store_history_string_value_cb,
+	NULL,
+	NULL
+};
+
 /******************************************************************************
  *                                                                            *
  * Function: zbx_module_api_version                                           *
@@ -79,7 +91,7 @@
 	return keys;
 }
 
-int	zbx_module_dummy_ping(AGENT_REQUEST *request, AGENT_RESULT *result)
+static int	zbx_module_dummy_ping(AGENT_REQUEST *request, AGENT_RESULT *result)
 {
 	SET_UI64_RESULT(result, 1);
 
@@ -86,7 +98,7 @@
 	return SYSINFO_RET_OK;
 }
 
-int	zbx_module_dummy_echo(AGENT_REQUEST *request, AGENT_RESULT *result)
+static int	zbx_module_dummy_echo(AGENT_REQUEST *request, AGENT_RESULT *result)
 {
 	char	*param;
 
@@ -128,7 +140,7 @@
  *          by checking value of request->nparam.                             *
  *                                                                            *
  ******************************************************************************/
-int	zbx_module_dummy_random(AGENT_REQUEST *request, AGENT_RESULT *result)
+static int	zbx_module_dummy_random(AGENT_REQUEST *request, AGENT_RESULT *result)
 {
 	char	*param1, *param2;
 	int	from, to;
@@ -158,6 +170,31 @@
 	return SYSINFO_RET_OK;
 }
 
+ZBX_HISTORY_HOOKS	*zbx_module_history_hooks()
+{
+	return &hooks;
+}
+
+static void     zbx_module_store_history_string_value_cb(ZBX_STRING_HISTORY_OBJECT *obj)
+{
+	FILE	*fp;
+
+	fp = fopen("/tmp/dummy.csv", "a");
+
+	if (NULL == fp)
+		exit(1);
+
+	fprintf(fp, "%d,%d,%d,%lu,%s\n",
+		obj->clock,
+		obj->ns,
+		getpid(),
+		obj->itemid,
+		obj->value);
+
+	if (EOF == fclose(fp))
+		exit(1);
+}
+
 /******************************************************************************
  *                                                                            *
  * Function: zbx_module_init                                                  *
Index: src/zabbix_agent/zabbix_agentd.c
===================================================================
--- src/zabbix_agent/zabbix_agentd.c	(revision 61608)
+++ src/zabbix_agent/zabbix_agentd.c	(working copy)
@@ -898,7 +898,7 @@
 		exit(EXIT_FAILURE);
 	}
 #endif
-	if (FAIL == load_modules(CONFIG_LOAD_MODULE_PATH, CONFIG_LOAD_MODULE, CONFIG_TIMEOUT, 1))
+	if (FAIL == zbx_load_modules(CONFIG_LOAD_MODULE_PATH, CONFIG_LOAD_MODULE, CONFIG_TIMEOUT, 1))
 	{
 		zabbix_log(LOG_LEVEL_CRIT, "loading modules failed, exiting...");
 		exit(EXIT_FAILURE);
@@ -1062,7 +1062,7 @@
 	free_perf_collector();
 	zbx_co_uninitialize();
 #else
-	unload_modules();
+	zbx_unload_modules();
 #endif
 	zabbix_log(LOG_LEVEL_INFORMATION, "Zabbix Agent stopped. Zabbix %s (revision %s).",
 			ZABBIX_VERSION, ZABBIX_REVISION);
@@ -1157,7 +1157,7 @@
 			zbx_set_common_signal_handlers();
 #endif
 #ifndef _WINDOWS
-			if (FAIL == load_modules(CONFIG_LOAD_MODULE_PATH, CONFIG_LOAD_MODULE, CONFIG_TIMEOUT, 0))
+			if (FAIL == zbx_load_modules(CONFIG_LOAD_MODULE_PATH, CONFIG_LOAD_MODULE, CONFIG_TIMEOUT, 0))
 			{
 				zabbix_log(LOG_LEVEL_CRIT, "loading modules failed, exiting...");
 				exit(EXIT_FAILURE);
@@ -1174,7 +1174,7 @@
 			free_perf_collector();	/* cpu_collector must be freed before perf_collector is freed */
 #endif
 #ifndef _WINDOWS
-			unload_modules();
+			zbx_unload_modules();
 #endif
 			free_metrics();
 			alias_list_free();
Index: src/zabbix_proxy/proxy.c
===================================================================
--- src/zabbix_proxy/proxy.c	(revision 61608)
+++ src/zabbix_proxy/proxy.c	(working copy)
@@ -884,7 +884,7 @@
 		exit(EXIT_FAILURE);
 	}
 #endif
-	if (FAIL == load_modules(CONFIG_LOAD_MODULE_PATH, CONFIG_LOAD_MODULE, CONFIG_TIMEOUT, 1))
+	if (FAIL == zbx_load_modules(CONFIG_LOAD_MODULE_PATH, CONFIG_LOAD_MODULE, CONFIG_TIMEOUT, 1))
 	{
 		zabbix_log(LOG_LEVEL_CRIT, "loading modules failed, exiting...");
 		exit(EXIT_FAILURE);
@@ -1086,7 +1086,7 @@
 
 	free_selfmon_collector();
 
-	unload_modules();
+	zbx_unload_modules();
 
 	zabbix_log(LOG_LEVEL_INFORMATION, "Zabbix Proxy stopped. Zabbix %s (revision %s).",
 			ZABBIX_VERSION, ZABBIX_REVISION);
Index: src/zabbix_server/server.c
===================================================================
--- src/zabbix_server/server.c	(revision 61608)
+++ src/zabbix_server/server.c	(working copy)
@@ -856,7 +856,7 @@
 		exit(EXIT_FAILURE);
 	}
 #endif
-	if (FAIL == load_modules(CONFIG_LOAD_MODULE_PATH, CONFIG_LOAD_MODULE, CONFIG_TIMEOUT, 1))
+	if (FAIL == zbx_load_modules(CONFIG_LOAD_MODULE_PATH, CONFIG_LOAD_MODULE, CONFIG_TIMEOUT, 1))
 	{
 		zabbix_log(LOG_LEVEL_CRIT, "loading modules failed, exiting...");
 		exit(EXIT_FAILURE);
@@ -1096,7 +1096,7 @@
 
 	zbx_uninitialize_events();
 
-	unload_modules();
+	zbx_unload_modules();
 
 	zabbix_log(LOG_LEVEL_INFORMATION, "Zabbix Server stopped. Zabbix %s (revision %s).",
 			ZABBIX_VERSION, ZABBIX_REVISION);
