-
Incident report
-
Resolution: Incomplete
-
Trivial
-
None
-
None
-
Zabbix4.0
If 11 is specified for packet with icmpping, "- C 11" is executed by fping.
]# fping -C 11 127.0.0.1 127.0.0.1 : [0], 96 bytes, 0.04 ms (0.04 avg, 0% loss) 127.0.0.1 : [1], 96 bytes, 0.19 ms (0.11 avg, 0% loss) 127.0.0.1 : [2], 96 bytes, 0.04 ms (0.09 avg, 0% loss) 127.0.0.1 : [3], 96 bytes, 0.12 ms (0.09 avg, 0% loss) 127.0.0.1 : [4], 96 bytes, 0.03 ms (0.08 avg, 0% loss) 127.0.0.1 : [5], 96 bytes, 0.04 ms (0.07 avg, 0% loss) 127.0.0.1 : [6], 96 bytes, 0.04 ms (0.07 avg, 0% loss) 127.0.0.1 : [7], 96 bytes, 0.04 ms (0.06 avg, 0% loss) 127.0.0.1 : [8], 96 bytes, 0.12 ms (0.07 avg, 0% loss) 127.0.0.1 : [9], 96 bytes, 0.04 ms (0.07 avg, 0% loss) 127.0.0.1 : [10], 96 bytes, 0.11 ms (0.07 avg, 0% loss)
"status" is allocated 11byte of count value.
for (i = 0; i < hosts_count; i++) { hosts[i].status = (char *)zbx_malloc(NULL, count); memset(hosts[i].status, 0, count); }
Parses the message returned from fping and acquires each value.
However, the program sees only one character after "[".
if ('[' == *c) { /* Fping appends response source address in format '[<- 10.3.0.10]' */ /* if it does not match the target address. Ignore such responses. */ if (NULL != strstr(c + 1, "[<-")) continue; /* get the index of individual ping response */ index = atoi(c + 1); <--- here! if (0 > index || index >= count) continue; host->status[index] = 1; continue; }
The "status" of "[10]" is stored in "status[1]".
The response time loops for count number, but the response time of "[10]" is ignored because "1" is not set in status.
/* process status line for a host */ index = 0; do { if (1 == host->status[index]) { sec = atof(c) / 1000; /* convert ms to seconds */ if (0 == host->rcv || host->min > sec) host->min = sec; if (0 == host->rcv || host->max < sec) host->max = sec; host->sum += sec; host->rcv++; } } while (++index < count && NULL != (c = strchr(c + 1, ' ')));