Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Output compatible for Netdata produces zero values #219

Closed
wiredmind opened this issue Apr 30, 2021 · 2 comments · Fixed by #229
Closed

Output compatible for Netdata produces zero values #219

wiredmind opened this issue Apr 30, 2021 · 2 comments · Fixed by #229
Labels

Comments

@wiredmind
Copy link

Starting with fping version 5.0, running on ARM (aarch64, armv7l) using the command line switch -N, --netdata output compatible for netdata (-l -Q are required) doesn't output correct values. For any host the min, max, and avg are always zero:

CHART fping.gateway_packets '' 'FPing Packets for host gateway' packets 'gateway' fping.packets line 110020 2
DIMENSION xmt sent absolute 1 1
DIMENSION rcv received absolute 1 1
BEGIN fping.gateway_packets
SET xmt = 2
SET rcv = 2
END
CHART fping.gateway_quality '' 'FPing Quality for host gateway' percentage 'gateway' fping.quality area 110010 2
DIMENSION returned '' absolute 1 1
BEGIN fping.gateway_quality
SET returned = 100
END
CHART fping.gateway_latency '' 'FPing Latency for host gateway' ms 'gateway' fping.latency area 110000 2
DIMENSION min minimum absolute 1 1000000
DIMENSION max maximum absolute 1 1000000
DIMENSION avg average absolute 1 1000000
BEGIN fping.gateway_latency
SET min = 0
SET avg = 0
SET max = 0
END
BEGIN fping.gateway_packets
SET xmt = 2
SET rcv = 2
END
BEGIN fping.gateway_quality
SET returned = 100
END

Omitting the -N switch produced expected result:

[18:49:28]
gateway : xmt/rcv/%loss = 2/2/0%, min/avg/max = 0.103/0.149/0.195
[18:49:30]
gateway : xmt/rcv/%loss = 2/2/0%, min/avg/max = 0.105/0.134/0.162
[18:49:32]
gateway : xmt/rcv/%loss = 2/2/0%, min/avg/max = 0.138/0.176/0.215
@gsnw
Copy link
Contributor

gsnw commented Jul 29, 2021

Information the error can reproduced on Raspberry Pi Model B Revision 2.0.
CPU: armv6l
Test Command: fping -l -Q 2 -N 8.8.8.8

Currently I have no idea why this happens.
Probably it has something to do with the int64_t and ARM CPU. But I am not sure.

The working print_per_system_splits() function use int and convert the value over sprint_tm()

@schweikert schweikert added the bug label Aug 7, 2021
@gsnw
Copy link
Contributor

gsnw commented Aug 13, 2021

@wiredmind the analyse to find a good solution is in progress, but here is a solution that works on my Raspberry Pi.
On Raspberry Pi you need long long int to print int64_t.

--- fping.c.orig	2021-08-13 20:30:44.099657873 +0200
+++ fping.c	2021-08-13 20:31:23.198575583 +0200
@@ -1656,9 +1656,9 @@
         printf("BEGIN fping.%s_latency\n", h->name);
         if (h->num_recv_i) {
             avg = h->total_time_i / h->num_recv_i;
-            printf("SET min = %ld\n", h->min_reply_i);
-            printf("SET avg = %ld\n", avg);
-            printf("SET max = %ld\n", h->max_reply_i);
+            printf("SET min = %lld\n", h->min_reply_i);
+            printf("SET avg = %lld\n", avg);
+            printf("SET max = %lld\n", h->max_reply_i);
         }
         printf("END\n");

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants