diff -aurN zabbix-2.2.1.org/src/zabbix_agent/active.c zabbix-2.2.1/src/zabbix_agent/active.c --- zabbix-2.2.1.org/src/zabbix_agent/active.c 2013-12-10 12:45:00.000000000 -0500 +++ zabbix-2.2.1/src/zabbix_agent/active.c 2013-12-14 10:25:13.047176515 -0500 @@ -391,12 +391,13 @@ ******************************************************************************/ static int refresh_active_checks(const char *host, unsigned short port) { - const char *__function_name = "refresh_active_checks"; - zbx_sock_t s; - char *buf; - int ret; - struct zbx_json json; - static int last_ret = SUCCEED; + const char *__function_name = "refresh_active_checks"; + zbx_sock_t s; + char *buf; + int ret; + struct zbx_json json; + static int last_ret = SUCCEED; + static unsigned int fail_count = 0; zabbix_log(LOG_LEVEL_DEBUG, "In %s() host:'%s' port:%hu", __function_name, host, port); @@ -483,17 +484,34 @@ " is working again", host, port); } parse_list_of_checks(buf, host, port); + fail_count = 0; } } zbx_tcp_close(&s); } - if (SUCCEED != ret && SUCCEED == last_ret) + if (SUCCEED != ret) { - zabbix_log(LOG_LEVEL_WARNING, - "active check configuration update from [%s:%hu] started to fail (%s)", - host, port, zbx_tcp_strerror()); + if (SUCCEED == last_ret) + { + zabbix_log(LOG_LEVEL_WARNING, + "active check configuration update from [%s:%hu] started to fail (%s)", + host, port, zbx_tcp_strerror()); + } + if (CONFIG_STOP_ACTIVE_CHECKS_FAIL > fail_count) { + fail_count++; + if (CONFIG_STOP_ACTIVE_CHECKS_FAIL == fail_count) { + zabbix_log(LOG_LEVEL_WARNING, + "active check configuration update from [%s:%hu] failed. active check data upload to [%s:%hu] was disabled. (%d of %d)", + host, port, host, port, fail_count, CONFIG_STOP_ACTIVE_CHECKS_FAIL); + disable_all_metrics(); + } else { + zabbix_log(LOG_LEVEL_WARNING, + "active check configuration update from [%s:%hu] failed. active check data upload to [%s:%hu] will be disabled. (%d of %d)", + host, port, host, port, fail_count, CONFIG_STOP_ACTIVE_CHECKS_FAIL); + } + } } last_ret = ret; diff -aurN zabbix-2.2.1.org/src/zabbix_agent/active.h zabbix-2.2.1/src/zabbix_agent/active.h --- zabbix-2.2.1.org/src/zabbix_agent/active.h 2013-12-14 09:05:50.676970333 -0500 +++ zabbix-2.2.1/src/zabbix_agent/active.h 2013-12-14 10:21:56.427123688 -0500 @@ -27,6 +27,7 @@ extern char *CONFIG_HOST_METADATA; extern char *CONFIG_HOST_METADATA_ITEM; extern int CONFIG_REFRESH_ACTIVE_CHECKS; +extern int CONFIG_STOP_ACTIVE_CHECKS_FAIL; extern int CONFIG_BUFFER_SEND; extern int CONFIG_BUFFER_SIZE; extern int CONFIG_MAX_LINES_PER_SECOND; diff -aurN zabbix-2.2.1.org/src/zabbix_agent/zabbix_agentd.c zabbix-2.2.1/src/zabbix_agent/zabbix_agentd.c --- zabbix-2.2.1.org/src/zabbix_agent/zabbix_agentd.c 2013-12-10 12:45:00.000000000 -0500 +++ zabbix-2.2.1/src/zabbix_agent/zabbix_agentd.c 2013-12-14 10:21:39.591132298 -0500 @@ -435,6 +435,8 @@ PARM_OPT, 0, 100}, {"RefreshActiveChecks", &CONFIG_REFRESH_ACTIVE_CHECKS, TYPE_INT, PARM_OPT, SEC_PER_MIN, SEC_PER_HOUR}, + {"StopActiveChecksFail", &CONFIG_STOP_ACTIVE_CHECKS_FAIL, TYPE_INT, + PARM_OPT, 0, 65535}, {"MaxLinesPerSecond", &CONFIG_MAX_LINES_PER_SECOND, TYPE_INT, PARM_OPT, 1, 1000}, {"AllowRoot", &CONFIG_ALLOW_ROOT, TYPE_INT, diff -aurN zabbix-2.2.1.org/src/zabbix_agent/zbxconf.c zabbix-2.2.1/src/zabbix_agent/zbxconf.c --- zabbix-2.2.1.org/src/zabbix_agent/zbxconf.c 2013-12-10 12:45:00.000000000 -0500 +++ zabbix-2.2.1/src/zabbix_agent/zbxconf.c 2013-12-14 10:19:54.245115498 -0500 @@ -44,6 +44,7 @@ int CONFIG_UNSAFE_USER_PARAMETERS = 0; int CONFIG_LISTEN_PORT = ZBX_DEFAULT_AGENT_PORT; int CONFIG_REFRESH_ACTIVE_CHECKS = 120; +int CONFIG_STOP_ACTIVE_CHECKS_FAIL = 0; char *CONFIG_LISTEN_IP = NULL; char *CONFIG_SOURCE_IP = NULL; int CONFIG_LOG_LEVEL = LOG_LEVEL_WARNING; diff -aurN zabbix-2.2.1.org/src/zabbix_agent/zbxconf.h zabbix-2.2.1/src/zabbix_agent/zbxconf.h --- zabbix-2.2.1.org/src/zabbix_agent/zbxconf.h 2013-12-10 12:45:00.000000000 -0500 +++ zabbix-2.2.1/src/zabbix_agent/zbxconf.h 2013-12-14 10:19:39.416103043 -0500 @@ -29,6 +29,7 @@ extern int CONFIG_UNSAFE_USER_PARAMETERS; extern int CONFIG_LISTEN_PORT; extern int CONFIG_REFRESH_ACTIVE_CHECKS; +extern int CONFIG_STOP_ACTIVE_CHECKS_FAIL; extern char *CONFIG_LISTEN_IP; extern int CONFIG_LOG_LEVEL; extern int CONFIG_MAX_LINES_PER_SECOND;