diff options
author | sasha <sasha@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2008-03-20 20:03:49 +0000 |
---|---|---|
committer | sasha <sasha@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2008-03-20 20:03:49 +0000 |
commit | b6b00887a164b8a384d01cc0f39018cbd47554bb (patch) | |
tree | 304030f7699ab005331ce7240d9f0a6d7df70411 /src | |
parent | a9e6d5287540ccfcfeedd3cb6f4e21aacdf88b55 (diff) | |
download | zabbix-b6b00887a164b8a384d01cc0f39018cbd47554bb.tar.gz zabbix-b6b00887a164b8a384d01cc0f39018cbd47554bb.tar.xz zabbix-b6b00887a164b8a384d01cc0f39018cbd47554bb.zip |
- [DEV-72] improved icmpping* processing. added "-c3" to fping
git-svn-id: svn://svn.zabbix.com/trunk@5511 97f52cf1-0a1b-0410-bd0e-c28be96e8082
Diffstat (limited to 'src')
-rw-r--r-- | src/zabbix_proxy/heart/heart.c | 2 | ||||
-rw-r--r-- | src/zabbix_server/pinger/pinger.c | 23 |
2 files changed, 12 insertions, 13 deletions
diff --git a/src/zabbix_proxy/heart/heart.c b/src/zabbix_proxy/heart/heart.c index 091dd431..82ddb6fd 100644 --- a/src/zabbix_proxy/heart/heart.c +++ b/src/zabbix_proxy/heart/heart.c @@ -45,7 +45,7 @@ static void send_heartbeat() zbx_sock_t sock; struct zbx_json j; - zabbix_log(LOG_LEVEL_DEBUG, "In process_configuration_sync()"); + zabbix_log(LOG_LEVEL_DEBUG, "In send_heartbeat()"); zbx_json_init(&j, 128); zbx_json_addstring(&j, "request", ZBX_PROTO_VALUE_PROXY_HEARTBEAT, ZBX_JSON_TYPE_STRING); diff --git a/src/zabbix_server/pinger/pinger.c b/src/zabbix_server/pinger/pinger.c index b9ddbde8..0fd91fea 100644 --- a/src/zabbix_server/pinger/pinger.c +++ b/src/zabbix_server/pinger/pinger.c @@ -247,13 +247,13 @@ static int do_ping(ZBX_FPING_HOST *hosts, int hosts_count, int now) fclose(f); #ifdef HAVE_IPV6 - zbx_snprintf(tmp, sizeof(tmp), "%s -e 2>/dev/null <%s;%s -e 2>/dev/null <%s", + zbx_snprintf(tmp, sizeof(tmp), "%s -c3 2>/dev/null <%s;%s -c3 2>/dev/null <%s", CONFIG_FPING_LOCATION, filename, CONFIG_FPING6_LOCATION, filename); #else /* HAVE_IPV6 */ - zbx_snprintf(tmp, sizeof(tmp), "%s -e 2>/dev/null <%s", + zbx_snprintf(tmp, sizeof(tmp), "%s -c3 2>/dev/null <%s", CONFIG_FPING_LOCATION, filename); #endif /* HAVE_IPV6 */ @@ -272,10 +272,11 @@ static int do_ping(ZBX_FPING_HOST *hosts, int hosts_count, int now) zabbix_log(LOG_LEVEL_DEBUG, "Update IP [%s]", tmp); + /* 12fc::21 : [0], 76 bytes, 0.39 ms (0.39 avg, 0% loss) */ + host = NULL; - c = strchr(tmp, ' '); - if (c != NULL) { + if (NULL != (c = strchr(tmp, ' '))) { *c = '\0'; for (i = 0; i < hosts_count; i++) if (0 == strcmp(tmp, hosts[i].addr)) { @@ -286,13 +287,10 @@ static int do_ping(ZBX_FPING_HOST *hosts, int hosts_count, int now) if (NULL != host) { c++; - - if (strstr(c, "alive") != NULL) { + if (NULL != (c = strchr(c, '('))) { + c++; host->alive = 1; - sscanf(c, "is alive (%lf ms)", - &host->mseconds); - zabbix_log(LOG_LEVEL_DEBUG, "Mseconds [%lf]", - host->mseconds); + host->mseconds = atof(c); } } } @@ -303,9 +301,10 @@ static int do_ping(ZBX_FPING_HOST *hosts, int hosts_count, int now) items = 0; for (i = 0; i < hosts_count; i++) { - zabbix_log(LOG_LEVEL_DEBUG, "Host [%s] alive [%d]", + zabbix_log(LOG_LEVEL_DEBUG, "Host [%s] alive [%d] " ZBX_FS_DBL " ms", hosts[i].addr, - hosts[i].alive); + hosts[i].alive, + hosts[i].mseconds); init_result(&value); SET_UI64_RESULT(&value, hosts[i].alive); |