diff -uNrp zabbix-4.0.17.bk/frontends/php/include/classes/items/CHelpItems.php zabbix-4.0.17/frontends/php/include/classes/items/CHelpItems.php
--- zabbix-4.0.17.bk/frontends/php/include/classes/items/CHelpItems.php	2020-02-10 13:54:52.100385779 +0900
+++ zabbix-4.0.17/frontends/php/include/classes/items/CHelpItems.php	2020-02-10 13:53:53.582521234 +0900
@@ -1081,6 +1081,22 @@ class CHelpItems {
 				[
 					'key' => 'jmx.discovery[<discovery mode>,<object name>]',
 					'description' => _('Return a JSON object describing the MBean objects or their attributes. Can be used for LLD.')
+				],
+				[
+					'key' => 'zabbix[preprocessing_queue]',
+					'description' => _('Number of items in the preprocessing queue.')
+				],
+				[
+					'key' => 'zabbix[preprocessing_queue_per_workers]',
+					'description' => _('Number of ratio items in the preprocessing queue per preprocessor workers.')
+				],
+				[
+					'key' => 'zabbix[alerter_queue]',
+					'description' => _('Number of alerts in the alerter queue.')
+				],
+				[
+					'key' => 'zabbix[alerter_queue_per_alerters]',
+					'description' => _('Number of ratio alerts in the alerter queue per alerters.')
 				]
 			]
 		];
diff -uNrp zabbix-4.0.17.bk/include/alerter.h zabbix-4.0.17/include/alerter.h
--- zabbix-4.0.17.bk/include/alerter.h	1970-01-01 09:00:00.000000000 +0900
+++ zabbix-4.0.17/include/alerter.h	2020-02-10 13:53:53.582521234 +0900
@@ -0,0 +1 @@
+zbx_uint64_t	zbx_alerter_get_queue_size(void);
diff -uNrp zabbix-4.0.17.bk/src/zabbix_proxy/Makefile.in zabbix-4.0.17/src/zabbix_proxy/Makefile.in
--- zabbix-4.0.17.bk/src/zabbix_proxy/Makefile.in	2020-02-10 13:54:49.749391221 +0900
+++ zabbix-4.0.17/src/zabbix_proxy/Makefile.in	2020-02-10 13:53:53.582521234 +0900
@@ -125,7 +125,8 @@ libzbxproxy_a_AR = $(AR) $(ARFLAGS)
 libzbxproxy_a_LIBADD =
 am_libzbxproxy_a_OBJECTS = libzbxproxy_a-servercomms.$(OBJEXT) \
 	libzbxproxy_a-events.$(OBJEXT) \
-	libzbxproxy_a-preprocessing.$(OBJEXT)
+	libzbxproxy_a-preprocessing.$(OBJEXT) \
+	libzbxproxy_a-alerter_protocol.$(OBJEXT)
 libzbxproxy_a_OBJECTS = $(am_libzbxproxy_a_OBJECTS)
 am__installdirs = "$(DESTDIR)$(sbindir)"
 PROGRAMS = $(sbin_PROGRAMS)
@@ -489,7 +490,8 @@ noinst_LIBRARIES = libzbxproxy.a
 libzbxproxy_a_SOURCES = \
 	servercomms.c servercomms.h \
 	events.c \
-	preprocessing.c
+	preprocessing.c \
+	alerter_protocol.c
 
 libzbxproxy_a_CFLAGS = \
 	-DZABBIX_DAEMON
@@ -645,6 +647,7 @@ distclean-compile:
 
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libzbxproxy_a-events.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libzbxproxy_a-preprocessing.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libzbxproxy_a-alerter_protocol.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libzbxproxy_a-servercomms.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zabbix_proxy-proxy.Po@am__quote@
 
@@ -706,6 +709,20 @@ libzbxproxy_a-preprocessing.obj: preproc
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzbxproxy_a_CFLAGS) $(CFLAGS) -c -o libzbxproxy_a-preprocessing.obj `if test -f 'preprocessing.c'; then $(CYGPATH_W) 'preprocessing.c'; else $(CYGPATH_W) '$(srcdir)/preprocessing.c'; fi`
 
