]> git.gsnw.org Git - fping.git/commitdiff
Fix xmt stats in Netdata output
authorVladimir Kobal <vlad@prokk.net>
Thu, 27 Feb 2020 12:54:03 +0000 (14:54 +0200)
committerVladimir Kobal <vlad@prokk.net>
Thu, 27 Feb 2020 12:54:03 +0000 (14:54 +0200)
src/fping.c

index d7abe4a813d6000f805d7f6a443ff0c62bf16bd3..323645d604410dd3bd57e75176e59e8e2f5a0390 100644 (file)
@@ -1469,6 +1469,15 @@ void print_netdata(void)
     for (i = 0; i < num_hosts; i++) {
         h = table[i];
 
+        /* if we just sent the probe and didn't receive a reply, we shouldn't count it */
+        h->discard_next_recv_i = 0;
+        if (h->waiting && timeval_diff(&current_time, &h->last_send_time) < h->timeout) {
+            if (h->num_sent_i) {
+                h->num_sent_i--;
+                h->discard_next_recv_i = 1;
+            }
+        }
+
         if (!sent_charts) {
             printf("CHART fping.%s_packets '' 'FPing Packets for host %s' packets '%s' fping.packets line 110020 %d\n", h->name, h->host, h->name, report_interval / 100000);
             printf("DIMENSION xmt sent absolute 1 1\n");
@@ -1486,15 +1495,6 @@ void print_netdata(void)
             /* printf("DIMENSION lost '' absolute 1 1\n"); */
         }
 
-        /* if we just sent the probe and didn't receive a reply, we shouldn't count it */
-        h->discard_next_recv_i = 0;
-        if (h->waiting && timeval_diff(&current_time, &h->last_send_time) < h->timeout) {
-            if (h->num_sent_i) {
-                h->num_sent_i--;
-                h->discard_next_recv_i = 1;
-            }
-        }
-
         printf("BEGIN fping.%s_quality\n", h->name);
         /*
         if( h->num_recv_i <= h->num_sent_i )