From e4110502eea8671911bdfd6fcfa5c8ce18e1e291 Mon Sep 17 00:00:00 2001 From: Thulinma Date: Sun, 15 Jan 2017 16:22:02 +0100 Subject: [PATCH] No longer measure localhost in kernel-style measurements --- src/controller/controller_statistics.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/controller/controller_statistics.cpp b/src/controller/controller_statistics.cpp index 1fe65e81..a173b6ef 100644 --- a/src/controller/controller_statistics.cpp +++ b/src/controller/controller_statistics.cpp @@ -1258,11 +1258,12 @@ void Controller::handlePrometheus(HTTP::Parser & H, Socket::Connection & conn, i netUsage.getline(line, 300); long long unsigned sent = 0; long long unsigned recv = 0; - //std::cout << line; - if (sscanf(line, "%*s %llu %*u %*u %*u %*u %*u %*u %*u %llu", &recv, &sent) == 2){ - //std::cout << "Net: " << recv << ", " << sent << std::endl; - bw_down_total += recv; - bw_up_total += sent; + char iface[10]; + if (sscanf(line, "%9s %llu %*u %*u %*u %*u %*u %*u %*u %llu", iface, &recv, &sent) == 3){ + if (iface[0] != 'l' || iface[1] != 'o'){ + bw_down_total += recv; + bw_up_total += sent; + } } } }