+libzbxproxy_a-alerter_protocol.o: alerter_protocol.c
+@am__fastdepCC_TRUE@	$(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzbxproxy_a_CFLAGS) $(CFLAGS) -MT libzbxproxy_a-alerter_protocol.o -MD -MP -MF $(DEPDIR)/libzbxproxy_a-alerter_protocol.Tpo -c -o libzbxproxy_a-alerter_protocol.o `test -f 'alerter_protocol.c' || echo '$(srcdir)/'`alerter_protocol.c
+@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libzbxproxy_a-alerter_protocol.Tpo $(DEPDIR)/libzbxproxy_a-alerter_protocol.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='alerter_protocol.c' object='libzbxproxy_a-alerter_protocol.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzbxproxy_a_CFLAGS) $(CFLAGS) -c -o libzbxproxy_a-alerter_protocol.o `test -f 'alerter_protocol.c' || echo '$(srcdir)/'`alerter_protocol.c
+
+libzbxproxy_a-alerter_protocol.obj: alerter_protocol.c
+@am__fastdepCC_TRUE@	$(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzbxproxy_a_CFLAGS) $(CFLAGS) -MT libzbxproxy_a-alerter_protocol.obj -MD -MP -MF $(DEPDIR)/libzbxproxy_a-alerter_protocol.Tpo -c -o libzbxproxy_a-alerter_protocol.obj `if test -f 'alerter_protocol.c'; then $(CYGPATH_W) 'alerter_protocol.c'; else $(CYGPATH_W) '$(srcdir)/alerter_protocol.c'; fi`
+@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libzbxproxy_a-alerter_protocol.Tpo $(DEPDIR)/libzbxproxy_a-alerter_protocol.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='alerter_protocol.c' object='libzbxproxy_a-alerter_protocol.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzbxproxy_a_CFLAGS) $(CFLAGS) -c -o libzbxproxy_a-alerter_protocol.obj `if test -f 'alerter_protocol.c'; then $(CYGPATH_W) 'alerter_protocol.c'; else $(CYGPATH_W) '$(srcdir)/alerter_protocol.c'; fi`
+
 zabbix_proxy-proxy.o: proxy.c
 @am__fastdepCC_TRUE@	$(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(zabbix_proxy_CFLAGS) $(CFLAGS) -MT zabbix_proxy-proxy.o -MD -MP -MF $(DEPDIR)/zabbix_proxy-proxy.Tpo -c -o zabbix_proxy-proxy.o `test -f 'proxy.c' || echo '$(srcdir)/'`proxy.c
 @am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/zabbix_proxy-proxy.Tpo $(DEPDIR)/zabbix_proxy-proxy.Po
diff -uNrp zabbix-4.0.17.bk/src/zabbix_proxy/alerter_protocol.c zabbix-4.0.17/src/zabbix_proxy/alerter_protocol.c
--- zabbix-4.0.17.bk/src/zabbix_proxy/alerter_protocol.c	1970-01-01 09:00:00.000000000 +0900
+++ zabbix-4.0.17/src/zabbix_proxy/alerter_protocol.c	2020-02-10 13:53:53.583521231 +0900
@@ -0,0 +1,6 @@
+#include "common.h"
+
+zbx_uint64_t	zbx_alerter_get_queue_size(void)
+{
+  return 0;
+}
diff -uNrp zabbix-4.0.17.bk/src/zabbix_server/alerter/alert_manager.c zabbix-4.0.17/src/zabbix_server/alerter/alert_manager.c
--- zabbix-4.0.17.bk/src/zabbix_server/alerter/alert_manager.c	2020-02-10 13:54:49.675391392 +0900
+++ zabbix-4.0.17/src/zabbix_server/alerter/alert_manager.c	2020-02-12 13:01:58.757808086 +0900
@@ -205,6 +205,9 @@ typedef struct
 	/* mediatype queue */
 	zbx_binary_heap_t	queue;
 
+	/* queued value counter */
+	zbx_uint64_t		queued_num;
+
 	/* the database status */
 	int			dbstatus;
 }
@@ -754,6 +757,7 @@ static void	am_remove_alert(zbx_am_t *ma
 	}
 
 	am_alert_free(alert);
+	manager->queued_num--;
 }
 
 /******************************************************************************
@@ -987,6 +991,8 @@ static void	am_queue_watchdog_alerts(zbx
 		alert = am_create_alert(0, media->mediatypeid, 0, 0, 0, media->sendto, alert_subject, alert_message, 0,
 				0, 0);
 
+		manager->queued_num++;
+
 		alertpool = am_get_alertpool(manager, alert->mediatypeid, alert->alertpoolid);
 		alertpool->refcount++;
 
@@ -1038,6 +1044,8 @@ static void	am_init(zbx_am_t *manager)
 	zbx_hashset_create(&manager->watchdog, 5, ZBX_DEFAULT_UINT64_HASH_FUNC, ZBX_DEFAULT_UINT64_COMPARE_FUNC);
 	zbx_binary_heap_create(&manager->queue, am_mediatype_queue_compare, ZBX_BINARY_HEAP_OPTION_DIRECT);
 
+	manager->queued_num = 0;
+
 	zabbix_log(LOG_LEVEL_DEBUG, "End of %s()", __function_name);
 }
 
@@ -1403,6 +1411,8 @@ static int	am_db_queue_alerts(zbx_am_t *
 
 		alertpool = am_get_alertpool(manager, alert->mediatypeid, alert->alertpoolid);
 
+		manager->queued_num++;
+
 		alertpool->refcount++;
 		mediatype->refcount++;
 
@@ -1742,6 +1752,7 @@ static int	am_process_alert(zbx_am_t *ma
 	if (NULL == (mediatype = am_get_mediatype(manager, alert->mediatypeid)))
 	{
 		am_alert_free(alert);
+		manager->queued_num--;
 		goto out;
 	}
 
@@ -2059,6 +2070,10 @@ ZBX_THREAD_ENTRY(alert_manager_thread, a
 					else
 						failed_num++;
 					break;
+				case ZBX_IPC_ALERTER_QUEUE:
+					zbx_ipc_client_send(client, message->code, (unsigned char *)&manager.queued_num,
+							sizeof(zbx_uint64_t));
+					break;
 			}
 
 			zbx_ipc_message_free(message);
diff -uNrp zabbix-4.0.17.bk/src/zabbix_server/alerter/alerter_protocol.c zabbix-4.0.17/src/zabbix_server/alerter/alerter_protocol.c
--- zabbix-4.0.17.bk/src/zabbix_server/alerter/alerter_protocol.c	2020-02-10 13:54:49.677391388 +0900
+++ zabbix-4.0.17/src/zabbix_server/alerter/alerter_protocol.c	2020-02-10 13:53:53.583521231 +0900
@@ -21,6 +21,7 @@
 
 #include "log.h"
 #include "zbxserialize.h"
+#include "zbxipcservice.h"
 
 #include "alerter_protocol.h"
 
@@ -254,4 +255,42 @@ void	zbx_alerter_deserialize_exec(const
 	(void)zbx_deserialize_str(data, command, len);
 }
 
+static void alerter_send(zbx_uint32_t code, unsigned char *data, zbx_uint32_t size,
+		zbx_ipc_message_t *response)
+{
+	char			*error = NULL;
+	static zbx_ipc_socket_t	socket = {0};
+
+	/* each process has a permanent connection to alert manager */
+	if (0 == socket.fd && FAIL == zbx_ipc_socket_open(&socket, ZBX_IPC_SERVICE_ALERTER, SEC_PER_MIN,
+			&error))
+	{
+		zabbix_log(LOG_LEVEL_CRIT, "cannot connect to alerter service: %s", error);
+		exit(EXIT_FAILURE);
+	}
+
+	if (FAIL == zbx_ipc_socket_write(&socket, code, data, size))
+	{
+		zabbix_log(LOG_LEVEL_CRIT, "cannot send data to alerter service");
+		exit(EXIT_FAILURE);
+	}
+
+	if (NULL != response && FAIL == zbx_ipc_socket_read(&socket, response))
+	{
+		zabbix_log(LOG_LEVEL_CRIT, "cannot receive data from alerter service");
+		exit(EXIT_FAILURE);
+	}
+}
+
+zbx_uint64_t	zbx_alerter_get_queue_size(void)
+{
+	zbx_uint64_t		size;
+	zbx_ipc_message_t	message;
+
+	zbx_ipc_message_init(&message);
+	alerter_send(ZBX_IPC_ALERTER_QUEUE, NULL, 0, &message);
+	memcpy(&size, message.data, sizeof(zbx_uint64_t));
+	zbx_ipc_message_clean(&message);
 
+  return size;
+}
diff -uNrp zabbix-4.0.17.bk/src/zabbix_server/alerter/alerter_protocol.h zabbix-4.0.17/src/zabbix_server/alerter/alerter_protocol.h
--- zabbix-4.0.17.bk/src/zabbix_server/alerter/alerter_protocol.h	2020-02-10 13:54:49.676391390 +0900
+++ zabbix-4.0.17/src/zabbix_server/alerter/alerter_protocol.h	2020-02-10 13:53:53.583521231 +0900
@@ -27,6 +27,8 @@
 /* alerter -> manager */
 #define ZBX_IPC_ALERTER_REGISTER	1000
 #define ZBX_IPC_ALERTER_RESULT		1001
+#define ZBX_IPC_ALERTER_QUEUE		1002
+#define ZBX_IPC_ALERTER_QUEUE_PER_ALERTER		1003
 
 
 /* manager -> alerter */
diff -uNrp zabbix-4.0.17.bk/src/zabbix_server/poller/checks_internal.c zabbix-4.0.17/src/zabbix_server/poller/checks_internal.c
--- zabbix-4.0.17.bk/src/zabbix_server/poller/checks_internal.c	2020-02-10 13:54:49.683391374 +0900
+++ zabbix-4.0.17/src/zabbix_server/poller/checks_internal.c	2020-02-10 13:53:53.583521231 +0900
@@ -25,6 +25,7 @@
 #include "valuecache.h"
 #include "proxy.h"
 #include "preproc.h"
+#include "alerter.h"
 
 #include "../vmware/vmware.h"
 #include "../../libs/zbxserver/zabbix_stats.h"
@@ -32,6 +33,9 @@
 
 extern unsigned char	program_type;
 
+extern int	CONFIG_PREPROCESSOR_FORKS;
+extern int	CONFIG_ALERTER_FORKS;
+
 static int	compare_interfaces(const void *p1, const void *p2)
 {
 	const DC_INTERFACE2	*i1 = (DC_INTERFACE2 *)p1, *i2 = (DC_INTERFACE2 *)p2;
@@ -850,6 +854,45 @@ int	get_value_internal(DC_ITEM *item, AG
 
 		SET_UI64_RESULT(result, zbx_preprocessor_get_queue_size());
 	}
+	else if (0 == strcmp(tmp, "preprocessing_queue_per_workers"))
+	{
+		if (0 == (program_type & ZBX_PROGRAM_TYPE_SERVER))
+			goto out;
+
+		if (1 != nparams)
+		{
+			SET_MSG_RESULT(result, zbx_strdup(NULL, "Invalid number of parameters."));
+			goto out;
+		}
+
+		SET_DBL_RESULT(result, ((double)zbx_preprocessor_get_queue_size()/CONFIG_PREPROCESSOR_FORKS));
+	}
+	else if (0 == strcmp(tmp, "alerter_queue"))
+	{
+		if (0 == (program_type & ZBX_PROGRAM_TYPE_SERVER))
+			goto out;
+
+		if (1 != nparams)
+		{
+			SET_MSG_RESULT(result, zbx_strdup(NULL, "Invalid number of parameters."));
+			goto out;
+		}
+
+		SET_UI64_RESULT(result, zbx_alerter_get_queue_size());
+	}
+	else if (0 == strcmp(tmp, "alerter_queue_per_alerters"))
+	{
+		if (0 == (program_type & ZBX_PROGRAM_TYPE_SERVER))
+			goto out;
+
+		if (1 != nparams)
+		{
+			SET_MSG_RESULT(result, zbx_strdup(NULL, "Invalid number of parameters."));
+			goto out;
+		}
+
+		SET_DBL_RESULT(result, ((double)zbx_alerter_get_queue_size()/CONFIG_ALERTER_FORKS));
+	}
 	else if (0 == strcmp(tmp, "stats"))			/* zabbix[stats,...] */
 	{
 		const char	*ip_str, *port_str, *ip;
